private void txtPatName_KeyUp(object sender, KeyEventArgs e) { if (txtPatName.Text != "") { } else { Lab_UsernameAvailable.Hide(); } }
private void txtPatName_Leave(object sender, EventArgs e) { Lab_UsernameAvailable.Show(); DataTable patSearch = this.cntrl.Get_patient_details(txtPatName.Text); if (patSearch.Rows.Count > 0) { Lab_UsernameAvailable.Text = "User with same name already exists"; Lab_UsernameAvailable.ForeColor = Color.Red; Lab_ViewDetails.Show(); } else { Lab_UsernameAvailable.Text = "User Available"; Lab_UsernameAvailable.ForeColor = Color.LimeGreen; Lab_ViewDetails.Hide(); } }
private void btn_SavePatient_Click(object sender, EventArgs e) { try { if (txtPMobNumber.TextLength != 10) { MessageBox.Show("Enter the mobile number.. !!", "Data not found.. ", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } if (txtpassportno.Text != "") { if (txtpassportno.TextLength != 8 && !(txtpassportno.Text).StartsWith("J")) { MessageBox.Show("Enter the passport number.. !!", "Data not found.. ", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } } if (txtPatientId.Text != "") { DataTable dtb = this.cntrl.get_patientid(txtPatientId.Text); if (dtb.Rows.Count > 0) { MessageBox.Show("This patient id already exists", "Duplication encountered", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } } else { DataTable cmd = this.cntrl.automaticid_when_automation_No(); if (cmd.Rows.Count > 0) { //int n = 0; //n = int.Parse(cmd.Rows[0]["patient_number"].ToString()) + 1;patient_prefix //if (n != 0) //{ txtPatientId.Text = cmd.Rows[0]["patient_prefix"].ToString() + cmd.Rows[0]["patient_number"].ToString(); //this.cntrl.update_autogenerateid(n); //} } } if (String.IsNullOrWhiteSpace(txtPatName.Text)) { txtPatName.Focus(); return; } else { string gender = "", dob = "", visited = ""; Lab_UsernameAvailable.Show(); DataTable patSearch = this.cntrl.Get_patient_details(txtPatName.Text); if (patSearch.Rows.Count > 0) { Lab_UsernameAvailable.Text = "User with same name already exists"; Lab_UsernameAvailable.ForeColor = Color.Red; Lab_ViewDetails.Show(); } else { Lab_UsernameAvailable.Text = "User Available"; Lab_UsernameAvailable.ForeColor = Color.LimeGreen; Lab_ViewDetails.Hide(); } if (txtPMobNumber.Text != "") { DataTable dtb_phone = this.cntrl.Get_patient_phoneno(txtPMobNumber.Text, txtPatName.Text); if (dtb_phone.Rows.Count > 0) { DialogResult res = MessageBox.Show(" This patient already exists,Do you really want to save this number?", " confirmation", MessageBoxButtons.YesNo, MessageBoxIcon.Question); if (res == DialogResult.No) { txtPMobNumber.Text = ""; txtPatName.Text = ""; return; } } //else //{ //} int i = 0; if (radMale.Checked == true) { gender = "Male"; } else { gender = "Female"; } if (DateTime.Now.Date.ToString("MM/dd/yyyy") == DTP_Dob.Value.ToString("MM/dd/yyyy")) { dob = null; } else { dob = DTP_Dob.Value.ToString("yyyy-MM-dd"); } if (DateTime.Now.Date.ToString("MM/dd/yyyy") == dateTimePickervisited.Value.ToString("MM/dd/yyyy")) { visited = DateTime.Now.Date.ToString("yyyy/MM/dd"); } else { visited = dateTimePickervisited.Value.ToString("yyyy/MM/dd"); } //Addfunction(); string smsName1 = PappyjoeMVC.Model.GlobalVariables.smsName.ToString(); string smsPass1 = PappyjoeMVC.Model.GlobalVariables.smsPass.ToString(); string type = "LNG"; i = this.cntrl.Save(txtPatName.Text, txtPatientId.Text, txtAadhar.Text, gender, dob, txtxAge.Text, cmdBloodbroup.Text, txtAccompained.Text, txtPMobNumber.Text, txtSMobileNumber.Text, txtLandline.Text, txtEmail.Text, txtxStreet.Text, txtLocality.Text, txtCity.Text, txtPincode.Text, txtReferedby.Text, txtFileNo.Text, visited, ddldoctor.Text, txtOccupation.Text, txtnationality.Text, txtpassportno.Text); this.cntrl.save_log(doctor_id, "Patient", "logged user adds new patient", "Add"); DataTable cmd = this.cntrl.automaticid(); if (cmd.Rows.Count > 0) { int n = 0; n = int.Parse(cmd.Rows[0]["patient_number"].ToString()) + 1; if (n != 0) { this.cntrl.update_autogenerateid(n); } } if (i > 0) { txtPic.Text = ""; string rs_patient = this.cntrl.get_maxId(); pat_id = rs_patient; if (medhisStatus == 0) { for (int count = 0; count < grmedical.Rows.Count; count++) { if (Convert.ToBoolean(grmedical.Rows[count].Cells[1].Value) == true) { this.cntrl.save_medical(pat_id, grmedical.Rows[count].Cells[0].Value.ToString()); } } } else { for (int count = 0; count < grmedical.Rows.Count; count++) { if (Convert.ToBoolean(grmedical.Rows[count].Cells[0].Value) == true) { this.cntrl.save_medical(pat_id, grmedical.Rows[count].Cells[1].Value.ToString()); } } } if (selectGrp == 0) { for (int count = 0; count < gridgroups.Rows.Count; count++) { if (Convert.ToBoolean(gridgroups.Rows[count].Cells[1].Value) == true) { this.cntrl.save_group(pat_id, gridgroups.Rows[count].Cells[0].Value.ToString()); } } } else { for (int count = 0; count < gridgroups.Rows.Count; count++) { if (Convert.ToBoolean(gridgroups.Rows[count].Cells[0].Value) == true) { this.cntrl.save_group(pat_id, gridgroups.Rows[count].Cells[1].Value.ToString()); } } } Clear_data(); string server = this.cntrl.server(); if (path != "") { try { if (File.Exists(@"\\" + server + "\\Pappyjoe_utilities\\patient_image\\" + pat_id)) { } else { System.IO.File.Copy(path, @"\\" + server + "\\Pappyjoe_utilities\\patient_image\\" + pat_id); } } catch {} } this.cntrl.SendSMS(smsName1, smsPass1, txtPMobNumber.Text, "Dear " + txtPatName.Text + " welcome to " + toolStripButton1.Text, type); if (statusForNewPatient == 1) { ActiveForm.Close(); } else { var form2 = new Patient_Profile_Details(); form2.patient_id = pat_id; form2.doctor_id = doctor_id; form2.Closed += (sender1, args) => this.Close(); this.Hide(); form2.Show(); } } else { MessageBox.Show("Inseration Failed,Error occured !!", " ", MessageBoxButtons.OK, MessageBoxIcon.Error); } } else { MessageBox.Show("Enter the mobile number.. !!", "Data not found.. ", MessageBoxButtons.OK, MessageBoxIcon.Error); Lab_InvalidNumber.Visible = true; return; } } } catch (Exception ex) { MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Information); } }