Exemple #1
0
        public void AddToDataGrid(bool exist)
        {
            if (!exist)
            {
                TreatmentSave();
            }
            DataTable currentTable = (DataTable)ViewState["CurrentTable"];

            string mealTime;

            if (afterMealRadioButton.Checked)
            {
                mealTime = "After Meal";
            }
            else
            {
                mealTime = "Before Meal";
            }
            DataRow dr = currentTable.NewRow();

            dr["diseaseName"]  = diseaseDropDownList.SelectedItem.Text;
            dr["medicineName"] = medicineDropDownList.SelectedItem.Text;
            dr["dose"]         = doseTextBox.Text;
            dr["mealCheck"]    = mealTime;
            dr["quantity"]     = qtyGivenTextBox.Text;
            dr["note"]         = noteTextBox.Text;
            currentTable.Rows.Add(dr);
            ViewState["CurrentTable"] = currentTable;

            TreatmentGivenGridView.DataSource = currentTable;
            TreatmentGivenGridView.DataBind();
        }
Exemple #2
0
        public void LoadDataGridView()
        {
            DataTable dt = new DataTable();
            DataRow   dr = null;

            dt.Columns.Add(new DataColumn("diseaseName", typeof(string)));
            dt.Columns.Add(new DataColumn("medicineName", typeof(string)));
            dt.Columns.Add(new DataColumn("dose", typeof(string)));
            dt.Columns.Add(new DataColumn("mealCheck", typeof(string)));
            dt.Columns.Add(new DataColumn("quantity", typeof(string)));
            dt.Columns.Add(new DataColumn("note", typeof(string)));
            dr = dt.NewRow();
            dr["diseaseName"]  = string.Empty;
            dr["medicineName"] = string.Empty;
            dr["dose"]         = string.Empty;
            dr["mealCheck"]    = string.Empty;
            dr["quantity"]     = string.Empty;
            dr["note"]         = string.Empty;
            dt.Rows.Add(dr);
            ViewState["CurrentTable"]         = dt;
            TreatmentGivenGridView.DataSource = dt;
            TreatmentGivenGridView.DataBind();
            ViewState["SerialNo"] = 0;
            List <Prescription> treatmentList = new List <Prescription>();

            ViewState["TreatmentGiven"] = treatmentList;
        }