public void Clear() { // clear personal information if (PatientSearchVar.ClearType == 0) { helper.ClearTextBox(TxtLastName); helper.ClearTextBox(TxtFirstName); helper.ClearTextBox(TxtPatientNum); helper.ClearCheckBox(ChkSurgeryDate); helper.ClearCheckBox(ChkDOB); helper.ClearCheckBox(ChkAge); helper.ClearRadioBtn(RdoMale); helper.ClearRadioBtn(RdoFemale); helper.ClearMaskedTextBox(MTxtssn); TxtLastName.Focus(); } // clear home information if (PatientSearchVar.ClearType == 1) { helper.ClearTextBox(TxtAddress1); helper.ClearTextBox(TxtAddress2); helper.ClearTextBox(TxtCity); helper.ClearComboBoxTxt(CboState); helper.ClearMaskedTextBox(MTxtZip); helper.ClearMaskedTextBox(MTxtPhone); helper.ClearMaskedTextBox(MTxtCell); TxtAddress1.Focus(); } }
private void OnErrorOccurred(object sender, EventArgs e) { if (_manageDriverViewModel.IsErrorInFirstName) { LblErrorMsg.Text = "First Name must be not null and contains alphabet only."; TxtFirstName.Focus(); return; } if (_manageDriverViewModel.IsErrorInLastName) { LblErrorMsg.Text = "Last Name must be not null and contains alphabet only."; TxtLastName.Focus(); return; } if (_manageDriverViewModel.IsErrorInUsername && _manageDriverViewModel.IsAddingDriver) { LblErrorMsg.Text = string.IsNullOrEmpty(_manageDriverViewModel.ErrorMessage) ? "Username must be not null and contains alphanumberic only." : _manageDriverViewModel.ErrorMessage;; TxtUsername.Focus(); return; } if (_manageDriverViewModel.IsErrorInPin) { LblErrorMsg.Text = "Pin number must be four digit only, no any aphabet allowed."; TxtPin.Focus(); return; } if (_manageDriverViewModel.IsErrorInGroup) { LblErrorMsg.Text = "Please select any Group."; CBGroup.Focus(); return; } }
public void Clear() { // clear personal info if (AddPatientVar.ClearType == 0) { helper.ClearTextBox(TxtLastName); helper.ClearTextBox(TxtFirstName); helper.ClearTextBox(TxtPatNum); helper.SetDateToToday(DtStart); helper.ClearRadioBtn(RdoMale); helper.ClearRadioBtn(RdoFemale); helper.ClearMaskedTextBox(MTxtssn); TxtLastName.Focus(); } // clear home if (AddPatientVar.ClearType == 1) { helper.ClearTextBox(TxtAddress1); helper.ClearTextBox(TxtAddress2); helper.ClearTextBox(TxtCity); helper.ClearComboBoxTxt(CboState); helper.ClearMaskedTextBox(MTxtZip); helper.ClearMaskedTextBox(MTxtPhone); helper.ClearMaskedTextBox(MTxtCell); TxtAddress1.Focus(); } // clear surgery if (AddPatientVar.ClearType == 2) { helper.SetDateToToday(DtSurgeryDate); helper.SetDateToToday(DtFiscalYear); DtSurgeryDate.Focus(); } }
private Boolean FieldValidation() { IIQCareSystem IQCareSecurity = (IIQCareSystem)ObjectFactory.CreateInstance("BusinessProcess.Security.BIQCareSystem, BusinessProcess.Security"); DateTime theCurrentDate = (DateTime)IQCareSecurity.SystemDate(); IQCareUtils theUtils = new IQCareUtils(); if (TxtFirstName.Text.Trim() == "") { MsgBuilder theBuilder = new MsgBuilder(); theBuilder.DataElements["Control"] = "First Name"; IQCareMsgBox.Show("BlankTextBox", theBuilder, this); TxtFirstName.Focus(); return(false); } if (TxtLastName.Text.Trim() == "") { MsgBuilder theBuilder = new MsgBuilder(); theBuilder.DataElements["Control"] = "Last Name"; IQCareMsgBox.Show("BlankTextBox", theBuilder, this); TxtLastName.Focus(); return(false); } if (TxtAdmissionNo.Text.Trim() == "") { MsgBuilder theBuilder = new MsgBuilder(); theBuilder.DataElements["Control"] = "Last Name"; IQCareMsgBox.Show("BlankTextBox", theBuilder, this); return(false); } if (TxtRegistrationDate.Text.Trim() == "") { MsgBuilder theBuilder = new MsgBuilder(); theBuilder.DataElements["Control"] = "Registration Date"; IQCareMsgBox.Show("BlankTextBox", theBuilder, this); TxtRegistrationDate.Focus(); return(false); } DateTime theEnrolDate = Convert.ToDateTime(theUtils.MakeDate(TxtRegistrationDate.Text)); if (theEnrolDate > theCurrentDate) { IQCareMsgBox.Show("EnrolDate", this); TxtRegistrationDate.Focus(); return(false); } if (DDGender.SelectedValue == "") { MsgBuilder theBuilder = new MsgBuilder(); theBuilder.DataElements["Control"] = "Sex"; IQCareMsgBox.Show("BlankTextBox", theBuilder, this); DDGender.Focus(); return(false); } if (TxtDOB.Text.Trim() == "") { MsgBuilder theBuilder = new MsgBuilder(); theBuilder.DataElements["Control"] = "DOB"; IQCareMsgBox.Show("BlankTextBox", theBuilder, this); TxtDOB.Focus(); return(false); } DateTime theDOBDate = Convert.ToDateTime(theUtils.MakeDate(TxtDOB.Text)); if (theDOBDate > theCurrentDate) { IQCareMsgBox.Show("DOBDate", this); TxtDOB.Focus(); return(false); } if (theDOBDate > theEnrolDate) { IQCareMsgBox.Show("DOB_EnrolDate", this); return(false); } return(true); }
protected void ImageButton1_Click(object sender, ImageClickEventArgs e) { try { cn.Close(); cn.Open(); string sql = "SELECT UserName from Manager where UserName=@un "; SqlCommand cmd = new SqlCommand(); cmd.Connection = cn; cmd.CommandType = CommandType.Text; cmd.CommandText = sql; cmd.Parameters.AddWithValue("un", TxtUserName.Text); dr = cmd.ExecuteReader(); if (dr.HasRows) { while (dr.Read()) { username = dr["UserName"].ToString(); } } dr.Close(); cn.Close(); if (username != null || username == "") { username = username.ToLower(); TxtUserName.Text = TxtUserName.Text.ToLower(); if (username == TxtUserName.Text) { LblError.Visible = true; LblError.Text = "The username '" + TxtUserName.Text + "' is Already Entered "; return; } else { LblError.Visible = false; } } else { LblError.Visible = false; } } catch (Exception ex) { Response.Write(ex.Message); } finally { cn.Close(); } try { if (TxtUserName.Text == "") { LblError.Visible = true; LblError.Text = "Please enter user name"; TxtUserName.Focus(); return; } if (TxtPassword.Text == "") { LblError.Visible = true; LblError.Text = "Please Password"; TxtPassword.Focus(); return; } if (TxtEmail.Text == "") { LblError.Visible = true; LblError.Text = "Please enter Email"; TxtEmail.Focus(); return; } if (TxtFirstName.Text == "") { LblError.Visible = true; LblError.Text = "Please enter First Name"; TxtFirstName.Focus(); return; } if (TxtLastName.Text == "") { LblError.Visible = true; LblError.Text = "Please enter Last Name"; TxtLastName.Focus(); return; } cn.Open(); string dob = ddlDay.Text + "/" + ddlMonth.Text + "/" + ddlYear.Text; DateTimeFormatInfo StartDate = new DateTimeFormatInfo(); StartDate.ShortDatePattern = "dd/MM/yyyy"; StartDate.DateSeparator = "/"; DateTime objDate = Convert.ToDateTime(dob, StartDate); DateTime jd = DateTime.Now; SqlCommand cm = new SqlCommand( "INSERT INTO Manager (First_Name, Last_Name, DOB, Occupation, Designation, Monthly_Salary, Email, Address, Country, City, PostalCode, Phone_Number, Status, Joining_Date, Password,Dept_Id, UserName, SQ1, Answer1, SQ2, Answer2, SQ3, Answer3) VALUES(@First_Name, @Last_Name, @DOB, @Occupation, @Designation, @Monthly_Salary, @Email, @Address, @Country, @City, @PostalCode, @Phone_Number, @Status, @Joining_Date, @Password,@Dept_Id, @User_Name, @SQ1, @Answer1, @SQ2, @Answer2, @SQ3, @Answer3)", cn); cm.Parameters.Add("@First_Name", TxtFirstName.Text); cm.Parameters.Add("@Last_Name", TxtLastName.Text); cm.Parameters.Add("@DOB", objDate); cm.Parameters.Add("@Occupation", TxtOccupation.Text); cm.Parameters.Add("@Designation", TxtDesignation.Text); cm.Parameters.Add("@Monthly_Salary", TxtSalary.Text); cm.Parameters.Add("@Email", TxtEmail.Text); cm.Parameters.Add("@Address", TxtAddress.Text); cm.Parameters.Add("@Country", TxtCountry.Text); cm.Parameters.Add("@City", TxtCity.Text); cm.Parameters.Add("@PostalCode", TxtPostalCode.Text); cm.Parameters.Add("@Phone_Number", TxtPhoneNo.Text); cm.Parameters.Add("@Status", TxtStatus.Text); cm.Parameters.Add("@Joining_Date", jd); cm.Parameters.Add("@Password", EncryptPasswrod(TxtPassword.Text)); cm.Parameters.Add("@Dept_Id", DDLAccountType.Text); cm.Parameters.Add("@User_Name", TxtUserName.Text); cm.Parameters.Add("@SQ1", TxtQ1.Text); cm.Parameters.Add("@Answer1", TxtA1.Text); cm.Parameters.Add("@SQ2", TxtQ2.Text); cm.Parameters.Add("@Answer2", TxtA2.Text); cm.Parameters.Add("@SQ3", TxtQ3.Text); cm.Parameters.Add("@Answer3", TxtA3.Text); cm.ExecuteNonQuery(); cm.Clone(); cn.Close(); LblError.Visible = true; LblError.Text = "An Email is sent to A Manager /n Account Added Successfully"; try { string emailfrom = "*****@*****.**"; string pwd = "inse6260"; string sb = "Welcome to INSE 6260 Bank "; string bd = "Dear Manager! Toy Account Has been Created successfully /n : Your user name to Login is :" + TxtUserName.Text + " and Password is:" + TxtPassword.Text + " and Security Questions Answer is apple"; MailMessage msg = new MailMessage(); msg.From = new MailAddress(emailfrom); msg.To.Add(TxtEmail.Text); msg.Subject = sb; msg.Body = bd; SmtpClient sc = new SmtpClient("smtp.gmail.com"); sc.Port = 587; sc.Credentials = new NetworkCredential(emailfrom, pwd); sc.EnableSsl = true; sc.Send(msg); Response.Write("mail send successfully"); TxtFirstName.Text = ""; TxtLastName.Text = ""; TxtOccupation.Text = ""; TxtDesignation.Text = ""; TxtSalary.Text = ""; TxtEmail.Text = ""; TxtAddress.Text = ""; TxtCity.Text = ""; TxtPostalCode.Text = ""; TxtPhoneNo.Text = ""; TxtStatus.Text = ""; TxtUserName.Text = ""; TxtPassword.Text = ""; TxtA1.Text = ""; TxtA2.Text = ""; TxtA3.Text = ""; Response.Redirect("~/Admin/AdminMenu.aspx", false); } catch (Exception ex) { } } catch { } }
private Boolean FieldValidation() { IIQCareSystem IQCareSecurity = (IIQCareSystem)ObjectFactory.CreateInstance("BusinessProcess.Security.BIQCareSystem, BusinessProcess.Security"); DateTime theCurrentDate = (DateTime)IQCareSecurity.SystemDate(); IQCareUtils theUtils = new IQCareUtils(); if (DDFinalResult.SelectedItem.Value == "9") { spDeath.Visible = true; } if (TxtFirstName.Text.Trim() == "") { MsgBuilder theBuilder = new MsgBuilder(); theBuilder.DataElements["Control"] = "First Name"; IQCareMsgBox.Show("BlankTextBox", theBuilder, this); TxtFirstName.Focus(); return(false); } if (TxtLastName.Text.Trim() == "") { MsgBuilder theBuilder = new MsgBuilder(); theBuilder.DataElements["Control"] = "Last Name"; IQCareMsgBox.Show("BlankTextBox", theBuilder, this); TxtLastName.Focus(); return(false); } if (TxtInfantId.Text.Trim() == "") { MsgBuilder theBuilder = new MsgBuilder(); theBuilder.DataElements["Control"] = "Infant ID"; IQCareMsgBox.Show("BlankTextBox", theBuilder, this); TxtInfantId.Focus(); return(false); } try { int i = Convert.ToInt32(TxtInfantId.Text); } catch { MsgBuilder theBuilder = new MsgBuilder(); theBuilder.DataElements["Control"] = "Infant ID"; IQCareMsgBox.Show("BlankTextBox", theBuilder, this); TxtDateOfBirth.Focus(); return(false); } if (TxtDateOfBirth.Value.Trim() == "") { MsgBuilder theBuilder = new MsgBuilder(); theBuilder.DataElements["Control"] = "DOB"; IQCareMsgBox.Show("BlankTextBox", theBuilder, this); TxtDateOfBirth.Focus(); return(false); } DateTime theDOBDate = Convert.ToDateTime(theUtils.MakeDate(TxtDateOfBirth.Value)); if (theDOBDate > theCurrentDate) { IQCareMsgBox.Show("DOBDate", this); TxtDateOfBirth.Focus(); return(false); } if (TxtDeathDate.Text != "") { spDeath.Visible = true; DateTime theDeathDate = Convert.ToDateTime(theUtils.MakeDate(TxtDeathDate.Text)); if (theDeathDate > theCurrentDate) { IQCareMsgBox.Show("DeathDateCheck", this); TxtDeathDate.Focus(); return(false); } if (theDeathDate < theDOBDate) { IQCareMsgBox.Show("DeathDOBDate", this); TxtDeathDate.Focus(); return(false); } } //if (DDInfantFeedingPractice.SelectedItem.Value.Trim() == "0") //{ // IQCareMsgBox.Show("InfantFeed", this); // DDInfantFeedingPractice.Focus(); // return false; //} //if (DDHIVTestType.SelectedItem.Value.Trim() == "0") //{ // IQCareMsgBox.Show("InfantHivTestType", this); // DDHIVTestType.Focus(); // return false; //} //if (DDResult.SelectedItem.Value.Trim() == "0") //{ // IQCareMsgBox.Show("InfantResult", this); // DDResult.Focus(); // return false; //} //if (DDFinalResult.SelectedItem.Value.Trim() == "0") //{ // IQCareMsgBox.Show("InfantFinalResult", this); // DDFinalResult.Focus(); // return false; //} return(true); }
protected void btnSave_Click(object sender, EventArgs e) { if (TxtFirstName.Text == "" || TxtFirstName.Text == string.Empty) { ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "Information", "alert('please Enter Child First Name')", true); TxtFirstName.Focus(); return; } if (TxtLastName.Text == "" || TxtLastName.Text == string.Empty) { ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "Information", "alert('please Enter Child Last Name')", true); TxtLastName.Focus(); return; } if (TxtMiddleName.Text == "" || TxtMiddleName.Text == string.Empty) { ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "Information", "alert('please Enter Child Middle Name')", true); TxtMiddleName.Focus(); return; } if (TxtDOB.Text == "" || TxtDOB.Text == string.Empty) { ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "Information", "alert('please Enter Child Date Of Birth')", true); TxtMiddleName.Focus(); return; } if (TxtAdmissionDate.Text == "" || TxtAdmissionDate.Text == string.Empty) { ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "Information", "alert('please Enter Enquiry Date for Admission ')", true); TxtAdmissionDate.Focus(); return; } if (TxtAddress.Text == "" || TxtAddress.Text == string.Empty) { ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "Information", "alert('please Enter Address')", true); TxtAddress.Focus(); return; } if (TxtStandard.Text == "" || TxtStandard.Text == string.Empty) { ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "Information", "alert('please Enter Child Standard')", true); TxtStandard.Focus(); return; } if (TxtWhatsupNumber.Text == "" || TxtWhatsupNumber.Text == string.Empty) { ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "Information", "alert('please Enter Whats app Number For Contact')", true); TxtWhatsupNumber.Focus(); return; } EWA_Admission objEWA = new EWA_Admission(); BL_Admission objBAL = new BL_Admission(); objEWA.FirstName = TxtFirstName.Text; objEWA.LastName = TxtLastName.Text; objEWA.MiddleName = TxtMiddleName.Text; objEWA.ParentEmail = TxtEmail.Text; objEWA.MobileNo = TxtWhatsupNumber.Text; objEWA.BirthDate = TxtDOB.Text; objEWA.ApplicationDate = TxtAdmissionDate.Text; objEWA.Branch1 = TxtStandard.Text; objEWA.AddressLine1 = TxtAddress.Text; int flag = objBAL.InsertEnquiryInfo(objEWA); if (flag > 0) { Clear(); msgBox.ShowMessage("Form Submitted Successfully", "Saved", UserControls.MessageBox.MessageStyle.Successfull); } else { msgBox.ShowMessage("Some Problem Occured....", "Critical", UserControls.MessageBox.MessageStyle.Critical); } }
private Boolean FieldValidation() { IIQCareSystem IQCareSecurity = (IIQCareSystem)ObjectFactory.CreateInstance("BusinessProcess.Security.BIQCareSystem, BusinessProcess.Security"); DateTime theCurrentDate = (DateTime)IQCareSecurity.SystemDate(); IQCareUtils theUtils = new IQCareUtils(); if (TxtFirstName.Text.Trim() == "") { MsgBuilder theBuilder = new MsgBuilder(); theBuilder.DataElements["Control"] = "First Name"; IQCareMsgBox.Show("BlankTextBox", theBuilder, this); TxtFirstName.Focus(); return(false); } if (TxtLastName.Text.Trim() == "") { MsgBuilder theBuilder = new MsgBuilder(); theBuilder.DataElements["Control"] = "Last Name"; IQCareMsgBox.Show("BlankTextBox", theBuilder, this); TxtLastName.Focus(); return(false); } if (TxtRegistrationDate.Text.Trim() == "") { MsgBuilder theBuilder = new MsgBuilder(); theBuilder.DataElements["Control"] = "Registration Date"; IQCareMsgBox.Show("BlankTextBox", theBuilder, this); TxtRegistrationDate.Focus(); return(false); } DateTime theEnrolDate = Convert.ToDateTime(theUtils.MakeDate(TxtRegistrationDate.Text)); if (theEnrolDate > theCurrentDate) { IQCareMsgBox.Show("EnrolDate", this); TxtRegistrationDate.Focus(); return(false); } if (DDGender.SelectedValue == "") { MsgBuilder theBuilder = new MsgBuilder(); theBuilder.DataElements["Control"] = "Sex"; IQCareMsgBox.Show("BlankTextBox", theBuilder, this); DDGender.Focus(); return(false); } if (TxtDOB.Text.Trim() == "") { MsgBuilder theBuilder = new MsgBuilder(); theBuilder.DataElements["Control"] = "DOB"; IQCareMsgBox.Show("BlankTextBox", theBuilder, this); TxtDOB.Focus(); return(false); } DateTime theDOBDate = Convert.ToDateTime(theUtils.MakeDate(TxtDOB.Text)); if (theDOBDate > theCurrentDate) { IQCareMsgBox.Show("DOBDate", this); TxtDOB.Focus(); return(false); } if (theDOBDate > theEnrolDate) { IQCareMsgBox.Show("DOB_EnrolDate", this); return(false); } /////17-09-09 //if (chkTransferIn.Checked == true && ddReferredFrom.SelectedIndex != 0) //{ // // //MsgBuilder theBuilder = new MsgBuilder(); // // theBuilder.DataElements["Control"] = "RefFrom"; // //// IQCareMsgBox.Show("BlankDropDown", theBuilder, this); // return false; // } ////17-09-09 if (chkTransferIn.Checked == false && ddReferredFrom.SelectedIndex != 0) { MsgBuilder theBuilder = new MsgBuilder(); theBuilder.DataElements["Control"] = "Either Tranfer in/Referred From"; IQCareMsgBox.Show("BlankDropDown", theBuilder, this); return(false); } if (chkTransferIn.Checked == true && ddReferredFrom.SelectedIndex == 0) { MsgBuilder theBuilder = new MsgBuilder(); theBuilder.DataElements["Control"] = "Either Tranfer in/Referred From"; IQCareMsgBox.Show("BlankDropDown", theBuilder, this); return(false); } if (TxtANCNumber.Text == "" && TxtPMTCTNumber.Text == "" && TxtAdmissionNumber.Text == "" && TxtOutPatientNumber.Text == "") { IQCareMsgBox.Show("PMTCTEnrol_ANC", this); return(false); } IPatientRegistration ValMgrPMTCT = (IPatientRegistration)ObjectFactory.CreateInstance(ObjFactoryParameter); string msg = ""; if (TxtANCNumber.Text != "") { DataTable theDT = ValMgrPMTCT.Validate(TxtANCNumber.Text, "ANC"); if (theDT.Rows.Count > 0) { //if (Request.QueryString["Name"] == "Edit") if (Convert.ToInt32(Session["PatientId"]) > 0) //i.e. update mode { if (theDT.Rows[0]["IDNumber"].ToString() != Convert.ToString(ViewState["ANC"])) { msg = "ANC" + "' '" + IQCareMsgBox.GetMessage("PMTCTDuplicate", this); MsgBuilder theBuilder = new MsgBuilder(); theBuilder.DataElements["MessageText"] = msg; IQCareMsgBox.Show("#C1", theBuilder, this); return(false); } } else { msg = "ANC" + "' '" + IQCareMsgBox.GetMessage("PMTCTDuplicate", this); MsgBuilder theBuilder = new MsgBuilder(); theBuilder.DataElements["MessageText"] = msg; IQCareMsgBox.Show("#C1", theBuilder, this); return(false); } } } if (TxtPMTCTNumber.Text != "") { DataTable theDT = ValMgrPMTCT.Validate(TxtPMTCTNumber.Text, "PMTCT"); if (theDT.Rows.Count > 0) { //if (Request.QueryString["Name"] == "Edit") //if (Request.QueryString["Name"] != "Add") //i.e. edit mode if (Convert.ToInt32(Session["PatientId"]) > 0) { if (theDT.Rows[0]["IDNumber"].ToString() != ViewState["PMTCT"].ToString()) { msg = "PMTCT" + "' '" + IQCareMsgBox.GetMessage("PMTCTDuplicate", this); MsgBuilder theBuilder = new MsgBuilder(); theBuilder.DataElements["MessageText"] = msg; IQCareMsgBox.Show("#C1", theBuilder, this); return(false); } } else { msg = "PMTCT" + "' '" + IQCareMsgBox.GetMessage("PMTCTDuplicate", this); MsgBuilder theBuilder = new MsgBuilder(); theBuilder.DataElements["MessageText"] = msg; IQCareMsgBox.Show("#C1", theBuilder, this); return(false); } } } if (TxtAdmissionNumber.Text != "") { DataTable theDT = ValMgrPMTCT.Validate(TxtAdmissionNumber.Text, "Admission"); if (theDT.Rows.Count > 0) { //if (Request.QueryString["Name"] == "Edit") //if (Request.QueryString["Name"] != "Add") //i.e. edit mode if (Convert.ToInt32(Session["PatientId"]) > 0) { if (theDT.Rows[0]["IDNumber"].ToString() != ViewState["Admission"].ToString()) { msg = "Admission" + "' '" + IQCareMsgBox.GetMessage("PMTCTDuplicate", this); MsgBuilder theBuilder = new MsgBuilder(); theBuilder.DataElements["MessageText"] = msg; IQCareMsgBox.Show("#C1", theBuilder, this); return(false); } } else { msg = "Admission" + "' '" + IQCareMsgBox.GetMessage("PMTCTDuplicate", this); MsgBuilder theBuilder = new MsgBuilder(); theBuilder.DataElements["MessageText"] = msg; IQCareMsgBox.Show("#C1", theBuilder, this); return(false); } } } if (TxtOutPatientNumber.Text != "") { DataTable theDT = ValMgrPMTCT.Validate(TxtOutPatientNumber.Text, "Outpatient"); if (theDT.Rows.Count > 0) { //if (Request.QueryString["Name"] == "Edit") //if (Request.QueryString["Name"] != "Add") //i.e. edit mode if (Convert.ToInt32(Session["PatientId"]) > 0) { if (theDT.Rows[0]["IDNumber"].ToString() != ViewState["Outpatient"].ToString()) { msg = "OutpatientNumber" + "' '" + IQCareMsgBox.GetMessage("PMTCTDuplicate", this); MsgBuilder theBuilder = new MsgBuilder(); theBuilder.DataElements["MessageText"] = msg; IQCareMsgBox.Show("#C1", theBuilder, this); return(false); } } else { msg = "OutpatientNumber" + "' '" + IQCareMsgBox.GetMessage("PMTCTDuplicate", this); MsgBuilder theBuilder = new MsgBuilder(); theBuilder.DataElements["MessageText"] = msg; IQCareMsgBox.Show("#C1", theBuilder, this); return(false); } } } return(true); }
private void btnSave_Click(object sender, EventArgs e) { if (txtIDNUMBER.Text == "") { MessageBox.Show("This field is required!.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Exclamation, MessageBoxDefaultButton.Button1); txtIDNUMBER.Focus(); } else if (TxtFirstName.Text == "") { MessageBox.Show("This field is required!.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Exclamation, MessageBoxDefaultButton.Button1); TxtFirstName.Focus(); } else if (TxtLastName.Text == "") { MessageBox.Show("This field is required!.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Exclamation, MessageBoxDefaultButton.Button1); TxtLastName.Focus(); } else if (TxtMiddleName.Text == "") { MessageBox.Show("This field is required!.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Exclamation, MessageBoxDefaultButton.Button1); TxtLastName.Focus(); } else if (TxtEmailAddress.Text == "") { MessageBox.Show("This field is required!.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Exclamation, MessageBoxDefaultButton.Button1); TxtEmailAddress.Focus(); } else if (cboPOstion.SelectedValue.ToString() == "")//Nothing selected { MessageBox.Show("This field is required!.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Exclamation, MessageBoxDefaultButton.Button1); cboPOstion.Focus(); } else if (cboDepartments.SelectedValue.ToString() == "")//Nothing selected { MessageBox.Show("This field is required!.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Exclamation, MessageBoxDefaultButton.Button1); cboDepartments.Focus(); } else { string StringReturn = ""; SqlConnection con = new SqlConnection(conStr); SqlCommand cmd = new SqlCommand(); cmd.CommandType = CommandType.StoredProcedure; cmd.CommandText = "TRAN_SAVEWORKER"; cmd.Parameters.Add("@IDRef", SqlDbType.VarChar, 15).Value = txtIDNUMBER.Text.ToString(); cmd.Parameters.Add("@Lastname", SqlDbType.VarChar, 100).Value = TxtLastName.Text.ToString(); cmd.Parameters.Add("@Firstname", SqlDbType.VarChar, 100).Value = TxtFirstName.Text.ToString(); cmd.Parameters.Add("@MidName", SqlDbType.VarChar, 100).Value = TxtMiddleName.Text.ToString(); cmd.Parameters.Add("@EmailAddress", SqlDbType.VarChar, 100).Value = TxtEmailAddress.Text.ToString(); cmd.Parameters.Add("@DesignationCode", SqlDbType.VarChar, 4).Value = cboPOstion.SelectedValue.ToString(); cmd.Parameters.Add("@DeptCode", SqlDbType.VarChar, 15).Value = cboDepartments.SelectedValue.ToString(); cmd.Connection = con; try { con.Open(); StringReturn = cmd.ExecuteScalar().ToString(); if (StringReturn == "EXISTS") { MessageBox.Show("ID Number Already Exists", "ERROR", MessageBoxButtons.OK, MessageBoxIcon.Warning, MessageBoxDefaultButton.Button1); } if (StringReturn == "DONE") { MessageBox.Show("Record Saved", "Information", MessageBoxButtons.OK, MessageBoxIcon.Information, MessageBoxDefaultButton.Button1); UserMaintainance um = new UserMaintainance(); um.Show(); this.Dispose(); } } catch (Exception ex) { throw ex; } finally { con.Close(); con.Dispose(); } } }
public FrmGetPersonForSale() { InitializeComponent(); People = null; TxtLastName.Focus(); }
protected void ImageButton1_Click(object sender, ImageClickEventArgs e) { try { try { cn.Open(); if (TxtPassportNo.Text != null) { int t1 = int.Parse(TxtPassportNo.Text); if (t1 <= 0) { LblError.Visible = true; LblError.Text = "Please enter Valid Passport Number"; TxtPassportNo.Focus(); return; } if (TxtPassportNo.Text.Length != 7) { LblMsg.Visible = true; LblMsg.Text = "Please Enter 7 digits passport number"; TxtPassportNo.Focus(); return; } if (TxtPassword.Text != "") { if (TxtPassword.Text.Length < 3) { LblError.Visible = true; LblError.Text = "Please Enter atleast 3 character length Password"; LblMsg.Visible = true; LblMsg.Text = "Please Enter atleast 3 character length Password"; TxtPassword.Focus(); LblMsg.Visible = true; return; } } string pas_Id = TxtPassportNo.Text; string sql = "Select PassportNo from Client where PassportNo=@pass_id"; SqlCommand cmd = new SqlCommand(); cmd.Connection = cn; cmd.CommandType = CommandType.Text; cmd.CommandText = sql; cmd.Parameters.AddWithValue("pass_id", pas_Id); dr = cmd.ExecuteReader(); if (dr.HasRows) { while (dr.Read()) { pn1 = dr["PassportNo"].ToString(); } } dr.Close(); cn.Close(); if (pn1 == TxtPassportNo.Text) { LblError.Visible = true; LblError.Text = "Passport Number Already exist"; LblMsg.Visible = true; LblMsg.Text = "Passport Number Already exist"; TxtPassportNo.Focus(); return; } else { LblMsg.Visible = false; } } } catch { } finally { cn.Close(); } if (TxtPassportNo.Text != "" && TxtPassword.Text != "" && TxtEmail.Text != "" && TxtFirstName.Text != "" && TxtLastName.Text != "") { //int chars = TxtPassportNo.Text.Length; if (TxtPassportNo.Text.Length != 7) { LblError.Visible = true; LblMsg.Text = "Please Enter 7 digits passport number"; LblMsg.Visible = true; LblMsg.Text = "Please Enter 7 digits passport number"; TxtPassportNo.Focus(); LblMsg.Visible = true; return; } if (TxtA1.Text == "") { LblError.Visible = true; LblError.Text = "Please Enter Security Answers A1"; TxtA1.Focus(); return; } if (TxtA2.Text == "") { LblError.Visible = true; LblError.Text = "Please Enter Security Answers A2"; TxtA2.Focus(); return; } if (TxtA3.Text == "") { LblError.Visible = true; LblError.Text = "Please Enter Security Answers A3"; TxtA3.Focus(); return; } LblError.Visible = false; string dob = ddlDay.Text + "/" + ddlMonth.Text + "/" + ddlYear.Text; cn.Open(); DateTimeFormatInfo StartDate = new DateTimeFormatInfo(); StartDate.ShortDatePattern = "dd/MM/yyyy"; StartDate.DateSeparator = "/"; DateTime objDate = Convert.ToDateTime(dob, StartDate); int cnt = 0; SqlCommand cm = new SqlCommand( "INSERT INTO Client (First_Name, Last_Name, DOB, Occupation, Designation, Monthly_Salary,Email, Address, Country, City, PostalCode, Phone_Number, Status, Password, SQ1, Answer1, SQ2, Answer2, SQ3, Answer3, PassportNo, Client_Check) VALUES(@First_Name, @Last_Name, @DOB, @Occupation, @Designation, @Monthly_Salary,@Email, @Address, @Country, @City, @PostalCode, @Phone_Number, @Status, @Password, @SQ1, @Answer1, @SQ2, @Answer2, @SQ3, @Answer3, @PassportNo,@Client_Check)", cn); cm.Parameters.Add("@First_Name", TxtFirstName.Text); cm.Parameters.Add("@Last_Name", TxtLastName.Text); cm.Parameters.Add("@DOB", objDate); cm.Parameters.Add("@Occupation", TxtOccupation.Text); cm.Parameters.Add("@Designation", TxtDesignation.Text); cm.Parameters.Add("@Monthly_Salary", TxtSalary.Text); cm.Parameters.Add("@Email", TxtEmail.Text); cm.Parameters.Add("@Address", TxtAddress.Text); cm.Parameters.Add("@Country", TxtCountry.Text); cm.Parameters.Add("@City", TxtCity.Text); cm.Parameters.Add("@PostalCode", TxtPostalCode.Text); cm.Parameters.Add("@Phone_Number", TxtPhoneNo.Text); cm.Parameters.Add("@Status", TxtStatus.Text); cm.Parameters.Add("@Password", EncryptPasswrod(TxtPassword.Text)); cm.Parameters.Add("@SQ1", TxtQ1.Text); cm.Parameters.Add("@Answer1", TxtA1.Text); cm.Parameters.Add("@SQ2", TxtQ2.Text); cm.Parameters.Add("@Answer2", TxtA2.Text); cm.Parameters.Add("@SQ3", TxtQ3.Text); cm.Parameters.Add("@Answer3", TxtA3.Text); cm.Parameters.Add("@PassportNo", TxtPassportNo.Text); cm.Parameters.Add("@Client_Check", cnt); cm.ExecuteNonQuery(); cm.Clone(); //cmd.CommandText = "Insert INTO Client (First_Name, Last_Name, DOB, Occupation, Designation, Monthly_Salary, Address, Country, City, PostalCode, Phone_Number, Status, Password, SQ1, Answer1, SQ2, Answer2, SQ3, Answer3, PassportNo) VALUES ('" + TxtFirstName.Text + "','" + TxtLastName.Text + "','" + myDateTime + "','" + TxtOccupation.Text + "','" + TxtDesignation.Text + "','" + TxtSalary.Text + "','" + TxtAddress.Text + "','" + TxtCountry.Text + "','" + TxtCity.Text + "','" + TxtPostalCode.Text + "','" + TxtPhoneNo.Text + "','" + TxtStatus.Text + "','" + TxtPassword.Text + "','" + TxtQ1.Text + "','" + TxtA1.Text + "','" + TxtQ2.Text + "','" + TxtA2.Text + "','" + TxtQ3.Text + "','" + TxtA3.Text + "', '" + TxtPassportNo.Text + "')"; //cmd.ExecuteNonQuery(); //cmd.Clone(); cn.Close(); Response.Write("Contact Added Successfully!"); try { cn.Open(); string sql = "Select Client_Id from Client where PassportNo=@tp"; SqlCommand cmd = new SqlCommand(); cmd.Connection = cn; cmd.CommandType = CommandType.Text; cmd.CommandText = sql; cmd.Parameters.AddWithValue("tp", TxtPassportNo.Text); dr = cmd.ExecuteReader(); if (dr.HasRows) { while (dr.Read()) { cd = dr["Client_Id"].ToString(); } } dr.Close(); cn.Close(); } catch { } finally { cn.Close(); insertaccount(); Session["cd"] = cd; Response.Redirect("~/Client/Register_Debit_Card.aspx", false); } { LblMsg.Visible = false; } } else { if (TxtPassword.Text == "") { LblError.Visible = true; LblError.Text = "Please enter passowrd"; TxtPassword.Focus(); } if (TxtPassword.Text != "") { if (TxtPassportNo.Text.Length != 3) { LblError.Visible = true; LblMsg.Text = "Please Enter atleast 3 character length Password"; LblMsg.Visible = true; LblMsg.Text = "Please Enter atleast 3 character length Password"; TxtPassword.Focus(); LblMsg.Visible = true; return; } } if (TxtPassportNo.Text == "") { LblError.Visible = true; LblError.Text = "Please enter Passport Number"; TxtPassportNo.Focus(); } if (TxtEmail.Text == "") { LblError.Visible = true; LblError.Text = "Please Enter Email"; TxtEmail.Focus(); } if (TxtFirstName.Text == "") { LblError.Visible = true; LblError.Text = "Please enter FirstName"; TxtFirstName.Focus(); } if (TxtLastName.Text == "") { LblError.Visible = true; LblError.Text = "Please enter Last Name"; TxtLastName.Focus(); } return; } } catch (Exception ex) { Response.Write(ex.Message); } finally { cn.Close(); } }
private Boolean FieldValidation() { IIQCareSystem IQCareSecurity = (IIQCareSystem)ObjectFactory.CreateInstance("BusinessProcess.Security.BIQCareSystem, BusinessProcess.Security"); DateTime theCurrentDate = (DateTime)IQCareSecurity.SystemDate(); IQCareUtils theUtils = new IQCareUtils(); if (DDFinalResult.SelectedItem.Value == "9") { spDeath.Visible = true; } if (TxtFirstName.Text.Trim() == "") { MsgBuilder theBuilder = new MsgBuilder(); theBuilder.DataElements["Control"] = "First Name"; IQCareMsgBox.Show("BlankTextBox", theBuilder, this); TxtFirstName.Focus(); return(false); } if (TxtLastName.Text.Trim() == "") { MsgBuilder theBuilder = new MsgBuilder(); theBuilder.DataElements["Control"] = "Last Name"; IQCareMsgBox.Show("BlankTextBox", theBuilder, this); TxtLastName.Focus(); return(false); } if (TxtInfantId.Text.Trim() == "") { MsgBuilder theBuilder = new MsgBuilder(); theBuilder.DataElements["Control"] = "Infant ID"; IQCareMsgBox.Show("BlankTextBox", theBuilder, this); TxtInfantId.Focus(); return(false); } try { Int64 i = Convert.ToInt64(TxtInfantId.Text); } catch { MsgBuilder theBuilder = new MsgBuilder(); theBuilder.DataElements["Control"] = "Infant ID"; IQCareMsgBox.Show("BlankTextBox", theBuilder, this); TxtDateOfBirth.Focus(); return(false); } if (TxtDateOfBirth.Value.Trim() == "") { MsgBuilder theBuilder = new MsgBuilder(); theBuilder.DataElements["Control"] = "DOB"; IQCareMsgBox.Show("BlankTextBox", theBuilder, this); TxtDateOfBirth.Focus(); return(false); } DateTime theDOBDate = Convert.ToDateTime(theUtils.MakeDate(TxtDateOfBirth.Value)); if (theDOBDate > theCurrentDate) { IQCareMsgBox.Show("DOBDate", this); TxtDateOfBirth.Focus(); return(false); } int Age = GetAge(theDOBDate); if (TxtDateOfBirth.Value != "") { Decimal AgeinYear = Math.Round(Convert.ToDecimal(Session["PatientAge"]), 0); if (Convert.ToDecimal(Age) >= AgeinYear) { //ScriptManager.RegisterStartupScript(this, GetType(), "PatientAge", "alert('Infant Age cannot be more than Parent Age');", true); MsgBuilder theMsg = new MsgBuilder(); theMsg.DataElements["Control"] = "Infant Age cannot be more than Parent Age"; IQCareMsgBox.Show("PatientAge", theMsg, this); TxtDateOfBirth.Focus(); return(false); } } if (TxtDeathDate.Value != "") { spDeath.Visible = true; DateTime theDeathDate = Convert.ToDateTime(theUtils.MakeDate(TxtDeathDate.Value)); if (theDeathDate > theCurrentDate) { IQCareMsgBox.Show("DeathDateCheck", this); TxtDeathDate.Focus(); return(false); } if (theDeathDate < theDOBDate) { IQCareMsgBox.Show("DeathDOBDate", this); TxtDeathDate.Focus(); return(false); } } //if (DDInfantFeedingPractice.SelectedItem.Value.Trim() == "0") //{ // IQCareMsgBox.Show("InfantFeed", this); // DDInfantFeedingPractice.Focus(); // return false; //} //if (DDHIVTestType.SelectedItem.Value.Trim() == "0") //{ // IQCareMsgBox.Show("InfantHivTestType", this); // DDHIVTestType.Focus(); // return false; //} //if (DDResult.SelectedItem.Value.Trim() == "0") //{ // IQCareMsgBox.Show("InfantResult", this); // DDResult.Focus(); // return false; //} //if (DDFinalResult.SelectedItem.Value.Trim() == "0") //{ // IQCareMsgBox.Show("InfantFinalResult", this); // DDFinalResult.Focus(); // return false; //} return(true); }
public FrmSelectPerson() { InitializeComponent(); People = null; TxtLastName.Focus(); }
/*************************************** * * This is where the EMPLOYEE DATA METHODS are. * ***************************************/ /// <summary> /// This will check the shared values for all employee fields /// </summary> /// <param name="creatingEmployee"> This is the employee that needs to be saved.</param> /// <returns></returns> private bool CheckBaseValues(Employee creatingEmployee) { uint tempUint = 0; if (uint.TryParse(TxtEmpID.Text, out tempUint)) { creatingEmployee.EmpID = tempUint; } else { LblStatus.Text = errorMessageUint; TxtEmpID.Focus(); return(false); } if (TxtLastName.Text == "") { LblStatus.Text = "Last name cannot be empty."; TxtLastName.Focus(); return(false); } if (TxtFirstName.Text == "") { LblStatus.Text = "First name cannot be empty."; TxtFirstName.Focus(); return(false); } if (TxtMaritalStatus.Text == "") { LblStatus.Text = "Marital Status cannont be empty."; TxtMaritalStatus.Focus(); return(false); } if (TxtDepartment.Text == "") { LblStatus.Text = "Department cannont be empty."; TxtDepartment.Focus(); return(false); } if (TxtTitle.Text == "") { LblStatus.Text = "Title cannot be emtpy."; TxtTitle.Focus(); return(false); } if (TxtStartDate.Text == "") { LblStatus.Text = "Start Date cannot be empty."; TxtStartDate.Focus(); return(false); } /* * //Middle Name Not required. * if (TxtMiddleName.Text == "") * { * LblStatus.Text = "Middle name cannot be empty."; * TxtMiddleName.Focus(); * return false; * } */ creatingEmployee.EmpType = CbxEmployeeType.Text; creatingEmployee.FirstName = TxtFirstName.Text; creatingEmployee.LastName = TxtLastName.Text; creatingEmployee.MiddleName = TxtMiddleName.Text; creatingEmployee.MaritalStatus = TxtMaritalStatus.Text; creatingEmployee.Department = TxtDepartment.Text; creatingEmployee.Title = TxtTitle.Text; creatingEmployee.StartDate = TxtStartDate.Text; if (CkbBenefits.Checked) { creatingEmployee.Benefits = true; } else { creatingEmployee.Benefits = false; } if (CkbActiveEmployee.Checked) { creatingEmployee.ActiveEmployee = true; } else { creatingEmployee.ActiveEmployee = false; } return(true); }