예제 #1
0
 public void getappointment(DataTable dt)
 {
     try
     {
         string dr_color = "0", dr_mobile = "0", dr_email = "";
         if (dt.Rows.Count > 0)
         {
             dr_color  = dt.Rows[0]["calendar_color"].ToString();
             name      = "Dr " + dt.Rows[0]["doctor_name"].ToString();
             dr_mobile = dt.Rows[0]["mobile_number"].ToString();
             dr_email  = dt.Rows[0]["email_id"].ToString();
         }
         Dateonly = Convert.ToDateTime(DateTime.Now.ToLocalTime());
         DateTime StartT, EndTime;
         StartT  = dpStartTimeDate.Value.Date;
         EndTime = dpStartTimeDate.Value.Date;
         StartT  = StartT.AddHours(cmbStartTime.SelectedIndex / 12);
         EndTime = EndTime.AddHours(cmbEndTime.SelectedIndex / 12);
         int md    = cmbStartTime.SelectedIndex % 12;
         int en_ms = cmbEndTime.SelectedIndex % 12;
         StartT1 = StartT.AddMinutes(md * 5);
         EndTime = EndTime.AddMinutes(en_ms * 5);
         var diff = EndTime.Subtract(StartT);
         diff1 = Convert.ToString(diff.Minutes);
         if (Dateonly > StartT)
         {
             MessageBox.Show("Appointment Date should be greater than Current Date...", "Appointment", MessageBoxButtons.OK, MessageBoxIcon.Information);
         }
         else
         {
             if (cmbStartTime.SelectedIndex <= cmbEndTime.SelectedIndex)
             {
                 if (appointment_id != "")
                 {
                     j = this.ctrlr.apntupdate(Convert.ToDateTime(StartT1).ToString("yyyy-MM-dd HH:mm"), diff1, txtDescription.Text, dr_id, compoprocedure.Text, name, appointment_id);
                     this.ctrlr.save_log(doctor_id, "Appointment", "logged user edits appointment", "Edit");
                 }
                 else
                 {
                     j = this.ctrlr.insappointment(Convert.ToDateTime(Dateonly).ToString("yyyy-MM-dd"), Convert.ToDateTime(StartT1).ToString("yyyy-MM-dd H:mm:ss"), diff1, txtDescription.Text, patient_id, linkLabel_Name.Text, dr_id, p_mobile, p_email, compoprocedure.Text, name);
                     this.ctrlr.save_log(doctor_id, "Appointment", "logged user adds new appointment", "Add");
                 }
                 if (checkBox1.Checked)
                 {
                     DataTable sms = this.ctrlr.smsdetails();
                     smsdetails(sms);
                     DataTable ptnt = this.ctrlr.Get_Patient_Details(patient_id);
                     Get_Patient_Details(ptnt);
                     DataTable rem = this.ctrlr.smsreminder();
                     smsreminder(rem);
                 }
                 if (checkBox3.Checked)
                 {
                     if (dr_mobile != "0")
                     {
                         string number = "91" + dr_mobile;
                         string type   = "LNG";
                         text = "You have an appointment on " + dpStartTimeDate.Value.ToShortDateString() + " " + cmbStartTime.Text + " With " + patient_name + " for " + compoprocedure.Text + " at " + clinicn + "," + contact_no;
                         string smsdctr = this.ctrlr.SendSMS(smsName, smsPass, number, text, type);
                         //For Remainder SMS
                         if (day_time != null)
                         {
                             if (dpStartTimeDate.Value > DateTime.Now.Date)
                             {
                                 text = "You have an appointment on " + dpStartTimeDate.Value.ToShortDateString() + " " + cmbStartTime.Text + " With " + patient_name + " for " + compoprocedure.Text + " at " + clinicn + "," + contact_no;
                                 string smsdctr2 = this.ctrlr.SendSMS(smsName, smsPass, number, text, "DRTOMS", patient_id.ToString(), StartT1.ToString("dd/MM/yyyy") + " 09:10:00 am", DateTime.Now.ToString("dd/MM/yyyy hh:mm:ss tt"));
                             }
                         }
                         if (before_time != null)
                         {
                             if (dpStartTimeDate.Value > DateTime.Now.Date)
                             {
                                 text = "You have an appointment on " + dpStartTimeDate.Value.ToShortDateString() + " " + cmbStartTime.Text + " With " + patient_name + " for " + compoprocedure.Text + " at " + clinicn + "," + contact_no;
                                 string smsdctr3 = this.ctrlr.SendSMS(smsName, smsPass, number, text, "DRTOMS", patient_id.ToString(), StartT1.ToString("dd/MM/yyyy") + before_time, DateTime.Now.ToString("dd/MM/yyyy hh:mm:ss tt"));
                             }
                         }
                     }
                 }//Doctor SMS End
                 if (checkBox2.Checked)
                 {
                     DataTable email = this.ctrlr.send_email();
                     send_email(email);
                 }// email end
                 if (checkBox4.Checked) // Doctor Email
                 {
                     if (dr_email != "")
                     {
                         DataTable email = this.ctrlr.send_email();
                         send_email(email);
                     }
                 }// Doctor Email end
                 if (j > 0)
                 {
                     var form2 = new PappyjoeMVC.View.Show_Appointment();
                     form2.patient_id = patient_id;
                     form2.doctor_id  = doctor_id;
                     form2.Closed    += (sender1, args) => this.Close();
                     this.Hide();
                     form2.Show();
                 }
                 else
                 {
                     MessageBox.Show("Inseration Failed!..", "Failed", MessageBoxButtons.OK, MessageBoxIcon.Error);
                 }
             }
             else
             {
                 MessageBox.Show("Appointment Time is incorrect,Please change the time", "Appointment", MessageBoxButtons.OK, MessageBoxIcon.Information);
             }
         }
     }
     catch (Exception ex)
     { MessageBox.Show(ex.Message, "Error !..", MessageBoxButtons.OK, MessageBoxIcon.Error); }
 }
예제 #2
0
 public void Get_Patient_Details(DataTable pat)
 {
     try
     {
         if (pat.Rows.Count > 0)
         {
             string number = "91" + pat.Rows[0]["primary_mobile_number"].ToString();
             string type   = "LNG";
             text = "Dear " + pat.Rows[0]["pt_name"].ToString() + " " + "Your appointment for " + compoprocedure.Text + " has been confirmed at " + StartT1.ToString("dd/MM/yyyy") + " " + cmbStartTime.Text + " with " + "Dr " + Cmb_doctor.Text + " Regards " + clinicn + "," + contact_no;
             string smspatnt = this.ctrlr.SendSMS(smsName, smsPass, number, text, type);
             string txt      = "Dear " + pat.Rows[0]["pt_name"].ToString() + " " + "Your appointment for " + compoprocedure.Text + " has been confirmed at " + StartT1.ToString("dd/MM/yyyy") + " " + cmbStartTime.Text + " with " + "Dr " + Cmb_doctor.Text + "Regards";
             this.ctrlr.inssms(patient_id, DateTime.Now.ToString("yyyy-MM-dd hh:mm"), txt);
             //For Remainder SMS
             if (day_time != null)
             {
                 if (dpStartTimeDate.Value > DateTime.Now.Date)
                 {
                     text = "Dear " + pat.Rows[0]["pt_name"].ToString() + ", " + "Today you have an appointment at " + clinicn + " on " + StartT1.ToString("dd/MM/yyyy") + " " + cmbStartTime.Text + " for " + compoprocedure.Text + " .Regards  " + clinicn + "," + contact_no;
                     string smspatnt2 = this.ctrlr.SendSMS(smsName, smsPass, number, text, "DRTOMS", patient_id.ToString(), StartT1.ToString("dd/MM/yyyy") + " 09:10:00 am", DateTime.Now.ToString("dd/MM/yyyy hh:mm:ss tt"));
                 }
             }
             if (before_time != null)
             {
                 if (dpStartTimeDate.Value > DateTime.Now.Date)
                 {
                     text = "Dear " + pat.Rows[0]["pt_name"].ToString() + ", " + "Today you have an appointment at " + clinicn + " on " + StartT1.ToString("dd/MM/yyyy") + " " + cmbStartTime.Text + " for " + compoprocedure.Text + " .Regards  " + clinicn + "," + contact_no;
                     string smspatnt3 = this.ctrlr.SendSMS(smsName, smsPass, number, text, "DRTOMS", patient_id.ToString(), StartT1.ToString("dd/MM/yyyy") + before_time, DateTime.Now.ToString("dd/MM/yyyy hh:mm:ss tt"));
                 }
             }
         }//SMS End Patient
     }
     catch (Exception ex)
     { MessageBox.Show("Error!..", ex.Message, MessageBoxButtons.OK, MessageBoxIcon.Error); }
 }