Example #1
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (Session["username"] != null && !string.IsNullOrEmpty((string)Session["username"]))
     {
         string username = (string)Session["username"];
         User   user     = new User(SqlUtilities.GetUserId(username));
         if (user.IsAdmin)
         {
             IsAdmin.Visible = true;
         }
         else
         {
             if (Request.UrlReferrer != null)
             {
                 Response.Redirect(Request.UrlReferrer.ToString());
             }
             else
             {
                 Response.Redirect("Profile.aspx?username=" + username);
             }
         }
     }
     if (SqlUtilities.GetAdmins() == null)
     {
         IsAdmin.Visible = true;
     }
     if (!IsPostBack)
     {
         Populate_MonthList();
         Populate_YearList();
     }
 }