/// <summary> /// Check whether data of user is valid /// </summary> /// <returns></returns> /// <remarks> /// Author: PhatLT. FPTSS. /// Created date: 14/02/2011 /// </remarks> public bool ValidateData() { DataRowView rview = (DataRowView)_manager.Current; DataRow row = rview.Row; clsCommon common = new clsCommon(); row.ClearErrors(); ep.SetError(txtConfirmPassword, ""); string userName = row["USERNAME"].ToString(); if (userName.Length == 0) { row.SetColumnError("USERNAME", clsResources.GetMessage("errors.required", lblUserName.Text)); txtUserName.Focus(); return(false); } else if (!common.IsLetterAndDigit(userName)) { row.SetColumnError("USERNAME", clsResources.GetMessage("errors.string.specialChar", lblUserName.Text)); txtUserName.Focus(); return(false); } if (row["PASSWORD"].ToString().Length == 0) { row.SetColumnError("PASSWORD", clsResources.GetMessage("errors.required", lblPassword.Text)); txtPassword.Focus(); return(false); } if (txtConfirmPassword.Text != txtPassword.Text) { ep.SetError(txtConfirmPassword, clsResources.GetMessage("errors.compare.equal", lblConfirmPassword.Text, lblPassword.Text)); return(false); } if (row["FIRSTNAME"].ToString().Length == 0) { row.SetColumnError("FIRSTNAME", clsResources.GetMessage("errors.required", lblFirstName.Text)); txtFirstName.Focus(); return(false); } if (row["LASTNAME"].ToString().Length == 0) { row.SetColumnError("LASTNAME", clsResources.GetMessage("errors.required", lblLastName.Text)); txtFirstName.Focus(); return(false); } if (row["EMAIL"] == DBNull.Value) { row.SetColumnError("EMAIL", clsResources.GetMessage("errors.required", lblEmail.Text)); txtEmail.Focus(); return(false); } else if (row["EMAIL"].ToString().Length > 0 && !common.IsEmail(row["EMAIL"].ToString())) { row.SetColumnError("EMAIL", clsResources.GetMessage("errors.email", lblAddress.Text)); txtAddress.Focus(); return(false); } if (row["ADDRESS"] == DBNull.Value) { row.SetColumnError("ADDRESS", clsResources.GetMessage("errors.required", lblAddress.Text)); txtAddress.Focus(); return(false); } if (row["PHONE"] == DBNull.Value) { row.SetColumnError("PHONE", clsResources.GetMessage("errors.required", lblPhone.Text)); txtPhone.Focus(); return(false); } if (txtStartDate.Value > txtEndDate.Value) { row.SetColumnError("END_DATE", clsResources.GetMessage("errors.compare.datetime", lblStartDate.Text, lblEndDate.Text)); txtStartDate.Focus(); return(false); } if (row["UROLE_ID"] == DBNull.Value) { row.SetColumnError("UROLE_ID", clsResources.GetMessage("errors.required", lblURoleID.Text)); cboURoleID.Focus(); return(false); } if (row["STATUS"] == DBNull.Value) { row.SetColumnError("STATUS", clsResources.GetMessage("errors.required", lblStatus.Text)); cboURoleID.Focus(); return(false); } if (row["DESCRIPTION"] == DBNull.Value) { row.SetColumnError("DESCRIPTION", clsResources.GetMessage("errors.required", lblDescription.Text)); txtDescription.Focus(); return(false); } if (!bln_IsEdit && bo.Exist(row["USERNAME"].ToString())) { row.SetColumnError("USERNAME", clsResources.GetMessage("errors.userName.exist")); txtUserName.Focus(); return(false); } return(true); }