示例#1
0
 private void lLChgPwd_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
 {
     if (user.GetUser(tbUID.Text))
     {
         if (user.Password.Trim().Length == 0)
         {
             FormChgPwd form = new FormChgPwd();
             form.UserName = tbUID.Text;
             form.Owner    = this;
             form.ShowDialog();
         }
         else
         {
             string encodePwd = esha.EncodeText(tbPWD.Text).Trim();
             string savedPwd  = user.Password.Trim();
             if (user.Password.Trim() == encodePwd)
             {
                 FormChgPwd form = new FormChgPwd();
                 form.UserName = tbUID.Text;
                 form.Owner    = this;
                 form.ShowDialog();
             }
             else
             {
                 MessageBox.Show("Please enter correct password to change.");
                 return;
             }
         }
     }
     else
     {
         MessageBox.Show("User Does not exists");
     }
 }
示例#2
0
 private void bLogon_Click(object sender, EventArgs e)
 {
     if (user.GetUser(tbUID.Text))
     {
         if (user.Password.Trim().Length == 0)
         {
             FormChgPwd form = new FormChgPwd();
             form.UserName = tbUID.Text;
             form.Owner    = this;
             form.ShowDialog();
         }
         else
         {
             string encodePwd = esha.EncodeText(tbPWD.Text).Trim();
             string savedPwd  = user.Password.Trim();
             if (user.Password.Trim() == encodePwd)
             {
                 RuntimeDefaults.UserName     = user.UserName;
                 RuntimeDefaults.LoggedStatus = true;
                 RuntimeDefaults.UserId       = user.id;
                 this.Close();
             }
             else
             {
                 MessageBox.Show("Password does not  match");
                 return;
             }
         }
     }
     else
     {
         //Here we should add new admin user
     }
 }