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); }
/// <summary> /// Save user information /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnSave_Click(object sender, EventArgs e) { if (txtConfirm.Text == txtPassword.Text) { User us = new User(); if (_userId != 0) us.LoadByPrimaryKey(_userId); else { us.AddNew(); us.UserName = txtUsername.Text; us.Password = txtPassword.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(); PopulateUser(); } else XtraMessageBox.Show("Password doesnt match!","Error",MessageBoxButtons.OK,MessageBoxIcon.Error); }