示例#1
0
 private void Page_Load(object sender, EventArgs e)
 {
     if (!IsPostBack)
     {
         try
         {
             uid = int.Parse(Request.QueryString["uid"]);
         }
         catch
         {
             uid = -1;
         }
         BaseDb db = DbFactory.ConstructDatabase();
         if (db.CheckUid(uid))                 //редактирование
         {
             if (!Page.User.Identity.IsAuthenticated || BaseDb.IsAnonymous(Page.User) || db.GetUid(Page.User.Identity.Name) != uid)
             {
                 throw new NeJudgeException("Identity");
             }
             else
             {
                 Table1.Rows[2].Visible        = false;
                 loginTextBoxValidator.Enabled = false;
                 User u = db.GetUser(uid);
                 nameTextBox.Text = u.Fullname;
                 mailTextBox.Text = u.Email;
             }
         }
         else                 //регистрация
         {
             Table1.Rows[3].Visible          = false;
             oldpassTextBoxValidator.Enabled = false;
         }
         db.Close();
     }
 }