//protected void DeleteProcedure_ServerClick(object sender, EventArgs e)
        //{
        //    string UserName = Session["User"].ToString();
        //    int ID = Convert.ToInt32(HiddenFieldPatientProcedure.Value);

        //    PatientProcedureDAL oProcedureDAL = new PatientProcedureDAL();
        //    PatientProcedureModel oProcedureClass = new PatientProcedureModel();

        //    oProcedureClass.IsDeleted = true;
        //    oProcedureClass.ReasonDelete = deleteCPTReason.InnerText;
        //    string lbl = lblPatientProcedure.Text;
        //    oProcedureClass.ID = ID;
        //    oProcedureDAL.DeleteData(UserName, oProcedureClass);

        //    PopulateOrders(EncounterNo.Value);
        //}

        protected void AddMedication_ServerClick(object sender, EventArgs e)
        {
            string sUserName = Session["User"].ToString();

            PatientMedicationDAL   oMedicationDAL   = new PatientMedicationDAL();
            PatientMedicationModel oMedicationClass = new PatientMedicationModel();

            oMedicationClass.EncounterNo = EncounterNo.Value;
            oMedicationClass.PatientNo   = PatientNo.Value;
            oMedicationClass.CaseNo      = "";
            oMedicationClass.Code        = medsList.SelectedValue;     //txtMedCode.Value;
            oMedicationClass.Description = medsList.SelectedItem.Text; //txtMedDescription.Value;
            oMedicationClass.Dosage      = Prescription.Value;         //txtMedDose.Value;
            oMedicationClass.PatientNo   = PatientNo.Value;
            oMedicationClass.StartDate   = DateTime.Now;
            oMedicationClass.Notes       = "";
            oMedicationDAL.InsertData(sUserName, oMedicationClass);

            if (cbFavorite.Checked == true)
            {
                var medFavoriteModel = new PhysicianPrescriptionTemplateModel();
                var medFavoriteDal   = new PhysicianPrescriptionTemplateDAL();

                medFavoriteModel.PhysicianID = Convert.ToInt16(PhysicianID.Value);
                medFavoriteModel.Dosage      = Prescription.Value;
                medFavoriteDal.InsertData(sUserName, medFavoriteModel);
                LoadPrescriptionFavorite(Convert.ToInt16(PhysicianID.Value));
            }

            PopulateMeds(EncounterNo.Value);
            ClearEntry();
        }
        private void PopulateMeds(string encounterNo)
        {
            PatientMedicationDAL   medsDAL   = new PatientMedicationDAL();
            PatientMedicationModel medsModel = new PatientMedicationModel();

            oDs = new DataSet();
            medsModel.EncounterNo = encounterNo;
            oDs = medsDAL.SelectByEncounterNo(medsModel);
            gvPrescription.DataSource = oDs.Tables[0];
            gvPrescription.DataBind();
        }
        protected void DeleteMedication_ServerClick(object sender, EventArgs e)
        {
            string UserName = Session["User"].ToString();
            int    ID       = Convert.ToInt32(HiddenFieldPatientMedication.Value);

            PatientMedicationDAL   oMedicationDAL   = new PatientMedicationDAL();
            PatientMedicationModel oMedicationClass = new PatientMedicationModel();

            oMedicationClass.IsDeleted    = true;
            oMedicationClass.ReasonDelete = deleteMedicationReason.InnerText;
            string lbl = lblPatientMedication.Text;

            oMedicationClass.ID = ID;
            oMedicationDAL.DeleteData(UserName, oMedicationClass);

            PopulateMeds(EncounterNo.Value);
        }
        private void PopulateMedication(string caseNo)
        {
            PatientMedicationDAL   medsDAL   = new PatientMedicationDAL();
            PatientMedicationModel medsModel = new PatientMedicationModel();

            oDs = new DataSet();

            medsModel.CaseNo    = caseNo;
            medsModel.PatientNo = PatientNo.Value;
            oDs = medsDAL.SeachData(medsModel);

            if (oDs != null)
            {
                gvMedications.DataSource = oDs.Tables[0];
                gvMedications.DataBind();
            }
        }
        protected void AddMedication_ServerClick(object sender, EventArgs e)
        {
            string sUserName = Session["User"].ToString();

            PatientMedicationDAL   oMedicationDAL   = new PatientMedicationDAL();
            PatientMedicationModel oMedicationClass = new PatientMedicationModel();

            oMedicationClass.CaseNo      = RefNo.Value;
            oMedicationClass.Code        = txtMedCode.Value;
            oMedicationClass.Description = txtMedDescription.Value;
            oMedicationClass.Dosage      = txtMedDose.Value;
            oMedicationClass.PatientNo   = PatientNo.Value;
            oMedicationClass.StartDate   = DateTime.Now;
            oMedicationClass.Notes       = "";
            oMedicationDAL.InsertData(sUserName, oMedicationClass);

            PopulateMedication(RefNo.Value);
        }
        private void PopulateMeds(string encounterNo)
        {
            lblMeds.Text = "";
            PatientMedicationDAL   medsDAL   = new PatientMedicationDAL();
            PatientMedicationModel medsModel = new PatientMedicationModel();
            var oDs = new DataSet();

            medsModel.EncounterNo = encounterNo;
            oDs = medsDAL.SelectByEncounterNo(medsModel);
            if (oDs != null)
            {
                if (oDs.Tables[0].Rows.Count > 0)
                {
                    for (int i = 0; i <= oDs.Tables[0].Rows.Count - 1; i++)
                    {
                        lblMeds.Text = lblMeds.Text + "<br>" + oDs.Tables[0].Rows[i]["description"].ToString() + "  -  " + oDs.Tables[0].Rows[i]["dosage"].ToString() + "<br>";
                    }
                }
            }
        }