Esempio n. 1
0
 private void BtnUpdate_Click(object sender, EventArgs e)
 {
     try
     {
         // Verify current password & Update My Account Start
         string strCurrentPassword = null;
         using (DBAuditDataContext dc = new DBAuditDataContext())
         {
             var strEncCurrentPass = Security.EncryptPassword(TxtCurrentPassword);
             dc.ProGetUserPassword(_staticStrCurrentUserName, ref strCurrentPassword);
             if (strEncCurrentPass == strCurrentPassword)
             {
                 // Update User Data Start
                 if (TxtPassword.Text != "")
                 {
                     var strEncPass = Security.EncryptPassword(TxtPassword);
                     dc.ProUpdateUserMyAccount(_staticStrCurrentUserName, TxtFirstName.Text,
                                               TxtLastName.Text, TxtAddress.Text, TxtTelephone.Text, TxtUserName.Text, strEncPass);
                 }
                 else
                 {
                     dc.ProUpdateUserMyAccountWithoutPassword(_staticStrCurrentUserName,
                                                              TxtFirstName.Text, TxtLastName.Text, TxtAddress.Text, TxtTelephone.Text,
                                                              TxtUserName.Text);
                 }
                 MessageBox.Show(@"تمت إضافة بيانات السلفة المؤقتة بنجاح", @"المراجع الذكي",
                                 MessageBoxButtons.OK, MessageBoxIcon.Information);
                 Close();
                 // Update User Data End
             }
             else
             {
                 MessageBox.Show(@"تمت إضافة بيانات السلفة المؤقتة بنجاح", @"المراجع الذكي",
                                 MessageBoxButtons.OK, MessageBoxIcon.Hand);
                 TxtCurrentPassword.Text = "";
             }
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
     // Verify current password & Update My Account Start
 }