//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();
        }
        public DataSet SelectByPhysicianID(PhysicianPrescriptionTemplateModel oClass)
        {
            strSql = "SELECT * " +
                     "FROM " + TABLE_NAME + " " +
                     "WHERE " + COLUMN_PHYSICIAN_ID + " = '" + oClass.PhysicianID + "' ";

            return(Select(strSql));
        }
        public void UpdateData(string user, PhysicianPrescriptionTemplateModel oClass)
        {
            strSql = "UPDATE " + TABLE_NAME + " SET " +
                     COLUMN_DOSAGE + " = '" + oClass.Dosage.Replace("'", "") + "', " +
                     " updated_by = '" + user + "', " +
                     " updated_date = '" + DateTime.Now.ToString("yyyy-MM-d HH:MM:ss") + "' " +
                     " WHERE " + COLUMN_ID + " = '" + oClass.ID + "' ";

            SaveData(strSql);
        }
        public DataSet SeachData(PhysicianPrescriptionTemplateModel oClass)
        {
            string dosage = oClass.Dosage;

            strSql = "SELECT * " +
                     "FROM " + TABLE_NAME + " " +
                     "WHERE " + COLUMN_ID + " = '" + oClass.ID + "' ";

            if (dosage != "")
            {
                strSql = strSql + "AND B" + COLUMN_DOSAGE + " like '%" + dosage + "%' ";
            }


            return(Select(strSql));
        }
        public void InsertData(string currUser, PhysicianPrescriptionTemplateModel oClass)
        {
            strSql = strSql + "INSERT INTO " + TABLE_NAME + " (" +
                     COLUMN_PHYSICIAN_ID + ", " +
                     COLUMN_DOSAGE + ", " +
                     "created_by, created_date, updated_by, updated_date) ";
            strSql = strSql + "values ('" +
                     oClass.PhysicianID + "', '" +
                     oClass.Dosage.Replace("'", "") + "', '" +
                     currUser + "', " +
                     "CurDate(), '" +
                     currUser + "', " +
                     "CurDate() " +
                     ") ";

            SaveData(strSql);
        }
        private void LoadPrescriptionFavorite(int PhysicianID)
        {
            var prescriptionFavoriteModel = new PhysicianPrescriptionTemplateModel();
            var prescriptionFavoriteDAl   = new PhysicianPrescriptionTemplateDAL();

            oDs = new DataSet();

            prescriptionFavoriteModel.PhysicianID = PhysicianID;
            oDs = prescriptionFavoriteDAl.SelectByPhysicianID(prescriptionFavoriteModel);

            var dosageTable = new DataTable();

            dosageTable.Columns.Add("Dosage");
            var dosageRow = dosageTable.NewRow();

            dosageRow[0] = "--Select Favorite--";
            dosageTable.Rows.Add(dosageRow);

            if (oDs != null)
            {
                if (oDs.Tables[0].Rows.Count > 0)
                {
                    for (int i = 0; i <= oDs.Tables[0].Rows.Count - 1; i++)
                    {
                        var dosageFavorite = dosageTable.NewRow();
                        dosageFavorite[0] = oDs.Tables[0].Rows[i]["dosage"].ToString();
                        dosageTable.Rows.Add(dosageFavorite);
                    }
                }
            }

            ddlPrescriptionTemplate.DataSource     = dosageTable;
            ddlPrescriptionTemplate.DataTextField  = "dosage";
            ddlPrescriptionTemplate.DataValueField = "dosage";
            ddlPrescriptionTemplate.DataBind();
        }