protected void btnSave_Click(object sender, EventArgs e) { if (((DataTable)Session["GridData"]).Rows.Count < 1) { IQCareMsgBox.Show("PharmacyNoData", this); return; } int Ptn_pk = 0, ARTSponsorID, UserId, LocationID, DeleteFlag, Visit_pk; DateTime DateEffective; PatientClassificationMgr = (IPatientClassification)ObjectFactory.CreateInstance("BusinessProcess.Clinical.BPatientClassification, BusinessProcess.Clinical"); DataTable theDT = (DataTable)Session["GridData"]; foreach (DataRow theDR in theDT.Rows) { IQCareUtils theUtils = new IQCareUtils(); Ptn_pk = Convert.ToInt32(Session["Ptn_Pk"]); ARTSponsorID = Convert.ToInt32(theDR["ARTSponsorID"]); UserId = Convert.ToInt32(Session["AppUserId"]); LocationID = Convert.ToInt32(Session["AppLocationId"]); DeleteFlag = 0; DateEffective = Convert.ToDateTime(theDR["VisitDate"]); Visit_pk = Convert.ToInt32(theDR["Visit_pk"]); PatientClassificationMgr.SaveUpdatePatientClassification(Ptn_pk, LocationID, Visit_pk, ARTSponsorID, UserId, DateEffective, DeleteFlag); DataSet theDS = PatientClassificationMgr.GetAllPatientClassificationData(Convert.ToInt32(Session["Ptn_Pk"])); Session["GridData"] = theDS.Tables[0]; theDT = (DataTable)Session["GridData"]; } ClearSession(); SaveCancel(); }
private void GetAllData() { PatientClassificationMgr = (IPatientClassification)ObjectFactory.CreateInstance("BusinessProcess.Clinical.BPatientClassification, BusinessProcess.Clinical"); if (Session["Ptn_Pk"].ToString() != "0") { DataSet theDS = PatientClassificationMgr.GetAllPatientClassificationData(Convert.ToInt32(Session["Ptn_Pk"])); DataTable theDT = theDS.Tables[0].Copy(); DataColumn[] thePKey = new DataColumn[3]; thePKey.SetValue(theDT.Columns["Ptn_PK"], 0); thePKey.SetValue(theDT.Columns["ARTSponsorId"], 1); thePKey.SetValue(theDT.Columns["VisitDate"], 2); theDT.PrimaryKey = thePKey; Session["GridData"] = theDT; /// theDS.Tables[0]; grdPClassification.DataSource = (DataTable)Session["GridData"]; BindGrid(); } }