示例#1
0
 private void btnOk_Click(object sender, EventArgs e)
 {
     try
     {
         if (btnOk.Text == "OK")
         {
             id = dgvPatient.CurrentRow.Cells["colid"].Value.ToString();
             string name = dgvPatient.CurrentRow.Cells["coldoctName"].Value.ToString();
             string dtb  = mdl.Get_DoctorId(name);
             drctId = dtb.ToString();
             if (id != "")
             {
                 var form2 = new Patient_Profile_Details();
                 form2.patient_id = id;
                 form2.doctor_id  = drctId;
                 form2.MdiParent  = this.MdiParent;
                 form2.Show();
                 form2.Closed += (sender1, args) => this.Close();
                 this.Close();
                 bool SetFlag = true;
                 var  form1   = new Add_New_Patients(SetFlag);
             }
         }
     }
     catch (Exception ex)
     {
     }
 }
        private void listpatientsearch_MouseClick(object sender, MouseEventArgs e)
        {
            var form2 = new Patient_Profile_Details();

            form2.doctor_id           = doctor_id;
            form2.patient_id          = listpatientsearch.SelectedValue.ToString();
            listpatientsearch.Visible = false;
            form2.Closed += (sender1, args) => this.Close();
            form2.Show();
        }
示例#3
0
        private void labelprofile_Click(object sender, EventArgs e)
        {
            var form2 = new Patient_Profile_Details();

            form2.doctor_id  = doctor_id;
            form2.patient_id = patient_id;
            form2.Closed    += (sender1, args) => this.Close();
            this.Hide();
            form2.Show();
        }
        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);
            }
        }
示例#5
0
 private void btnSavePatient_Click(object sender, EventArgs e)
 {
     try
     {
         if (RBtnMale.Checked == true)
         {
             gender = RBtnMale.Text;
         }
         else
         {
             gender = RBtnFemale.Text;
         }
         int i = 0;
         if (String.IsNullOrWhiteSpace(txtPatientName.Text))
         {
             MessageBox.Show("Please enter Patient Name", "Empty Field", MessageBoxButtons.OK, MessageBoxIcon.Information);
         }
         else
         {
             if (txtPrimaryMobNbr.Text != "")
             {
                 i = this.cntrl.update(txtPatientName.Text, txtPatientId.Text, txtAdhaarId.Text, gender, txtAge.Text, DateTimePickerDob.Value.ToString("yyyy-MM-dd"), cmbBloodGroup.Text, txtAccompaniedBy.Text, txtPrimaryMobNbr.Text, txtSecondaryMobNbr.Text, txtLandLineNbr.Text, txtEmail.Text, txtStreetAddress.Text, txtLocality.Text, txtCity.Text, txtPin.Text, txtReferredBy.Text, txtFileNo.Text, DateTimePickerAdmitDate.Value.ToString("yyyy/MM/dd"), txtOccupation.Text, cmbDoctorName.Text, txtnationality.Text, txtpassport.Text, patient_id);
                 if (i > 0)
                 {
                     this.cntrl.save_log(doctor_id, "Patient", "logged user edits patient", "Edit");
                     if (pictureBox_PatientPhoto.Image == null)
                     {
                         pictureBox_PatientPhoto.Image = PappyjoeMVC.Properties.Resources.nophoto;
                         txtPic.Text = "";
                     }
                     this.cntrl.delete_pt_medhistory(patient_id);
                     for (int q = 0; q < grmedical.Rows.Count; q++)
                     {
                         if (Convert.ToBoolean(grmedical.Rows[q].Cells[1].Value) == true)
                         {
                             this.cntrl.insert_pt_medhistory(patient_id, grmedical.Rows[q].Cells[0].Value.ToString());
                         }
                     }
                     ///////update pt_group ////////
                     this.cntrl.delete_pt_group(patient_id);
                     for (int d = 0; d < dgvgroup.Rows.Count; d++)
                     {
                         if (Convert.ToBoolean(dgvgroup.Rows[d].Cells[1].Value) == true)
                         {
                             this.cntrl.insert_pt_group(patient_id, dgvgroup.Rows[d].Cells[0].Value.ToString());
                         }
                     }
                     if (path != "")
                     {
                         try
                         {
                             if (File.Exists(@"\\" + this.cntrl.getserver() + "\\Pappyjoe_utilities\\patient_image\\" + patient_id))
                             {
                             }
                             else
                             {
                                 System.IO.File.Copy(path, @"\\" + this.cntrl.getserver() + "\\Pappyjoe_utilities\\patient_image\\" + patient_id);
                             }
                         }
                         catch { }
                     }
                     var form2 = new Patient_Profile_Details();
                     form2.doctor_id  = doctor_id;
                     form2.patient_id = patient_id;
                     form2.Closed    += (sender1, args) => this.Close();
                     this.Hide();
                     form2.Show();
                 }
                 else
                 {
                     MessageBox.Show("Updation Failed !!!....", "Failed", MessageBoxButtons.OK, MessageBoxIcon.Error);
                 }
             }
             else
             {
                 MessageBox.Show("Enter valid Mobile Number", "Invalid", MessageBoxButtons.OK, MessageBoxIcon.Error);
             }
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }