protected void Page_Load(object sender, EventArgs e)
{
if(Session["userDetails"] == null)
{
Response.Redirect("~/Account/Login.aspx");
}
else if (Request.QueryString["ID"] == null)
{
Response.Redirect("~/Groups/Groups.aspx");
}
else
{
int groupID = Convert.ToInt32(Request.QueryString["ID"]);
Group currentGroup = GroupDAO.GetGroupFromGroupId(groupID);
if (currentGroup == null || currentGroup.Owner.UserID != ((User)Session["userDetails"]).UserID)
{
Response.Redirect("~/Groups/Groups.aspx");
}
if (txbGroupName.Text == "")
{
txbGroupName.Text = currentGroup.Name;
}
if (txbDescription.Text == "")
{
txbDescription.Text = currentGroup.Description;
}
if (lblAllHashTags.Text == "")
{
lblAllHashTags.Text = "[]";
foreach (string tag in currentGroup.HashTags)
{
txbHashTag.Text = tag;
AddHashTag(null, null);
}
}
}
}