//private void BindPageGridMakerCheckerX() // { // try // { // var getMakerCheckerXDetails = from u in db.CM_MAKER_CHECKER_XREF // orderby u.CHECKER_ID descending // select new // { // recordID = u.RECORD_ID, // Maker = u.CM_USER_PROFILE.USER_ID, // Checker = u.CM_USER_PROFILE.USER_ID, // // Createdby = u.CREATED_BY, // // DateCreated = u.CREATED_DATE // }; // this.GridView5.DataSource = getMakerCheckerXDetails.ToList(); // this.GridView5.DataBind(); //} //catch (Exception ex) //{ // this.lblAssgnUserMsg.Text = MessageFormatter.GetFormattedErrorMessage("Error:" + ex.Message); //} // } protected void btnCreateUser_Click(object sender, EventArgs e) { hidTAB.Value = "#tab1"; if (string.IsNullOrEmpty(this.txtUsername.Text)) { this.lblUsrMsg.Text = MessageFormatter.GetFormattedErrorMessage("User Name required!"); return; } if (string.IsNullOrEmpty(this.txtPassword.Text)) { this.lblUsrMsg.Text = MessageFormatter.GetFormattedErrorMessage("Password required!"); return; } //if (string.IsNullOrEmpty(this.txtConfirmPasswd.Text)) //{ // this.lblUsrMsg.Text = MessageFormatter.GetFormattedErrorMessage("Confirm Password required!"); // return; //} if (string.IsNullOrEmpty(this.txtEmail.Text)) { this.lblUsrMsg.Text = MessageFormatter.GetFormattedErrorMessage("Email required!"); return; } if (string.IsNullOrEmpty(this.txtfName.Text)) { this.lblUsrMsg.Text = MessageFormatter.GetFormattedErrorMessage("First Name required!"); return; } if (string.IsNullOrEmpty(this.txtlName.Text)) { this.lblUsrMsg.Text = MessageFormatter.GetFormattedErrorMessage("Last Name required!"); return; } if (string.IsNullOrEmpty(this.ddlRoleName.SelectedValue)) { this.lblUsrMsg.Text = MessageFormatter.GetFormattedErrorMessage("Role required!"); return; } //if (this.txtPassword.Text != this.txtConfirmPasswd.Text) //{ // this.lblUsrMsg.Text = MessageFormatter.GetFormattedErrorMessage("Password and confirm password must be thesame!"); // return; //} if (mp.getUserr(this.txtUsername.Text, this.txtEmail.Text) == true) { this.lblUsrMsg.Text = MessageFormatter.GetFormattedErrorMessage("User already exist!"); return; } else { //Create new user try { bool newUser = mp.CreateUser(this.txtUsername.Text, this.txtPassword.Text, this.ddlRoleName.SelectedValue, this.txtfName.Text, this.txtlName.Text, this.txtEmail.Text); if (newUser == true) { this.lblUsrMsg.Text = MessageFormatter.GetFormattedSuccessMessage("User Created Succesfully!"); EmailHelper Email = new EmailHelper(); Email.UserCreationMailSender(this.txtEmail.Text, this.ddlRoleName.SelectedItem.ToString()); clearForm(); GridView1.DataBind(); } else { this.lblUsrMsg.Text = MessageFormatter.GetFormattedErrorMessage("Error Creating User!"); } } catch (Exception ex) { this.lblUsrMsg.Text = MessageFormatter.GetFormattedErrorMessage("Error:" + ex.Message + ex.InnerException); } } }
protected void btnCreateUser_Click(object sender, EventArgs e) { if (string.IsNullOrEmpty(this.txtUsername.Text)) { this.lblMsg.Text = MessageFormatter.GetFormattedErrorMessage("User Name required!"); return; } if (string.IsNullOrEmpty(this.txtPassword.Text)) { this.lblMsg.Text = MessageFormatter.GetFormattedErrorMessage("Password required!"); return; } if (string.IsNullOrEmpty(this.txtConfirmPasswd.Text)) { this.lblMsg.Text = MessageFormatter.GetFormattedErrorMessage("Confirm Password required!"); return; } if (string.IsNullOrEmpty(this.txtEmail.Text)) { this.lblMsg.Text = MessageFormatter.GetFormattedErrorMessage("Email required!"); return; } if (string.IsNullOrEmpty(this.txtfName.Text)) { this.lblMsg.Text = MessageFormatter.GetFormattedErrorMessage("First Name required!"); return; } if (string.IsNullOrEmpty(this.txtlName.Text)) { this.lblMsg.Text = MessageFormatter.GetFormattedErrorMessage("Last Name required!"); return; } if (string.IsNullOrEmpty(this.ddlRoleName.SelectedValue)) { this.lblMsg.Text = MessageFormatter.GetFormattedErrorMessage("Role required!"); return; } if (mp.getUserr(this.txtUsername.Text, this.txtEmail.Text) == true) { this.lblMsg.Text = MessageFormatter.GetFormattedErrorMessage("User already exist!"); return; } else { //Create new user try { bool newUser = mp.CreateUser(this.txtUsername.Text, this.txtPassword.Text, this.ddlRoleName.SelectedValue, this.txtfName.Text, this.txtlName.Text, this.txtEmail.Text); if (newUser == true) { this.lblMsg.Text = MessageFormatter.GetFormattedSuccessMessage("User Created Succesfully!"); clearForm(); } else { this.lblMsg.Text = MessageFormatter.GetFormattedErrorMessage("Error Creating Role!"); } } catch (Exception ex) { this.lblMsg.Text = MessageFormatter.GetFormattedErrorMessage("Error:" + ex.Message); } } }