protected void Page_Load(object sender, EventArgs e)
    {
        if(!IsPostBack)
        {
            string appointmentToken = Request.QueryString["appointmenttoken"].ToString();
            Common_EncryptDecryptBL objCommon_EncryptDecryptBL = new Common_EncryptDecryptBL();
            appointmentToken = objCommon_EncryptDecryptBL.Decrypt(appointmentToken);
            Doctor_GetAppointmentDetailsByAppointmentTokenBL objDoctor_GetAppointmentDetailsByAppointmentTokenBL=new Doctor_GetAppointmentDetailsByAppointmentTokenBL();
            ds = objDoctor_GetAppointmentDetailsByAppointmentTokenBL.Doctor_GetAppointmentDetailsByAppointmentToken(appointmentToken);
            Label1.Text = appointmentToken;
            Label2.Text = ds.Tables[0].Rows[0]["APPOINTMENT_DATE"].ToString();
            Label3.Text = ds.Tables[0].Rows[0]["APPOINTMENT_TIME"].ToString();
            int patientId = Convert.ToInt32(ds.Tables[0].Rows[0]["PATIENT_ID_FK"].ToString());

            Doctor_GetOPDTreatmentMedicineBL objGetOPDTreatmentMedicineBL = new Doctor_GetOPDTreatmentMedicineBL();
            ds = objGetOPDTreatmentMedicineBL.Doctor_GetOPDTreatmentMedicine(appointmentToken);
            if(ds.Tables[0].Rows.Count == 0)
                Label4.Visible = true;
            else
            {
                GridView1.DataSource = ds;
                GridView1.DataBind();
                Label4.Visible = false;
            }
        }
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            string appointmentToken = Request.QueryString["appointmenttoken"].ToString();
            Common_EncryptDecryptBL objCommon_EncryptDecryptBL = new Common_EncryptDecryptBL();
            appointmentToken = objCommon_EncryptDecryptBL.Decrypt(appointmentToken);
            Doctor_GetAppointmentDetailsByAppointmentTokenBL objDoctor_GetAppointmentDetailsByAppointmentTokenBL = new Doctor_GetAppointmentDetailsByAppointmentTokenBL();
            ds          = objDoctor_GetAppointmentDetailsByAppointmentTokenBL.Doctor_GetAppointmentDetailsByAppointmentToken(appointmentToken);
            Label1.Text = appointmentToken;
            Label2.Text = ds.Tables[0].Rows[0]["APPOINTMENT_DATE"].ToString();
            Label3.Text = ds.Tables[0].Rows[0]["APPOINTMENT_TIME"].ToString();
            int patientId = Convert.ToInt32(ds.Tables[0].Rows[0]["PATIENT_ID_FK"].ToString());

            Doctor_GetOPDTreatmentMedicineBL objGetOPDTreatmentMedicineBL = new Doctor_GetOPDTreatmentMedicineBL();
            ds = objGetOPDTreatmentMedicineBL.Doctor_GetOPDTreatmentMedicine(appointmentToken);
            if (ds.Tables[0].Rows.Count == 0)
            {
                Label4.Visible = true;
            }
            else
            {
                GridView1.DataSource = ds;
                GridView1.DataBind();
                Label4.Visible = false;
            }
        }
    }
    protected void Button1_Click(object sender, EventArgs e)
    {
        int medicineTypeId = Convert.ToInt32(DropDownList1.SelectedValue);
        int medicineNameId = Convert.ToInt32(DropDownList2.SelectedValue);
        string medicineStrength = TextBox1.Text;
        string medicineQuantity = TextBox4.Text;
        string medicineStartDate = DateTime.ParseExact(TextBox5.Text, "dd/MM/yyyy", System.Globalization.CultureInfo.InvariantCulture).ToString();
        int numberOfRefills = Convert.ToInt32(TextBox2.Text);
        string quantityOnRefills = TextBox6.Text;
        string medicineInstructions = TextBox3.Text;

        Doctor_OPDTreatmentMedicineBO objOPDTreatmentMedicineBO = new Doctor_OPDTreatmentMedicineBO();
        objOPDTreatmentMedicineBO.medicineInstructions = medicineInstructions;
        objOPDTreatmentMedicineBO.medicineType = DropDownList1.SelectedItem.Text;
        objOPDTreatmentMedicineBO.medicineName = DropDownList2.SelectedItem.Text;
        objOPDTreatmentMedicineBO.medicineStrength = TextBox1.Text;
        objOPDTreatmentMedicineBO.medicineQuantity = TextBox4.Text;
        objOPDTreatmentMedicineBO.medicineStartDate = TextBox5.Text;
        objOPDTreatmentMedicineBO.numberOfRefills = Convert.ToInt32(TextBox2.Text);
        objOPDTreatmentMedicineBO.quantityOnRefills = TextBox6.Text;
        objOPDTreatmentMedicineBO.medicineInstructions = TextBox3.Text;

        objOPDTreatmentMedicineBOList.Add(objOPDTreatmentMedicineBO);

        Doctor_AddOPDTreatmentMedicineBL objAddOPDTreatmentMedicineBL = new Doctor_AddOPDTreatmentMedicineBL();
        objAddOPDTreatmentMedicineBL.Doctor_AddOPDTreatmentMedicine(appointmentToken, medicineTypeId,
            medicineNameId, medicineStrength, medicineQuantity, medicineStartDate, numberOfRefills,
            quantityOnRefills, medicineInstructions);

        Doctor_GetOPDTreatmentMedicineBL objGetOPDTreatmentMedicineBL = new Doctor_GetOPDTreatmentMedicineBL();
        GridView3.DataSource = objGetOPDTreatmentMedicineBL.Doctor_GetOPDTreatmentMedicine(appointmentToken);
        GridView3.DataBind();
        Panel4.Visible = true;
        LinkButton2.Visible = false;
    }
    protected void LinkButton1_Click(object sender, EventArgs e)
    {
        LinkButton  linkbutton          = sender as LinkButton;
        GridViewRow row                 = linkbutton.NamingContainer as GridViewRow;
        int         treatmentMedicineId = Convert.ToInt32(GridView3.DataKeys[row.RowIndex].Value.ToString());

        Doctor_DeleteOPDTreatmentMedicineDL objDeleteTreatmentMedicineBL = new Doctor_DeleteOPDTreatmentMedicineDL();

        objDeleteTreatmentMedicineBL.Doctor_DeleteOPDTreatmentMedicine(treatmentMedicineId);

        Doctor_GetOPDTreatmentMedicineBL objGetOPDTreatmentMedicineBL = new Doctor_GetOPDTreatmentMedicineBL();

        GridView3.DataSource = objGetOPDTreatmentMedicineBL.Doctor_GetOPDTreatmentMedicine(appointmentToken);
        GridView3.DataBind();
    }
    protected void Button1_Click(object sender, EventArgs e)
    {
        int    medicineTypeId       = Convert.ToInt32(DropDownList1.SelectedValue);
        int    medicineNameId       = Convert.ToInt32(DropDownList2.SelectedValue);
        string medicineStrength     = TextBox1.Text;
        string medicineQuantity     = TextBox4.Text;
        string medicineStartDate    = DateTime.ParseExact(TextBox5.Text, "dd/MM/yyyy", System.Globalization.CultureInfo.InvariantCulture).ToString();
        int    numberOfRefills      = Convert.ToInt32(TextBox2.Text);
        string quantityOnRefills    = TextBox6.Text;
        string medicineInstructions = TextBox3.Text;

        Doctor_OPDTreatmentMedicineBO objOPDTreatmentMedicineBO = new Doctor_OPDTreatmentMedicineBO();

        objOPDTreatmentMedicineBO.medicineInstructions = medicineInstructions;
        objOPDTreatmentMedicineBO.medicineType         = DropDownList1.SelectedItem.Text;
        objOPDTreatmentMedicineBO.medicineName         = DropDownList2.SelectedItem.Text;
        objOPDTreatmentMedicineBO.medicineStrength     = TextBox1.Text;
        objOPDTreatmentMedicineBO.medicineQuantity     = TextBox4.Text;
        objOPDTreatmentMedicineBO.medicineStartDate    = TextBox5.Text;
        objOPDTreatmentMedicineBO.numberOfRefills      = Convert.ToInt32(TextBox2.Text);
        objOPDTreatmentMedicineBO.quantityOnRefills    = TextBox6.Text;
        objOPDTreatmentMedicineBO.medicineInstructions = TextBox3.Text;

        objOPDTreatmentMedicineBOList.Add(objOPDTreatmentMedicineBO);

        Doctor_AddOPDTreatmentMedicineBL objAddOPDTreatmentMedicineBL = new Doctor_AddOPDTreatmentMedicineBL();

        objAddOPDTreatmentMedicineBL.Doctor_AddOPDTreatmentMedicine(appointmentToken, medicineTypeId,
                                                                    medicineNameId, medicineStrength, medicineQuantity, medicineStartDate, numberOfRefills,
                                                                    quantityOnRefills, medicineInstructions);

        Doctor_GetOPDTreatmentMedicineBL objGetOPDTreatmentMedicineBL = new Doctor_GetOPDTreatmentMedicineBL();

        GridView3.DataSource = objGetOPDTreatmentMedicineBL.Doctor_GetOPDTreatmentMedicine(appointmentToken);
        GridView3.DataBind();
        Panel4.Visible      = true;
        LinkButton2.Visible = false;
    }
    protected void LinkButton1_Click(object sender, EventArgs e)
    {
        LinkButton linkbutton = sender as LinkButton;
        GridViewRow row = linkbutton.NamingContainer as GridViewRow;
        int treatmentMedicineId = Convert.ToInt32(GridView3.DataKeys[row.RowIndex].Value.ToString());

        Doctor_DeleteOPDTreatmentMedicineDL objDeleteTreatmentMedicineBL = new Doctor_DeleteOPDTreatmentMedicineDL();
        objDeleteTreatmentMedicineBL.Doctor_DeleteOPDTreatmentMedicine(treatmentMedicineId);

        Doctor_GetOPDTreatmentMedicineBL objGetOPDTreatmentMedicineBL = new Doctor_GetOPDTreatmentMedicineBL();
        GridView3.DataSource = objGetOPDTreatmentMedicineBL.Doctor_GetOPDTreatmentMedicine(appointmentToken);
        GridView3.DataBind();
    }