Example #1
0
    protected void LinkButton2_Click(object sender, EventArgs e)
    {
        string oldAppointmentDate = Request.QueryString["Date"].ToString();
        string newAppointmentDate = TextBox1.Text;
        string newAppointmentTime = TextBox2.Text;

        SMS.APIType    = SMSGateway.Site2SMS;
        SMS.MashapeKey = "qsdptI9i8PmshCC3BzZtyTTZVMtqp1CKzOYjsnHn0tfnCt11sT";
        SMS.Username   = "******";
        SMS.Password   = "******";
        string appointmentToken = Session["appointmentToken"].ToString();

        GetDoctorNameByAppointmentTokenBL objGetDoctorNameByAppointmentTokenBL = new GetDoctorNameByAppointmentTokenBL();
        string doctorName = objGetDoctorNameByAppointmentTokenBL.GetDoctorNameByAppointmentToken(appointmentToken);

        DataSet ds = new DataSet();
        GetPatientInfoByAppointmentTokenBL objGetPatientInfoByAppointmentTokenBL = new GetPatientInfoByAppointmentTokenBL();

        ds = objGetPatientInfoByAppointmentTokenBL.GetPatientInfoByAppointmentToken(appointmentToken);
        string patientPrimaryPhone = ds.Tables[0].Rows[0]["PATIENT_PRIMARY_PHONE"].ToString();

        Common_GetSMSTemplateBL objGetSMSTemplateBL = new Common_GetSMSTemplateBL();
        string SMStemplate = objGetSMSTemplateBL.Common_GetSMSTemplate(1);
        var    regex       = new Regex(Regex.Escape("#"));
        string SMSMessage  = regex.Replace(SMStemplate, doctorName, 1);

        SMSMessage = regex.Replace(SMSMessage, oldAppointmentDate, 2);
        SMSMessage = regex.Replace(SMSMessage, newAppointmentDate, 3);
        SMSMessage = regex.Replace(SMSMessage, newAppointmentTime, 4);
        SMS.SendSms(patientPrimaryPhone, SMSMessage);
    }
 protected void Button3_Click(object sender, EventArgs e)
 {
     appointmentToken = TextBox7.Text;
     reset();
     GetPatientInfoByAppointmentTokenBL objGetPatientInfoByAppointmentTokenBL = new GetPatientInfoByAppointmentTokenBL();
     ds = objGetPatientInfoByAppointmentTokenBL.GetPatientInfoByAppointmentToken(appointmentToken);
     if(ds.Tables[0].Rows.Count != 0)
     {
         Panel1.Visible = true;
         patientId = Convert.ToInt32(ds.Tables[0].Rows[0]["ID"].ToString());
         Label2.Text = ds.Tables[0].Rows[0]["PATIENT_NAME"].ToString();
         Label3.Text = ds.Tables[0].Rows[0]["PATIENT_DOB"].ToString();
         Label4.Text = ds.Tables[0].Rows[0]["PATIENT_PRIMARY_PHONE"].ToString();
         appointmentDate = ds.Tables[0].Rows[0]["APPOINTMENT_DATE"].ToString();
         appointmentTime = ds.Tables[0].Rows[0]["APPOINTMENT_TIME"].ToString();
         DateTime dt = Convert.ToDateTime(appointmentDate);
         if(dt == DateTime.Now.Date)
         {
             Label5.Text = "";
             Panel2.Visible = true;
             Panel3.Visible = true;
             Panel4.Visible = false;
             LinkButton2.Visible = false;
             GetPatientAppointmentHistoryBL objGetPatientAppointmentHistoryBL = new GetPatientAppointmentHistoryBL();
             ds1 = objGetPatientAppointmentHistoryBL.GetPatientAppointmentHistory(patientId);
             GridView1.DataSource = ds1;
             GridView1.DataBind();
             Doctor_GetOPDTreatmentAllMedicinesBL objGetOPDTreatmentAllMedicinesBL = new Doctor_GetOPDTreatmentAllMedicinesBL();
             ds2 = objGetOPDTreatmentAllMedicinesBL.Doctor_GetOPDTreatmentAllMedicines(patientId);
             GridView2.DataSource = ds2;
             GridView2.DataBind();
             GridView3.DataSource = null;
             GridView3.DataBind();
         }
         else
         {
             Panel2.Visible = false;
             Panel3.Visible = true;
             Panel4.Visible = false;
             LinkButton2.Visible = false;
             Label5.Text = "Patient Does Not Have Appointment Today";
             Label5.ForeColor = System.Drawing.Color.Red;
             Label5.BackColor = System.Drawing.Color.Yellow;
             GetPatientAppointmentHistoryBL objGetPatientAppointmentHistoryBL = new GetPatientAppointmentHistoryBL();
             ds1 = objGetPatientAppointmentHistoryBL.GetPatientAppointmentHistory(patientId);
             GridView1.DataSource = ds1;
             GridView1.DataBind();
             Doctor_GetOPDTreatmentAllMedicinesBL objGetOPDTreatmentAllMedicinesBL = new Doctor_GetOPDTreatmentAllMedicinesBL();
             ds2 = objGetOPDTreatmentAllMedicinesBL.Doctor_GetOPDTreatmentAllMedicines(patientId);
             GridView2.DataSource = ds2;
             GridView2.DataBind();
             GridView3.DataSource = null;
             GridView3.DataBind();
         }
     }
     else
     {
         Panel1.Visible = false;
         Panel2.Visible = false;
         Panel3.Visible = false;
         Panel4.Visible = false;
         LinkButton2.Visible = false;
         Label5.Text = "No Patient Found";
         Label5.ForeColor = System.Drawing.Color.Red;
     }
 }
    protected void LinkButton2_Click(object sender, EventArgs e)
    {
        string oldAppointmentDate = Request.QueryString["Date"].ToString();
        string newAppointmentDate = TextBox1.Text;
        string newAppointmentTime = TextBox2.Text;

        SMS.APIType = SMSGateway.Site2SMS;
        SMS.MashapeKey = "qsdptI9i8PmshCC3BzZtyTTZVMtqp1CKzOYjsnHn0tfnCt11sT";
        SMS.Username = "******";
        SMS.Password = "******";
        string appointmentToken = Session["appointmentToken"].ToString();

        GetDoctorNameByAppointmentTokenBL objGetDoctorNameByAppointmentTokenBL = new GetDoctorNameByAppointmentTokenBL();
        string doctorName = objGetDoctorNameByAppointmentTokenBL.GetDoctorNameByAppointmentToken(appointmentToken);

        DataSet ds = new DataSet();
        GetPatientInfoByAppointmentTokenBL objGetPatientInfoByAppointmentTokenBL = new GetPatientInfoByAppointmentTokenBL();
        ds = objGetPatientInfoByAppointmentTokenBL.GetPatientInfoByAppointmentToken(appointmentToken);
        string patientPrimaryPhone = ds.Tables[0].Rows[0]["PATIENT_PRIMARY_PHONE"].ToString();

        Common_GetSMSTemplateBL objGetSMSTemplateBL = new Common_GetSMSTemplateBL();
        string SMStemplate = objGetSMSTemplateBL.Common_GetSMSTemplate(1);
        var regex = new Regex(Regex.Escape("#"));
        string SMSMessage = regex.Replace(SMStemplate, doctorName, 1);
        SMSMessage = regex.Replace(SMSMessage, oldAppointmentDate, 2);
        SMSMessage = regex.Replace(SMSMessage, newAppointmentDate, 3);
        SMSMessage = regex.Replace(SMSMessage, newAppointmentTime, 4);
        SMS.SendSms(patientPrimaryPhone, SMSMessage);
    }
    protected void Button3_Click(object sender, EventArgs e)
    {
        appointmentToken = TextBox7.Text;
        reset();
        GetPatientInfoByAppointmentTokenBL objGetPatientInfoByAppointmentTokenBL = new GetPatientInfoByAppointmentTokenBL();

        ds = objGetPatientInfoByAppointmentTokenBL.GetPatientInfoByAppointmentToken(appointmentToken);
        if (ds.Tables[0].Rows.Count != 0)
        {
            Panel1.Visible  = true;
            patientId       = Convert.ToInt32(ds.Tables[0].Rows[0]["ID"].ToString());
            Label2.Text     = ds.Tables[0].Rows[0]["PATIENT_NAME"].ToString();
            Label3.Text     = ds.Tables[0].Rows[0]["PATIENT_DOB"].ToString();
            Label4.Text     = ds.Tables[0].Rows[0]["PATIENT_PRIMARY_PHONE"].ToString();
            appointmentDate = ds.Tables[0].Rows[0]["APPOINTMENT_DATE"].ToString();
            appointmentTime = ds.Tables[0].Rows[0]["APPOINTMENT_TIME"].ToString();
            DateTime dt = Convert.ToDateTime(appointmentDate);
            if (dt == DateTime.Now.Date)
            {
                Label5.Text         = "";
                Panel2.Visible      = true;
                Panel3.Visible      = true;
                Panel4.Visible      = false;
                LinkButton2.Visible = false;
                GetPatientAppointmentHistoryBL objGetPatientAppointmentHistoryBL = new GetPatientAppointmentHistoryBL();
                ds1 = objGetPatientAppointmentHistoryBL.GetPatientAppointmentHistory(patientId);
                GridView1.DataSource = ds1;
                GridView1.DataBind();
                Doctor_GetOPDTreatmentAllMedicinesBL objGetOPDTreatmentAllMedicinesBL = new Doctor_GetOPDTreatmentAllMedicinesBL();
                ds2 = objGetOPDTreatmentAllMedicinesBL.Doctor_GetOPDTreatmentAllMedicines(patientId);
                GridView2.DataSource = ds2;
                GridView2.DataBind();
                GridView3.DataSource = null;
                GridView3.DataBind();
            }
            else
            {
                Panel2.Visible      = false;
                Panel3.Visible      = true;
                Panel4.Visible      = false;
                LinkButton2.Visible = false;
                Label5.Text         = "Patient Does Not Have Appointment Today";
                Label5.ForeColor    = System.Drawing.Color.Red;
                Label5.BackColor    = System.Drawing.Color.Yellow;
                GetPatientAppointmentHistoryBL objGetPatientAppointmentHistoryBL = new GetPatientAppointmentHistoryBL();
                ds1 = objGetPatientAppointmentHistoryBL.GetPatientAppointmentHistory(patientId);
                GridView1.DataSource = ds1;
                GridView1.DataBind();
                Doctor_GetOPDTreatmentAllMedicinesBL objGetOPDTreatmentAllMedicinesBL = new Doctor_GetOPDTreatmentAllMedicinesBL();
                ds2 = objGetOPDTreatmentAllMedicinesBL.Doctor_GetOPDTreatmentAllMedicines(patientId);
                GridView2.DataSource = ds2;
                GridView2.DataBind();
                GridView3.DataSource = null;
                GridView3.DataBind();
            }
        }
        else
        {
            Panel1.Visible      = false;
            Panel2.Visible      = false;
            Panel3.Visible      = false;
            Panel4.Visible      = false;
            LinkButton2.Visible = false;
            Label5.Text         = "No Patient Found";
            Label5.ForeColor    = System.Drawing.Color.Red;
        }
    }