private void xpButton18_Click(object sender, EventArgs e)
 {
     if (txtPassword.Text == txtConfirm.Text)
     {
         User us = new User();
         if (userId != 0)
         {
             us.LoadByPrimaryKey(userId);
             string userName = us.UserName;
             us.GetUserByAccountInfo(userName, txtOldPass.Text);// .LoadByPrimaryKey(userId);
             if (us.RowCount > 0)
             {
                 if (txtPassword.Text != "")
                 {
                     us.SavePassword(txtPassword.Text);
                 }
                 //us.Password = txtPassword.Text;
                 us.Save();
                 XtraMessageBox.Show(@"Password changed!", @"Confirmation", MessageBoxButtons.OK, MessageBoxIcon.Information);
             }
             else
             {
                 XtraMessageBox.Show("Old Password is not correct!", "Invaild Password", MessageBoxButtons.OK, MessageBoxIcon.Error);
             }
         }
     }
     else
     {
         MessageBox.Show("Password doesnt match!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }
        private void btnSave_Click(object sender, EventArgs e)
        {
            bool isNew = false;
            if (txtConfirm.Text == txtPassword.Text && cboUserType.SelectedValue != null)
            {
                User us = new User();
                if (userId != 0)
                {
                    us.LoadByPrimaryKey(userId);
                }
                else
                {
                    us.AddNew();
                    isNew = true;
                }

                us.UserName = txtUsername.Text;
                us.FullName = txtFullName.Text;
                us.Address = txtAddress.Text;
                us.Mobile = txtMobile.Text;
                us.Active = ckActive.Checked;
                us.UserType = Convert.ToInt32(cboUserType.SelectedValue);
                us.Save();
                int userID = us.ID;
                // DO MD5
                if (txtPassword.Text != "")
                {
                    us.SavePassword(txtPassword.Text);
                }

                RefreshUserStoreGrid(userID);
                PopulateUser();
                XtraMessageBox.Show("Your changes have been saved!", "Confirmation", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            else
                XtraMessageBox.Show("Password doesnt match or you didnt select User Type!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
        }