public DataSet GetProcedures(string Constr, string DBName) { lock (this) { try { //////Entity theObject = new Entity(); //////ClsUtility.Init_Hashtable(); //////ClsUtility.AddParameters("@dbname", SqlDbType.VarChar, DBName); //////return (DataSet)theObject.ReturnObject(Constr, ClsUtility.theParams, "pr_GetProcedureList", ClsDBUtility.ObjectEnum.DataSet); this.Connection = DataMgr.GetConnection(); this.Transaction = DataMgr.BeginTransaction(this.Connection); ClsObject objProcList = new ClsObject(); objProcList.Connection = this.Connection; objProcList.Transaction = this.Transaction; ClsUtility.Init_Hashtable(); ClsUtility.AddParameters("@dbname", SqlDbType.VarChar, DBName); return((DataSet)objProcList.ReturnObject(ClsUtility.theParams, "pr_GetProcedureList", ClsDBUtility.ObjectEnum.DataSet)); } catch { //theTran.Rollback(); DataMgr.RollBackTransation(this.Transaction); throw; //////throw ex; } finally { if (this.Connection != null) { DataMgr.ReleaseConnection(this.Connection); } } } }
public int StatusUpdate(Hashtable ht) { int RowsEffected = 0; try { this.Connection = DataMgr.GetConnection(); this.Transaction = DataMgr.BeginTransaction(this.Connection); ClsObject ModuleMgr = new ClsObject(); ModuleMgr.Connection = this.Connection; ModuleMgr.Transaction = this.Transaction; ClsUtility.Init_Hashtable(); ClsUtility.AddParameters("@ModuleId", SqlDbType.Int, ht["ModuleID"].ToString()); ClsUtility.AddParameters("@Status", SqlDbType.Int, ht["Status"].ToString()); ClsUtility.AddParameters("@DeleteFlag", SqlDbType.Int, ht["DeleteFlag"].ToString()); ClsUtility.AddParameters("@UserID", SqlDbType.Int, ht["UserID"].ToString()); RowsEffected = (Int32)ModuleMgr.ReturnObject(ClsUtility.theParams, "pr_FormBuilder_StatusUpdate_Constella", ClsUtility.ObjectEnum.ExecuteNonQuery); DataMgr.CommitTransaction(this.Transaction); DataMgr.ReleaseConnection(this.Connection); } catch { DataMgr.RollBackTransation(this.Transaction); throw; } finally { if (this.Connection != null) { DataMgr.ReleaseConnection(this.Connection); } } return(RowsEffected); }
public DataSet MarkOrderAsFullyDispensed(Int32 orderID, string Reason) { DataSet dataset = new DataSet(); try { this.Connection = DataMgr.GetConnection(); this.Transaction = DataMgr.BeginTransaction(this.Connection); ClsObject theManager = new ClsObject(); theManager.Connection = this.Connection; theManager.Transaction = this.Transaction; ClsUtility.Init_Hashtable(); ClsUtility.AddParameters("@ptn_pharmacy_pk", SqlDbType.Int, orderID.ToString()); ClsUtility.AddParameters("@Reason", SqlDbType.VarChar, Reason); dataset = (DataSet)theManager.ReturnObject(ClsUtility.theParams, "pr_SCM_SavePharmacyMarkOrderFullyDispensed_Web", ClsDBUtility.ObjectEnum.DataSet); DataMgr.CommitTransaction(this.Transaction); DataMgr.ReleaseConnection(this.Connection); } catch { DataMgr.RollBackTransation(this.Transaction); throw; } finally { if (this.Connection != null) { DataMgr.ReleaseConnection(this.Connection); } } return(dataset); }
public int DeleteFamilyInfo(int Id, int @UserId) { try { int theAffectedRows = 0; this.Connection = DataMgr.GetConnection(); this.Transaction = DataMgr.BeginTransaction(this.Connection); ClsObject DeleteFamilyInfo = new ClsObject(); DeleteFamilyInfo.Connection = this.Connection; DeleteFamilyInfo.Transaction = this.Transaction; ClsUtility.Init_Hashtable(); ClsUtility.AddParameters("@Id", SqlDbType.Int, Id.ToString()); ClsUtility.AddParameters("@UserId", SqlDbType.Int, UserId.ToString()); theAffectedRows = (int)DeleteFamilyInfo.ReturnObject(ClsUtility.theParams, "Pr_Clinical_DeleteFamilyInfo_Constella", ClsUtility.ObjectEnum.ExecuteNonQuery); DataMgr.CommitTransaction(this.Transaction); DataMgr.ReleaseConnection(this.Connection); return(theAffectedRows); } catch { DataMgr.RollBackTransation(this.Transaction); throw; } finally { if (this.Connection != null) { DataMgr.ReleaseConnection(this.Connection); } } }
//*****************************************************************************************// // public DataSet SearchResultAppointStatus() // { // oUtility.Init_Hashtable(); // ClsObject SearchResultAppointStatus = new ClsObject(); // return (DataSet)SearchResultAppointStatus.ReturnObject(oUtility.theParams, "pr_Scheduler_Search_PatientAppointment_Constella", ClsUtility.ObjectEnum.DataSet); // } public DataSet SearchPatientAppointment(string LName, string FName, int PatientID, string HospitalID, DateTime DOB, int Sex, int AppStatus) { try { this.Connection = DataMgr.GetConnection(); this.Transaction = DataMgr.BeginTransaction(this.Connection); ClsObject SchedulerMgr = new ClsObject(); SchedulerMgr.Connection = this.Connection; SchedulerMgr.Transaction = this.Transaction; oUtility.AddParameters("@LastName", SqlDbType.VarChar, LName); oUtility.AddParameters("@FirstName", SqlDbType.VarChar, FName); oUtility.AddParameters("@PatientID", SqlDbType.Int, PatientID.ToString()); oUtility.AddParameters("@HospitalID", SqlDbType.VarChar, HospitalID); oUtility.AddParameters("@DOB", SqlDbType.DateTime, DOB.ToString()); oUtility.AddParameters("@Sex", SqlDbType.Int, Sex.ToString()); oUtility.AddParameters("@AppStatus", SqlDbType.Int, AppStatus.ToString()); DataSet SchedulerDR; SchedulerDR = (DataSet)SchedulerMgr.ReturnObject(oUtility.theParams, "pr_Scheduler_Search_PatientAppointment_Constella", ClsUtility.ObjectEnum.DataSet); return(SchedulerDR); } catch { throw; } finally { if (this.Connection != null) { DataMgr.ReleaseConnection(this.Connection); } } }
public DataTable GetSatelliteByID_Name(string SatID, string SatName) { try { this.Connection = DataMgr.GetConnection(); this.Transaction = DataMgr.BeginTransaction(this.Connection); ClsObject SatelliteEditMgr = new ClsObject(); SatelliteEditMgr.Connection = this.Connection; SatelliteEditMgr.Transaction = this.Transaction; ClsUtility.Init_Hashtable(); ClsUtility.AddParameters("@SatID", SqlDbType.VarChar, SatID.ToString()); ClsUtility.AddParameters("@SatName", SqlDbType.VarChar, SatName.ToString()); return (DataTable)SatelliteEditMgr.ReturnObject(ClsUtility.theParams, "pr_Admin_GetSatellitebyID_Name_Constella", ClsUtility.ObjectEnum.DataTable); } catch { throw; } finally { if (this.Connection != null) DataMgr.ReleaseConnection(this.Connection); } }
public int Save_Update_KNHHEI(int patientID, int VisitID, int LocationID, Hashtable ht, DataSet theDSchklist, int userID, int DataQualityFlag) { int retval = 0; DataSet theDS; ClsObject KNHPMTCTHEI = new ClsObject(); try { this.Connection = DataMgr.GetConnection(); this.Transaction = DataMgr.BeginTransaction(this.Connection); KNHPMTCTHEI.Connection = this.Connection; KNHPMTCTHEI.Transaction = this.Transaction; oUtility.Init_Hashtable(); oUtility.AddParameters("@patientid", SqlDbType.Int, patientID.ToString()); oUtility.AddParameters("@locationid", SqlDbType.Int, LocationID.ToString()); oUtility.AddParameters("@Visit_ID", SqlDbType.Int, VisitID.ToString()); oUtility.AddParameters("@KNHHEIVisitDate", SqlDbType.VarChar, ht["KNHHEIVisitDate"].ToString()); oUtility.AddParameters("@KNHHEIVisitType", SqlDbType.Int, ht["KNHHEIVisitType"].ToString()); //Vital Sign oUtility.AddParameters("@KNHHEITemp", SqlDbType.Decimal, ht["KNHHEITemp"].ToString()); oUtility.AddParameters("@KNHHEIRR", SqlDbType.Decimal, ht["KNHHEIRR"].ToString()); oUtility.AddParameters("@KNHHEIHR", SqlDbType.Decimal, ht["KNHHEIHR"].ToString()); oUtility.AddParameters("@KNHHEIHeight", SqlDbType.Decimal, ht["KNHHEIHeight"].ToString()); oUtility.AddParameters("@KNHHEIWeight", SqlDbType.Decimal, ht["KNHHEIWeight"].ToString()); oUtility.AddParameters("@KNHHEIBPSystolic", SqlDbType.Decimal, ht["KNHHEIBPSystolic"].ToString()); oUtility.AddParameters("@KNHHEIBPDiastolic", SqlDbType.Decimal, ht["KNHHEIBPDiastolic"].ToString()); oUtility.AddParameters("@KNHHEIHeadCircum", SqlDbType.Decimal, ht["KNHHEIHeadCircum"].ToString()); oUtility.AddParameters("@KNHHEIWA", SqlDbType.Int, ht["KNHHEIWA"].ToString()); oUtility.AddParameters("@KNHHEIWH", SqlDbType.Int, ht["KNHHEIWH"].ToString()); oUtility.AddParameters("@KNHHEIBMIz", SqlDbType.Int, ht["KNHHEIBMIz"].ToString()); oUtility.AddParameters("@KNHHEINurseComments", SqlDbType.VarChar, ht["KNHHEINurseComments"].ToString()); oUtility.AddParameters("@KNHHEIReferToSpecialClinic", SqlDbType.VarChar, ht["KNHHEIReferToSpecialClinic"].ToString()); oUtility.AddParameters("@KNHHEIReferToOther", SqlDbType.VarChar, ht["KNHHEIReferToOther"].ToString()); //Neonatal History oUtility.AddParameters("@KNHHEISrRefral", SqlDbType.VarChar, ht["KNHHEISrRefral"].ToString()); oUtility.AddParameters("@KNHHEIPlDelivery", SqlDbType.Int, ht["KNHHEIPlDelivery"].ToString()); oUtility.AddParameters("@KNHHEIPlDeliveryotherfacility", SqlDbType.VarChar, ht["KNHHEIPlDeliveryotherfacility"].ToString()); oUtility.AddParameters("@KNHHEIPlDeliveryother", SqlDbType.VarChar, ht["KNHHEIPlDeliveryother"].ToString()); oUtility.AddParameters("@KNHHEIMdDelivery", SqlDbType.Int, ht["KNHHEIMdDelivery"].ToString()); oUtility.AddParameters("@KNHHEIBWeight", SqlDbType.Decimal, ht["KNHHEIBWeight"].ToString()); oUtility.AddParameters("@KNHHEIARVProp", SqlDbType.Int, ht["KNHHEIARVProp"].ToString()); oUtility.AddParameters("@KNHHEIARVPropOther", SqlDbType.VarChar, ht["KNHHEIARVPropOther"].ToString()); oUtility.AddParameters("@KNHHEIIFeedoption", SqlDbType.Int, ht["KNHHEIIFeedoption"].ToString()); oUtility.AddParameters("@KNHHEIIFeedoptionother", SqlDbType.VarChar, ht["KNHHEIIFeedoptionother"].ToString()); //Maternal History oUtility.AddParameters("@KNHHEIStateofMother", SqlDbType.Int, ht["KNHHEIStateofMother"].ToString()); oUtility.AddParameters("@KNHHEIMRegisthisclinic", SqlDbType.Int, ht["KNHHEIMRegisthisclinic"].ToString()); oUtility.AddParameters("@KNHHEIPlMFollowup", SqlDbType.Int, ht["KNHHEIPlMFollowup"].ToString()); oUtility.AddParameters("@KNHHEIPlMFollowupother", SqlDbType.VarChar, ht["KNHHEIPlMFollowupother"].ToString()); oUtility.AddParameters("@KNHHEIMRecievedDrug", SqlDbType.Int, ht["KNHHEIMRecievedDrug"].ToString()); oUtility.AddParameters("@KNHHEIOnARTEnrol", SqlDbType.Int, ht["KNHHEIOnARTEnrol"].ToString()); //Immunization -- Saving to grid now....... //oUtility.AddParameters("@KNHHEIDateImmunised", SqlDbType.VarChar, ht["KNHHEIDateImmunised"].ToString()); //oUtility.AddParameters("@KNHHEIPeriodImmunised", SqlDbType.Int, ht["KNHHEIPeriodImmunised"].ToString()); //oUtility.AddParameters("@KNHHEIGivenImmunised", SqlDbType.Int, ht["KNHHEIGivenImmunised"].ToString()); //Presenting Complaints oUtility.AddParameters("@KNHHEIAdditionalComplaint", SqlDbType.VarChar, ht["KNHHEIAdditionalComplaint"].ToString()); //Examination, Milestone and Diagnosis oUtility.AddParameters("@KNHHEIExamination", SqlDbType.VarChar, ht["KNHHEIExamination"].ToString()); //oUtility.AddParameters("@KNHHEIMilestones", SqlDbType.Int, ht["KNHHEIMilestones"].ToString()); //oUtility.AddParameters("@KNHHEIAssessmmentOutcome", SqlDbType.Int, ht["KNHHEIAssessmmentOutcome"].ToString()); // Management Plan oUtility.AddParameters("@KNHHEIVitamgiven", SqlDbType.Int, ht["KNHHEIVitamgiven"].ToString()); //oUtility.AddParameters("@KNHHEIPlan", SqlDbType.Int, ht["KNHHEIPlan"].ToString()); //oUtility.AddParameters("@KNHHEIPlanRegimen", SqlDbType.Int, ht["KNHHEIPlanRegimen"].ToString()); //Referral, Admission and Appointment oUtility.AddParameters("@KNHHEIReferredto", SqlDbType.Int, ht["KNHHEIReferredto"].ToString()); oUtility.AddParameters("@KNHHEIReferredtoother", SqlDbType.VarChar, ht["KNHHEIReferredtoother"].ToString()); oUtility.AddParameters("@KNHHEIAdmittoward", SqlDbType.Int, ht["KNHHEIAdmittoward"].ToString()); oUtility.AddParameters("@KNHHEITCA", SqlDbType.Int, ht["KNHHEITCA"].ToString()); oUtility.AddParameters("@KNHHEIWorkUpPlan", SqlDbType.Int, ht["KNHHEIWorkUpPlan"].ToString()); theDS = (DataSet)KNHPMTCTHEI.ReturnObject(oUtility.theParams, "pr_Clinical_SaveUpdateKNHHEI_Futures", ClsUtility.ObjectEnum.DataSet); //////////////////////////////// VisitID = Convert.ToInt32(theDS.Tables[0].Rows[0]["VisitId"]); retval = VisitID; //Diagnosis if (theDSchklist.Tables["dtD"] != null && theDSchklist.Tables["dtD"].Rows.Count > 0) { foreach (DataRow theDR in theDSchklist.Tables["dtD"].Rows) { oUtility.Init_Hashtable(); oUtility.AddParameters("@patientid", SqlDbType.Int, patientID.ToString()); oUtility.AddParameters("@Visit_ID", SqlDbType.Int, VisitID.ToString()); oUtility.AddParameters("@Id", SqlDbType.Int, theDR["DiagnosisID"].ToString()); oUtility.AddParameters("@CodeName", SqlDbType.VarChar, "DiagnosisPeads"); oUtility.AddParameters("@OtherNotes", SqlDbType.VarChar, theDR["Diagnosis_Other"].ToString()); oUtility.AddParameters("@UserId", SqlDbType.Int, userID.ToString()); int temp = (int)KNHPMTCTHEI.ReturnObject(oUtility.theParams, "pr_KNHPMTCTHEI_SavecheckedlistItems", ClsUtility.ObjectEnum.ExecuteNonQuery); } } //Presenting Complaints if (theDSchklist.Tables["dtPC"] != null && theDSchklist.Tables["dtPC"].Rows.Count > 0) { foreach (DataRow theDR in theDSchklist.Tables["dtPC"].Rows) { oUtility.Init_Hashtable(); oUtility.AddParameters("@patientid", SqlDbType.Int, patientID.ToString()); oUtility.AddParameters("@Visit_ID", SqlDbType.Int, VisitID.ToString()); oUtility.AddParameters("@Id", SqlDbType.Int, theDR["PComplaintId"].ToString()); oUtility.AddParameters("@CodeName", SqlDbType.VarChar, "PresentingComplaints"); oUtility.AddParameters("@Numeric", SqlDbType.Int, theDR["Complaint_Other"].ToString()); oUtility.AddParameters("@OtherNotes", SqlDbType.VarChar, theDR["Complaint_Other"].ToString()); oUtility.AddParameters("@UserId", SqlDbType.Int, userID.ToString()); int temp = (int)KNHPMTCTHEI.ReturnObject(oUtility.theParams, "pr_KNHPMTCTHEI_SavecheckedlistItems", ClsUtility.ObjectEnum.ExecuteNonQuery); } } //Vital Sign Referred To if (theDSchklist.Tables["dtVS_Rt"] != null && theDSchklist.Tables["dtVS_Rt"].Rows.Count > 0) { foreach (DataRow theDR in theDSchklist.Tables["dtVS_Rt"].Rows) { oUtility.Init_Hashtable(); oUtility.AddParameters("@patientid", SqlDbType.Int, patientID.ToString()); oUtility.AddParameters("@Visit_ID", SqlDbType.Int, VisitID.ToString()); oUtility.AddParameters("@Id", SqlDbType.Int, theDR["ID"].ToString()); oUtility.AddParameters("@CodeName", SqlDbType.VarChar, "VitalSign"); oUtility.AddParameters("@OtherNotes", SqlDbType.VarChar, ""); oUtility.AddParameters("@UserId", SqlDbType.Int, userID.ToString()); int temp = (int)KNHPMTCTHEI.ReturnObject(oUtility.theParams, "pr_KNHPMTCTHEI_SavecheckedlistItems", ClsUtility.ObjectEnum.ExecuteNonQuery); } } //TB Assessment if (theDSchklist.Tables["dtTBA"] != null && theDSchklist.Tables["dtTBA"].Rows.Count > 0) { foreach (DataRow theDR in theDSchklist.Tables["dtTBA"].Rows) { oUtility.Init_Hashtable(); oUtility.AddParameters("@patientid", SqlDbType.Int, patientID.ToString()); oUtility.AddParameters("@Visit_ID", SqlDbType.Int, VisitID.ToString()); oUtility.AddParameters("@Id", SqlDbType.Int, theDR["ID"].ToString()); oUtility.AddParameters("@CodeName", SqlDbType.VarChar, "TBAssessment"); oUtility.AddParameters("@OtherNotes", SqlDbType.VarChar, ""); oUtility.AddParameters("@UserId", SqlDbType.Int, userID.ToString()); int temp = (int)KNHPMTCTHEI.ReturnObject(oUtility.theParams, "pr_KNHPMTCTHEI_SavecheckedlistItems", ClsUtility.ObjectEnum.ExecuteNonQuery); } } //Neo Natal History if (theDSchklist.Tables["dtNeonatal"] != null && theDSchklist.Tables["dtNeonatal"].Rows.Count > 0) { foreach (DataRow theDR in theDSchklist.Tables["dtNeonatal"].Rows) { oUtility.Init_Hashtable(); oUtility.AddParameters("@patientid", SqlDbType.Int, patientID.ToString()); oUtility.AddParameters("@Visit_ID", SqlDbType.Int, VisitID.ToString()); oUtility.AddParameters("@LocationID", SqlDbType.Int, LocationID.ToString()); oUtility.AddParameters("@Section", SqlDbType.VarChar, theDR["Section"].ToString()); oUtility.AddParameters("@TypeofTestId", SqlDbType.Int, theDR["TypeofTestId"].ToString()); oUtility.AddParameters("@TypeofTest", SqlDbType.VarChar, theDR["TypeofTest"].ToString()); oUtility.AddParameters("@ResultId", SqlDbType.Int, theDR["ResultId"].ToString()); oUtility.AddParameters("@Result", SqlDbType.VarChar, theDR["Result"].ToString()); oUtility.AddParameters("@Date", SqlDbType.VarChar, theDR["Date"].ToString()); oUtility.AddParameters("@Comments", SqlDbType.VarChar, theDR["Comments"].ToString()); oUtility.AddParameters("@UserId", SqlDbType.Int, userID.ToString()); int temp = (int)KNHPMTCTHEI.ReturnObject(oUtility.theParams, "pr_KNHPMTCTHEI_SaveGridViewData", ClsUtility.ObjectEnum.ExecuteNonQuery); } } //Maternal History if (theDSchklist.Tables["dtMaternal"] != null && theDSchklist.Tables["dtMaternal"].Rows.Count > 0) { foreach (DataRow theDR in theDSchklist.Tables["dtMaternal"].Rows) { oUtility.Init_Hashtable(); oUtility.AddParameters("@patientid", SqlDbType.Int, patientID.ToString()); oUtility.AddParameters("@Visit_ID", SqlDbType.Int, VisitID.ToString()); oUtility.AddParameters("@LocationID", SqlDbType.Int, LocationID.ToString()); oUtility.AddParameters("@Section", SqlDbType.VarChar, theDR["Section"].ToString()); oUtility.AddParameters("@TypeofTestId", SqlDbType.Int, theDR["TypeofTestId"].ToString()); oUtility.AddParameters("@TypeofTest", SqlDbType.VarChar, theDR["TypeofTest"].ToString()); oUtility.AddParameters("@ResultId", SqlDbType.Int, theDR["ResultId"].ToString()); oUtility.AddParameters("@Result", SqlDbType.VarChar, theDR["Result"].ToString()); oUtility.AddParameters("@Date", SqlDbType.VarChar, theDR["Date"].ToString()); oUtility.AddParameters("@Comments", SqlDbType.VarChar, theDR["Comments"].ToString()); oUtility.AddParameters("@UserId", SqlDbType.Int, userID.ToString()); int temp = (int)KNHPMTCTHEI.ReturnObject(oUtility.theParams, "pr_KNHPMTCTHEI_SaveGridViewData", ClsUtility.ObjectEnum.ExecuteNonQuery); } } //Immunization if (theDSchklist.Tables["dtImmunization"] != null && theDSchklist.Tables["dtImmunization"].Rows.Count > 0) { foreach (DataRow theDR in theDSchklist.Tables["dtImmunization"].Rows) { oUtility.Init_Hashtable(); oUtility.AddParameters("@patientid", SqlDbType.Int, patientID.ToString()); oUtility.AddParameters("@Visit_ID", SqlDbType.Int, VisitID.ToString()); oUtility.AddParameters("@LocationID", SqlDbType.Int, LocationID.ToString()); oUtility.AddParameters("@Section", SqlDbType.VarChar, theDR["Section"].ToString()); oUtility.AddParameters("@TypeofTestId", SqlDbType.Int, theDR["TypeofTestId"].ToString()); oUtility.AddParameters("@TypeofTest", SqlDbType.VarChar, theDR["TypeofTest"].ToString()); oUtility.AddParameters("@ResultId", SqlDbType.Int, theDR["ResultId"].ToString()); oUtility.AddParameters("@Result", SqlDbType.VarChar, theDR["Result"].ToString()); oUtility.AddParameters("@Date", SqlDbType.VarChar, theDR["Date"].ToString()); oUtility.AddParameters("@Comments", SqlDbType.VarChar, theDR["Comments"].ToString()); oUtility.AddParameters("@UserId", SqlDbType.Int, userID.ToString()); int temp = (int)KNHPMTCTHEI.ReturnObject(oUtility.theParams, "pr_KNHPMTCTHEI_SaveGridViewData", ClsUtility.ObjectEnum.ExecuteNonQuery); } } //Milestones if (theDSchklist.Tables["dtMilestone"] != null && theDSchklist.Tables["dtMilestone"].Rows.Count > 0) { foreach (DataRow theDR in theDSchklist.Tables["dtMilestone"].Rows) { oUtility.Init_Hashtable(); oUtility.AddParameters("@patientid", SqlDbType.Int, patientID.ToString()); oUtility.AddParameters("@Visit_ID", SqlDbType.Int, VisitID.ToString()); oUtility.AddParameters("@LocationID", SqlDbType.Int, LocationID.ToString()); oUtility.AddParameters("@Section", SqlDbType.VarChar, theDR["Section"].ToString()); oUtility.AddParameters("@TypeofTestId", SqlDbType.Int, theDR["TypeofTestId"].ToString()); oUtility.AddParameters("@TypeofTest", SqlDbType.VarChar, theDR["TypeofTest"].ToString()); oUtility.AddParameters("@ResultId", SqlDbType.Int, theDR["ResultId"].ToString()); oUtility.AddParameters("@Result", SqlDbType.VarChar, theDR["Result"].ToString()); oUtility.AddParameters("@Date", SqlDbType.VarChar, theDR["Date"].ToString()); oUtility.AddParameters("@Comments", SqlDbType.VarChar, theDR["Comments"].ToString()); oUtility.AddParameters("@UserId", SqlDbType.Int, userID.ToString()); int temp = (int)KNHPMTCTHEI.ReturnObject(oUtility.theParams, "pr_KNHPMTCTHEI_SaveGridViewData", ClsUtility.ObjectEnum.ExecuteNonQuery); } } //TBAssessment if (theDSchklist.Tables["dtTBAssessment"] != null && theDSchklist.Tables["dtTBAssessment"].Rows.Count > 0) { foreach (DataRow theDR in theDSchklist.Tables["dtTBAssessment"].Rows) { oUtility.Init_Hashtable(); oUtility.AddParameters("@patientid", SqlDbType.Int, patientID.ToString()); oUtility.AddParameters("@Visit_ID", SqlDbType.Int, VisitID.ToString()); oUtility.AddParameters("@LocationID", SqlDbType.Int, LocationID.ToString()); oUtility.AddParameters("@Section", SqlDbType.VarChar, theDR["Section"].ToString()); oUtility.AddParameters("@TypeofTestId", SqlDbType.Int, theDR["TypeofTestId"].ToString()); oUtility.AddParameters("@TypeofTest", SqlDbType.VarChar, theDR["TypeofTest"].ToString()); oUtility.AddParameters("@ResultId", SqlDbType.Int, theDR["ResultId"].ToString()); oUtility.AddParameters("@Result", SqlDbType.VarChar, theDR["Result"].ToString()); oUtility.AddParameters("@Date", SqlDbType.VarChar, theDR["Date"].ToString()); oUtility.AddParameters("@Comments", SqlDbType.VarChar, theDR["Comments"].ToString()); oUtility.AddParameters("@UserId", SqlDbType.Int, userID.ToString()); int temp = (int)KNHPMTCTHEI.ReturnObject(oUtility.theParams, "pr_KNHPMTCTHEI_SaveGridViewData", ClsUtility.ObjectEnum.ExecuteNonQuery); } } DataMgr.CommitTransaction(this.Transaction); DataMgr.ReleaseConnection(this.Connection); } catch { DataMgr.RollBackTransation(this.Transaction); throw; } finally { if (this.Connection != null) { DataMgr.ReleaseConnection(this.Connection); } } return(retval); }
public DataSet SaveUpdateNigeriaAdultIEHIVHistoryData(Hashtable hashTable, DataTable dtMultiSelectValues, int DataQuality, int signature, DataTable dtPriorART) { try { DataSet theDS; int visitID; this.Connection = DataMgr.GetConnection(); this.Transaction = DataMgr.BeginTransaction(this.Connection); ClsUtility.Init_Hashtable(); ClsUtility.AddParameters("@Ptn_pk", SqlDbType.Int, hashTable["patientID"].ToString()); ClsUtility.AddParameters("@Visit_Pk", SqlDbType.Int, hashTable["visitID"].ToString()); ClsUtility.AddParameters("@locationID", SqlDbType.Int, hashTable["locationID"].ToString()); ClsUtility.AddParameters("@visitDate", SqlDbType.VarChar, hashTable["visitDate"].ToString()); ClsUtility.AddParameters("@PrevARVExposure", SqlDbType.Int, hashTable["PrevARVExposure"].ToString()); ClsUtility.AddParameters("@ARTTransferinFrom", SqlDbType.Int, hashTable["ARTTransferinFrom"].ToString()); ClsUtility.AddParameters("@durationcarefrom", SqlDbType.VarChar, hashTable["durationcarefrom"].ToString()); ClsUtility.AddParameters("@durationcareto", SqlDbType.VarChar, hashTable["durationcareto"].ToString()); ClsUtility.AddParameters("@EntryType", SqlDbType.Int, hashTable["EntryType"].ToString()); ClsUtility.AddParameters("@LatestCD4", SqlDbType.VarChar, hashTable["LatestCD4"].ToString()); ClsUtility.AddParameters("@LatestCD4Date", SqlDbType.VarChar, hashTable["LatestCD4Date"].ToString()); ClsUtility.AddParameters("@LowestCD4", SqlDbType.Int, hashTable["LowestCD4"].ToString()); ClsUtility.AddParameters("@LowestCD4Date", SqlDbType.DateTime, hashTable["LowestCD4Date"].ToString()); ClsUtility.AddParameters("@LatestViralLoad", SqlDbType.Int, hashTable["LatestViralLoad"].ToString()); ClsUtility.AddParameters("@LatestViralLoadDate", SqlDbType.DateTime, hashTable["LatestViralLoadDate"].ToString()); ClsUtility.AddParameters("@ComplaintOther", SqlDbType.VarChar, hashTable["ComplaintOther"].ToString()); ClsUtility.AddParameters("@ServiceEntry", SqlDbType.Int, hashTable["ServiceEntry"].ToString()); ClsUtility.AddParameters("@ParticipatedAdhernce", SqlDbType.Int, hashTable["ParticipatedAdhernce"].ToString()); ClsUtility.AddParameters("@MissedArv3days", SqlDbType.Int, hashTable["MissedArv3days"].ToString()); ClsUtility.AddParameters("@ReasomMissedARV", SqlDbType.Int, hashTable["ReasomMissedARV"].ToString()); ClsUtility.AddParameters("@TreatmentIntrupted", SqlDbType.Int, hashTable["TreatmentIntrupted"].ToString()); //ClsUtility.AddParameters("@PresentingComplaintsAdditionalNotes", SqlDbType.VarChar, hashTable["PresentingComplaintsAdditionalNotes"].ToString()); ClsUtility.AddParameters("@IntrupptedDate", SqlDbType.VarChar, hashTable["IntrupptedDate"].ToString()); ClsUtility.AddParameters("@intrpdays", SqlDbType.Int, hashTable["intrpdays"].ToString()); ClsUtility.AddParameters("@ReasonInterrupted", SqlDbType.Int, hashTable["ReasonInterrupted"].ToString()); ClsUtility.AddParameters("@Treatmentstopped", SqlDbType.Int, hashTable["Treatmentstopped"].ToString()); ClsUtility.AddParameters("@StopedReasonDate", SqlDbType.VarChar, hashTable["StopedReasonDate"].ToString()); ClsUtility.AddParameters("@stoppeddays", SqlDbType.Int, hashTable["stoppeddays"].ToString()); ClsUtility.AddParameters("@StopedReason", SqlDbType.Int, hashTable["StopedReason"].ToString()); ClsUtility.AddParameters("@Otherdisclosed", SqlDbType.VarChar, hashTable["Otherdisclosed"].ToString()); ClsUtility.AddParameters("@hivdiscussed", SqlDbType.VarChar, hashTable["hivdiscussed"].ToString()); ClsUtility.AddParameters("@supportgroup", SqlDbType.Int, hashTable["supportgroup"].ToString()); ClsUtility.AddParameters("@OtherShortTermEffects", SqlDbType.VarChar, hashTable["OtherShortTermEffects"].ToString()); ClsUtility.AddParameters("@OtherLongtermEffects", SqlDbType.Int, hashTable["OtherLongtermEffects"].ToString()); ClsUtility.AddParameters("@DataQlty", SqlDbType.Int, DataQuality.ToString()); ClsUtility.AddParameters("@UserId", SqlDbType.Int, signature.ToString()); ClsObject VisitManager = new ClsObject(); VisitManager.Connection = this.Connection; VisitManager.Transaction = this.Transaction; // DataSet tempDataSet; theDS = (DataSet)VisitManager.ReturnObject(ClsUtility.theParams, "pr_Clinical_SaveUpdate_Nigeria_AdultIE_HIVHistoryTab", ClsDBUtility.ObjectEnum.DataSet); visitID = (int)theDS.Tables[0].Rows[0]["Visit_Id"]; //Pre Existing Medical Condition for (int i = 0; i < dtMultiSelectValues.Rows.Count; i++) { if (dtMultiSelectValues.Rows[i]["ID"].ToString() != "") { ClsUtility.Init_Hashtable(); ClsUtility.AddParameters("@Ptn_pk", SqlDbType.Int, hashTable["patientID"].ToString()); ClsUtility.AddParameters("@Visit_Pk", SqlDbType.Int, visitID.ToString()); ClsUtility.AddParameters("@ID", SqlDbType.Int, dtMultiSelectValues.Rows[i]["ID"].ToString()); ClsUtility.AddParameters("@FieldName", SqlDbType.VarChar, dtMultiSelectValues.Rows[i]["FieldName"].ToString()); ClsUtility.AddParameters("@OtherNotes", SqlDbType.VarChar, dtMultiSelectValues.Rows[i]["Other_notes"].ToString()); int temp = (int)VisitManager.ReturnObject(ClsUtility.theParams, "pr_Clinical_Save_Multiselect_line", ClsDBUtility.ObjectEnum.ExecuteNonQuery); } } //Prior ART for (int i = 0; i < dtPriorART.Rows.Count; i++) { if (dtPriorART.Rows[i]["ID"].ToString() != "") { ClsUtility.Init_Hashtable(); ClsUtility.AddParameters("@Ptn_pk", SqlDbType.Int, hashTable["patientID"].ToString()); ClsUtility.AddParameters("@Visit_Pk", SqlDbType.Int, visitID.ToString()); ClsUtility.AddParameters("@ID", SqlDbType.Int, dtPriorART.Rows[i]["ID"].ToString()); ClsUtility.AddParameters("@NumericFiled", SqlDbType.Int, dtPriorART.Rows[i]["NumericField"].ToString()); ClsUtility.AddParameters("@FieldName", SqlDbType.VarChar, "NigeriaPriorART"); ClsUtility.AddParameters("@DateField1", SqlDbType.VarChar, dtPriorART.Rows[i]["DateField1"].ToString()); ClsUtility.AddParameters("@DateField2", SqlDbType.VarChar, dtPriorART.Rows[i]["DateField2"].ToString()); int temp = (int)VisitManager.ReturnObject(ClsUtility.theParams, "pr_Clinical_Save_Multiselect_line", ClsDBUtility.ObjectEnum.ExecuteNonQuery); } } DataMgr.CommitTransaction(this.Transaction); DataMgr.ReleaseConnection(this.Connection); return(theDS); } catch { DataMgr.RollBackTransation(this.Transaction); throw; } finally { if (this.Connection != null) { DataMgr.ReleaseConnection(this.Connection); } } }
public DataSet SaveUpdateNigeriaPaedIEExaminationData(Hashtable hashTable, DataTable dtMultiSelectValues, int DataQuality, int signature) { try { DataSet theDS; int visitID; this.Connection = DataMgr.GetConnection(); this.Transaction = DataMgr.BeginTransaction(this.Connection); ClsUtility.Init_Hashtable(); ClsUtility.AddParameters("@Ptn_pk", SqlDbType.Int, hashTable["patientID"].ToString()); ClsUtility.AddParameters("@Visit_Pk", SqlDbType.Int, hashTable["visitID"].ToString()); ClsUtility.AddParameters("@locationID", SqlDbType.Int, hashTable["locationID"].ToString()); ClsUtility.AddParameters("@visitDate", SqlDbType.VarChar, hashTable["visitDate"].ToString()); if (hashTable["Temp"].ToString() != "") { ClsUtility.AddParameters("@Temp", SqlDbType.Decimal, hashTable["Temp"].ToString()); } if (hashTable["RR"].ToString() != "") { ClsUtility.AddParameters("@RR", SqlDbType.Decimal, hashTable["RR"].ToString()); } if (hashTable["height"].ToString() != "") { ClsUtility.AddParameters("@height", SqlDbType.Decimal, hashTable["height"].ToString()); } if (hashTable["weight"].ToString() != "") { ClsUtility.AddParameters("@weight", SqlDbType.Decimal, hashTable["weight"].ToString()); } if (hashTable["BPDiastolic"].ToString() != "") { ClsUtility.AddParameters("@BPDiastolic", SqlDbType.Decimal, hashTable["BPDiastolic"].ToString()); } if (hashTable["BPSystolic"].ToString() != "") { ClsUtility.AddParameters("@BPSystolic", SqlDbType.Decimal, hashTable["BPSystolic"].ToString()); } if (hashTable["HeadCircumference"].ToString() != "") { ClsUtility.AddParameters("@HeadCircumference", SqlDbType.Decimal, hashTable["HeadCircumference"].ToString()); } ClsUtility.AddParameters("@MUAC", SqlDbType.Int, hashTable["MUAC"].ToString()); if (hashTable["SurfaceArea"].ToString() != "") { ClsUtility.AddParameters("@SurfaceArea", SqlDbType.Decimal, hashTable["SurfaceArea"].ToString()); } ClsUtility.AddParameters("@OtherNigeriaPEGeneral", SqlDbType.VarChar, hashTable["OtherNigeriaPEGeneral"].ToString()); ClsUtility.AddParameters("@OtherNigeriaPESkin", SqlDbType.VarChar, hashTable["OtherNigeriaPESkin"].ToString()); ClsUtility.AddParameters("@OtherNigeriaPEHeadEyeEnt", SqlDbType.VarChar, hashTable["OtherNigeriaPEHeadEyeEnt"].ToString()); ClsUtility.AddParameters("@OtherNigeriaPECardiovascular", SqlDbType.VarChar, hashTable["OtherNigeriaPECardiovascular"].ToString()); ClsUtility.AddParameters("@OtherNigeriaPEBreast", SqlDbType.VarChar, hashTable["OtherNigeriaPEBreast"].ToString()); ClsUtility.AddParameters("@OtherNigeriaPEGenitalia", SqlDbType.VarChar, hashTable["OtherNigeriaPEGenitalia"].ToString()); ClsUtility.AddParameters("@txtOtherNigeriaPERespiratory", SqlDbType.VarChar, hashTable["txtOtherNigeriaPERespiratory"].ToString()); ClsUtility.AddParameters("@OtherNigeriaPEGastrointestinal", SqlDbType.VarChar, hashTable["OtherNigeriaPEGastrointestinal"].ToString()); ClsUtility.AddParameters("@OtherNigeriaPENeurological", SqlDbType.VarChar, hashTable["OtherNigeriaPENeurological"].ToString()); ClsUtility.AddParameters("@OtherNigeriaPEMentalstatus", SqlDbType.VarChar, hashTable["OtherNigeriaPEMentalstatus"].ToString()); ClsUtility.AddParameters("@OtherAdditionaldetailedfindings", SqlDbType.VarChar, hashTable["OtherAdditionaldetailedfindings"].ToString()); ClsUtility.AddParameters("@Assessment", SqlDbType.Int, hashTable["Assessment"].ToString()); ClsUtility.AddParameters("@WHOStage", SqlDbType.Int, hashTable["WHOStage"].ToString()); ClsUtility.AddParameters("@DataQlty", SqlDbType.Int, DataQuality.ToString()); ClsUtility.AddParameters("@UserId", SqlDbType.Int, signature.ToString()); ClsObject VisitManager = new ClsObject(); VisitManager.Connection = this.Connection; VisitManager.Transaction = this.Transaction; // DataSet tempDataSet; theDS = (DataSet)VisitManager.ReturnObject(ClsUtility.theParams, "pr_Clinical_SaveUpdate_Nigeria_PaedIE_ExamTab", ClsDBUtility.ObjectEnum.DataSet); visitID = (int)theDS.Tables[0].Rows[0]["Visit_Id"]; //Pre Existing Medical Condition for (int i = 0; i < dtMultiSelectValues.Rows.Count; i++) { if (dtMultiSelectValues.Rows[i]["ID"].ToString() != "") { ClsUtility.Init_Hashtable(); ClsUtility.AddParameters("@Ptn_pk", SqlDbType.Int, hashTable["patientID"].ToString()); ClsUtility.AddParameters("@Visit_Pk", SqlDbType.Int, visitID.ToString()); ClsUtility.AddParameters("@ID", SqlDbType.Int, dtMultiSelectValues.Rows[i]["ID"].ToString()); ClsUtility.AddParameters("@FieldName", SqlDbType.VarChar, dtMultiSelectValues.Rows[i]["FieldName"].ToString()); ClsUtility.AddParameters("@OtherNotes", SqlDbType.VarChar, dtMultiSelectValues.Rows[i]["Other_notes"].ToString()); int temp = (int)VisitManager.ReturnObject(ClsUtility.theParams, "pr_Clinical_Save_Multiselect_line", ClsDBUtility.ObjectEnum.ExecuteNonQuery); } } DataMgr.CommitTransaction(this.Transaction); DataMgr.ReleaseConnection(this.Connection); return(theDS); } catch { DataMgr.RollBackTransation(this.Transaction); throw; } finally { if (this.Connection != null) { DataMgr.ReleaseConnection(this.Connection); } } }
public DataSet SaveUpdateNigeriaAdultIEClinicalHistoryData(Hashtable hashTable, DataTable dtMultiSelectValues, int DataQuality, int signature) { try { DataSet theDS; int visitID; this.Connection = DataMgr.GetConnection(); this.Transaction = DataMgr.BeginTransaction(this.Connection); ClsUtility.Init_Hashtable(); ClsUtility.AddParameters("@Ptn_pk", SqlDbType.Int, hashTable["patientID"].ToString()); ClsUtility.AddParameters("@Visit_Pk", SqlDbType.Int, hashTable["visitID"].ToString()); ClsUtility.AddParameters("@locationID", SqlDbType.Int, hashTable["locationID"].ToString()); ClsUtility.AddParameters("@visitDate", SqlDbType.VarChar, hashTable["visitDate"].ToString()); ClsUtility.AddParameters("@OtherPresentingComplaints", SqlDbType.VarChar, hashTable["OtherPresentingComplaints"].ToString()); ClsUtility.AddParameters("@PresentingComplaintsAdditionalNotes", SqlDbType.VarChar, hashTable["PresentingComplaintsAdditionalNotes"].ToString()); ClsUtility.AddParameters("@MedicalHistoryAdditionalComplaints", SqlDbType.VarChar, hashTable["MedicalHistoryAdditionalComplaints"].ToString()); ClsUtility.AddParameters("@MedicalHistoryLastHistory", SqlDbType.VarChar, hashTable["MedicalHistoryLastHistory"].ToString()); ClsUtility.AddParameters("@MedicalHistoryFamilyHistory", SqlDbType.VarChar, hashTable["MedicalHistoryFamilyHistory"].ToString()); ClsUtility.AddParameters("@MedicalHistoryHospitalization", SqlDbType.VarChar, hashTable["MedicalHistoryHospitalization"].ToString()); ClsUtility.AddParameters("@Pregnant", SqlDbType.Int, hashTable["Pregnant"].ToString()); ClsUtility.AddParameters("@LMPDate", SqlDbType.VarChar, hashTable["LMPDate"].ToString()); ClsUtility.AddParameters("@EDDDate", SqlDbType.VarChar, hashTable["EDDDate"].ToString()); ClsUtility.AddParameters("@GestationalAge", SqlDbType.Int, hashTable["GestationalAge"].ToString()); ClsUtility.AddParameters("@DataQlty", SqlDbType.Int, DataQuality.ToString()); ClsUtility.AddParameters("@UserId", SqlDbType.Int, signature.ToString()); ClsObject VisitManager = new ClsObject(); VisitManager.Connection = this.Connection; VisitManager.Transaction = this.Transaction; // DataSet tempDataSet; theDS = (DataSet)VisitManager.ReturnObject(ClsUtility.theParams, "pr_Clinical_SaveUpdate_Nigeria_AdultIE_ClinicalHistoryTab", ClsDBUtility.ObjectEnum.DataSet); visitID = (int)theDS.Tables[0].Rows[0]["Visit_Id"]; //Pre Existing Medical Condition for (int i = 0; i < dtMultiSelectValues.Rows.Count; i++) { if (dtMultiSelectValues.Rows[i]["ID"].ToString() != "") { ClsUtility.Init_Hashtable(); ClsUtility.AddParameters("@Ptn_pk", SqlDbType.Int, hashTable["patientID"].ToString()); ClsUtility.AddParameters("@Visit_Pk", SqlDbType.Int, visitID.ToString()); ClsUtility.AddParameters("@ID", SqlDbType.Int, dtMultiSelectValues.Rows[i]["ID"].ToString()); ClsUtility.AddParameters("@FieldName", SqlDbType.VarChar, dtMultiSelectValues.Rows[i]["FieldName"].ToString()); ClsUtility.AddParameters("@OtherNotes", SqlDbType.VarChar, dtMultiSelectValues.Rows[i]["Other_notes"].ToString()); int temp = (int)VisitManager.ReturnObject(ClsUtility.theParams, "pr_Clinical_Save_Multiselect_line", ClsDBUtility.ObjectEnum.ExecuteNonQuery); } } DataMgr.CommitTransaction(this.Transaction); DataMgr.ReleaseConnection(this.Connection); return(theDS); } catch { DataMgr.RollBackTransation(this.Transaction); throw; } finally { if (this.Connection != null) { DataMgr.ReleaseConnection(this.Connection); } } }
public int SaveCustomRegistrationFormDetail(DataSet dsSaveFormData, DataTable dtFieldDetails) { try { this.Connection = DataMgr.GetConnection(); this.Transaction = DataMgr.BeginTransaction(this.Connection); ClsObject FormDetail = new ClsObject(); FormDetail.Connection = this.Connection; FormDetail.Transaction = this.Transaction; int theRowAffected = 0; DataRow theDR; int iFeatureId; string strTableName = string.Empty; //save mst_feature data ClsUtility.Init_Hashtable(); if (dsSaveFormData.Tables[0].Rows[0]["InsertUpdateStatus"].ToString() == "I") { ClsUtility.AddParameters("@FeatureId", SqlDbType.Int, "0"); } else { ClsUtility.AddParameters("@FeatureId", SqlDbType.Int, dsSaveFormData.Tables[0].Rows[0]["FeatureId"].ToString()); } ClsUtility.AddParameters("@FeatureName", SqlDbType.VarChar, dsSaveFormData.Tables[0].Rows[0]["FeatureName"].ToString().Replace("'", "")); ClsUtility.AddParameters("@ReportFlag", SqlDbType.Int, dsSaveFormData.Tables[0].Rows[0]["ReportFlag"].ToString()); ClsUtility.AddParameters("@DeleteFlag", SqlDbType.Int, dsSaveFormData.Tables[0].Rows[0]["DeleteFlag"].ToString()); ClsUtility.AddParameters("@AdminFlag", SqlDbType.Int, dsSaveFormData.Tables[0].Rows[0]["AdminFlag"].ToString()); ClsUtility.AddParameters("@SystemId", SqlDbType.Int, dsSaveFormData.Tables[0].Rows[0]["SystemId"].ToString()); ClsUtility.AddParameters("@UserID", SqlDbType.Int, dsSaveFormData.Tables[0].Rows[0]["UserID"].ToString()); ClsUtility.AddParameters("@Published", SqlDbType.Int, dsSaveFormData.Tables[0].Rows[0]["Published"].ToString()); ClsUtility.AddParameters("@CountryId", SqlDbType.Int, dsSaveFormData.Tables[0].Rows[0]["CountryId"].ToString()); ClsUtility.AddParameters("@ModuleId", SqlDbType.Int, dsSaveFormData.Tables[0].Rows[0]["ModuleId"].ToString()); ClsUtility.AddParameters("@MultiVisit", SqlDbType.Int, dsSaveFormData.Tables[0].Rows[0]["MultiVisit"].ToString()); theDR = (DataRow)FormDetail.ReturnObject(ClsUtility.theParams, "Pr_FormBuilder_SaveMstFeature_Futures", ClsDBUtility.ObjectEnum.DataRow); iFeatureId = System.Convert.ToInt32(theDR[0].ToString()); string[] strFeatureName = new string[10]; strFeatureName = dsSaveFormData.Tables[0].Rows[0]["FeatureName"].ToString().Split(' '); for (int j = 0; j < strFeatureName.Length; j++) { if (j > 0) { strTableName += "_" + strFeatureName[j]; } else { strTableName += strFeatureName[j]; } } for (int i = 0; i < dsSaveFormData.Tables[1].Rows.Count; i++) { ClsUtility.Init_Hashtable(); ClsUtility.AddParameters("@SectionId", SqlDbType.Int, dsSaveFormData.Tables[1].Rows[i]["SectionId"].ToString()); ClsUtility.AddParameters("@SectionName", SqlDbType.VarChar, dsSaveFormData.Tables[1].Rows[i]["SectionName"].ToString()); ClsUtility.AddParameters("@Seq", SqlDbType.Int, dsSaveFormData.Tables[1].Rows[i]["Sequence"].ToString()); ClsUtility.AddParameters("@CustomFlag", SqlDbType.Int, dsSaveFormData.Tables[1].Rows[i]["CustomFlag"].ToString()); ClsUtility.AddParameters("@DeleteFlag", SqlDbType.Int, dsSaveFormData.Tables[1].Rows[i]["DeleteFlag"].ToString()); ClsUtility.AddParameters("@UserID", SqlDbType.Int, dsSaveFormData.Tables[1].Rows[i]["UserId"].ToString()); ClsUtility.AddParameters("@FeatureId", SqlDbType.Int, iFeatureId.ToString()); theDR = (DataRow)FormDetail.ReturnObject(ClsUtility.theParams, "Pr_FormBuilder_SaveMstSection_Futures", ClsDBUtility.ObjectEnum.DataRow); } //save lnk_form data for (int i = 0; i < dsSaveFormData.Tables[2].Rows.Count; i++) { ClsUtility.Init_Hashtable(); ClsUtility.AddParameters("@Id", SqlDbType.Int, dsSaveFormData.Tables[2].Rows[i]["Id"].ToString()); ClsUtility.AddParameters("@FeatureId", SqlDbType.Int, iFeatureId.ToString()); ClsUtility.AddParameters("@SectionId", SqlDbType.Int, dsSaveFormData.Tables[2].Rows[i]["SectionId"].ToString()); ClsUtility.AddParameters("@FieldId", SqlDbType.Int, dsSaveFormData.Tables[2].Rows[i]["FieldId"].ToString()); ClsUtility.AddParameters("@FieldLabel", SqlDbType.VarChar, dsSaveFormData.Tables[2].Rows[i]["FieldLabel"].ToString()); ClsUtility.AddParameters("@AdditionalInformation", SqlDbType.VarChar, dsSaveFormData.Tables[2].Rows[i]["AdditionalInformation"].ToString()); ClsUtility.AddParameters("@Seq", SqlDbType.Int, dsSaveFormData.Tables[2].Rows[i]["Sequence"].ToString()); ClsUtility.AddParameters("@UserID", SqlDbType.Int, dsSaveFormData.Tables[2].Rows[i]["UserId"].ToString()); ClsUtility.AddParameters("@Predefined", SqlDbType.Int, dsSaveFormData.Tables[2].Rows[i]["Predefined"].ToString()); theRowAffected = (int)FormDetail.ReturnObject(ClsUtility.theParams, "Pr_FormBuilder_SaveLnkForm_Futures", ClsDBUtility.ObjectEnum.ExecuteNonQuery); DataView dvFilteredRow = new DataView(); dvFilteredRow = dtFieldDetails.DefaultView; DataTable dtRow = new DataTable(); if (dsSaveFormData.Tables[2].Rows[i]["FieldId"].ToString().Contains("7100000") == true) { dvFilteredRow.RowFilter = "ID='71' and predefine=" + dsSaveFormData.Tables[2].Rows[i]["Predefined"].ToString(); } else { dvFilteredRow.RowFilter = "ID='" + dsSaveFormData.Tables[2].Rows[i]["FieldId"].ToString() + "' and predefine=" + dsSaveFormData.Tables[2].Rows[i]["Predefined"].ToString(); } dtRow = dvFilteredRow.ToTable(); ClsUtility.Init_Hashtable(); ClsUtility.AddParameters("@TableName", SqlDbType.VarChar, strTableName); ClsUtility.AddParameters("@FieldName", SqlDbType.VarChar, dtRow.Rows[0]["FieldName"].ToString()); ClsUtility.AddParameters("@DataType", SqlDbType.Int, dtRow.Rows[0]["ControlId"].ToString()); ClsUtility.AddParameters("@Predefined", SqlDbType.Int, dsSaveFormData.Tables[2].Rows[i]["Predefined"].ToString()); ClsUtility.AddParameters("@FieldId", SqlDbType.Int, dsSaveFormData.Tables[2].Rows[i]["FieldId"].ToString()); theRowAffected = (int)FormDetail.ReturnObject(ClsUtility.theParams, "Pr_FormBuilder_PatientRegistrationCustomTableCreation_Futures", ClsDBUtility.ObjectEnum.ExecuteNonQuery); } //Delete fields selected from remove field in formbuilder while in update mode for (int i = 0; i < dsSaveFormData.Tables[3].Rows.Count; i++) { ClsUtility.Init_Hashtable(); ClsUtility.AddParameters("@Id", SqlDbType.Int, dsSaveFormData.Tables[3].Rows[i]["Id"].ToString()); ClsUtility.AddParameters("@FieldName", SqlDbType.VarChar, dsSaveFormData.Tables[3].Rows[i]["FieldName"].ToString()); ClsUtility.AddParameters("@TableName", SqlDbType.VarChar, strTableName); theRowAffected = (int)FormDetail.ReturnObject(ClsUtility.theParams, "Pr_FormBuilder_RemoveFieldInFormBuilder_Futures", ClsDBUtility.ObjectEnum.ExecuteNonQuery); } //Delete sections selected from remove section in formbuilder while in update mode if (dsSaveFormData.Tables.Count > 4) { for (int i = 0; i < dsSaveFormData.Tables[4].Rows.Count; i++) { ClsUtility.Init_Hashtable(); ClsUtility.AddParameters("@SectionId", SqlDbType.Int, dsSaveFormData.Tables[4].Rows[i]["SectionId"].ToString()); ClsUtility.AddParameters("@FeatureId", SqlDbType.Int, iFeatureId.ToString()); ClsUtility.AddParameters("@TableName", SqlDbType.VarChar, strTableName); theRowAffected = (int)FormDetail.ReturnObject(ClsUtility.theParams, "Pr_FormBuilder_RemoveSectionAndFieldInFormBuilder_Futures", ClsDBUtility.ObjectEnum.ExecuteNonQuery); } } DataMgr.CommitTransaction(this.Transaction); DataMgr.ReleaseConnection(this.Connection); return(iFeatureId); } catch { DataMgr.RollBackTransation(this.Transaction); throw; } finally { if (this.Connection != null) { DataMgr.ReleaseConnection(this.Connection); } } }
public PharmacyContext() : base((DbConnection)DataMgr.GetConnection(), true) { Configuration.ProxyCreationEnabled = false; Database.SetInitializer <PharmacyContext>(null); }
public DataTable UpdateContactCare(Hashtable ht, int DataQuality, int CareEndedID, int TrackingID, DataTable theCustomFieldData) { ClsObject CareManager = new ClsObject(); try { this.Connection = DataMgr.GetConnection(); this.Transaction = DataMgr.BeginTransaction(this.Connection); CareManager.Connection = this.Connection; CareManager.Transaction = this.Transaction; DataSet theDs = new DataSet(); ClsUtility.Init_Hashtable(); if (ht["PatientID"] != null) { ClsUtility.AddParameters("@PatientId", SqlDbType.VarChar, ht["PatientID"].ToString()); } else { ClsUtility.AddParameters("@PatientId", SqlDbType.VarChar, ""); } if (ht["LocationID"] != null) { ClsUtility.AddParameters("@LocationId", SqlDbType.VarChar, ht["LocationID"].ToString()); } else { ClsUtility.AddParameters("@LocationId", SqlDbType.VarChar, ""); } if (ht["theMissedAppDate"] != null) { ClsUtility.AddParameters("@MissedAppDate", SqlDbType.VarChar, ht["theMissedAppDate"].ToString()); } else { ClsUtility.AddParameters("@MissedAppDate", SqlDbType.VarChar, ""); } if (ht["theDateContact"] != null) { ClsUtility.AddParameters("@DateLastContact", SqlDbType.VarChar, ht["theDateContact"].ToString()); } else { ClsUtility.AddParameters("@DateLastContact", SqlDbType.VarChar, ""); } if (ht["theARTEnd"] != null) { ClsUtility.AddParameters("@ARTended", SqlDbType.VarChar, ht["theARTEnd"].ToString()); } else { ClsUtility.AddParameters("@ARTended", SqlDbType.VarChar, ""); } if (ht["theARTEnddate"] != null) { ClsUtility.AddParameters("@ARTenddate", SqlDbType.VarChar, ht["theARTEnddate"].ToString()); } else { ClsUtility.AddParameters("@ARTenddate", SqlDbType.VarChar, ""); } if (ht["ARTendreaon"] != null) { ClsUtility.AddParameters("@ARTendreason", SqlDbType.VarChar, ht["ARTendreaon"].ToString()); } else { ClsUtility.AddParameters("@ARTendreason", SqlDbType.VarChar, ""); } if (ht["theCareEnd"] != null) { ClsUtility.AddParameters("@Careended", SqlDbType.VarChar, ht["theCareEnd"].ToString()); } else { ClsUtility.AddParameters("@Careended", SqlDbType.VarChar, ""); } if (ht["ExitReason"] != null) { ClsUtility.AddParameters("@PatientExitReason", SqlDbType.VarChar, ht["ExitReason"].ToString()); } else { ClsUtility.AddParameters("@PatientExitReason", SqlDbType.VarChar, ""); } if (ht["ddLostFollowreason"] != null) { ClsUtility.AddParameters("@LostFollowreason", SqlDbType.VarChar, ht["ddLostFollowreason"].ToString()); } else { ClsUtility.AddParameters("@LostFollowreason", SqlDbType.VarChar, ""); } if (ht["txtdropoutother"] != null) { ClsUtility.AddParameters("@Followupreasonother", SqlDbType.VarChar, ht["txtdropoutother"].ToString()); } else { ClsUtility.AddParameters("@Followupreasonother", SqlDbType.VarChar, ""); } if (ht["lptfreason"] != null) { ClsUtility.AddParameters("@LPTFTransfer", SqlDbType.VarChar, ht["lptfreason"].ToString()); } else { ClsUtility.AddParameters("@LPTFTransfer", SqlDbType.VarChar, ""); } if (ht["ddDroppedOutReason"] != null) { ClsUtility.AddParameters("@DroppedOutReasonOther", SqlDbType.VarChar, ht["ddDroppedOutReason"].ToString()); } else { ClsUtility.AddParameters("@DroppedOutReasonOther", SqlDbType.VarChar, ""); } if (ht["ddDeathReason"] != null) { ClsUtility.AddParameters("@DeathReason", SqlDbType.VarChar, ht["ddDeathReason"].ToString()); } else { ClsUtility.AddParameters("@DeathReason", SqlDbType.VarChar, ""); } if (ht["txtDeathDate"] != null) { ClsUtility.AddParameters("@DeathDate", SqlDbType.VarChar, ht["txtDeathDate"].ToString()); } else { ClsUtility.AddParameters("@DeathDate", SqlDbType.VarChar, ""); } if (ht["txtDeathReasonDescription"] != null) { ClsUtility.AddParameters("@DeathReasonDescription", SqlDbType.VarChar, ht["txtDeathReasonDescription"].ToString()); } else { ClsUtility.AddParameters("@DeathReasonDescription", SqlDbType.VarChar, ""); } if (ht["PMTCTCareEnded"] != null) { ClsUtility.AddParameters("@PMTCTCareEnded", SqlDbType.VarChar, ht["PMTCTCareEnded"].ToString()); } else { ClsUtility.AddParameters("@PMTCTCareEnded", SqlDbType.VarChar, ""); } if (ht["txtCareEndDate"] != null) { ClsUtility.AddParameters("@CareEndedDate", SqlDbType.VarChar, ht["txtCareEndDate"].ToString()); } else { ClsUtility.AddParameters("@CareEndedDate", SqlDbType.VarChar, "1900-01-01"); } if (ht["theCareEnd"] != null) { ClsUtility.AddParameters("@Status", SqlDbType.VarChar, ht["theCareEnd"].ToString()); } else { ClsUtility.AddParameters("@Status", SqlDbType.VarChar, ""); } ClsUtility.AddParameters("@EmployeeID", SqlDbType.VarChar, ht["ddinterviewer"].ToString()); ClsUtility.AddParameters("@UserID", SqlDbType.VarChar, ht["UserId"].ToString()); ClsUtility.AddParameters("@DataQuality", SqlDbType.VarChar, DataQuality.ToString()); ClsUtility.AddParameters("@TrackingID", SqlDbType.VarChar, TrackingID.ToString()); ClsUtility.AddParameters("@CareEndedID", SqlDbType.VarChar, CareEndedID.ToString()); DataTable theDT; theDT = (DataTable)CareManager.ReturnObject(ClsUtility.theParams, "pr_Scheduler_UpdateCareTrackingDetails_Constella", ClsDBUtility.ObjectEnum.DataTable); //// Custom Fields ////////////// ////////////PreSet Values Used///////////////// /// #99# --- Ptn_Pk /// #88# --- LocationId /// #77# --- Visit_Pk /// #66# --- Visit_Date /// #55# --- Ptn_Pharmacy_Pk /// #44# --- OrderedByDate /// #33# --- LabId /// #22# --- TrackingId /// #11# --- CareEndedId /// #00# --- HomeVisitId /////////////////////////////////////////////// //ClsObject theCustomManager = new ClsObject(); for (Int32 i = 0; i < theCustomFieldData.Rows.Count; i++) { ClsUtility.Init_Hashtable(); string theQuery = theCustomFieldData.Rows[i]["Query"].ToString(); theQuery = theQuery.Replace("#99#", ht["PatientID"].ToString()); theQuery = theQuery.Replace("#88#", theDT.Rows[0][0].ToString()); theQuery = theQuery.Replace("#11#", CareEndedID.ToString()); theQuery = theQuery.Replace("#22#", TrackingID.ToString()); theQuery = theQuery.Replace("#66#", "'" + ht["txtCareEndDate"].ToString() + "'"); ClsUtility.AddParameters("@QryString", SqlDbType.VarChar, theQuery); int theRowsAffected = (Int32)CareManager.ReturnObject(ClsUtility.theParams, "pr_General_Dynamic_Insert", ClsDBUtility.ObjectEnum.ExecuteNonQuery); } DataMgr.CommitTransaction(this.Transaction); DataMgr.ReleaseConnection(this.Connection); return(theDT); } catch { DataMgr.RollBackTransation(this.Transaction); throw; } finally { CareManager = null; if (this.Connection != null) { DataMgr.ReleaseConnection(this.Connection); } } }
public DataTable SavePharmacyDispense_Web(Int32 PatientId, Int32 LocationId, Int32 StoreId, int OrderedBy, string OrderedByDate, Int32 DispensedBy, string DisensedByDate, Int32 OrderType, Int32 ProgramId, string Regimen, Int32 OrderId, DataTable theDT, DateTime PharmacyRefillDate, Int32 DataStatus, int UserID) { DataTable thePharmacyDT = new DataTable(); try { this.Connection = DataMgr.GetConnection(); this.Transaction = DataMgr.BeginTransaction(this.Connection); ClsObject theManager = new ClsObject(); oUtility.Init_Hashtable(); oUtility.AddParameters("@Ptn_Pk", SqlDbType.Int, PatientId.ToString()); oUtility.AddParameters("@LocationId", SqlDbType.Int, LocationId.ToString()); oUtility.AddParameters("@PrescribedBy", SqlDbType.Int, OrderedBy.ToString()); oUtility.AddParameters("@PrescribedByDate", SqlDbType.DateTime, OrderedByDate == "" ? null : OrderedByDate); oUtility.AddParameters("@DispensedBy", SqlDbType.Int, DispensedBy.ToString()); oUtility.AddParameters("@DispensedByDate", SqlDbType.DateTime, DisensedByDate == "" ? null : DisensedByDate); oUtility.AddParameters("@OrderType", SqlDbType.Int, OrderType.ToString()); oUtility.AddParameters("@ProgramId", SqlDbType.Int, ProgramId.ToString()); oUtility.AddParameters("@StoreId", SqlDbType.Int, StoreId.ToString()); oUtility.AddParameters("@Regimen", SqlDbType.VarChar, Regimen); oUtility.AddParameters("@UserId", SqlDbType.Int, UserID.ToString()); oUtility.AddParameters("@OrderId", SqlDbType.Int, OrderId.ToString()); oUtility.AddParameters("@AppointmentDate", SqlDbType.DateTime, PharmacyRefillDate.ToString()); thePharmacyDT = (DataTable)theManager.ReturnObject(oUtility.theParams, "pr_SCM_SavePharmacyDispenseOrder_Web", ClsUtility.ObjectEnum.DataTable); foreach (DataRow theDR in theDT.Rows) { oUtility.Init_Hashtable(); oUtility.AddParameters("@Ptn_Pk", SqlDbType.Int, PatientId.ToString()); oUtility.AddParameters("@StoreId", SqlDbType.Int, StoreId.ToString()); oUtility.AddParameters("@VisitId", SqlDbType.Int, thePharmacyDT.Rows[0]["VisitId"].ToString()); oUtility.AddParameters("@Ptn_Pharmacy_Pk", SqlDbType.Int, thePharmacyDT.Rows[0]["Ptn_Pharmacy_Pk"].ToString()); oUtility.AddParameters("@Drug_Pk", SqlDbType.Int, theDR["DrugId"].ToString()); oUtility.AddParameters("@MorningDose", SqlDbType.Decimal, theDR["Morning"].ToString()); oUtility.AddParameters("@MiddayDose", SqlDbType.Decimal, theDR["Midday"].ToString()); oUtility.AddParameters("@EveningDose", SqlDbType.Decimal, theDR["Evening"].ToString()); oUtility.AddParameters("@NightDose", SqlDbType.Decimal, theDR["Night"].ToString()); oUtility.AddParameters("@DispensedQuantity", SqlDbType.Int, "0"); oUtility.AddParameters("@Prophylaxis", SqlDbType.Int, theDR["Prophylaxis"].ToString() == "True" ? "1" : "0"); oUtility.AddParameters("@BatchId", SqlDbType.Int, theDR["BatchId"].ToString()); if (theDR["BatchNo"].ToString().Contains("(")) { oUtility.AddParameters("@BatchNo", SqlDbType.VarChar, theDR["BatchNo"].ToString().Substring(0, theDR["BatchNo"].ToString().IndexOf('('))); } else { oUtility.AddParameters("@BatchNo", SqlDbType.VarChar, theDR["BatchNo"].ToString()); } oUtility.AddParameters("@ExpiryDate", SqlDbType.DateTime, theDR["ExpiryDate"].ToString()); oUtility.AddParameters("@DispensingUnit", SqlDbType.Int, theDR["DispensingUnitId"].ToString()); oUtility.AddParameters("@DispensedByDate", SqlDbType.DateTime, DisensedByDate.ToString()); oUtility.AddParameters("@LocationId", SqlDbType.Int, LocationId.ToString()); oUtility.AddParameters("@UserId", SqlDbType.Int, UserID.ToString()); oUtility.AddParameters("@DataStatus", SqlDbType.Int, DataStatus.ToString()); oUtility.AddParameters("@Duration", SqlDbType.Decimal, theDR["Duration"].ToString() != "" ? theDR["Duration"].ToString() : "0"); oUtility.AddParameters("@PrescribeOrderedQuantity", SqlDbType.Decimal, theDR["QtyPrescribed"].ToString() != "" ? theDR["QtyPrescribed"].ToString() : "0"); oUtility.AddParameters("@PillCount", SqlDbType.Decimal, theDR["PillCount"].ToString() != "" ? theDR["PillCount"].ToString() : "0"); oUtility.AddParameters("@PrintPrescriptionStatus", SqlDbType.Int, theDR["PrintPrescriptionStatus"].ToString()); oUtility.AddParameters("@PatientInstructions", SqlDbType.VarChar, theDR["Instructions"].ToString()); oUtility.AddParameters("@Comments", SqlDbType.VarChar, theDR["Comments"].ToString()); Int32 theRowCount = (Int32)theManager.ReturnObject(oUtility.theParams, "pr_SCM_SavePharmacyDispenseOrderDetail_Web", ClsUtility.ObjectEnum.ExecuteNonQuery); //Save details to dtl_PatientPharmacyOrderpartialDispense table if (Convert.ToInt32(theDR["QtyDispensed"].ToString() != "" ? theDR["QtyDispensed"].ToString() : "0") > 0) { oUtility.Init_Hashtable(); oUtility.AddParameters("@ptn_pharmacy_pk", SqlDbType.Int, thePharmacyDT.Rows[0]["Ptn_Pharmacy_Pk"].ToString()); oUtility.AddParameters("@drug_pk", SqlDbType.Int, theDR["DrugId"].ToString()); oUtility.AddParameters("@batchid", SqlDbType.Int, theDR["BatchId"].ToString()); oUtility.AddParameters("@DispensedQuantity", SqlDbType.Decimal, theDR["QtyDispensed"].ToString() != "" ? theDR["QtyDispensed"].ToString() : "0"); oUtility.AddParameters("@DispensedBy", SqlDbType.Int, DispensedBy.ToString()); oUtility.AddParameters("@DispensedByDate", SqlDbType.DateTime, DisensedByDate.ToString()); oUtility.AddParameters("@comments", SqlDbType.Int, theDR["comments"].ToString()); theManager.ReturnObject(oUtility.theParams, "pr_SCM_SavePharmacyPartialDispense_Web", ClsUtility.ObjectEnum.DataTable); } } DataMgr.CommitTransaction(this.Transaction); DataMgr.ReleaseConnection(this.Connection); } catch { DataMgr.RollBackTransation(this.Transaction); throw; } finally { if (this.Connection != null) { DataMgr.ReleaseConnection(this.Connection); } } return(thePharmacyDT); }
public int SaveNewUser(string FName, string LName, string UserName, string Password, string Email, string Phone, int UserId, int Designation, Hashtable UserGroup, Hashtable Store) { ClsObject UserManager = new ClsObject(); try { this.Connection = DataMgr.GetConnection(); this.Transaction = DataMgr.BeginTransaction(this.Connection); UserManager.Connection = this.Connection; UserManager.Transaction = this.Transaction; Utility theUtil = new Utility(); Password = theUtil.Encrypt(Password); ClsUtility.Init_Hashtable(); ClsUtility.AddParameters("@fname", SqlDbType.VarChar, FName); ClsUtility.AddParameters("@lname", SqlDbType.VarChar, LName); ClsUtility.AddParameters("@username", SqlDbType.VarChar, UserName); ClsUtility.AddParameters("@password", SqlDbType.VarChar, Password); ClsUtility.AddParameters("@email", SqlDbType.VarChar, Email); ClsUtility.AddParameters("@phone", SqlDbType.VarChar, Phone); ClsUtility.AddParameters("@userid", SqlDbType.Int, UserId.ToString()); ClsUtility.AddParameters("@Designation", SqlDbType.Int, Designation.ToString()); DataRow theDR; theDR = (DataRow)UserManager.ReturnObject(ClsUtility.theParams, "Pr_Admin_SaveNewUser_Constella", ClsDBUtility.ObjectEnum.DataRow); if (Convert.ToInt32(theDR[0]) == 0) { MsgBuilder theBL = new MsgBuilder(); theBL.DataElements["MessageText"] = "Error in Saving User Record. Try Again.."; AppException.Create("#C1", theBL); return(Convert.ToInt32(theDR[0])); } #region "Insert Groups and Stores" int i = 1; for (i = 1; i <= UserGroup.Count; i++) { ClsUtility.Init_Hashtable(); ClsUtility.AddParameters("@UserId", SqlDbType.Int, theDR[0].ToString()); ClsUtility.AddParameters("@GroupId", SqlDbType.Int, UserGroup[i].ToString()); ClsUtility.AddParameters("@OperatorId", SqlDbType.Int, UserId.ToString()); UserManager.ReturnObject(ClsUtility.theParams, "Pr_Admin_InsertUserGroup_Constella", ClsDBUtility.ObjectEnum.ExecuteNonQuery); } int k = 1; for (k = 1; k <= Store.Count; k++) { ClsUtility.Init_Hashtable(); ClsUtility.AddParameters("@UserId", SqlDbType.Int, theDR[0].ToString()); ClsUtility.AddParameters("@StoreId", SqlDbType.Int, Store[k].ToString()); UserManager.ReturnObject(ClsUtility.theParams, "Pr_Admin_InsertStoreUser_Constella", ClsDBUtility.ObjectEnum.ExecuteNonQuery); } #endregion DataMgr.CommitTransaction(this.Transaction); DataMgr.ReleaseConnection(this.Connection); return(Convert.ToInt32(theDR[0])); } catch { DataMgr.RollBackTransation(this.Transaction); throw; } finally { UserManager = null; if (this.Connection != null) { DataMgr.ReleaseConnection(this.Connection); } } }
public int SaveNewFacility(string FacilityName, string CountryID, string PosID, string SatelliteID, string NationalID, int ProvinceId, int DistrictId, string image, int currency, int AppGracePeriod, string dateformat, DateTime PepFarStartDate, int SystemId, int thePreferred, int Paperless, int UserID, DataTable dtModule, Hashtable ht) { try { this.Connection = DataMgr.GetConnection(); this.Transaction = DataMgr.BeginTransaction(this.Connection); ClsObject FacilityManager = new ClsObject(); FacilityManager.Connection = this.Connection; FacilityManager.Transaction = this.Transaction; ClsUtility.Init_Hashtable(); ClsUtility.AddParameters("@FacilityName", SqlDbType.VarChar, FacilityName); ClsUtility.AddParameters("@CountryID", SqlDbType.VarChar, CountryID.ToString()); ClsUtility.AddParameters("@PosID", SqlDbType.VarChar, PosID.ToString()); ClsUtility.AddParameters("@SatelliteID", SqlDbType.VarChar, SatelliteID.ToString()); ClsUtility.AddParameters("@NationalID", SqlDbType.VarChar, NationalID.ToString()); ClsUtility.AddParameters("@ProvinceId", SqlDbType.Int, ProvinceId.ToString()); ClsUtility.AddParameters("@DistrictId", SqlDbType.Int, DistrictId.ToString()); ClsUtility.AddParameters("@image", SqlDbType.VarChar, image); ClsUtility.AddParameters("@currency", SqlDbType.Int, currency.ToString()); ClsUtility.AddParameters("@AppGracePeriod", SqlDbType.Int, AppGracePeriod.ToString()); ClsUtility.AddParameters("@dateformat", SqlDbType.VarChar, dateformat.ToString()); ClsUtility.AddParameters("@PepFarStartDate", SqlDbType.DateTime, PepFarStartDate.ToString()); ClsUtility.AddParameters("@SystemId", SqlDbType.Int, SystemId.ToString()); ClsUtility.AddParameters("@Preferred", SqlDbType.Int, thePreferred.ToString()); ClsUtility.AddParameters("@Paperless", SqlDbType.Int, Paperless.ToString()); ClsUtility.AddParameters("@UserId", SqlDbType.Int, UserID.ToString()); ClsUtility.AddParameters("@FacilityLogo", SqlDbType.VarChar, ht["FacilityLogo"].ToString()); ClsUtility.AddParameters("@FacilityAddress", SqlDbType.VarChar, ht["FacilityAddress"].ToString()); ClsUtility.AddParameters("@FacilityTel", SqlDbType.VarChar, ht["FacilityTel"].ToString()); ClsUtility.AddParameters("@FacilityCell", SqlDbType.VarChar, ht["FacilityCell"].ToString()); ClsUtility.AddParameters("@FacilityFax", SqlDbType.VarChar, ht["FacilityFax"].ToString()); ClsUtility.AddParameters("@FacilityEmail", SqlDbType.VarChar, ht["FacilityEmail"].ToString()); ClsUtility.AddParameters("@FacilityURL", SqlDbType.VarChar, ht["FacilityURL"].ToString()); ClsUtility.AddParameters("@FacilityFooter", SqlDbType.VarChar, ht["FacilityFootertext"].ToString()); ClsUtility.AddParameters("@FacilityTemplate", SqlDbType.Int, ht["Facilitytemplate"].ToString()); ClsUtility.AddParameters("@StrongPassword", SqlDbType.Int, ht["StrongPassword"].ToString()); ClsUtility.AddParameters("@ExpirePaswordFlag", SqlDbType.Int, ht["ExpirePaswordFlag"].ToString()); ClsUtility.AddParameters("@ExpirePaswordDays", SqlDbType.VarChar, ht["ExpirePaswordDays"].ToString()); ClsUtility.AddParameters("@DateConstraint", SqlDbType.VarChar, ht["DateConstraint"].ToString()); Int32 RowsAffected = (Int32)FacilityManager.ReturnObject(ClsUtility.theParams, "Pr_Admin_InsertFacility_Constella", ClsDBUtility.ObjectEnum.ExecuteNonQuery); if (RowsAffected <= 0) { MsgBuilder theBL = new MsgBuilder(); theBL.DataElements["MessageText"] = "Error in Saving Facility record. Try Again.."; //Exception ex = AppException.Create("#C1", theBL); //throw ex; AppException.Create("#C1", theBL); } if (RowsAffected > 0) { for (int i = 0; i < dtModule.Rows.Count; i++) { ClsUtility.Init_Hashtable(); ClsUtility.AddParameters("@FacilityID", SqlDbType.Int, "99999"); ClsUtility.AddParameters("@ModuleId", SqlDbType.Int, dtModule.Rows[i]["ModuleId"].ToString()); ClsUtility.AddParameters("@UserId", SqlDbType.Int, UserID.ToString()); ClsUtility.AddParameters("@Flag", SqlDbType.Int, "0"); int retval = (int)FacilityManager.ReturnObject(ClsUtility.theParams, "pr_Admin_SaveModule_Futures", ClsDBUtility.ObjectEnum.ExecuteNonQuery); if (RowsAffected < 0) { MsgBuilder theBL = new MsgBuilder(); theBL.DataElements["MessageText"] = "Error in Saving Facility record. Try Again.."; //Exception ex = AppException.Create("#C1", theBL); //throw ex; AppException.Create("#C1", theBL); } } } FacilityManager = null; DataMgr.CommitTransaction(this.Transaction); DataMgr.ReleaseConnection(this.Connection); return(RowsAffected); } catch { throw; } finally { if (this.Connection != null) { DataMgr.ReleaseConnection(this.Connection); } } }
public int SaveHomePageIndicator(DataSet dsSaveIndicatorQuery, string Flag) { int iFeatureId; try { this.Connection = DataMgr.GetConnection(); this.Transaction = DataMgr.BeginTransaction(this.Connection); ClsObject FormDetail = new ClsObject(); FormDetail.Connection = this.Connection; FormDetail.Transaction = this.Transaction; int theRowAffected = 0; DataRow theDR; int iId; oUtility.Init_Hashtable(); oUtility.AddParameters("@FeatureId", SqlDbType.Int, dsSaveIndicatorQuery.Tables[1].Rows[0]["FeatureId"].ToString()); oUtility.AddParameters("@FeatureName", SqlDbType.VarChar, dsSaveIndicatorQuery.Tables[1].Rows[0]["FeatureName"].ToString()); oUtility.AddParameters("@DeleteFlag", SqlDbType.Int, "0"); oUtility.AddParameters("@SystemId", SqlDbType.Int, "0"); oUtility.AddParameters("@UserID", SqlDbType.Int, dsSaveIndicatorQuery.Tables[1].Rows[0]["UserID"].ToString()); oUtility.AddParameters("@Published", SqlDbType.Int, dsSaveIndicatorQuery.Tables[1].Rows[0]["Published"].ToString()); oUtility.AddParameters("@ModuleId", SqlDbType.Int, dsSaveIndicatorQuery.Tables[1].Rows[0]["ModuleId"].ToString()); theDR = (DataRow)FormDetail.ReturnObject(oUtility.theParams, "Pr_FormBuilder_SaveFeature_Futures", ClsUtility.ObjectEnum.DataRow); iFeatureId = System.Convert.ToInt32(theDR[0].ToString()); oUtility.Init_Hashtable(); oUtility.AddParameters("@Id", SqlDbType.Int, dsSaveIndicatorQuery.Tables[2].Rows[0]["Id"].ToString()); oUtility.AddParameters("@Name", SqlDbType.VarChar, dsSaveIndicatorQuery.Tables[2].Rows[0]["Name"].ToString()); oUtility.AddParameters("@FeatureId", SqlDbType.Int, iFeatureId.ToString()); oUtility.AddParameters("@DeleteFlag", SqlDbType.Int, "0"); oUtility.AddParameters("@UserID", SqlDbType.Int, dsSaveIndicatorQuery.Tables[2].Rows[0]["UserId"].ToString()); theDR = (DataRow)FormDetail.ReturnObject(oUtility.theParams, "Pr_FormBuilder_SaveHomePageIndicatorQuery_Futures", ClsUtility.ObjectEnum.DataRow); iId = System.Convert.ToInt32(theDR[0].ToString()); for (int i = 0; i <= dsSaveIndicatorQuery.Tables[0].Rows.Count - 1; i++) { oUtility.Init_Hashtable(); if (Flag == "U") { oUtility.AddParameters("@Id", SqlDbType.Int, dsSaveIndicatorQuery.Tables[0].Rows[i]["Id"].ToString()); } else { oUtility.AddParameters("@Id", SqlDbType.Int, "0"); } oUtility.AddParameters("@HomePageId", SqlDbType.Int, iId.ToString()); oUtility.AddParameters("@IndicatorName", SqlDbType.VarChar, dsSaveIndicatorQuery.Tables[0].Rows[i]["Indicator"].ToString()); oUtility.AddParameters("@Query", SqlDbType.VarChar, dsSaveIndicatorQuery.Tables[0].Rows[i]["Query"].ToString()); oUtility.AddParameters("@Seq", SqlDbType.Int, (i + 1).ToString()); oUtility.AddParameters("@DeleteFlag", SqlDbType.Int, "0"); oUtility.AddParameters("@UserId", SqlDbType.Int, dsSaveIndicatorQuery.Tables[0].Rows[i]["UserId"].ToString()); theRowAffected = (int)FormDetail.ReturnObject(oUtility.theParams, "Pr_FormBuilder_SavedtlHomePageIndicatorQuery_Futures", ClsUtility.ObjectEnum.ExecuteNonQuery); } DataMgr.CommitTransaction(this.Transaction); DataMgr.ReleaseConnection(this.Connection); } catch (Exception err) { DataMgr.RollBackTransation(this.Transaction); throw err; } finally { if (this.Connection != null) { DataMgr.ReleaseConnection(this.Connection); } } return(iFeatureId); }
public int UpdateICDCodeRecord(string Id, Hashtable theHT, ArrayList theAL) { String TableName = "mst_" + theHT["TableName"].ToString(); ClsObject CustomManager = new ClsObject(); try { this.Connection = DataMgr.GetConnection(); CustomManager.Connection = this.Connection; this.Transaction = DataMgr.BeginTransaction(this.Connection); CustomManager.Transaction = this.Transaction; ClsUtility.Init_Hashtable(); ClsUtility.AddParameters("@TableName", SqlDbType.VarChar, TableName); ClsUtility.AddParameters("@Id", SqlDbType.Int, Id.ToString()); ClsUtility.AddParameters("@Name", SqlDbType.VarChar, theHT["Name"].ToString()); ClsUtility.AddParameters("@Code", SqlDbType.VarChar, ""); ClsUtility.AddParameters("@Stage", SqlDbType.VarChar, theHT["Stage"].ToString()); ClsUtility.AddParameters("@DeleteFlag", SqlDbType.Int, theHT["Status"].ToString()); ClsUtility.AddParameters("@Sequence", SqlDbType.Int, theHT["Sequence"].ToString()); ClsUtility.AddParameters("@Category", SqlDbType.Int, theHT["Category"].ToString()); ClsUtility.AddParameters("@UserId", SqlDbType.Int, theHT["UserId"].ToString()); ClsUtility.AddParameters("@SystemId", SqlDbType.Int, theHT["SystemId"].ToString()); ClsUtility.AddParameters("@CID", SqlDbType.Int, theHT["CountryID"].ToString()); Int32 RowsAffected = (Int32)CustomManager.ReturnObject(ClsUtility.theParams, "Pr_Admin_UpdateCustomListMasters_Constella", ClsUtility.ObjectEnum.ExecuteNonQuery); String DiseaseId = Convert.ToString(Id); ClsUtility.Init_Hashtable(); ClsUtility.AddParameters("@DiseaseId", SqlDbType.Int, DiseaseId); ClsUtility.AddParameters("@ICDCodeId", SqlDbType.Int, theHT["ICDCode"].ToString()); ClsUtility.AddParameters("@Validate", SqlDbType.Int, theHT["Validate"].ToString()); if (Convert.ToInt32(theHT["Code"]) == 31) { ClsUtility.AddParameters("@DiseaseFlag", SqlDbType.Int, "1"); } else { ClsUtility.AddParameters("@DiseaseFlag", SqlDbType.Int, "0"); } ClsUtility.AddParameters("@UserId", SqlDbType.Int, theHT["UserId"].ToString()); int RowsAffectedICDCode = (Int32)CustomManager.ReturnObject(ClsUtility.theParams, "Pr_Admin_UpdateCustomMastersLinkICDCodes_Constella", ClsUtility.ObjectEnum.ExecuteNonQuery); int CountFlag = 0; foreach (String AR in theAL) { ClsUtility.Init_Hashtable(); ClsUtility.AddParameters("@DiseaseId", SqlDbType.Int, DiseaseId); ClsUtility.AddParameters("@CountFlag", SqlDbType.Int, CountFlag.ToString()); ClsUtility.AddParameters("@ModuleId", SqlDbType.Int, AR); ClsUtility.AddParameters("@ICDCodeId", SqlDbType.Int, theHT["ICDCode"].ToString()); if (Convert.ToInt32(theHT["Code"]) == 31) { ClsUtility.AddParameters("@DiseaseFlag", SqlDbType.Int, "1"); } else { ClsUtility.AddParameters("@DiseaseFlag", SqlDbType.Int, "0"); } ClsUtility.AddParameters("@UserId", SqlDbType.Int, theHT["UserId"].ToString()); int RowsAffectedModuleICDCode = (Int32)CustomManager.ReturnObject(ClsUtility.theParams, "Pr_Admin_UpdateCustomMastersLinkModuleICDCodes_Constella", ClsUtility.ObjectEnum.ExecuteNonQuery); CountFlag++; } DataMgr.CommitTransaction(this.Transaction); return(RowsAffectedICDCode); } catch { DataMgr.RollBackTransation(this.Transaction); throw; } finally { CustomManager = null; if (this.Connection != null) { DataMgr.ReleaseConnection(this.Connection); } } }
public int SaveFormDetail(DataSet dsSaveFormData, DataTable dtFieldDetails, DataTable dtbusinessRules, DataSet DSFormVer) { //try //{ this.Connection = DataMgr.GetConnection(); this.Transaction = DataMgr.BeginTransaction(this.Connection); ClsObject FormDetail = new ClsObject(); FormDetail.Connection = this.Connection; FormDetail.Transaction = this.Transaction; int theRowAffected = 0; DataRow theDR; int iFeatureId; int iRegFlag; string Pharmacy = ""; string FeatureName = ""; int iSectionId; string strTableName = string.Empty; //save mst_feature data ClsUtility.Init_Hashtable(); if (dsSaveFormData.Tables[0].Rows[0]["InsertUpdateStatus"].ToString() == "I") { ClsUtility.AddParameters("@FeatureId", SqlDbType.Int, "0"); } else { ClsUtility.AddParameters("@FeatureId", SqlDbType.Int, dsSaveFormData.Tables[0].Rows[0]["FeatureId"].ToString()); } ClsUtility.AddParameters("@FeatureName", SqlDbType.VarChar, dsSaveFormData.Tables[0].Rows[0]["FeatureName"].ToString().Replace("'", "")); ClsUtility.AddParameters("@ReportFlag", SqlDbType.Int, dsSaveFormData.Tables[0].Rows[0]["ReportFlag"].ToString()); ClsUtility.AddParameters("@DeleteFlag", SqlDbType.Int, dsSaveFormData.Tables[0].Rows[0]["DeleteFlag"].ToString()); ClsUtility.AddParameters("@AdminFlag", SqlDbType.Int, dsSaveFormData.Tables[0].Rows[0]["AdminFlag"].ToString()); //ClsUtility.AddParameters("@OptionalFlag", SqlDbType.Int, dsSaveFormData.Tables[0].Rows[0]["OptionalFlag"].ToString()); ClsUtility.AddParameters("@SystemId", SqlDbType.Int, dsSaveFormData.Tables[0].Rows[0]["SystemId"].ToString()); ClsUtility.AddParameters("@UserID", SqlDbType.Int, dsSaveFormData.Tables[0].Rows[0]["UserID"].ToString()); ClsUtility.AddParameters("@Published", SqlDbType.Int, dsSaveFormData.Tables[0].Rows[0]["Published"].ToString()); ClsUtility.AddParameters("@CountryId", SqlDbType.Int, dsSaveFormData.Tables[0].Rows[0]["CountryId"].ToString()); ClsUtility.AddParameters("@ModuleId", SqlDbType.Int, dsSaveFormData.Tables[0].Rows[0]["ModuleId"].ToString()); ClsUtility.AddParameters("@MultiVisit", SqlDbType.Int, dsSaveFormData.Tables[0].Rows[0]["MultiVisit"].ToString()); //theDR = (DataRow)FormDetail.ReturnObject(ClsUtility.theParams, "Pr_PMTCT_SaveMstFeature_Futures", ClsDBUtility.ObjectEnum.DataRow); theDR = (DataRow)FormDetail.ReturnObject(ClsUtility.theParams, "Pr_FormBuilder_SaveMstFeature_Futures", ClsDBUtility.ObjectEnum.DataRow); iFeatureId = System.Convert.ToInt32(theDR[0].ToString()); iRegFlag = System.Convert.ToInt32(theDR[2].ToString()); Pharmacy = theDR[1].ToString(); if (iFeatureId != 0) { if (dtbusinessRules.Rows.Count == 0) { ClsUtility.Init_Hashtable(); ClsUtility.AddParameters("@FeatureId", SqlDbType.Int, iFeatureId.ToString()); ClsUtility.AddParameters("@BusRuleid", SqlDbType.Int, "1"); ClsUtility.AddParameters("@value", SqlDbType.Int, "1"); ClsUtility.AddParameters("@value1", SqlDbType.Int, "1"); ClsUtility.AddParameters("@UserID", SqlDbType.Int, "1"); ClsUtility.AddParameters("@setType", SqlDbType.Int, "1"); ClsUtility.AddParameters("@counter", SqlDbType.Int, "0"); theRowAffected = (int)FormDetail.ReturnObject(ClsUtility.theParams, "pr_FormBuilder_DeleteFormBusinessRules", ClsDBUtility.ObjectEnum.ExecuteNonQuery); } for (int i = 0; i < dtbusinessRules.Rows.Count; i++) { ClsUtility.Init_Hashtable(); ClsUtility.AddParameters("@FeatureId", SqlDbType.Int, iFeatureId.ToString()); ClsUtility.AddParameters("@BusRuleid", SqlDbType.Int, dtbusinessRules.Rows[i]["BusRuleId"].ToString()); ClsUtility.AddParameters("@value", SqlDbType.Int, dtbusinessRules.Rows[i]["Value"].ToString()); ClsUtility.AddParameters("@value1", SqlDbType.Int, dtbusinessRules.Rows[i]["Value1"].ToString()); ClsUtility.AddParameters("@UserID", SqlDbType.Int, dsSaveFormData.Tables[0].Rows[0]["UserID"].ToString()); ClsUtility.AddParameters("@setType", SqlDbType.Int, dtbusinessRules.Rows[i]["SetType"].ToString()); ClsUtility.AddParameters("@counter", SqlDbType.Int, i.ToString()); theRowAffected = (int)FormDetail.ReturnObject(ClsUtility.theParams, "pr_FormBuilder_SaveUpdateFormBusinessRules", ClsDBUtility.ObjectEnum.ExecuteNonQuery); } } string[] strFeatureName = new string[10]; strFeatureName = dsSaveFormData.Tables[0].Rows[0]["FeatureName"].ToString().Split(' '); for (int j = 0; j < strFeatureName.Length; j++) { if (j > 0) { strTableName += "_" + strFeatureName[j]; } else { strTableName += strFeatureName[j]; } } FeatureName = strTableName; strTableName = "DTL_FBCUSTOMFIELD_" + strTableName; //save mst_section data //foreach (DataRow drFormData in dsSaveFormData.Tables[1]) for (int i = 0; i < dsSaveFormData.Tables[1].Rows.Count; i++) { if (dsSaveFormData.Tables[1].Rows[i]["DeleteFlag"].ToString() == "0") { ClsUtility.Init_Hashtable(); ClsUtility.AddParameters("@SectionId", SqlDbType.Int, dsSaveFormData.Tables[1].Rows[i]["SectionId"].ToString()); ClsUtility.AddParameters("@SectionName", SqlDbType.VarChar, dsSaveFormData.Tables[1].Rows[i]["SectionName"].ToString()); ClsUtility.AddParameters("@Seq", SqlDbType.Int, dsSaveFormData.Tables[1].Rows[i]["Sequence"].ToString()); ClsUtility.AddParameters("@CustomFlag", SqlDbType.Int, dsSaveFormData.Tables[1].Rows[i]["CustomFlag"].ToString()); ClsUtility.AddParameters("@DeleteFlag", SqlDbType.Int, dsSaveFormData.Tables[1].Rows[i]["DeleteFlag"].ToString()); ClsUtility.AddParameters("@UserID", SqlDbType.Int, dsSaveFormData.Tables[1].Rows[i]["UserId"].ToString()); //ClsUtility.AddParameters("@FeatureId", SqlDbType.Int, dsSaveFormData.Tables[1].Rows[i]["FeatureId"].ToString()); ClsUtility.AddParameters("@FeatureId", SqlDbType.Int, iFeatureId.ToString()); ClsUtility.AddParameters("@IsGridView", SqlDbType.Int, dsSaveFormData.Tables[1].Rows[i]["IsGridView"].ToString()); //theDR = (DataRow)FormDetail.ReturnObject(ClsUtility.theParams, "Pr_PMTCT_SaveMstSection_Futures", ClsDBUtility.ObjectEnum.DataRow); theDR = (DataRow)FormDetail.ReturnObject(ClsUtility.theParams, "Pr_FormBuilder_SaveMstSection_Futures", ClsDBUtility.ObjectEnum.DataRow); } } //save lnk_form data //foreach (DataRow drFormData in dsSaveFormData.Tables[2]) for (int i = 0; i < dsSaveFormData.Tables[2].Rows.Count; i++) { ClsUtility.Init_Hashtable(); ClsUtility.AddParameters("@Id", SqlDbType.Int, dsSaveFormData.Tables[2].Rows[i]["Id"].ToString()); ClsUtility.AddParameters("@FeatureId", SqlDbType.Int, iFeatureId.ToString()); //ClsUtility.AddParameters("@FeatureId", SqlDbType.Int, dsSaveFormData.Tables[2].Rows[i]["FeatureId"].ToString()); if (Pharmacy.Contains("Pharmacy_") && iRegFlag == 2 && Convert.ToInt32(dsSaveFormData.Tables[2].Rows[i]["SectionId"]) == 0) { ClsUtility.AddParameters("@SectionId", SqlDbType.Int, theDR[0].ToString()); } else { ClsUtility.AddParameters("@SectionId", SqlDbType.Int, dsSaveFormData.Tables[2].Rows[i]["SectionId"].ToString()); } ClsUtility.AddParameters("@FieldId", SqlDbType.Int, dsSaveFormData.Tables[2].Rows[i]["FieldId"].ToString()); ClsUtility.AddParameters("@FieldLabel", SqlDbType.VarChar, dsSaveFormData.Tables[2].Rows[i]["FieldLabel"].ToString()); ClsUtility.AddParameters("@AdditionalInformation", SqlDbType.VarChar, dsSaveFormData.Tables[2].Rows[i]["AdditionalInformation"].ToString()); ClsUtility.AddParameters("@Seq", SqlDbType.Int, dsSaveFormData.Tables[2].Rows[i]["Sequence"].ToString()); ClsUtility.AddParameters("@UserID", SqlDbType.Int, dsSaveFormData.Tables[2].Rows[i]["UserId"].ToString()); ClsUtility.AddParameters("@Predefined", SqlDbType.Int, dsSaveFormData.Tables[2].Rows[i]["Predefined"].ToString()); //theRowAffected = (int)FormDetail.ReturnObject(ClsUtility.theParams, "Pr_PMTCT_SaveLnkForm_Futures", ClsDBUtility.ObjectEnum.ExecuteNonQuery); theRowAffected = (int)FormDetail.ReturnObject(ClsUtility.theParams, "Pr_FormBuilder_SaveLnkForm_Futures", ClsDBUtility.ObjectEnum.ExecuteNonQuery); DataView dvFilteredRow = new DataView(); dvFilteredRow = dtFieldDetails.DefaultView; DataTable dtRow = new DataTable(); if (dsSaveFormData.Tables[2].Rows[i]["FieldId"].ToString() == "71" && dsSaveFormData.Tables[2].Rows[i]["Predefined"].ToString() == "1") { dvFilteredRow.RowFilter = "ID='71' and predefine=" + dsSaveFormData.Tables[2].Rows[i]["Predefined"].ToString(); } else { dvFilteredRow.RowFilter = "ID='" + dsSaveFormData.Tables[2].Rows[i]["FieldId"].ToString() + "' and predefine=" + dsSaveFormData.Tables[2].Rows[i]["Predefined"].ToString(); } dtRow = dvFilteredRow.ToTable(); /* ----------Added by Paritosh -Implementing Grid View------------*/ DataView dvFilteredRowGridView = new DataView(); dvFilteredRowGridView = dsSaveFormData.Tables[1].DefaultView; dvFilteredRowGridView.RowFilter = "SectionId = " + dsSaveFormData.Tables[2].Rows[i]["SectionId"].ToString(); if (dvFilteredRowGridView[0]["IsGridView"].ToString() == "1") { string strTableNameSection = "DTL_CUSTOMFORM_" + dvFilteredRowGridView[0]["SectionName"].ToString() + "_" + FeatureName; ClsUtility.Init_Hashtable(); ClsUtility.AddParameters("@TableName", SqlDbType.VarChar, strTableNameSection); ClsUtility.AddParameters("@FieldName", SqlDbType.VarChar, dtRow.Rows[0]["FieldName"].ToString()); ClsUtility.AddParameters("@DataType", SqlDbType.Int, dtRow.Rows[0]["ControlId"].ToString()); ClsUtility.AddParameters("@FieldId", SqlDbType.Int, dsSaveFormData.Tables[2].Rows[i]["FieldId"].ToString()); theRowAffected = (int)FormDetail.ReturnObject(ClsUtility.theParams, "Pr_FormBuilder_CustomTableCreationGridView_Futures", ClsDBUtility.ObjectEnum.ExecuteNonQuery); } /* ---------- end ------------*/ if (dsSaveFormData.Tables[2].Rows[i]["FieldId"].ToString() != "71" && dsSaveFormData.Tables[2].Rows[i]["Predefined"].ToString() != "1") { ClsUtility.Init_Hashtable(); ClsUtility.AddParameters("@TableName", SqlDbType.VarChar, strTableName); ClsUtility.AddParameters("@FieldName", SqlDbType.VarChar, dtRow.Rows[0]["FieldName"].ToString()); ClsUtility.AddParameters("@DataType", SqlDbType.Int, dtRow.Rows[0]["ControlId"].ToString()); ClsUtility.AddParameters("@Predefined", SqlDbType.Int, dsSaveFormData.Tables[2].Rows[i]["Predefined"].ToString()); ClsUtility.AddParameters("@FieldId", SqlDbType.Int, dsSaveFormData.Tables[2].Rows[i]["FieldId"].ToString()); //theRowAffected = (int)FormDetail.ReturnObject(ClsUtility.theParams, "Pr_PMTCT_CustomTableCreation_Futures", ClsDBUtility.ObjectEnum.ExecuteNonQuery); theRowAffected = (int)FormDetail.ReturnObject(ClsUtility.theParams, "Pr_FormBuilder_CustomTableCreation_Futures", ClsDBUtility.ObjectEnum.ExecuteNonQuery); } /* if (dsSaveFormData.Tables[2].Rows[i]["FieldId"].ToString() != "71" && dsSaveFormData.Tables[2].Rows[i]["Predefined"].ToString() != "0") * { * ClsUtility.Init_Hashtable(); * ClsUtility.AddParameters("@TableName", SqlDbType.VarChar, strTableName); * ClsUtility.AddParameters("@FieldName", SqlDbType.VarChar, dtRow.Rows[0]["FieldName"].ToString()); * ClsUtility.AddParameters("@DataType", SqlDbType.Int, dtRow.Rows[0]["ControlId"].ToString()); * ClsUtility.AddParameters("@Predefined", SqlDbType.Int, dsSaveFormData.Tables[2].Rows[i]["Predefined"].ToString()); * ClsUtility.AddParameters("@FieldId", SqlDbType.Int, dsSaveFormData.Tables[2].Rows[i]["FieldId"].ToString()); * theRowAffected = (int)FormDetail.ReturnObject(ClsUtility.theParams, "Pr_FormBuilder_CustomTableCreation_Futures", ClsDBUtility.ObjectEnum.ExecuteNonQuery); * }*/ } //Delete fields selected from remove field in formbuilder while in update mode for (int i = 0; i < dsSaveFormData.Tables[3].Rows.Count; i++) { string Tblname; if (iFeatureId == 126) { Tblname = strTableName; } else if (iFeatureId == System.Convert.ToInt32(dsSaveFormData.Tables[0].Rows[0]["FeatureId"]) && iRegFlag == 2) { Tblname = strTableName; } else { if (dsSaveFormData.Tables[3].Rows[i]["IsGridView"].ToString() == "1") { Tblname = "DTL_CUSTOMFORM_" + dsSaveFormData.Tables[3].Rows[i]["SectionName"].ToString() + "_" + FeatureName; } else { Tblname = strTableName; } } ClsUtility.Init_Hashtable(); ClsUtility.AddParameters("@Id", SqlDbType.Int, dsSaveFormData.Tables[3].Rows[i]["Id"].ToString()); ClsUtility.AddParameters("@FieldName", SqlDbType.VarChar, dsSaveFormData.Tables[3].Rows[i]["FieldName"].ToString()); ClsUtility.AddParameters("@TableName", SqlDbType.VarChar, Tblname); //theRowAffected = (int)FormDetail.ReturnObject(ClsUtility.theParams, "Pr_PMTCT_RemoveFieldInFormBuilder_Futures", ClsDBUtility.ObjectEnum.ExecuteNonQuery); theRowAffected = (int)FormDetail.ReturnObject(ClsUtility.theParams, "Pr_FormBuilder_RemoveFieldInFormBuilder_Futures", ClsDBUtility.ObjectEnum.ExecuteNonQuery); } //Delete sections selected from remove section in formbuilder while in update mode if (dsSaveFormData.Tables.Count > 4) { if (dsSaveFormData.Tables.Contains("MstTab"))// || dsSaveFormData.Tables[5].TableName == "MstTab") { for (int i = 0; i < dsSaveFormData.Tables["MstTab"].Rows.Count; i++) { ClsUtility.Init_Hashtable(); ClsUtility.AddParameters("@TabID", SqlDbType.Int, dsSaveFormData.Tables["MstTab"].Rows[i]["TabID"].ToString()); ClsUtility.AddParameters("@FeatureId", SqlDbType.Int, iFeatureId.ToString()); ClsUtility.AddParameters("@TabName", SqlDbType.VarChar, dsSaveFormData.Tables["MstTab"].Rows[i]["TabName"].ToString()); ClsUtility.AddParameters("@Seq", SqlDbType.Int, dsSaveFormData.Tables["MstTab"].Rows[i]["seq"].ToString()); ClsUtility.AddParameters("@Signature", SqlDbType.Int, dsSaveFormData.Tables["MstTab"].Rows[i]["Signature"].ToString()); ClsUtility.AddParameters("@UserID", SqlDbType.Int, dsSaveFormData.Tables["MstTab"].Rows[i]["UserId"].ToString()); theRowAffected = (int)FormDetail.ReturnObject(ClsUtility.theParams, "Pr_FormBuilder_SaveMstTab_Futures", ClsDBUtility.ObjectEnum.ExecuteNonQuery); } } if (dsSaveFormData.Tables.Contains("LnkSectionTab"))// || dsSaveFormData.Tables[6].TableName == "LnkSectionTab") { for (int i = 0; i < dsSaveFormData.Tables["LnkSectionTab"].Rows.Count; i++) { ClsUtility.Init_Hashtable(); ClsUtility.AddParameters("@ID", SqlDbType.Int, dsSaveFormData.Tables["LnkSectionTab"].Rows[i]["ID"].ToString()); ClsUtility.AddParameters("@TabID", SqlDbType.Int, dsSaveFormData.Tables["LnkSectionTab"].Rows[i]["TabID"].ToString()); ClsUtility.AddParameters("@SectionId", SqlDbType.Int, dsSaveFormData.Tables["LnkSectionTab"].Rows[i]["SectionId"].ToString()); ClsUtility.AddParameters("@UserID", SqlDbType.Int, dsSaveFormData.Tables["LnkSectionTab"].Rows[i]["UserId"].ToString()); ClsUtility.AddParameters("@FeatureId", SqlDbType.Int, iFeatureId.ToString()); theRowAffected = (int)FormDetail.ReturnObject(ClsUtility.theParams, "Pr_FormBuilder_SaveLnkTabSection_Futures", ClsDBUtility.ObjectEnum.ExecuteNonQuery); } } if (dsSaveFormData.Tables.Contains("DeleteSection")) { for (int i = 0; i < dsSaveFormData.Tables["DeleteSection"].Rows.Count; i++) { ClsUtility.Init_Hashtable(); ClsUtility.AddParameters("@SectionId", SqlDbType.Int, dsSaveFormData.Tables["DeleteSection"].Rows[i]["SectionId"].ToString()); ClsUtility.AddParameters("@FeatureId", SqlDbType.Int, iFeatureId.ToString()); ClsUtility.AddParameters("@TableName", SqlDbType.VarChar, strTableName); //theRowAffected = (int)FormDetail.ReturnObject(ClsUtility.theParams, "Pr_PMTCT_RemoveSectionAndFieldInFormBuilder_Futures", ClsDBUtility.ObjectEnum.ExecuteNonQuery); theRowAffected = (int)FormDetail.ReturnObject(ClsUtility.theParams, "Pr_FormBuilder_RemoveSectionAndFieldInFormBuilder_Futures", ClsDBUtility.ObjectEnum.ExecuteNonQuery); } } if (dsSaveFormData.Tables.Contains("DeleteTab")) { for (int i = 0; i < dsSaveFormData.Tables["DeleteTab"].Rows.Count; i++) { ClsUtility.Init_Hashtable(); ClsUtility.AddParameters("@TabID", SqlDbType.Int, dsSaveFormData.Tables["DeleteTab"].Rows[i]["TabId"].ToString()); ClsUtility.AddParameters("@FeatureId", SqlDbType.Int, iFeatureId.ToString()); theRowAffected = (int)FormDetail.ReturnObject(ClsUtility.theParams, "Pr_FormBuilder_RemoveTabInFormBuilder_Futures", ClsDBUtility.ObjectEnum.ExecuteNonQuery); } } } if (object.Equals(DSFormVer, null) == false && DSFormVer.Tables.Count > 0) { ///Save Update Form Version Masters if (DSFormVer.Tables[0].Rows.Count > 0) { ClsUtility.Init_Hashtable(); ClsUtility.AddParameters("@VerId", SqlDbType.Int, DSFormVer.Tables[0].Rows[0]["VerId"].ToString()); ClsUtility.AddParameters("@VersionName", SqlDbType.Decimal, DSFormVer.Tables[0].Rows[0]["VersionName"].ToString()); ClsUtility.AddParameters("@VersionDate", SqlDbType.VarChar, String.Format("{0:dd-MMM-yyyy}", DSFormVer.Tables[0].Rows[0]["VersionDate"]).ToString()); ClsUtility.AddParameters("@FeatureId", SqlDbType.Int, iFeatureId.ToString()); ClsUtility.AddParameters("@UserId", SqlDbType.Int, DSFormVer.Tables[0].Rows[0]["UserId"].ToString()); ClsUtility.AddParameters("@PaperVersion", SqlDbType.VarChar, DSFormVer.Tables[0].Rows[0]["PaperVersion"].ToString()); DataRow theDRVer = (DataRow)FormDetail.ReturnObject(ClsUtility.theParams, "Pr_FormBuilder_SaveFormVersion_Futures", ClsDBUtility.ObjectEnum.DataRow); if (DSFormVer.Tables[1].Rows.Count > 0 && theDRVer.ItemArray.Any()) { foreach (DataRow theDRdetails in DSFormVer.Tables[1].Rows) { ClsUtility.Init_Hashtable(); ClsUtility.AddParameters("@VerId", SqlDbType.Int, theDRVer["VersionId"].ToString()); ClsUtility.AddParameters("@TabId", SqlDbType.Decimal, theDRdetails["TabId"].ToString()); ClsUtility.AddParameters("@FunctionId", SqlDbType.Int, theDRdetails["FunctionId"].ToString()); ClsUtility.AddParameters("@FeatureId", SqlDbType.Int, iFeatureId.ToString()); ClsUtility.AddParameters("@UserId", SqlDbType.Int, DSFormVer.Tables[0].Rows[0]["UserId"].ToString()); theRowAffected = (int)FormDetail.ReturnObject(ClsUtility.theParams, "Pr_FormBuilder_SaveFormVersionDetails_Futures", ClsDBUtility.ObjectEnum.ExecuteNonQuery); } } if (DSFormVer.Tables[2].Rows.Count > 0 && theDRVer.ItemArray.Any()) { foreach (DataRow theDRdetails in DSFormVer.Tables[2].Rows) { ClsUtility.Init_Hashtable(); ClsUtility.AddParameters("@VerId", SqlDbType.Int, theDRVer["VersionId"].ToString()); ClsUtility.AddParameters("@TabId", SqlDbType.Decimal, theDRdetails["TabId"].ToString()); ClsUtility.AddParameters("@SectionId", SqlDbType.Decimal, theDRdetails["SectionId"].ToString()); ClsUtility.AddParameters("@FunctionId", SqlDbType.Int, theDRdetails["FunctionId"].ToString()); ClsUtility.AddParameters("@FeatureId", SqlDbType.Int, iFeatureId.ToString()); ClsUtility.AddParameters("@UserId", SqlDbType.Int, DSFormVer.Tables[0].Rows[0]["UserId"].ToString()); theRowAffected = (int)FormDetail.ReturnObject(ClsUtility.theParams, "Pr_FormBuilder_SaveFormVersionDetails_Futures", ClsDBUtility.ObjectEnum.ExecuteNonQuery); } } if (DSFormVer.Tables[3].Rows.Count > 0 && theDRVer.ItemArray.Any()) { foreach (DataRow theDRdetails in DSFormVer.Tables[3].Rows) { ClsUtility.Init_Hashtable(); ClsUtility.AddParameters("@VerId", SqlDbType.Int, theDRVer["VersionId"].ToString()); ClsUtility.AddParameters("@TabId", SqlDbType.Decimal, theDRdetails["TabId"].ToString()); ClsUtility.AddParameters("@SectionId", SqlDbType.Decimal, theDRdetails["SectionId"].ToString()); ClsUtility.AddParameters("@FieldId", SqlDbType.Decimal, theDRdetails["FieldId"].ToString()); ClsUtility.AddParameters("@FunctionId", SqlDbType.Int, theDRdetails["FunctionId"].ToString()); ClsUtility.AddParameters("@FeatureId", SqlDbType.Int, iFeatureId.ToString()); ClsUtility.AddParameters("@UserId", SqlDbType.Int, DSFormVer.Tables[0].Rows[0]["UserId"].ToString()); theRowAffected = (int)FormDetail.ReturnObject(ClsUtility.theParams, "Pr_FormBuilder_SaveFormVersionDetails_Futures", ClsDBUtility.ObjectEnum.ExecuteNonQuery); } } } } DataMgr.CommitTransaction(this.Transaction); DataMgr.ReleaseConnection(this.Connection); return(iFeatureId); // } //catch //{ // DataMgr.RollBackTransation(this.Transaction); // throw; //} //finally //{ // if (this.Connection != null) // DataMgr.ReleaseConnection(this.Connection); //} }
//Saving and Updating public int Save_Update_FollowUP(int patientID, int VisitID, int LocationID, Hashtable ht, DataSet theDS_ARTFU, int VisitIE, int rdoARVSideEffectsNone, int rdoARVSideEffectsNotDocumented, int rdoOIsAIDsIllnessNone, int rdoOIsAIDsIllnessNotDocumented, int userID, Boolean Save, Boolean Update, DateTime createDate, int DataQualityFlag, DataTable theCustomFieldData) { int retval = 0; ClsObject FollowupManager = new ClsObject(); try { this.Connection = DataMgr.GetConnection(); this.Transaction = DataMgr.BeginTransaction(this.Connection); FollowupManager.Connection = this.Connection; FollowupManager.Transaction = this.Transaction; ClsUtility.Init_Hashtable(); ClsUtility.AddParameters("@patientid", SqlDbType.Int, patientID.ToString()); ClsUtility.AddParameters("@locationid", SqlDbType.Int, LocationID.ToString()); ClsUtility.AddParameters("@HIVvisitdate", SqlDbType.DateTime, ht["Visitdate"].ToString()); ClsUtility.AddParameters("@PrevARVsCD4", SqlDbType.Int, ht["txtpriorARVsFU"].ToString()); ClsUtility.AddParameters("@PrevARVsCD4Date", SqlDbType.DateTime, ht["txtpriorARVsCD4DateFU"].ToString()); ClsUtility.AddParameters("@VisitID_IE", SqlDbType.DateTime, VisitIE.ToString()); ClsUtility.AddParameters("@Visit_typeID", SqlDbType.Int, ht["VisittypeIDFU"].ToString()); ClsUtility.AddParameters("@Pregnant", SqlDbType.Int, ht["Pregnant"].ToString()); ClsUtility.AddParameters("@Delivered", SqlDbType.VarChar, ht["Delivered"].ToString()); ClsUtility.AddParameters("@DelDate", SqlDbType.VarChar, ht["DelDate"].ToString()); ClsUtility.AddParameters("@EDDDate", SqlDbType.VarChar, ht["EDDDate"].ToString()); ClsUtility.AddParameters("@lmp", SqlDbType.DateTime, ht["LMPdate"].ToString()); ClsUtility.AddParameters("@MissedLastWeek", SqlDbType.Int, ht["DosesMissedLastWeek"].ToString()); ClsUtility.AddParameters("@MissedLastMonth", SqlDbType.Int, ht["DosesMissedLastMonth"].ToString()); ClsUtility.AddParameters("@NumDOTPerWeek", SqlDbType.Int, ht["NumDOTPerWeek"].ToString()); ClsUtility.AddParameters("@NumHomeVisitsPerWeek", SqlDbType.Int, ht["NumHomeVisitsPerWeek"].ToString()); ClsUtility.AddParameters("@SupportGroup", SqlDbType.Bit, ht["SupportGroup"].ToString()); ClsUtility.AddParameters("@InterruptedDate", SqlDbType.DateTime, ht["InterruptedDate"].ToString()); ClsUtility.AddParameters("@InterruptedNumDays", SqlDbType.Int, ht["InterruptedNumDays"].ToString()); ClsUtility.AddParameters("@StoppedDate", SqlDbType.DateTime, ht["stoppedDate"].ToString()); ClsUtility.AddParameters("@StoppedNumDays", SqlDbType.Int, ht["stoppedNumDays"].ToString()); ClsUtility.AddParameters("@HerbalMeds", SqlDbType.Bit, ht["HerbalMeds"].ToString()); ClsUtility.AddParameters("@Temp", SqlDbType.Decimal, ht["physTemp"].ToString()); ClsUtility.AddParameters("@RR", SqlDbType.Decimal, ht["physRR"].ToString()); ClsUtility.AddParameters("@HR", SqlDbType.Decimal, ht["physHR"].ToString()); ClsUtility.AddParameters("@BPDiastolic", SqlDbType.Decimal, ht["physBPDiastolic"].ToString()); ClsUtility.AddParameters("@BPSystolic", SqlDbType.Decimal, ht["physBPSystolic"].ToString()); ClsUtility.AddParameters("@Height", SqlDbType.Int, ht["physHeight"].ToString()); ClsUtility.AddParameters("@Weight", SqlDbType.Decimal, ht["physWeight"].ToString()); ClsUtility.AddParameters("@Pain", SqlDbType.Int, ht["physExamPain"].ToString()); ClsUtility.AddParameters("@WHOStage", SqlDbType.Int, ht["phyWHOstage"].ToString()); ClsUtility.AddParameters("@WABStage", SqlDbType.Int, ht["physWABStage"].ToString()); ClsUtility.AddParameters("@ARVtherapyPlan", SqlDbType.Int, ht["ARVtherapyplan"].ToString()); ClsUtility.AddParameters("@ARTEnddate", SqlDbType.DateTime, ht["ARTEndDate"].ToString()); ClsUtility.AddParameters("@ARVTHerapyReasonCode", SqlDbType.Int, ht["ArvTherapyReasonCode"].ToString()); ClsUtility.AddParameters("@TherapyOther", SqlDbType.Int, ht["ARVTherapyReasonOther"].ToString()); ClsUtility.AddParameters("@AppExist", SqlDbType.VarChar, ht["AppExist"].ToString()); ClsUtility.AddParameters("@VisitIDApp", SqlDbType.VarChar, Convert.ToString(ht["VisitIDApp"])); ClsUtility.AddParameters("@appdate", SqlDbType.VarChar, Convert.ToString(ht["appdate"])); ClsUtility.AddParameters("@appreason", SqlDbType.VarChar, Convert.ToString(ht["appreason"])); ClsUtility.AddParameters("@employeeID", SqlDbType.BigInt, ht["Signatureid"].ToString()); ClsUtility.AddParameters("@signatureid", SqlDbType.BigInt, ht["Signatureid"].ToString()); ClsUtility.AddParameters("@UserID", SqlDbType.Int, userID.ToString()); ClsUtility.AddParameters("@dataquality", SqlDbType.Int, DataQualityFlag.ToString()); ClsUtility.AddParameters("@plannotes", SqlDbType.VarChar, ht["PlanNote"].ToString()); ClsUtility.AddParameters("@Visit_pkID", SqlDbType.Int, VisitID.ToString()); //Ajay Kumar-05-Jan-2010 Begin //Clinical note added ClsUtility.AddParameters("@ClinicalNotes", SqlDbType.VarChar, ht["ClinicalNotes"].ToString()); //Ajay Kumar-05-Jan-2010 End ClsUtility.AddParameters("@Flag", SqlDbType.Int, ht["Flag"].ToString()); int retvalother = (int)FollowupManager.ReturnObject(ClsUtility.theParams, "pr_Clinical_SaveUpdateFollowUp_Constella", ClsUtility.ObjectEnum.ExecuteNonQuery); //if (Save == true) //{ // int retvalother = (int)FollowupManager.ReturnObject(ClsUtility.theParams, "pr_Clinical_SaveFollowUp_Constella", ClsUtility.ObjectEnum.ExecuteNonQuery); //} //else if (Update == true) //{ // int retvalother = (int)FollowupManager.ReturnObject(ClsUtility.theParams, "pr_Clinical_UpdateFollowUP_Constella", ClsUtility.ObjectEnum.ExecuteNonQuery); //} /*Appointment Status*/ //Updating Most Recent EmployeeID for appointment if (Convert.ToInt32(ht["AppExist"].ToString()) == 1) { ClsUtility.Init_Hashtable(); ClsUtility.AddParameters("@patientid", SqlDbType.Int, patientID.ToString()); ClsUtility.AddParameters("@locationid", SqlDbType.Int, LocationID.ToString()); ClsUtility.AddParameters("@Visit_pkAppID", SqlDbType.Int, VisitID.ToString()); ClsUtility.AddParameters("@signatureid", SqlDbType.BigInt, ht["Signatureid"].ToString()); int RowsAffected = (int)FollowupManager.ReturnObject(ClsUtility.theParams, "pr_Clinical_UpdateIEAppointmentSignature_Constella", ClsUtility.ObjectEnum.ExecuteNonQuery); } /* Reason Missed */ if (Update == true) { ////////Delete Statement //////ClsUtility.Init_Hashtable(); //////ClsUtility.AddParameters("@Visit_pkID", SqlDbType.Int, VisitID.ToString()); //////ClsUtility.AddParameters("@patientid", SqlDbType.Int, patientID.ToString()); //////ClsUtility.AddParameters("@locationid", SqlDbType.Int, LocationID.ToString()); //////int retvalmissed1 = (int)FollowupManager.ReturnObject(ClsUtility.theParams, "pr_Clinical_DeleteMissedReason_Constella", ClsUtility.ObjectEnum.ExecuteNonQuery); //Update Statement for (int i = 0; i < theDS_ARTFU.Tables[0].Rows.Count; i++) { ClsUtility.Init_Hashtable(); ClsUtility.AddParameters("@patientid", SqlDbType.Int, patientID.ToString()); ClsUtility.AddParameters("@locationid", SqlDbType.Int, LocationID.ToString()); ClsUtility.AddParameters("@Visit_pkID", SqlDbType.Int, VisitID.ToString()); ClsUtility.AddParameters("@MissedReasonID", SqlDbType.Int, theDS_ARTFU.Tables[0].Rows[i]["MissedReasonID"].ToString()); ClsUtility.AddParameters("@OtherReason_Desc", SqlDbType.VarChar, theDS_ARTFU.Tables[0].Rows[i][1].ToString()); ClsUtility.AddParameters("@UserID", SqlDbType.Int, userID.ToString()); ClsUtility.AddParameters("@createdate", SqlDbType.Int, createDate.ToString()); int retvalmissed = (int)FollowupManager.ReturnObject(ClsUtility.theParams, "pr_Clinical_UpdateMissedReason_Constella", ClsUtility.ObjectEnum.ExecuteNonQuery); } } else if (Save == true) { for (int i = 0; i < theDS_ARTFU.Tables[0].Rows.Count; i++) { ClsUtility.Init_Hashtable(); ClsUtility.AddParameters("@patientid", SqlDbType.Int, patientID.ToString()); ClsUtility.AddParameters("@locationid", SqlDbType.Int, LocationID.ToString()); ClsUtility.AddParameters("@MissedReasonID", SqlDbType.Int, theDS_ARTFU.Tables[0].Rows[i]["MissedReasonID"].ToString()); ClsUtility.AddParameters("@OtherReason_Desc", SqlDbType.VarChar, theDS_ARTFU.Tables[0].Rows[i][1].ToString()); ClsUtility.AddParameters("@UserID", SqlDbType.Int, userID.ToString()); int retvalmissed = (int)FollowupManager.ReturnObject(ClsUtility.theParams, "pr_Clinical_SaveMissedReason_Constella", ClsUtility.ObjectEnum.ExecuteNonQuery); } } //Save and Update Complaints if (Save == true) { for (int i = 0; i < theDS_ARTFU.Tables[1].Rows.Count; i++) { ClsUtility.Init_Hashtable(); ClsUtility.AddParameters("@patientid", SqlDbType.Int, patientID.ToString()); ClsUtility.AddParameters("@locationid", SqlDbType.Int, LocationID.ToString()); ClsUtility.AddParameters("@Symptomid", SqlDbType.Int, theDS_ARTFU.Tables[1].Rows[i]["PresentComplaintsID"].ToString()); ClsUtility.AddParameters("@UserID", SqlDbType.Int, userID.ToString()); int retvalcomplaint = (int)FollowupManager.ReturnObject(ClsUtility.theParams, "pr_Clinical_SaveComplaintsIEFU_Constella", ClsUtility.ObjectEnum.ExecuteNonQuery); } } else if (Update == true) { //pr_Clinical_DeleteFollowUP_PatientSymptoms_Constella //Delete Statement ////ClsUtility.Init_Hashtable(); ////ClsUtility.AddParameters("@Visit_pkID", SqlDbType.Int, VisitID.ToString()); ////ClsUtility.AddParameters("@patientid", SqlDbType.Int, patientID.ToString()); ////ClsUtility.AddParameters("@locationid", SqlDbType.Int, LocationID.ToString()); ////int retvalcomplaint1 = (int)FollowupManager.ReturnObject(ClsUtility.theParams, "pr_Clinical_DeleteComplaintsIE_Constella", ClsUtility.ObjectEnum.ExecuteNonQuery); //Update Statement for (int i = 0; i < theDS_ARTFU.Tables[1].Rows.Count; i++) { ClsUtility.Init_Hashtable(); ClsUtility.AddParameters("@patientid", SqlDbType.Int, patientID.ToString()); ClsUtility.AddParameters("@locationid", SqlDbType.Int, LocationID.ToString()); ClsUtility.AddParameters("@Symptomid", SqlDbType.Int, theDS_ARTFU.Tables[1].Rows[i]["PresentComplaintsID"].ToString()); ClsUtility.AddParameters("@UserID", SqlDbType.Int, userID.ToString()); ClsUtility.AddParameters("@Visit_pkID", SqlDbType.Int, VisitID.ToString()); //ClsUtility.AddParameters("@createdate", SqlDbType.DateTime, createDate.ToString()); int retvalcomplaint = (int)FollowupManager.ReturnObject(ClsUtility.theParams, "pr_Clinical_UpdateComplaintsIE_Constella", ClsUtility.ObjectEnum.ExecuteNonQuery); } } //ARV Side Effects - Left if (Save == true) { if (rdoARVSideEffectsNone == 31) { ClsUtility.Init_Hashtable(); ClsUtility.AddParameters("@patientid", SqlDbType.Int, patientID.ToString()); ClsUtility.AddParameters("@locationid", SqlDbType.Int, LocationID.ToString()); ClsUtility.AddParameters("@Symptomid", SqlDbType.Int, rdoARVSideEffectsNone.ToString()); ClsUtility.AddParameters("@UserID", SqlDbType.Int, userID.ToString()); int retvalarvleft = (int)FollowupManager.ReturnObject(ClsUtility.theParams, "pr_Clinical_SaveComplaintsIEFU_Constella", ClsUtility.ObjectEnum.ExecuteNonQuery); } else if (rdoARVSideEffectsNotDocumented == 32) { ClsUtility.Init_Hashtable(); ClsUtility.AddParameters("@patientid", SqlDbType.Int, patientID.ToString()); ClsUtility.AddParameters("@locationid", SqlDbType.Int, LocationID.ToString()); ClsUtility.AddParameters("@Symptomid", SqlDbType.Int, rdoARVSideEffectsNotDocumented.ToString()); ClsUtility.AddParameters("@UserID", SqlDbType.Int, userID.ToString()); int retvalarvleft = (int)FollowupManager.ReturnObject(ClsUtility.theParams, "pr_Clinical_SaveComplaintsIEFU_Constella", ClsUtility.ObjectEnum.ExecuteNonQuery); } else if (rdoARVSideEffectsNone == 0 && rdoARVSideEffectsNotDocumented == 0) { for (int i = 0; i < theDS_ARTFU.Tables[2].Rows.Count; i++) { ClsUtility.Init_Hashtable(); ClsUtility.AddParameters("@patientid", SqlDbType.Int, patientID.ToString()); ClsUtility.AddParameters("@locationid", SqlDbType.Int, LocationID.ToString()); ClsUtility.AddParameters("@Symptomid", SqlDbType.Int, theDS_ARTFU.Tables[2].Rows[i]["ARVSideEffectsID1"].ToString()); ClsUtility.AddParameters("@UserID", SqlDbType.Int, userID.ToString()); int retvalarvleft = (int)FollowupManager.ReturnObject(ClsUtility.theParams, "pr_Clinical_SaveComplaintsIEFU_Constella", ClsUtility.ObjectEnum.ExecuteNonQuery); } } } else if (Update == true) { if (rdoARVSideEffectsNone == 31) { ClsUtility.Init_Hashtable(); ClsUtility.AddParameters("@patientid", SqlDbType.Int, patientID.ToString()); ClsUtility.AddParameters("@locationid", SqlDbType.Int, LocationID.ToString()); ClsUtility.AddParameters("@Symptomid", SqlDbType.Int, rdoARVSideEffectsNone.ToString()); ClsUtility.AddParameters("@UserID", SqlDbType.Int, userID.ToString()); ClsUtility.AddParameters("@Visit_pkID", SqlDbType.Int, VisitID.ToString()); //ClsUtility.AddParameters("@createdate", SqlDbType.Int, createDate.ToString()); int retvalarvleft = (int)FollowupManager.ReturnObject(ClsUtility.theParams, "pr_Clinical_UpdateComplaintsIE_Constella", ClsUtility.ObjectEnum.ExecuteNonQuery); } else if (rdoARVSideEffectsNotDocumented == 32) { ClsUtility.Init_Hashtable(); ClsUtility.AddParameters("@patientid", SqlDbType.Int, patientID.ToString()); ClsUtility.AddParameters("@locationid", SqlDbType.Int, LocationID.ToString()); ClsUtility.AddParameters("@Symptomid", SqlDbType.Int, rdoARVSideEffectsNotDocumented.ToString()); ClsUtility.AddParameters("@UserID", SqlDbType.Int, userID.ToString()); ClsUtility.AddParameters("@Visit_pkID", SqlDbType.Int, VisitID.ToString()); //ClsUtility.AddParameters("@createdate", SqlDbType.Int, createDate.ToString()); int retvalarvleft = (int)FollowupManager.ReturnObject(ClsUtility.theParams, "pr_Clinical_UpdateComplaintsIE_Constella", ClsUtility.ObjectEnum.ExecuteNonQuery); } else if (rdoARVSideEffectsNone == 0 && rdoARVSideEffectsNotDocumented == 0) { for (int i = 0; i < theDS_ARTFU.Tables[2].Rows.Count; i++) { ClsUtility.Init_Hashtable(); ClsUtility.AddParameters("@patientid", SqlDbType.Int, patientID.ToString()); ClsUtility.AddParameters("@locationid", SqlDbType.Int, LocationID.ToString()); ClsUtility.AddParameters("@Symptomid", SqlDbType.Int, theDS_ARTFU.Tables[2].Rows[i]["ARVSideEffectsID1"].ToString()); ClsUtility.AddParameters("@UserID", SqlDbType.Int, userID.ToString()); ClsUtility.AddParameters("@Visit_pkID", SqlDbType.Int, VisitID.ToString()); //ClsUtility.AddParameters("@createdate", SqlDbType.Int, createDate.ToString()); int retvalarvleft = (int)FollowupManager.ReturnObject(ClsUtility.theParams, "pr_Clinical_UpdateComplaintsIE_Constella", ClsUtility.ObjectEnum.ExecuteNonQuery); } } } //ARV Side Effects Right if (Save == true) { for (int i = 0; i < theDS_ARTFU.Tables[3].Rows.Count; i++) { ClsUtility.Init_Hashtable(); ClsUtility.AddParameters("@patientid", SqlDbType.Int, patientID.ToString()); ClsUtility.AddParameters("@locationid", SqlDbType.Int, LocationID.ToString()); ClsUtility.AddParameters("@Symptomid", SqlDbType.Int, theDS_ARTFU.Tables[3].Rows[i]["ARVSideEffectsID2"].ToString()); ClsUtility.AddParameters("@UserID", SqlDbType.Int, userID.ToString()); int retvalarvright = (int)FollowupManager.ReturnObject(ClsUtility.theParams, "pr_Clinical_SaveComplaintsIEFU_Constella", ClsUtility.ObjectEnum.ExecuteNonQuery); } } else if (Update == true) { for (int i = 0; i < theDS_ARTFU.Tables[3].Rows.Count; i++) { ClsUtility.Init_Hashtable(); ClsUtility.AddParameters("@patientid", SqlDbType.Int, patientID.ToString()); ClsUtility.AddParameters("@locationid", SqlDbType.Int, LocationID.ToString()); ClsUtility.AddParameters("@Symptomid", SqlDbType.Int, theDS_ARTFU.Tables[3].Rows[i]["ARVSideEffectsID2"].ToString()); ClsUtility.AddParameters("@UserID", SqlDbType.Int, userID.ToString()); ClsUtility.AddParameters("@Visit_pkID", SqlDbType.Int, VisitID.ToString()); //ClsUtility.AddParameters("@createdate", SqlDbType.Int, createDate.ToString()); int retvalarvright = (int)FollowupManager.ReturnObject(ClsUtility.theParams, "pr_Clinical_UpdateComplaintsIE_Constella", ClsUtility.ObjectEnum.ExecuteNonQuery); } } //TBScreen if (Save == true) { //pr_Clinical_SaveComplaintsIEFU_Constella for (int i = 0; i < theDS_ARTFU.Tables[4].Rows.Count; i++) { ClsUtility.Init_Hashtable(); ClsUtility.AddParameters("@patientid", SqlDbType.Int, patientID.ToString()); ClsUtility.AddParameters("@locationid", SqlDbType.Int, LocationID.ToString()); ClsUtility.AddParameters("@Symptomid", SqlDbType.Int, theDS_ARTFU.Tables[4].Rows[i]["TBScreenID"].ToString()); ClsUtility.AddParameters("@UserID", SqlDbType.Int, userID.ToString()); int retvalTBScreen = (int)FollowupManager.ReturnObject(ClsUtility.theParams, "pr_Clinical_SaveComplaintsIEFU_Constella", ClsUtility.ObjectEnum.ExecuteNonQuery); } } else if (Update == true) { for (int i = 0; i < theDS_ARTFU.Tables[4].Rows.Count; i++) { ClsUtility.Init_Hashtable(); ClsUtility.AddParameters("@patientid", SqlDbType.Int, patientID.ToString()); ClsUtility.AddParameters("@locationid", SqlDbType.Int, LocationID.ToString()); ClsUtility.AddParameters("@Symptomid", SqlDbType.Int, theDS_ARTFU.Tables[4].Rows[i]["TBScreenID"].ToString()); ClsUtility.AddParameters("@UserID", SqlDbType.Int, userID.ToString()); ClsUtility.AddParameters("@Visit_pkID", SqlDbType.Int, VisitID.ToString()); //ClsUtility.AddParameters("@createdate", SqlDbType.Int, createDate.ToString()); int retvalTBScreen = (int)FollowupManager.ReturnObject(ClsUtility.theParams, "pr_Clinical_UpdateComplaintsIE_Constella", ClsUtility.ObjectEnum.ExecuteNonQuery); } } //Save OI & AIDS Defining Illness - left if (Save == true) { if (rdoOIsAIDsIllnessNone == 99) { ClsUtility.Init_Hashtable(); ClsUtility.AddParameters("@patientid", SqlDbType.Int, patientID.ToString()); ClsUtility.AddParameters("@locationid", SqlDbType.Int, LocationID.ToString()); ClsUtility.AddParameters("@HIVAssocDiseaseID", SqlDbType.Int, rdoOIsAIDsIllnessNone.ToString()); ClsUtility.AddParameters("@DateofHIVAssocDisease", SqlDbType.DateTime, ht["Visitdate"].ToString()); ClsUtility.AddParameters("@DiseaseDesc", SqlDbType.VarChar, "Blank"); ClsUtility.AddParameters("@UserID", SqlDbType.Int, userID.ToString()); int retvalAssocCondLeft = (int)FollowupManager.ReturnObject(ClsUtility.theParams, "pr_Clinical_Save_OI_AID_ILLNESS_FU_Constella", ClsUtility.ObjectEnum.ExecuteNonQuery); } else if (rdoOIsAIDsIllnessNotDocumented == 98) { ClsUtility.Init_Hashtable(); ClsUtility.AddParameters("@patientid", SqlDbType.Int, patientID.ToString()); ClsUtility.AddParameters("@locationid", SqlDbType.Int, LocationID.ToString()); ClsUtility.AddParameters("@HIVAssocDiseaseID", SqlDbType.Int, rdoOIsAIDsIllnessNotDocumented.ToString()); ClsUtility.AddParameters("@DateofHIVAssocDisease", SqlDbType.DateTime, ht["Visitdate"].ToString()); ClsUtility.AddParameters("@DiseaseDesc", SqlDbType.VarChar, "Blank"); ClsUtility.AddParameters("@UserID", SqlDbType.Int, userID.ToString()); int retvalAssocCondLeft = (int)FollowupManager.ReturnObject(ClsUtility.theParams, "pr_Clinical_Save_OI_AID_ILLNESS_FU_Constella", ClsUtility.ObjectEnum.ExecuteNonQuery); } else if (rdoOIsAIDsIllnessNone == 0 && rdoOIsAIDsIllnessNotDocumented == 0) { for (int i = 0; i < theDS_ARTFU.Tables[5].Rows.Count; i++) { ClsUtility.Init_Hashtable(); ClsUtility.AddParameters("@patientid", SqlDbType.Int, patientID.ToString()); ClsUtility.AddParameters("@locationid", SqlDbType.Int, LocationID.ToString()); ClsUtility.AddParameters("@HIVAssocDiseaseID", SqlDbType.Int, theDS_ARTFU.Tables[5].Rows[i]["OI_AIDS_ID1"].ToString()); ClsUtility.AddParameters("@DateofHIVAssocDisease", SqlDbType.DateTime, ht["Visitdate"].ToString()); ClsUtility.AddParameters("@DiseaseDesc", SqlDbType.VarChar, theDS_ARTFU.Tables[5].Rows[i][1].ToString()); ClsUtility.AddParameters("@UserID", SqlDbType.Int, userID.ToString()); int retvalAssocCondLeft = (int)FollowupManager.ReturnObject(ClsUtility.theParams, "pr_Clinical_Save_OI_AID_ILLNESS_FU_Constella", ClsUtility.ObjectEnum.ExecuteNonQuery); } } } else if (Update == true) { ////////Delete Statement ////ClsUtility.Init_Hashtable(); ////ClsUtility.AddParameters("@Visit_pkID", SqlDbType.Int, VisitID.ToString()); ////ClsUtility.AddParameters("@patientid", SqlDbType.Int, patientID.ToString()); ////ClsUtility.AddParameters("@locationid", SqlDbType.Int, LocationID.ToString()); ////int retvalAssocCondLeft1 = (int)FollowupManager.ReturnObject(ClsUtility.theParams, "pr_Clinical_DeleteFollowUP_PatientDisease_Constella", ClsUtility.ObjectEnum.ExecuteNonQuery); if (rdoOIsAIDsIllnessNone == 99) { ClsUtility.Init_Hashtable(); ClsUtility.AddParameters("@patientid", SqlDbType.Int, patientID.ToString()); ClsUtility.AddParameters("@locationid", SqlDbType.Int, LocationID.ToString()); ClsUtility.AddParameters("@HIVAssocDiseaseID", SqlDbType.Int, rdoOIsAIDsIllnessNone.ToString()); ClsUtility.AddParameters("@DateofHIVAssocDisease", SqlDbType.DateTime, ht["Visitdate"].ToString()); ClsUtility.AddParameters("@DiseaseDesc", SqlDbType.VarChar, "Blank"); ClsUtility.AddParameters("@UserID", SqlDbType.Int, userID.ToString()); ClsUtility.AddParameters("@Visit_pkID", SqlDbType.Int, VisitID.ToString()); ClsUtility.AddParameters("@createdate", SqlDbType.DateTime, createDate.ToString()); int retvalAssocCondLeft = (int)FollowupManager.ReturnObject(ClsUtility.theParams, "pr_Clinical_Update_OI_AID_ILLNESS_FU_Constella", ClsUtility.ObjectEnum.ExecuteNonQuery); } else if (rdoOIsAIDsIllnessNotDocumented == 98) { ClsUtility.Init_Hashtable(); ClsUtility.AddParameters("@patientid", SqlDbType.Int, patientID.ToString()); ClsUtility.AddParameters("@locationid", SqlDbType.Int, LocationID.ToString()); ClsUtility.AddParameters("@HIVAssocDiseaseID", SqlDbType.Int, rdoOIsAIDsIllnessNotDocumented.ToString()); ClsUtility.AddParameters("@DateofHIVAssocDisease", SqlDbType.DateTime, ht["Visitdate"].ToString()); ClsUtility.AddParameters("@DiseaseDesc", SqlDbType.VarChar, "Blank"); ClsUtility.AddParameters("@UserID", SqlDbType.Int, userID.ToString()); ClsUtility.AddParameters("@Visit_pkID", SqlDbType.Int, VisitID.ToString()); ClsUtility.AddParameters("@createdate", SqlDbType.Int, createDate.ToString()); int retvalAssocCondLeft = (int)FollowupManager.ReturnObject(ClsUtility.theParams, "pr_Clinical_Update_OI_AID_ILLNESS_FU_Constella", ClsUtility.ObjectEnum.ExecuteNonQuery); } else if (rdoOIsAIDsIllnessNone == 0 && rdoOIsAIDsIllnessNotDocumented == 0) { for (int i = 0; i < theDS_ARTFU.Tables[5].Rows.Count; i++) { ClsUtility.Init_Hashtable(); ClsUtility.AddParameters("@patientid", SqlDbType.Int, patientID.ToString()); ClsUtility.AddParameters("@locationid", SqlDbType.Int, LocationID.ToString()); ClsUtility.AddParameters("@HIVAssocDiseaseID", SqlDbType.Int, theDS_ARTFU.Tables[5].Rows[i]["OI_AIDS_ID1"].ToString()); ClsUtility.AddParameters("@DateofHIVAssocDisease", SqlDbType.DateTime, ht["Visitdate"].ToString()); ClsUtility.AddParameters("@DiseaseDesc", SqlDbType.VarChar, theDS_ARTFU.Tables[5].Rows[i][1].ToString()); ClsUtility.AddParameters("@UserID", SqlDbType.Int, userID.ToString()); ClsUtility.AddParameters("@Visit_pkID", SqlDbType.Int, VisitID.ToString()); ClsUtility.AddParameters("@createdate", SqlDbType.Int, createDate.ToString()); int retvalAssocCondLeft = (int)FollowupManager.ReturnObject(ClsUtility.theParams, "pr_Clinical_Update_OI_AID_ILLNESS_FU_Constella", ClsUtility.ObjectEnum.ExecuteNonQuery); } } } //Save OI & AIDS Defining Illness - right if (Save == true) { for (int i = 0; i < theDS_ARTFU.Tables[6].Rows.Count; i++) { ClsUtility.Init_Hashtable(); ClsUtility.AddParameters("@patientid", SqlDbType.Int, patientID.ToString()); ClsUtility.AddParameters("@locationid", SqlDbType.Int, LocationID.ToString()); ClsUtility.AddParameters("@HIVAssocDiseaseID", SqlDbType.Int, theDS_ARTFU.Tables[6].Rows[i]["OI_AIDS_ID2"].ToString()); ClsUtility.AddParameters("@DateofHIVAssocDisease", SqlDbType.DateTime, ht["Visitdate"].ToString()); ClsUtility.AddParameters("@DiseaseDesc", SqlDbType.VarChar, theDS_ARTFU.Tables[6].Rows[i][1].ToString()); ClsUtility.AddParameters("@UserID", SqlDbType.Int, userID.ToString()); int retvalAssocCondright = (int)FollowupManager.ReturnObject(ClsUtility.theParams, "pr_Clinical_Save_OI_AID_ILLNESS_FU_Constella", ClsUtility.ObjectEnum.ExecuteNonQuery); } } else if (Update == true) { for (int i = 0; i < theDS_ARTFU.Tables[6].Rows.Count; i++) { ClsUtility.Init_Hashtable(); ClsUtility.AddParameters("@patientid", SqlDbType.Int, patientID.ToString()); ClsUtility.AddParameters("@locationid", SqlDbType.Int, LocationID.ToString()); ClsUtility.AddParameters("@HIVAssocDiseaseID", SqlDbType.Int, theDS_ARTFU.Tables[6].Rows[i]["OI_AIDS_ID2"].ToString()); ClsUtility.AddParameters("@DateofHIVAssocDisease", SqlDbType.DateTime, ht["Visitdate"].ToString()); ClsUtility.AddParameters("@DiseaseDesc", SqlDbType.VarChar, theDS_ARTFU.Tables[6].Rows[i][1].ToString()); ClsUtility.AddParameters("@UserID", SqlDbType.Int, userID.ToString()); ClsUtility.AddParameters("@Visit_pkID", SqlDbType.Int, VisitID.ToString()); ClsUtility.AddParameters("@createdate", SqlDbType.Int, createDate.ToString()); int retvalAssocCondright = (int)FollowupManager.ReturnObject(ClsUtility.theParams, "pr_Clinical_Update_OI_AID_ILLNESS_FU_Constella", ClsUtility.ObjectEnum.ExecuteNonQuery); } } //Saving Assessment if (Save == true) {//Save statement for (int i = 0; i < theDS_ARTFU.Tables[7].Rows.Count; i++) { ClsUtility.Init_Hashtable(); ClsUtility.AddParameters("@patientid", SqlDbType.Int, patientID.ToString()); ClsUtility.AddParameters("@locationid", SqlDbType.Int, LocationID.ToString()); ClsUtility.AddParameters("@AssessmentID", SqlDbType.Int, theDS_ARTFU.Tables[7].Rows[i]["AssessmentID"].ToString()); ClsUtility.AddParameters("@UserID", SqlDbType.Int, userID.ToString()); int retvalAssessment = (int)FollowupManager.ReturnObject(ClsUtility.theParams, "pr_Clinical_SaveAssessmentFU_Constella", ClsUtility.ObjectEnum.ExecuteNonQuery); } } else if (Update == true) { //Delete Statement ClsUtility.Init_Hashtable(); ClsUtility.AddParameters("@Visit_pkID", SqlDbType.Int, VisitID.ToString()); ClsUtility.AddParameters("@patientid", SqlDbType.Int, patientID.ToString()); ClsUtility.AddParameters("@locationid", SqlDbType.Int, LocationID.ToString()); ClsUtility.AddParameters("@plannotes", SqlDbType.VarChar, ht["PlanNote"].ToString()); ClsUtility.AddParameters("@UserID", SqlDbType.Int, userID.ToString()); int retvalAssessment1 = (int)FollowupManager.ReturnObject(ClsUtility.theParams, "pr_Clinical_DeleteFollowUP_PatientAssessment_Constella", ClsUtility.ObjectEnum.ExecuteNonQuery); //Update for (int i = 0; i < theDS_ARTFU.Tables[7].Rows.Count; i++) { ClsUtility.Init_Hashtable(); ClsUtility.AddParameters("@patientid", SqlDbType.Int, patientID.ToString()); ClsUtility.AddParameters("@locationid", SqlDbType.Int, LocationID.ToString()); ClsUtility.AddParameters("@AssessmentID", SqlDbType.Int, theDS_ARTFU.Tables[7].Rows[i]["AssessmentID"].ToString()); ClsUtility.AddParameters("@UserID", SqlDbType.Int, userID.ToString()); ClsUtility.AddParameters("@Visit_pkID", SqlDbType.Int, VisitID.ToString()); ClsUtility.AddParameters("@createdate", SqlDbType.Int, createDate.ToString()); int retvalAssessment = (int)FollowupManager.ReturnObject(ClsUtility.theParams, "pr_Clinical_UpdateAssessmentFU_Constella", ClsUtility.ObjectEnum.ExecuteNonQuery); } } //// Custom Fields ////////////// ////////////PreSet Values Used///////////////// /// #99# --- Ptn_Pk /// #88# --- LocationId /// #77# --- Visit_Pk /// #66# --- Visit_Date /// #55# --- Ptn_Pharmacy_Pk /// #44# --- OrderedByDate /// #33# --- LabId /// #22# --- TrackingId /// #11# --- CareEndedId /// #00# --- HomeVisitId /////////////////////////////////////////////// //ClsObject theCustomManager = new ClsObject(); //Generating VisitID from ART Followup Form String VisitIDART = ""; if (Save == true) { string theSQL = string.Format("Select IDENT_CURRENT('ord_Visit')"); ClsUtility.Init_Hashtable(); DataTable DTVisitID = (DataTable)FollowupManager.ReturnObject(ClsUtility.theParams, theSQL, ClsUtility.ObjectEnum.DataTable); VisitIDART = DTVisitID.Rows[0][0].ToString(); } if (Update == true) { VisitIDART = VisitID.ToString(); } for (Int32 i = 0; i < theCustomFieldData.Rows.Count; i++) { ClsUtility.Init_Hashtable(); string theQuery = theCustomFieldData.Rows[i]["Query"].ToString(); theQuery = theQuery.Replace("#99#", patientID.ToString()); theQuery = theQuery.Replace("#88#", LocationID.ToString()); theQuery = theQuery.Replace("#77#", VisitIDART); theQuery = theQuery.Replace("#66#", "'" + ht["Visitdate"].ToString() + "'"); ClsUtility.AddParameters("@QryString", SqlDbType.VarChar, theQuery); int RowsAffected = (Int32)FollowupManager.ReturnObject(ClsUtility.theParams, "pr_General_Dynamic_Insert", ClsUtility.ObjectEnum.ExecuteNonQuery); } //////////////////////////////// DataMgr.CommitTransaction(this.Transaction); DataMgr.ReleaseConnection(this.Connection); } catch { DataMgr.RollBackTransation(this.Transaction); throw; } finally { if (this.Connection != null) { DataMgr.ReleaseConnection(this.Connection); } } return(retval); }
public DataSet SaveUpdateInitialFollowupVisitData(Hashtable hashTable, DataSet dataSet, bool isUpdate, DataTable theCustomDataDT) { try { DataSet theDS; int visitID; this.Connection = DataMgr.GetConnection(); this.Transaction = DataMgr.BeginTransaction(this.Connection); ClsUtility.Init_Hashtable(); ClsUtility.AddParameters("@patientID", SqlDbType.Int, hashTable["patientID"].ToString()); ClsUtility.AddParameters("@locationID", SqlDbType.Int, hashTable["locationID"].ToString()); ClsUtility.AddParameters("@dataQuality", SqlDbType.Int, hashTable["dataQuality"].ToString()); ClsUtility.AddParameters("@UserId", SqlDbType.Int, hashTable["UserID"].ToString()); //Appointment Scheduling if (hashTable["visitDate"].ToString() != "") { ClsUtility.AddParameters("@visitDate", SqlDbType.VarChar, hashTable["visitDate"].ToString()); } ClsUtility.AddParameters("@TypeofVisit", SqlDbType.Int, hashTable["TypeofVisit"].ToString()); ClsUtility.AddParameters("@Scheduled", SqlDbType.Int, hashTable["Scheduled"].ToString()); ClsUtility.AddParameters("@treatmentSupporterName", SqlDbType.VarChar, hashTable["treatmentSupporterName"].ToString()); ClsUtility.AddParameters("@treatmentSupporterContact", SqlDbType.VarChar, hashTable["treatmentSupporterContact"].ToString()); //Clinical Status ClsUtility.AddParameters("@Temp", SqlDbType.Decimal, hashTable["physTemp"].ToString()); ClsUtility.AddParameters("@height", SqlDbType.Decimal, hashTable["height"].ToString()); ClsUtility.AddParameters("@weight", SqlDbType.Decimal, hashTable["weight"].ToString()); ClsUtility.AddParameters("@BPSystolic", SqlDbType.Decimal, hashTable["BPSystolic"].ToString()); ClsUtility.AddParameters("@BPDiastolic", SqlDbType.Decimal, hashTable["BPDiastolic"].ToString()); ClsUtility.AddParameters("@HR", SqlDbType.Decimal, hashTable["HR"].ToString()); ClsUtility.AddParameters("@RR", SqlDbType.Decimal, hashTable["RR"].ToString()); ClsUtility.AddParameters("@Headcircumference", SqlDbType.Decimal, hashTable["Headcircumference"].ToString()); if (hashTable["WeightForAge"].ToString() != "") { ClsUtility.AddParameters("@WeightForAge", SqlDbType.Int, hashTable["WeightForAge"].ToString()); } if (hashTable["WeightForHeight"].ToString() != "") { ClsUtility.AddParameters("@WeightForHeight", SqlDbType.Int, hashTable["WeightForHeight"].ToString()); } if (hashTable["BMIz"].ToString() != "") { ClsUtility.AddParameters("@BMIz", SqlDbType.Int, hashTable["BMIz"].ToString()); } //Pegnancy ClsUtility.AddParameters("@pregnant", SqlDbType.Int, hashTable["pregnant"].ToString()); if (hashTable["pregnant"].ToString() == "89") { if (hashTable["EDD"].ToString() != "") { ClsUtility.AddParameters("@EDD", SqlDbType.VarChar, hashTable["EDD"].ToString()); } ClsUtility.AddParameters("@ANCNo", SqlDbType.Int, hashTable["ANCNo"].ToString()); ClsUtility.AddParameters("@ReferredtoPMTCT", SqlDbType.Int, hashTable["ReferredtoPMTCT"].ToString()); } if (hashTable["pregnant"].ToString() == "91") { if (hashTable["DateofInducedAbortion"].ToString() != "") { ClsUtility.AddParameters("@DateofInducedAbortion", SqlDbType.VarChar, hashTable["DateofInducedAbortion"].ToString()); } } if (hashTable["pregnant"].ToString() == "92") { if (hashTable["DateofMiscarriage"].ToString() != "") { ClsUtility.AddParameters("@DateofMiscarriage", SqlDbType.VarChar, hashTable["DateofMiscarriage"].ToString()); } } //Family planning ClsUtility.AddParameters("@familyPlanningStatus", SqlDbType.Int, hashTable["familyPlanningStatus"].ToString()); if (hashTable.ContainsKey("NoFamilyPlanning")) { ClsUtility.AddParameters("@NoFamilyPlanning", SqlDbType.Int, hashTable["NoFamilyPlanning"].ToString()); } //TB ClsUtility.AddParameters("@TBStatus", SqlDbType.Int, hashTable["TBStatus"].ToString()); if (hashTable.ContainsKey("TBStartDate")) { if (hashTable["TBStartDate"].ToString() != "") { ClsUtility.AddParameters("@TBRxStart", SqlDbType.VarChar, hashTable["TBStartDate"].ToString()); } } if (hashTable.ContainsKey("TBTreatmentNo")) { ClsUtility.AddParameters("@TBRegNumber", SqlDbType.VarChar, hashTable["TBTreatmentNo"].ToString()); } //Nutritional Problems ClsUtility.AddParameters("@nutritionalProblem", SqlDbType.Int, hashTable["nutritionalProblem"].ToString()); //WHO Stage ClsUtility.AddParameters("@WHOStage", SqlDbType.Int, hashTable["WHOStage"].ToString()); //pharmacy ClsUtility.AddParameters("@CotrimoxazoleAdhere", SqlDbType.Int, hashTable["CotrimoxazoleAdhere"].ToString()); ClsUtility.AddParameters("@ARVDrugsAdhere", SqlDbType.Int, hashTable["ARVDrugsAdhere"].ToString()); ClsUtility.AddParameters("@WhyPooFair", SqlDbType.Int, hashTable["WhyPooFair"].ToString()); if (hashTable.ContainsKey("reasonARVDrugsPoorFairOther")) { ClsUtility.AddParameters("@reasonARVDrugsPoorFairOther", SqlDbType.VarChar, hashTable["reasonARVDrugsPoorFairOther"].ToString()); } //Subsitutions/Interruption ClsUtility.AddParameters("@TherapyPlan", SqlDbType.Int, hashTable["TherapyPlan"].ToString()); ClsUtility.AddParameters("@TherapyReasonCode", SqlDbType.Int, hashTable["TherapyReasonCode"].ToString()); ClsUtility.AddParameters("@TherapyOther", SqlDbType.VarChar, hashTable["TherapyOther"].ToString()); if (hashTable["PrescribedARVStartDate"].ToString() != "") { ClsUtility.AddParameters("@PrescribedARVStartDate", SqlDbType.VarChar, hashTable["PrescribedARVStartDate"].ToString()); } ClsUtility.AddParameters("@numOfDaysHospitalized", SqlDbType.VarChar, hashTable["numOfDaysHospitalized"].ToString()); ClsUtility.AddParameters("@nutritionalSupport", SqlDbType.Int, hashTable["nutritionalSupport"].ToString()); ClsUtility.AddParameters("@infantFeedingOption", SqlDbType.Int, hashTable["infantFeedingOption"].ToString()); ClsUtility.AddParameters("@attendingClinician", SqlDbType.Int, hashTable["attendingClinician"].ToString()); if (hashTable["Datenextappointment"].ToString() != "") { ClsUtility.AddParameters("@Datenextappointment", SqlDbType.VarChar, hashTable["Datenextappointment"].ToString()); } ClsObject VisitManager = new ClsObject(); VisitManager.Connection = this.Connection; VisitManager.Transaction = this.Transaction; if (!isUpdate) { // DataSet tempDataSet; theDS = (DataSet)VisitManager.ReturnObject(ClsUtility.theParams, "pr_Clinical_SaveInitialFollowupVisit", ClsDBUtility.ObjectEnum.DataSet); // visitID = (int)tempDataSet.Tables[0].Rows[0]["visitID"]; visitID = (int)theDS.Tables[0].Rows[0]["visitID"]; //Family Planning Methods for (int i = 0; i < dataSet.Tables[0].Rows.Count; i++) { ClsUtility.Init_Hashtable(); ClsUtility.AddParameters("@patientID", SqlDbType.Int, hashTable["patientID"].ToString()); ClsUtility.AddParameters("@locationID", SqlDbType.Int, hashTable["locationID"].ToString()); ClsUtility.AddParameters("@visitID", SqlDbType.Int, visitID.ToString()); ClsUtility.AddParameters("@UserId", SqlDbType.Int, hashTable["UserID"].ToString()); ClsUtility.AddParameters("@familyPlanningMethodID", SqlDbType.Int, dataSet.Tables[0].Rows[i]["familyPlanningMethodID"].ToString()); int temp = (int)VisitManager.ReturnObject(ClsUtility.theParams, "pr_Clinical_SaveHIVCareFamilyPlanning", ClsDBUtility.ObjectEnum.ExecuteNonQuery); } //Potential Side Effects for (int i = 0; i < dataSet.Tables[1].Rows.Count; i++) { ClsUtility.Init_Hashtable(); ClsUtility.AddParameters("@patientID", SqlDbType.Int, hashTable["patientID"].ToString()); ClsUtility.AddParameters("@locationID", SqlDbType.Int, hashTable["locationID"].ToString()); ClsUtility.AddParameters("@visitID", SqlDbType.Int, visitID.ToString()); ClsUtility.AddParameters("@potentialSideEffectID", SqlDbType.Int, dataSet.Tables[1].Rows[i]["potentialSideEffectID"].ToString()); ClsUtility.AddParameters("@potentialSideEffectOther", SqlDbType.VarChar, (string.IsNullOrEmpty(Convert.ToString(dataSet.Tables[1].Rows[i]["potentialSideEffect_Other"]))) ? "" : dataSet.Tables[1].Rows[i]["potentialSideEffect_Other"].ToString()); int temp = (int)VisitManager.ReturnObject(ClsUtility.theParams, "pr_Clinical_SaveHIVCarePotentialSideEffect", ClsDBUtility.ObjectEnum.ExecuteNonQuery); } //New OIs Problems for (int i = 0; i < dataSet.Tables[2].Rows.Count; i++) { ClsUtility.Init_Hashtable(); ClsUtility.AddParameters("@patientID", SqlDbType.Int, hashTable["patientID"].ToString()); ClsUtility.AddParameters("@locationID", SqlDbType.Int, hashTable["locationID"].ToString()); ClsUtility.AddParameters("@visitID", SqlDbType.Int, visitID.ToString()); ClsUtility.AddParameters("@newOIsProblemID", SqlDbType.Int, dataSet.Tables[2].Rows[i]["newOIsProblemID"].ToString()); ClsUtility.AddParameters("@TBStatus", SqlDbType.Int, hashTable["TBStatus"].ToString()); if (hashTable.ContainsKey("TBTreatmentNo")) { ClsUtility.AddParameters("@TBRegNumber", SqlDbType.VarChar, hashTable["TBTreatmentNo"].ToString()); } ClsUtility.AddParameters("@newOIsProblemIDOther", SqlDbType.VarChar, (string.IsNullOrEmpty(Convert.ToString(dataSet.Tables[2].Rows[i]["newOIsProblemID_Other"]))) ? "" : dataSet.Tables[2].Rows[i]["newOIsProblemID_Other"].ToString()); ClsUtility.AddParameters("@nutritionalProblem", SqlDbType.Int, hashTable["nutritionalProblem"].ToString()); int temp = (int)VisitManager.ReturnObject(ClsUtility.theParams, "pr_Clinical_SaveHIVCareNewOIsProblem", ClsDBUtility.ObjectEnum.ExecuteNonQuery); } //Referred To for (int i = 0; i < dataSet.Tables[3].Rows.Count; i++) { ClsUtility.Init_Hashtable(); ClsUtility.AddParameters("@patientID", SqlDbType.Int, hashTable["patientID"].ToString()); ClsUtility.AddParameters("@locationID", SqlDbType.Int, hashTable["locationID"].ToString()); ClsUtility.AddParameters("@visitID", SqlDbType.Int, visitID.ToString()); ClsUtility.AddParameters("@referredTo", SqlDbType.Int, dataSet.Tables[3].Rows[i]["referredToID"].ToString()); ClsUtility.AddParameters("@referredToOther", SqlDbType.VarChar, (string.IsNullOrEmpty(Convert.ToString(dataSet.Tables[3].Rows[i]["referredToOtherID_Other"]))) ? "" : dataSet.Tables[3].Rows[i]["referredToOtherID_Other"].ToString()); int temp = (int)VisitManager.ReturnObject(ClsUtility.theParams, "pr_Clinical_SaveHIVCareARTReferredTo", ClsDBUtility.ObjectEnum.ExecuteNonQuery); } //Positive Prevention At Risk Population for (int i = 0; i < dataSet.Tables[4].Rows.Count; i++) { ClsUtility.Init_Hashtable(); ClsUtility.AddParameters("@patientID", SqlDbType.Int, hashTable["patientID"].ToString()); ClsUtility.AddParameters("@locationID", SqlDbType.Int, hashTable["locationID"].ToString()); ClsUtility.AddParameters("@visitID", SqlDbType.Int, visitID.ToString()); ClsUtility.AddParameters("@RiskPopulationID", SqlDbType.Int, dataSet.Tables[4].Rows[i]["RiskPopulationID"].ToString()); int temp = (int)VisitManager.ReturnObject(ClsUtility.theParams, "pr_Clinical_SaveHIVCareAtRiskPopulation", ClsDBUtility.ObjectEnum.ExecuteNonQuery); } //Positive Prevention At Risk Population Services for (int i = 0; i < dataSet.Tables[5].Rows.Count; i++) { ClsUtility.Init_Hashtable(); ClsUtility.AddParameters("@patientID", SqlDbType.Int, hashTable["patientID"].ToString()); ClsUtility.AddParameters("@locationID", SqlDbType.Int, hashTable["locationID"].ToString()); ClsUtility.AddParameters("@visitID", SqlDbType.Int, visitID.ToString()); ClsUtility.AddParameters("@PopulationServiceID", SqlDbType.Int, dataSet.Tables[5].Rows[i]["PopulationServiceID"].ToString()); int temp = (int)VisitManager.ReturnObject(ClsUtility.theParams, "pr_Clinical_SaveHIVCareAtRiskPopulationServices", ClsDBUtility.ObjectEnum.ExecuteNonQuery); } //Prevention with positives (PwP) for (int i = 0; i < dataSet.Tables[6].Rows.Count; i++) { ClsUtility.Init_Hashtable(); ClsUtility.AddParameters("@patientID", SqlDbType.Int, hashTable["patientID"].ToString()); ClsUtility.AddParameters("@locationID", SqlDbType.Int, hashTable["locationID"].ToString()); ClsUtility.AddParameters("@visitID", SqlDbType.Int, visitID.ToString()); ClsUtility.AddParameters("@pwpID", SqlDbType.Int, dataSet.Tables[6].Rows[i]["pwpID"].ToString()); ClsUtility.AddParameters("@pwpID_Other", SqlDbType.VarChar, (string.IsNullOrEmpty(Convert.ToString(dataSet.Tables[6].Rows[i]["pwpID_Other"]))) ? "" : dataSet.Tables[6].Rows[i]["pwpID_Other"].ToString()); int temp = (int)VisitManager.ReturnObject(ClsUtility.theParams, "pr_Clinical_SaveHIVCarePreventionwithpositives", ClsDBUtility.ObjectEnum.ExecuteNonQuery); } for (Int32 i = 0; i < theCustomDataDT.Rows.Count; i++) { ClsUtility.Init_Hashtable(); string theQuery = theCustomDataDT.Rows[i]["Query"].ToString(); theQuery = theQuery.Replace("#99#", hashTable["patientID"].ToString()); theQuery = theQuery.Replace("#88#", hashTable["locationID"].ToString()); theQuery = theQuery.Replace("#77#", visitID.ToString()); theQuery = theQuery.Replace("#66#", "'" + hashTable["visitDate"].ToString() + "'"); ClsUtility.AddParameters("@QryString", SqlDbType.VarChar, theQuery); int RowsAffected = (Int32)VisitManager.ReturnObject(ClsUtility.theParams, "pr_General_Dynamic_Insert", ClsDBUtility.ObjectEnum.ExecuteNonQuery); } } else { visitID = Convert.ToInt32(hashTable["visitID"].ToString()); ClsUtility.AddParameters("@visitID", SqlDbType.Int, hashTable["visitID"].ToString()); //ClsUtility.AddParameters("@createDate", SqlDbType.DateTime, hashTable["createDate"].ToString()); theDS = (DataSet)VisitManager.ReturnObject(ClsUtility.theParams, "pr_Clinical_UpdateInitialFollowupVisit", ClsDBUtility.ObjectEnum.DataSet); for (int i = 0; i < dataSet.Tables[0].Rows.Count; i++) { ClsUtility.Init_Hashtable(); ClsUtility.AddParameters("@patientID", SqlDbType.Int, hashTable["patientID"].ToString()); ClsUtility.AddParameters("@locationID", SqlDbType.Int, hashTable["locationID"].ToString()); ClsUtility.AddParameters("@visitID", SqlDbType.Int, visitID.ToString()); ClsUtility.AddParameters("@UserId", SqlDbType.Int, hashTable["UserID"].ToString()); ClsUtility.AddParameters("@familyPlanningMethodID", SqlDbType.Int, dataSet.Tables[0].Rows[i]["familyPlanningMethodID"].ToString()); int temp = (int)VisitManager.ReturnObject(ClsUtility.theParams, "pr_Clinical_SaveHIVCareFamilyPlanning", ClsDBUtility.ObjectEnum.ExecuteNonQuery); } //Potential Side Effects for (int i = 0; i < dataSet.Tables[1].Rows.Count; i++) { ClsUtility.Init_Hashtable(); ClsUtility.AddParameters("@patientID", SqlDbType.Int, hashTable["patientID"].ToString()); ClsUtility.AddParameters("@locationID", SqlDbType.Int, hashTable["locationID"].ToString()); ClsUtility.AddParameters("@visitID", SqlDbType.Int, visitID.ToString()); ClsUtility.AddParameters("@potentialSideEffectID", SqlDbType.Int, dataSet.Tables[1].Rows[i]["potentialSideEffectID"].ToString()); ClsUtility.AddParameters("@potentialSideEffectOther", SqlDbType.VarChar, (string.IsNullOrEmpty(Convert.ToString(dataSet.Tables[1].Rows[i]["potentialSideEffect_Other"]))) ? "" : dataSet.Tables[1].Rows[i]["potentialSideEffect_Other"].ToString()); //ClsUtility.AddParameters("@createDate", SqlDbType.DateTime, hashTable["createDate"].ToString()); int temp = (int)VisitManager.ReturnObject(ClsUtility.theParams, "pr_Clinical_SaveHIVCarePotentialSideEffect", ClsDBUtility.ObjectEnum.ExecuteNonQuery); } //New OIs Problems for (int i = 0; i < dataSet.Tables[2].Rows.Count; i++) { ClsUtility.Init_Hashtable(); ClsUtility.AddParameters("@patientID", SqlDbType.Int, hashTable["patientID"].ToString()); ClsUtility.AddParameters("@locationID", SqlDbType.Int, hashTable["locationID"].ToString()); ClsUtility.AddParameters("@visitID", SqlDbType.Int, visitID.ToString()); ClsUtility.AddParameters("@newOIsProblemID", SqlDbType.Int, dataSet.Tables[2].Rows[i]["newOIsProblemID"].ToString()); ClsUtility.AddParameters("@TBStatus", SqlDbType.Int, hashTable["TBStatus"].ToString()); if (hashTable.ContainsKey("TBTreatmentNo")) { ClsUtility.AddParameters("@TBRegNumber", SqlDbType.VarChar, hashTable["TBTreatmentNo"].ToString()); } ClsUtility.AddParameters("@newOIsProblemIDOther", SqlDbType.VarChar, (string.IsNullOrEmpty(Convert.ToString(dataSet.Tables[2].Rows[i]["newOIsProblemID_Other"]))) ? "" : dataSet.Tables[2].Rows[i]["newOIsProblemID_Other"].ToString()); ClsUtility.AddParameters("@nutritionalProblem", SqlDbType.Int, hashTable["nutritionalProblem"].ToString()); int temp = (int)VisitManager.ReturnObject(ClsUtility.theParams, "pr_Clinical_SaveHIVCareNewOIsProblem", ClsDBUtility.ObjectEnum.ExecuteNonQuery); } //Referred To for (int i = 0; i < dataSet.Tables[3].Rows.Count; i++) { ClsUtility.Init_Hashtable(); ClsUtility.AddParameters("@patientID", SqlDbType.Int, hashTable["patientID"].ToString()); ClsUtility.AddParameters("@locationID", SqlDbType.Int, hashTable["locationID"].ToString()); ClsUtility.AddParameters("@visitID", SqlDbType.Int, visitID.ToString()); ClsUtility.AddParameters("@referredTo", SqlDbType.Int, dataSet.Tables[3].Rows[i]["referredToID"].ToString()); ClsUtility.AddParameters("@referredToOther", SqlDbType.VarChar, (string.IsNullOrEmpty(Convert.ToString(dataSet.Tables[3].Rows[i]["referredToOtherID_Other"]))) ? "" : dataSet.Tables[3].Rows[i]["referredToOtherID_Other"].ToString()); int temp = (int)VisitManager.ReturnObject(ClsUtility.theParams, "pr_Clinical_SaveHIVCareARTReferredTo", ClsDBUtility.ObjectEnum.ExecuteNonQuery); } //Positive Prevention At Risk Population for (int i = 0; i < dataSet.Tables[4].Rows.Count; i++) { ClsUtility.Init_Hashtable(); ClsUtility.AddParameters("@patientID", SqlDbType.Int, hashTable["patientID"].ToString()); ClsUtility.AddParameters("@locationID", SqlDbType.Int, hashTable["locationID"].ToString()); ClsUtility.AddParameters("@visitID", SqlDbType.Int, visitID.ToString()); ClsUtility.AddParameters("@RiskPopulationID", SqlDbType.Int, dataSet.Tables[4].Rows[i]["RiskPopulationID"].ToString()); int temp = (int)VisitManager.ReturnObject(ClsUtility.theParams, "pr_Clinical_SaveHIVCareAtRiskPopulation", ClsDBUtility.ObjectEnum.ExecuteNonQuery); } //Positive Prevention At Risk Population Services for (int i = 0; i < dataSet.Tables[5].Rows.Count; i++) { ClsUtility.Init_Hashtable(); ClsUtility.AddParameters("@patientID", SqlDbType.Int, hashTable["patientID"].ToString()); ClsUtility.AddParameters("@locationID", SqlDbType.Int, hashTable["locationID"].ToString()); ClsUtility.AddParameters("@visitID", SqlDbType.Int, visitID.ToString()); ClsUtility.AddParameters("@PopulationServiceID", SqlDbType.Int, dataSet.Tables[5].Rows[i]["PopulationServiceID"].ToString()); int temp = (int)VisitManager.ReturnObject(ClsUtility.theParams, "pr_Clinical_SaveHIVCareAtRiskPopulationServices", ClsDBUtility.ObjectEnum.ExecuteNonQuery); } //Prevention with positives (PwP) for (int i = 0; i < dataSet.Tables[6].Rows.Count; i++) { ClsUtility.Init_Hashtable(); ClsUtility.AddParameters("@patientID", SqlDbType.Int, hashTable["patientID"].ToString()); ClsUtility.AddParameters("@locationID", SqlDbType.Int, hashTable["locationID"].ToString()); ClsUtility.AddParameters("@visitID", SqlDbType.Int, visitID.ToString()); ClsUtility.AddParameters("@pwpID", SqlDbType.Int, dataSet.Tables[6].Rows[i]["pwpID"].ToString()); ClsUtility.AddParameters("@pwpID_Other", SqlDbType.VarChar, (string.IsNullOrEmpty(Convert.ToString(dataSet.Tables[6].Rows[i]["pwpID_Other"]))) ? "" : dataSet.Tables[6].Rows[i]["pwpID_Other"].ToString()); int temp = (int)VisitManager.ReturnObject(ClsUtility.theParams, "pr_Clinical_SaveHIVCarePreventionwithpositives", ClsDBUtility.ObjectEnum.ExecuteNonQuery); } for (Int32 i = 0; i < theCustomDataDT.Rows.Count; i++) { ClsUtility.Init_Hashtable(); string theQuery = theCustomDataDT.Rows[i]["Query"].ToString(); theQuery = theQuery.Replace("#99#", hashTable["patientID"].ToString()); theQuery = theQuery.Replace("#88#", hashTable["locationID"].ToString()); theQuery = theQuery.Replace("#77#", visitID.ToString()); theQuery = theQuery.Replace("#66#", "'" + hashTable["visitDate"].ToString() + "'"); ClsUtility.AddParameters("@QryString", SqlDbType.VarChar, theQuery); int RowsAffected = (Int32)VisitManager.ReturnObject(ClsUtility.theParams, "pr_General_Dynamic_Insert", ClsDBUtility.ObjectEnum.ExecuteNonQuery); } } DataMgr.CommitTransaction(this.Transaction); DataMgr.ReleaseConnection(this.Connection); return(theDS); } catch { DataMgr.RollBackTransation(this.Transaction); throw; } finally { if (this.Connection != null) { DataMgr.ReleaseConnection(this.Connection); } } }
public DataTable SavePharmacyDispense_Web(Int32 PatientId, Int32 LocationId, Int32 StoreId, Int32 UserId, int dispensedBy, string DispDate, Int32 OrderType, Int32 ProgramId, string theRegimen, Int32 OrderId, DataTable theDT, string PharmacyRefillDate, Int32 DataStatus, int orderedBy, string orderDate, string deleteScript, int regimenLine = 0, int regimenCode = 0, int therapyPlan = 0) { string Morning, Midday, Evening, Night; DataTable thePharmacyDT = new DataTable(); //Added by VY for regimen #region "Regimen" //string theRegimen = ""; string thetmpRegimen = ""; for (int i = 0; i < theDT.Rows.Count; i++) { if (theDT.Rows[i]["GenericAbbrevation"].ToString() != "") { if (thetmpRegimen == "") { thetmpRegimen = theDT.Rows[i]["GenericAbbrevation"].ToString(); } else { thetmpRegimen = String.Format("{0}/{1}", thetmpRegimen, theDT.Rows[i]["GenericAbbrevation"]); } } thetmpRegimen = thetmpRegimen.Trim(); } foreach (string s in thetmpRegimen.Split('/')) { if (theRegimen == "" && s != "") { theRegimen = theRegimen + s; } else if (theRegimen != "" && s != "") { if (!theRegimen.Contains(s)) { theRegimen = theRegimen + "/" + s; } } } #endregion try { this.Connection = DataMgr.GetConnection(); this.Transaction = DataMgr.BeginTransaction(this.Connection); ClsObject theManager = new ClsObject(); ClsUtility.Init_Hashtable(); ClsUtility.AddParameters("@Ptn_Pk", SqlDbType.Int, PatientId.ToString()); ClsUtility.AddParameters("@LocationId", SqlDbType.Int, LocationId.ToString()); ClsUtility.AddParameters("@DispensedBy", SqlDbType.Int, dispensedBy.ToString()); if (DispDate.ToString() != "") { ClsUtility.AddParameters("@DispensedByDate", SqlDbType.VarChar, DispDate.ToString()); } ClsUtility.AddParameters("@OrderType", SqlDbType.Int, OrderType.ToString()); ClsUtility.AddParameters("@ProgramId", SqlDbType.Int, ProgramId.ToString()); ClsUtility.AddParameters("@StoreId", SqlDbType.Int, StoreId.ToString()); ClsUtility.AddParameters("@Regimen", SqlDbType.VarChar, theRegimen); ClsUtility.AddParameters("@UserId", SqlDbType.Int, UserId.ToString()); ClsUtility.AddParameters("@OrderId", SqlDbType.Int, OrderId.ToString()); ClsUtility.AddParameters("@AppointmentDate", SqlDbType.VarChar, PharmacyRefillDate.ToString()); ClsUtility.AddParameters("@OrderedBy", SqlDbType.Int, orderedBy.ToString()); if (orderDate.ToString() != "") { ClsUtility.AddParameters("@OrderDate", SqlDbType.VarChar, orderDate.ToString()); } if (deleteScript != "") { ClsUtility.AddParameters("@deleteScript", SqlDbType.VarChar, deleteScript); } ClsUtility.AddParameters("@RegimenLine", SqlDbType.Int, regimenLine.ToString()); ClsUtility.AddParameters("@RegimenCode", SqlDbType.Int, regimenCode.ToString()); ClsUtility.AddParameters("@TherapyPlan", SqlDbType.Int, therapyPlan.ToString()); thePharmacyDT = (DataTable)theManager.ReturnObject(ClsUtility.theParams, "pr_SCM_SavePharmacyDispenseOrder_Web", ClsDBUtility.ObjectEnum.DataTable); foreach (DataRow theDR in theDT.Rows) { ClsUtility.Init_Hashtable(); ClsUtility.AddParameters("@Ptn_Pk", SqlDbType.Int, PatientId.ToString()); ClsUtility.AddParameters("@StoreId", SqlDbType.Int, StoreId.ToString()); ClsUtility.AddParameters("@VisitId", SqlDbType.Int, thePharmacyDT.Rows[0]["VisitId"].ToString()); ClsUtility.AddParameters("@Ptn_Pharmacy_Pk", SqlDbType.Int, thePharmacyDT.Rows[0]["Ptn_Pharmacy_Pk"].ToString()); ClsUtility.AddParameters("@Drug_Pk", SqlDbType.Int, theDR["DrugId"].ToString()); ClsUtility.AddParameters("@MorningDose", SqlDbType.Decimal, Morning = (theDR["Morning"].ToString() == "") ? "0" : theDR["Morning"].ToString()); ClsUtility.AddParameters("@MiddayDose", SqlDbType.Decimal, Midday = (theDR["Midday"].ToString() == "") ? "0" : theDR["Midday"].ToString()); ClsUtility.AddParameters("@EveningDose", SqlDbType.Decimal, Evening = (theDR["Evening"].ToString() == "") ? "0" : theDR["Evening"].ToString()); ClsUtility.AddParameters("@NightDose", SqlDbType.Decimal, Night = (theDR["Night"].ToString() == "") ? "0" : theDR["Night"].ToString()); ClsUtility.AddParameters("@DispensedQuantity", SqlDbType.Int, "0"); ClsUtility.AddParameters("@Prophylaxis", SqlDbType.Int, theDR["Prophylaxis"].ToString() == "True" ? "1" : "0"); ClsUtility.AddParameters("@BatchId", SqlDbType.Int, theDR["BatchId"].ToString()); if (theDR["BatchNo"].ToString().Contains("(")) { ClsUtility.AddParameters("@BatchNo", SqlDbType.VarChar, theDR["BatchNo"].ToString().Substring(0, theDR["BatchNo"].ToString().IndexOf('('))); } else { ClsUtility.AddParameters("@BatchNo", SqlDbType.VarChar, theDR["BatchNo"].ToString()); } ClsUtility.AddParameters("@ExpiryDate", SqlDbType.VarChar, theDR["ExpiryDate"].ToString()); ClsUtility.AddParameters("@DispensingUnit", SqlDbType.Int, theDR["DispensingUnitId"].ToString()); if (DispDate.ToString() != "") { ClsUtility.AddParameters("@DispensedByDate", SqlDbType.VarChar, DispDate.ToString()); } ClsUtility.AddParameters("@LocationId", SqlDbType.Int, LocationId.ToString()); ClsUtility.AddParameters("@UserId", SqlDbType.Int, UserId.ToString()); ClsUtility.AddParameters("@DataStatus", SqlDbType.Int, DataStatus.ToString()); ClsUtility.AddParameters("@Duration", SqlDbType.Decimal, theDR["Duration"].ToString() != "" ? theDR["Duration"].ToString() : "0"); ClsUtility.AddParameters("@PrescribeOrderedQuantity", SqlDbType.Decimal, theDR["QtyPrescribed"].ToString() != "" ? theDR["QtyPrescribed"].ToString() : "0"); ClsUtility.AddParameters("@PillCount", SqlDbType.VarChar, theDR["PillCount"].ToString() == "" ? "0" : theDR["PillCount"].ToString()); ClsUtility.AddParameters("@PrintPrescriptionStatus", SqlDbType.Int, theDR["PrintPrescriptionStatus"].ToString() == "True" ? "1" : "0"); ClsUtility.AddParameters("@PatientInstructions", SqlDbType.VarChar, theDR["Instructions"].ToString()); ClsUtility.AddParameters("@Comments", SqlDbType.VarChar, theDR["Comments"].ToString()); Int32 theRowCount = (Int32)theManager.ReturnObject(ClsUtility.theParams, "pr_SCM_SavePharmacyDispenseOrderDetail_Web", ClsDBUtility.ObjectEnum.ExecuteNonQuery); //Save details to dtl_PatientPharmacyOrderpartialDispense table ClsUtility.Init_Hashtable(); ClsUtility.AddParameters("@Ptn_Pk", SqlDbType.Int, PatientId.ToString()); ClsUtility.AddParameters("@StoreId", SqlDbType.Int, StoreId.ToString()); ClsUtility.AddParameters("@ptn_pharmacy_pk", SqlDbType.Int, thePharmacyDT.Rows[0]["Ptn_Pharmacy_Pk"].ToString()); ClsUtility.AddParameters("@drug_pk", SqlDbType.Int, theDR["DrugId"].ToString()); ClsUtility.AddParameters("@batchid", SqlDbType.Int, theDR["BatchId"].ToString()); ClsUtility.AddParameters("@ExpiryDate", SqlDbType.VarChar, theDR["ExpiryDate"].ToString()); ClsUtility.AddParameters("@DispensedQuantity", SqlDbType.Int, theDR["QtyDispensed"].ToString() == "" ? "0" : theDR["QtyDispensed"].ToString()); //ClsUtility.AddParameters("@DispensedQuantity", SqlDbType.Decimal, theDR["RefillQty"].ToString() == "" ? "0" : theDR["RefillQty"].ToString()); ClsUtility.AddParameters("@DispensedBy", SqlDbType.Int, dispensedBy.ToString()); if (DispDate.ToString() != "") { ClsUtility.AddParameters("@DispensedByDate", SqlDbType.VarChar, DispDate.ToString()); } ClsUtility.AddParameters("@PrintPrescriptionStatus", SqlDbType.Int, theDR["PrintPrescriptionStatus"].ToString() == "True" ? "1" : "0"); ClsUtility.AddParameters("@comments", SqlDbType.Int, theDR["comments"].ToString()); ClsUtility.AddParameters("@UserId", SqlDbType.Int, UserId.ToString()); DataTable dt = (DataTable)theManager.ReturnObject(ClsUtility.theParams, "pr_SCM_SavePharmacyPartialDispense_Web", ClsDBUtility.ObjectEnum.DataTable); } DataMgr.CommitTransaction(this.Transaction); DataMgr.ReleaseConnection(this.Connection); } catch { DataMgr.RollBackTransation(this.Transaction); throw; } finally { if (this.Connection != null) { DataMgr.ReleaseConnection(this.Connection); } } return(thePharmacyDT); }
public DataSet SaveUpdateNigeriaPaedIEClinicalHistoryData(Hashtable hashTable, DataTable dtMultiSelectValues, int DataQuality, int signature, DataTable dtPriorART) { try { DataSet theDS; int visitID; this.Connection = DataMgr.GetConnection(); this.Transaction = DataMgr.BeginTransaction(this.Connection); ClsUtility.Init_Hashtable(); ClsUtility.AddParameters("@Ptn_pk", SqlDbType.Int, hashTable["patientID"].ToString()); ClsUtility.AddParameters("@Visit_Pk", SqlDbType.Int, hashTable["visitID"].ToString()); ClsUtility.AddParameters("@locationID", SqlDbType.Int, hashTable["locationID"].ToString()); ClsUtility.AddParameters("@visitDate", SqlDbType.VarChar, hashTable["visitDate"].ToString()); ClsUtility.AddParameters("@MedicalHistoryAdditionalComplaints", SqlDbType.VarChar, hashTable["MedicalHistoryAdditionalComplaints"].ToString()); ClsUtility.AddParameters("@MedicalHistoryLastHistory", SqlDbType.VarChar, hashTable["MedicalHistoryLastHistory"].ToString()); ClsUtility.AddParameters("@DevelopmentAsses", SqlDbType.Int, hashTable["DevelopmentAssesment"].ToString()); ClsUtility.AddParameters("@ImmunAge", SqlDbType.Int, hashTable["ImmunizationComplete"].ToString()); ClsUtility.AddParameters("@PrevHIV", SqlDbType.Int, hashTable["PreviousCareHIV"].ToString()); ClsUtility.AddParameters("@FeedMode", SqlDbType.Int, hashTable["FeedMode"].ToString()); ClsUtility.AddParameters("@PrevExpoPMTCT", SqlDbType.Int, hashTable["PrevARVExposurePMTCT"].ToString()); ClsUtility.AddParameters("@PrevExpoPMTCTMonths", SqlDbType.VarChar, hashTable["PrevARVExposurePMTCTMonths"].ToString()); ClsUtility.AddParameters("@PrevExpoPMTCTDrugs", SqlDbType.VarChar, hashTable["PrevARVExposurePMTCTDrugs"].ToString()); ClsUtility.AddParameters("@currentmedicationother", SqlDbType.VarChar, hashTable["ComplaintOther"].ToString()); ClsUtility.AddParameters("@ServiceEntry", SqlDbType.Int, hashTable["ServiceEntry"].ToString()); ClsUtility.AddParameters("@ParticipatedAdhernce", SqlDbType.Int, hashTable["ParticipatedAdhernce"].ToString()); ClsUtility.AddParameters("@MissedArv3days", SqlDbType.Int, hashTable["MissedArv3days"].ToString()); ClsUtility.AddParameters("@ReasomMissedARV", SqlDbType.Int, hashTable["ReasomMissedARV"].ToString()); ClsUtility.AddParameters("@TreatmentIntrupted", SqlDbType.Int, hashTable["TreatmentIntrupted"].ToString()); ClsUtility.AddParameters("@IntrupptedDate", SqlDbType.VarChar, hashTable["IntrupptedDate"].ToString()); ClsUtility.AddParameters("@intrpdays", SqlDbType.Int, hashTable["intrpdays"].ToString()); ClsUtility.AddParameters("@ReasonInterrupted", SqlDbType.Int, hashTable["ReasonInterrupted"].ToString()); ClsUtility.AddParameters("@Treatmentstopped", SqlDbType.Int, hashTable["Treatmentstopped"].ToString()); ClsUtility.AddParameters("@StopedReasonDate", SqlDbType.VarChar, hashTable["StopedReasonDate"].ToString()); ClsUtility.AddParameters("@stoppeddays", SqlDbType.Int, hashTable["stoppeddays"].ToString()); ClsUtility.AddParameters("@StopedReason", SqlDbType.Int, hashTable["StopedReason"].ToString()); ClsUtility.AddParameters("@Otherdisclosed", SqlDbType.VarChar, hashTable["Otherdisclosed"].ToString()); ClsUtility.AddParameters("@hivdiscussed", SqlDbType.VarChar, hashTable["hivdiscussed"].ToString()); ClsUtility.AddParameters("@supportgroup", SqlDbType.Int, hashTable["supportgroup"].ToString()); ClsUtility.AddParameters("@DataQlty", SqlDbType.Int, DataQuality.ToString()); ClsUtility.AddParameters("@UserId", SqlDbType.Int, signature.ToString()); ClsObject VisitManager = new ClsObject(); VisitManager.Connection = this.Connection; VisitManager.Transaction = this.Transaction; // DataSet tempDataSet; theDS = (DataSet)VisitManager.ReturnObject(ClsUtility.theParams, "pr_Clinical_SaveUpdate_Nigeria_PaedIE_ClinicalHistoryTab", ClsDBUtility.ObjectEnum.DataSet); visitID = (int)theDS.Tables[0].Rows[0]["Visit_Id"]; //Pre Existing Medical Condition for (int i = 0; i < dtMultiSelectValues.Rows.Count; i++) { if (dtMultiSelectValues.Rows[i]["ID"].ToString() != "") { ClsUtility.Init_Hashtable(); ClsUtility.AddParameters("@Ptn_pk", SqlDbType.Int, hashTable["patientID"].ToString()); ClsUtility.AddParameters("@Visit_Pk", SqlDbType.Int, visitID.ToString()); ClsUtility.AddParameters("@ID", SqlDbType.Int, dtMultiSelectValues.Rows[i]["ID"].ToString()); ClsUtility.AddParameters("@FieldName", SqlDbType.VarChar, dtMultiSelectValues.Rows[i]["FieldName"].ToString()); ClsUtility.AddParameters("@OtherNotes", SqlDbType.VarChar, dtMultiSelectValues.Rows[i]["Other_notes"].ToString()); int temp = (int)VisitManager.ReturnObject(ClsUtility.theParams, "pr_Clinical_Save_Multiselect_line", ClsDBUtility.ObjectEnum.ExecuteNonQuery); } } //Prior ART for (int i = 0; i < dtPriorART.Rows.Count; i++) { if (dtPriorART.Rows[i]["ID"].ToString() != "") { ClsUtility.Init_Hashtable(); ClsUtility.AddParameters("@Ptn_pk", SqlDbType.Int, hashTable["patientID"].ToString()); ClsUtility.AddParameters("@Visit_Pk", SqlDbType.Int, visitID.ToString()); ClsUtility.AddParameters("@ID", SqlDbType.Int, dtPriorART.Rows[i]["ID"].ToString()); ClsUtility.AddParameters("@NumericFiled", SqlDbType.Int, dtPriorART.Rows[i]["NumericField"].ToString()); ClsUtility.AddParameters("@FieldName", SqlDbType.VarChar, "NigeriaPriorART"); ClsUtility.AddParameters("@DateField1", SqlDbType.VarChar, dtPriorART.Rows[i]["DateField1"].ToString()); ClsUtility.AddParameters("@DateField2", SqlDbType.VarChar, dtPriorART.Rows[i]["DateField2"].ToString()); int temp = (int)VisitManager.ReturnObject(ClsUtility.theParams, "pr_Clinical_Save_Multiselect_line", ClsDBUtility.ObjectEnum.ExecuteNonQuery); } } DataMgr.CommitTransaction(this.Transaction); DataMgr.ReleaseConnection(this.Connection); return(theDS); } catch { DataMgr.RollBackTransation(this.Transaction); throw; } finally { if (this.Connection != null) { DataMgr.ReleaseConnection(this.Connection); } } }
public DataTable SavePharmacyDispense(Int32 thePatientId, Int32 theLocationId, Int32 theStoreId, Int32 theUserId, DateTime theDispDate, Int32 theOrderType, Int32 theProgramId, string theRegimen, Int32 theOrderId, DataTable theDT, DateTime PharmacyRefillDate) { DataTable thePharmacyDT = new DataTable(); try { this.Connection = DataMgr.GetConnection(); this.Transaction = DataMgr.BeginTransaction(this.Connection); ClsObject theManager = new ClsObject(); ClsUtility.Init_Hashtable(); ClsUtility.AddParameters("@Ptn_Pk", SqlDbType.Int, thePatientId.ToString()); ClsUtility.AddParameters("@LocationId", SqlDbType.Int, theLocationId.ToString()); ClsUtility.AddParameters("@DispensedBy", SqlDbType.Int, theUserId.ToString()); ClsUtility.AddParameters("@DispensedByDate", SqlDbType.VarChar, String.Format("{0:dd-MMM-yyyy}", theDispDate).ToString()); ClsUtility.AddParameters("@OrderType", SqlDbType.Int, theOrderType.ToString()); ClsUtility.AddParameters("@ProgramId", SqlDbType.Int, theProgramId.ToString()); ClsUtility.AddParameters("@StoreId", SqlDbType.Int, theStoreId.ToString()); ClsUtility.AddParameters("@Regimen", SqlDbType.VarChar, theRegimen); ClsUtility.AddParameters("@UserId", SqlDbType.Int, theUserId.ToString()); ClsUtility.AddParameters("@OrderId", SqlDbType.Int, theOrderId.ToString()); ClsUtility.AddParameters("@PharmacyRefillAppDate", SqlDbType.VarChar, PharmacyRefillDate.ToString("dd-MMM-yyyy")); thePharmacyDT = (DataTable)theManager.ReturnObject(ClsUtility.theParams, "pr_SCM_SavePharmacyDispenseOrder_Futures", ClsDBUtility.ObjectEnum.DataTable); foreach (DataRow theDR in theDT.Rows) { ClsUtility.Init_Hashtable(); ClsUtility.AddParameters("@Ptn_Pk", SqlDbType.Int, thePatientId.ToString()); ClsUtility.AddParameters("@StoreId", SqlDbType.Int, theStoreId.ToString()); ClsUtility.AddParameters("@VisitId", SqlDbType.Int, thePharmacyDT.Rows[0]["VisitId"].ToString()); ClsUtility.AddParameters("@Ptn_Pharmacy_Pk", SqlDbType.Int, thePharmacyDT.Rows[0]["Ptn_Pharmacy_Pk"].ToString()); ClsUtility.AddParameters("@Drug_Pk", SqlDbType.Int, theDR["ItemId"].ToString()); ClsUtility.AddParameters("@StrengthId", SqlDbType.Int, theDR["StrengthId"].ToString()); ClsUtility.AddParameters("@FrequencyId", SqlDbType.Int, theDR["FrequencyId"].ToString()); ClsUtility.AddParameters("@DispensedQuantity", SqlDbType.Int, Convert.ToInt32(theDR["QtyDisp"]).ToString()); ClsUtility.AddParameters("@Prophylaxis", SqlDbType.Int, theDR["Prophylaxis"].ToString()); ClsUtility.AddParameters("@BatchId", SqlDbType.Int, theDR["BatchId"].ToString()); ClsUtility.AddParameters("@CostPrice", SqlDbType.Decimal, theDR["CostPrice"].ToString() != "" ? theDR["CostPrice"].ToString() : "0"); if (theDR["BatchNo"].ToString().Contains("(")) { ClsUtility.AddParameters("@BatchNo", SqlDbType.VarChar, theDR["BatchNo"].ToString().Substring(0, theDR["BatchNo"].ToString().IndexOf('('))); } else { ClsUtility.AddParameters("@BatchNo", SqlDbType.VarChar, theDR["BatchNo"].ToString()); } ClsUtility.AddParameters("@Margin", SqlDbType.Decimal, theDR["Margin"].ToString() != "" ? theDR["Margin"].ToString() : "0"); ClsUtility.AddParameters("@SellingPrice", SqlDbType.Decimal, theDR["SellingPrice"].ToString() != "" ? theDR["SellingPrice"].ToString() : "0"); ClsUtility.AddParameters("@BillAmount", SqlDbType.Decimal, theDR["BillAmount"].ToString() != "" ? theDR["BillAmount"].ToString() : "0"); ClsUtility.AddParameters("@ExpiryDate", SqlDbType.VarChar, theDR["ExpiryDate"].ToString()); ClsUtility.AddParameters("@DispensingUnit", SqlDbType.Int, theDR["DispensingUnitId"].ToString()); ClsUtility.AddParameters("@DispensedByDate", SqlDbType.VarChar, theDispDate.ToString("dd-MMM-yyyy")); ClsUtility.AddParameters("@LocationId", SqlDbType.Int, theLocationId.ToString()); ClsUtility.AddParameters("@UserId", SqlDbType.Int, theUserId.ToString()); ClsUtility.AddParameters("@DataStatus", SqlDbType.Int, theDR["DataStatus"].ToString()); ClsUtility.AddParameters("@PrescribeOrderedQuantity", SqlDbType.Decimal, theDR["OrderedQuantity"].ToString() != "" ? theDR["OrderedQuantity"].ToString() : "0"); ClsUtility.AddParameters("@Dose", SqlDbType.Decimal, theDR["Dose"].ToString() != "" ? theDR["Dose"].ToString() : "0"); ClsUtility.AddParameters("@Duration", SqlDbType.Decimal, theDR["Duration"].ToString() != "" ? theDR["Duration"].ToString() : "0"); ClsUtility.AddParameters("@PrintPrescriptionStatus", SqlDbType.Int, theDR["PrintPrescriptionStatus"].ToString()); ClsUtility.AddParameters("@PatientInstructions", SqlDbType.VarChar, theDR["PatientInstructions"].ToString()); Int32 theRowCount = (Int32)theManager.ReturnObject(ClsUtility.theParams, "pr_SCM_SavePharmacyDispenseOrderDetail_Futures", ClsDBUtility.ObjectEnum.ExecuteNonQuery); } // return thePharmacyDT; DataMgr.CommitTransaction(this.Transaction); DataMgr.ReleaseConnection(this.Connection); } catch { DataMgr.RollBackTransation(this.Transaction); throw; } finally { if (this.Connection != null) { DataMgr.ReleaseConnection(this.Connection); } } return(thePharmacyDT); }
public DataSet SaveUpdateNigeriaPaedIEManagementData(Hashtable hashTable, DataTable dtMultiSelectValues, int DataQuality, int signature) { try { DataSet theDS; int visitID; this.Connection = DataMgr.GetConnection(); this.Transaction = DataMgr.BeginTransaction(this.Connection); ClsUtility.Init_Hashtable(); ClsUtility.AddParameters("@Ptn_pk", SqlDbType.Int, hashTable["patientID"].ToString()); ClsUtility.AddParameters("@Visit_Pk", SqlDbType.Int, hashTable["visitID"].ToString()); ClsUtility.AddParameters("@locationID", SqlDbType.Int, hashTable["locationID"].ToString()); ClsUtility.AddParameters("@visitDate", SqlDbType.VarChar, hashTable["visitDate"].ToString()); ClsUtility.AddParameters("@LabEvaluation", SqlDbType.Int, hashTable["LabEvaluation"].ToString()); ClsUtility.AddParameters("@LabReview", SqlDbType.VarChar, hashTable["LabReview"].ToString()); ClsUtility.AddParameters("@OtherReferrals", SqlDbType.VarChar, hashTable["OtherReferrals"].ToString()); ClsUtility.AddParameters("@Regimen", SqlDbType.Int, hashTable["Regimen"].ToString()); ClsUtility.AddParameters("@ARVTherapyPlan", SqlDbType.Int, hashTable["ARVTherapyPlan"].ToString()); ClsUtility.AddParameters("@OtherARVChangePlan", SqlDbType.DateTime, hashTable["OtherARVChangePlan"].ToString()); ClsUtility.AddParameters("@DataQlty", SqlDbType.Int, DataQuality.ToString()); ClsUtility.AddParameters("@UserId", SqlDbType.Int, signature.ToString()); ClsObject VisitManager = new ClsObject(); VisitManager.Connection = this.Connection; VisitManager.Transaction = this.Transaction; // DataSet tempDataSet; theDS = (DataSet)VisitManager.ReturnObject(ClsUtility.theParams, "pr_Clinical_SaveUpdate_Nigeria_PaedIE_MgtTab", ClsDBUtility.ObjectEnum.DataSet); visitID = (int)theDS.Tables[0].Rows[0]["Visit_Id"]; //Pre Existing Medical Condition for (int i = 0; i < dtMultiSelectValues.Rows.Count; i++) { if (dtMultiSelectValues.Rows[i]["ID"].ToString() != "") { ClsUtility.Init_Hashtable(); ClsUtility.AddParameters("@Ptn_pk", SqlDbType.Int, hashTable["patientID"].ToString()); ClsUtility.AddParameters("@Visit_Pk", SqlDbType.Int, visitID.ToString()); ClsUtility.AddParameters("@ID", SqlDbType.Int, dtMultiSelectValues.Rows[i]["ID"].ToString()); ClsUtility.AddParameters("@FieldName", SqlDbType.VarChar, dtMultiSelectValues.Rows[i]["FieldName"].ToString()); ClsUtility.AddParameters("@OtherNotes", SqlDbType.VarChar, dtMultiSelectValues.Rows[i]["Other_notes"].ToString()); int temp = (int)VisitManager.ReturnObject(ClsUtility.theParams, "pr_Clinical_Save_Multiselect_line", ClsDBUtility.ObjectEnum.ExecuteNonQuery); } } DataMgr.CommitTransaction(this.Transaction); DataMgr.ReleaseConnection(this.Connection); return(theDS); } catch { DataMgr.RollBackTransation(this.Transaction); throw; } finally { if (this.Connection != null) { DataMgr.ReleaseConnection(this.Connection); } } }
public DataSet SaveHomeVisit(int LocationID, int ptn_pk, string PatientCHW, string PatientAlternateCHW, int hvPerWeek1, int hvPerWeek2, int hvPerWeek3, int hvPerWeek4, int VisitsPerWeek, int Duration, DateTime StartDate, int UserId, int HomeVisitID, int Flag, int DataQualityFlag, DataTable theCustomFieldData) { ClsObject HomeVisitManager = new ClsObject(); DataSet theDT = new DataSet(); try { this.Connection = DataMgr.GetConnection(); this.Transaction = DataMgr.BeginTransaction(this.Connection); HomeVisitManager.Connection = this.Connection; HomeVisitManager.Transaction = this.Transaction; oUtility.Init_Hashtable(); oUtility.AddParameters("@LocationID", SqlDbType.Int, LocationID.ToString()); oUtility.AddParameters("@PatientId", SqlDbType.Int, ptn_pk.ToString()); oUtility.AddParameters("@PatientCHW", SqlDbType.VarChar, PatientCHW); oUtility.AddParameters("@PatientAlternateCHW", SqlDbType.VarChar, PatientAlternateCHW); oUtility.AddParameters("@hvPerWeek1", SqlDbType.Int, hvPerWeek1.ToString()); oUtility.AddParameters("@hvPerWeek2", SqlDbType.Int, hvPerWeek2.ToString()); oUtility.AddParameters("@hvPerWeek3", SqlDbType.Int, hvPerWeek3.ToString()); oUtility.AddParameters("@hvPerWeek4", SqlDbType.Int, hvPerWeek4.ToString()); oUtility.AddParameters("@VisitsPerWeek", SqlDbType.Int, VisitsPerWeek.ToString()); oUtility.AddParameters("@Duration", SqlDbType.Int, Duration.ToString()); oUtility.AddParameters("@StartDate", SqlDbType.DateTime, StartDate.ToString()); oUtility.AddParameters("@UserID", SqlDbType.Int, UserId.ToString()); oUtility.AddParameters("@HomeVisitID", SqlDbType.Int, HomeVisitID.ToString()); oUtility.AddParameters("@DataQuality", SqlDbType.Int, DataQualityFlag.ToString()); //////if (Flag == 0) //////{ ////// theDT = (DataSet)HomeVisitManager.ReturnObject(oUtility.theParams, "pr_Scheduler_SaveHomeVisit_Constella", ClsUtility.ObjectEnum.DataSet); //////} //////else if (Flag == 1) //////{ ////// theDT = (DataSet)HomeVisitManager.ReturnObject(oUtility.theParams, "pr_Scheduler_UpdateHomeVisit_Constella", ClsUtility.ObjectEnum.DataSet); //////} theDT = (DataSet)HomeVisitManager.ReturnObject(oUtility.theParams, "pr_Scheduler_UpdateHomeVisit_Constella", ClsUtility.ObjectEnum.DataSet); //// Custom Fields ////////////// ////////////PreSet Values Used///////////////// /// #99# --- Ptn_Pk /// #88# --- LocationId /// #77# --- Visit_Pk /// #66# --- Visit_Date /// #55# --- Ptn_Pharmacy_Pk /// #44# --- OrderedByDate /// #33# --- LabId /// #22# --- TrackingId /// #11# --- CareEndedId /// #00# --- HomeVisitId /////////////////////////////////////////////// String VisitIDHome = ""; VisitIDHome = theDT.Tables[1].Rows[0][0].ToString(); ////string theSQL = string.Format("Select IDENT_CURRENT('dtl_PatientHomeVisit')"); ////oUtility.Init_Hashtable(); ////DataTable DTVisitID = (DataTable)HomeVisitManager.ReturnObject(oUtility.theParams, theSQL, ClsUtility.ObjectEnum.DataTable); ////VisitIDHome = DTVisitID.Rows[0][0].ToString(); for (Int32 i = 0; i < theCustomFieldData.Rows.Count; i++) { oUtility.Init_Hashtable(); string theQuery = theCustomFieldData.Rows[i]["Query"].ToString(); theQuery = theQuery.Replace("#99#", ptn_pk.ToString()); theQuery = theQuery.Replace("#88#", LocationID.ToString()); theQuery = theQuery.Replace("#00#", VisitIDHome.ToString()); theQuery = theQuery.Replace("#66#", "'" + StartDate.ToString() + "'"); oUtility.AddParameters("@QryString", SqlDbType.VarChar, theQuery); int RowsAffected = (Int32)HomeVisitManager.ReturnObject(oUtility.theParams, "pr_General_Dynamic_Insert", ClsUtility.ObjectEnum.ExecuteNonQuery); } DataMgr.CommitTransaction(this.Transaction); DataMgr.ReleaseConnection(this.Connection); return(theDT); } catch { DataMgr.RollBackTransation(this.Transaction); throw; } finally { HomeVisitManager = null; if (this.Connection != null) { DataMgr.ReleaseConnection(this.Connection); } } }
public int SaveUpdateWebDrugDetails(int Drug_Pk, Hashtable theHash, DataTable Generics, int UserID, DataTable Strength) { DataTable dtGen = new DataTable(); DataTable dtStrength = new DataTable(); int TotalNoRowsAffected = 0; DataSet theReturnDT = new DataSet(); DataTable theExistRow = new DataTable(); try { this.Connection = DataMgr.GetConnection(); this.Transaction = DataMgr.BeginTransaction(this.Connection); ClsObject DrugManager = new ClsObject(); DrugManager.Connection = this.Connection; DrugManager.Transaction = this.Transaction; if (theHash["ItemType"].ToString() == "300") { if (Strength.Rows.Count != 0) { foreach (DataRow dr in Strength.Rows) { StringBuilder strgenname = new StringBuilder(); foreach (DataRow drgenericname in Generics.Rows) { string genName = ""; genName = drgenericname["Name"].ToString(); genName = "/" + genName.ToString(); strgenname.Append(genName.ToString()); } strgenname.Remove(0, 1); #region "Save Trade Name and Map with Generic" ClsUtility.Init_Hashtable(); ClsUtility.AddParameters("@DrugId", SqlDbType.Int, Drug_Pk.ToString()); ClsUtility.AddParameters("@DrugName", SqlDbType.VarChar, strgenname.ToString() + "-" + theHash["ItemName"].ToString() + " " + dr["Name"].ToString()); ClsUtility.AddParameters("@ItemType", SqlDbType.VarChar, theHash["ItemType"].ToString()); ClsUtility.AddParameters("@ItemSubType", SqlDbType.Int, theHash["ItemSubType"].ToString()); ClsUtility.AddParameters("@ItemCode", SqlDbType.VarChar, theHash["ItemCode"].ToString()); ClsUtility.AddParameters("@RxNorm", SqlDbType.VarChar, theHash["RxNorm"].ToString()); ClsUtility.AddParameters("@DrugAbbre", SqlDbType.VarChar, theHash["DrugAbbre"].ToString()); ClsUtility.AddParameters("@MorningDose", SqlDbType.Int, theHash["MorningDose"].ToString()); ClsUtility.AddParameters("@MiddayDose", SqlDbType.Int, theHash["MiddayDose"].ToString()); ClsUtility.AddParameters("@EveningDose", SqlDbType.Int, theHash["EveningDose"].ToString()); ClsUtility.AddParameters("@NightDose", SqlDbType.Int, theHash["NightDose"].ToString()); ClsUtility.AddParameters("@Manufacturer", SqlDbType.Int, theHash["Manufacturer"].ToString()); ClsUtility.AddParameters("@ItemInstruction", SqlDbType.VarChar, theHash["ItemInstruction"].ToString()); ClsUtility.AddParameters("@SyrupPowder", SqlDbType.Int, theHash["SyrupPowder"].ToString()); ClsUtility.AddParameters("@VolumeUnit", SqlDbType.Int, theHash["VolumeUnit"].ToString()); ClsUtility.AddParameters("@PurchaseUnit", SqlDbType.Int, theHash["PurchaseUnit"].ToString()); ClsUtility.AddParameters("@PurchaseQuantity", SqlDbType.Int, theHash["PurchaseQuantity"].ToString()); ClsUtility.AddParameters("@PurchaseUnitPrice", SqlDbType.Decimal, theHash["PurchaseUnitPrice"].ToString()); ClsUtility.AddParameters("@DispMargin", SqlDbType.Decimal, theHash["DispMargin"].ToString()); ClsUtility.AddParameters("@DispensingUnit", SqlDbType.Int, theHash["DispensingUnit"].ToString()); ClsUtility.AddParameters("@DispUnitPrice", SqlDbType.Decimal, theHash["DispUnitPrice"].ToString()); ClsUtility.AddParameters("@SellingPrice", SqlDbType.Decimal, theHash["SellingPrice"].ToString()); ClsUtility.AddParameters("@EffectiveDate", SqlDbType.VarChar, theHash["EffectiveDate"].ToString()); ClsUtility.AddParameters("@UserId", SqlDbType.Int, UserID.ToString()); theReturnDT = (DataSet)DrugManager.ReturnObject(ClsUtility.theParams, "pr_Admin_DrugManagement", ClsDBUtility.ObjectEnum.DataSet); int g = 0; for (int i = 0; i < theReturnDT.Tables.Count; i++) { if (theReturnDT.Tables[i].Columns.Contains("DrugId")) { g = i; } } if (theReturnDT.Tables[g].Rows[0][0].ToString() == "0") { MsgBuilder theMsg = new MsgBuilder(); theMsg.DataElements["MessageText"] = "Item Already Exists. Try Again.."; Exception ex = AppException.Create("#C1", theMsg); throw ex; } int newDrugId = 0; if (Drug_Pk > 0) { newDrugId = Drug_Pk; } else { newDrugId = Convert.ToInt32(theReturnDT.Tables[g].Rows[0][0]); } ClsUtility.Init_Hashtable(); ClsUtility.AddParameters("@DrugId", SqlDbType.Int, newDrugId.ToString()); ClsUtility.AddParameters("@DrugType", SqlDbType.Int, theHash["ItemType"].ToString()); ClsUtility.AddParameters("@DrugSubType", SqlDbType.Int, theHash["ItemSubType"].ToString()); ClsUtility.AddParameters("@UserId", SqlDbType.Int, UserID.ToString()); dtGen = (DataTable)DrugManager.ReturnObject(ClsUtility.theParams, "Pr_InsertGenericTableValues", ClsDBUtility.ObjectEnum.DataTable, Generics, "@TableVar"); ClsUtility.Init_Hashtable(); ClsUtility.AddParameters("@DrugId", SqlDbType.Int, newDrugId.ToString()); ClsUtility.AddParameters("@UserId", SqlDbType.Int, UserID.ToString()); dtStrength = (DataTable)DrugManager.ReturnObject(ClsUtility.theParams, "Pr_InsertStrengthTableValues", ClsDBUtility.ObjectEnum.DataTable, Strength, "@TableVar"); TotalNoRowsAffected = TotalNoRowsAffected + 1; #endregion } } } else { ClsUtility.Init_Hashtable(); ClsUtility.AddParameters("@ItemId", SqlDbType.Int, Drug_Pk.ToString()); ClsUtility.AddParameters("@ItemName", SqlDbType.VarChar, theHash["ItemName"].ToString()); ClsUtility.AddParameters("@ItemType", SqlDbType.VarChar, theHash["ItemType"].ToString()); ClsUtility.AddParameters("@ItemSubType", SqlDbType.Int, theHash["ItemSubType"].ToString()); ClsUtility.AddParameters("@ItemCode", SqlDbType.VarChar, theHash["ItemCode"].ToString()); ClsUtility.AddParameters("@RxNorm", SqlDbType.VarChar, theHash["RxNorm"].ToString()); ClsUtility.AddParameters("@Manufacturer", SqlDbType.Int, theHash["Manufacturer"].ToString()); ClsUtility.AddParameters("@ItemInstruction", SqlDbType.VarChar, theHash["ItemInstruction"].ToString()); ClsUtility.AddParameters("@SyrupPowder", SqlDbType.Int, theHash["SyrupPowder"].ToString()); ClsUtility.AddParameters("@VolumeUnit", SqlDbType.Int, theHash["VolumeUnit"].ToString()); ClsUtility.AddParameters("@PurchaseUnit", SqlDbType.Int, theHash["PurchaseUnit"].ToString()); ClsUtility.AddParameters("@PurchaseQuantity", SqlDbType.Int, theHash["PurchaseQuantity"].ToString()); ClsUtility.AddParameters("@PurchaseUnitPrice", SqlDbType.Decimal, theHash["PurchaseUnitPrice"].ToString()); ClsUtility.AddParameters("@DispMargin", SqlDbType.Decimal, theHash["DispMargin"].ToString()); ClsUtility.AddParameters("@DispensingUnit", SqlDbType.Int, theHash["DispensingUnit"].ToString()); ClsUtility.AddParameters("@DispUnitPrice", SqlDbType.Decimal, theHash["DispUnitPrice"].ToString()); ClsUtility.AddParameters("@SellingPrice", SqlDbType.Decimal, theHash["SellingPrice"].ToString()); ClsUtility.AddParameters("@EffectiveDate", SqlDbType.VarChar, theHash["EffectiveDate"].ToString()); ClsUtility.AddParameters("@UserId", SqlDbType.Int, UserID.ToString()); int RowEffected = (int)DrugManager.ReturnObject(ClsUtility.theParams, "pr_Admin_ItemManagement", ClsDBUtility.ObjectEnum.ExecuteNonQuery); if (RowEffected.ToString() == "0") { MsgBuilder theMsg = new MsgBuilder(); theMsg.DataElements["MessageText"] = "Item Already Exists. Try Again.."; Exception ex = AppException.Create("#C1", theMsg); throw ex; } TotalNoRowsAffected = TotalNoRowsAffected + 1; } //////////////////////////////////////////////////// DrugManager = null; DataMgr.CommitTransaction(this.Transaction); DataMgr.ReleaseConnection(this.Connection); } catch { DataMgr.RollBackTransation(this.Transaction); //throw; } finally { if (this.Connection != null) { DataMgr.ReleaseConnection(this.Connection); } } return(TotalNoRowsAffected); }
public DataTable SavePatientRecord(Hashtable ht, Array arrIllness, Array arrReferredTo, Array arrAdhReason, Array arrARVReason4, DataTable theCustomFieldData) { //public int SavePatientRecord(Hashtable ht, Array arrIllness, Array arrReferredTo, Array arrAdhReason, Array arrARVReason4, strCustomField) ClsObject PatientRecord = new ClsObject(); int retval = 0; string VisitId; DataTable dtresult; // DateTime VisitDt; // int theRowAffected = 0; try { this.Connection = DataMgr.GetConnection(); this.Transaction = DataMgr.BeginTransaction(this.Connection); PatientRecord.Connection = this.Connection; PatientRecord.Transaction = this.Transaction; ClsUtility.Init_Hashtable(); ClsUtility.AddParameters("@Mode", SqlDbType.VarChar, ht["Mode"].ToString()); ClsUtility.AddParameters("@LocationID", SqlDbType.VarChar, ht["LocationID"].ToString()); ClsUtility.AddParameters("@UserID", SqlDbType.VarChar, ht["UserID"].ToString()); ClsUtility.AddParameters("@Ptn_Pk", SqlDbType.VarChar, ht["Ptn_Pk"].ToString()); ClsUtility.AddParameters("@VisitId", SqlDbType.VarChar, ht["VisitId"].ToString()); ClsUtility.AddParameters("@VisitDate", SqlDbType.VarChar, ht["VisitDate"].ToString()); ClsUtility.AddParameters("@TypeOfVisit", SqlDbType.VarChar, ht["TypeOfVisit"].ToString()); ClsUtility.AddParameters("@Height", SqlDbType.Int, ht["Height"].ToString()); ClsUtility.AddParameters("@Weight", SqlDbType.Decimal, ht["Weight"].ToString()); ClsUtility.AddParameters("@WHOStage", SqlDbType.Decimal, ht["WHOStage"].ToString()); ClsUtility.AddParameters("@OtherComplication", SqlDbType.VarChar, ht["OtherComplication"].ToString()); ClsUtility.AddParameters("@Pregnant", SqlDbType.Int, ht["Pregnant"].ToString()); ClsUtility.AddParameters("@EDD", SqlDbType.DateTime, ht["EDD"].ToString()); ClsUtility.AddParameters("@FuncStatus", SqlDbType.Int, ht["FuncStatus"].ToString()); ClsUtility.AddParameters("@TBStatus", SqlDbType.Int, ht["TBStatus"].ToString()); ClsUtility.AddParameters("@TBID", SqlDbType.VarChar, ht["TBID"].ToString()); ClsUtility.AddParameters("@NutritionalSupport", SqlDbType.Int, ht["NutritionalSupport"].ToString()); ClsUtility.AddParameters("@AppReason", SqlDbType.Int, ht["AppReason"].ToString()); ClsUtility.AddParameters("@AppDate", SqlDbType.VarChar, ht["AppDate"].ToString()); ClsUtility.AddParameters("@Signature", SqlDbType.Int, ht["Signature"].ToString()); ClsUtility.AddParameters("@CD4", SqlDbType.VarChar, ht["CD4"].ToString()); ClsUtility.AddParameters("@CD4Percent", SqlDbType.VarChar, ht["CD4Percent"].ToString()); ClsUtility.AddParameters("@TLC", SqlDbType.VarChar, ht["TLC"].ToString()); ClsUtility.AddParameters("@TLCPercent", SqlDbType.VarChar, ht["TLCPercent"].ToString()); ClsUtility.AddParameters("@OrderedBy", SqlDbType.VarChar, ht["OrderedBy"].ToString()); ClsUtility.AddParameters("@OrderedDate", SqlDbType.VarChar, ht["OrderedDate"].ToString()); ClsUtility.AddParameters("@ReportedBy", SqlDbType.VarChar, ht["ReportedBy"].ToString()); ClsUtility.AddParameters("@ReportedDate", SqlDbType.VarChar, ht["ReportedDate"].ToString()); ClsUtility.AddParameters("@Delivered", SqlDbType.VarChar, ht["Delivered"].ToString()); ClsUtility.AddParameters("@DOB", SqlDbType.VarChar, ht["DOB"].ToString()); ClsUtility.AddParameters("@PrevLABID", SqlDbType.VarChar, ht["PrevLABID"].ToString()); ClsUtility.AddParameters("@DQ", SqlDbType.VarChar, ht["DQ"].ToString()); ClsUtility.AddParameters("@EligibleReason", SqlDbType.Int, ht["EligibleReason"].ToString()); dtresult = (DataTable)PatientRecord.ReturnObject(ClsUtility.theParams, "pr_Clinical_SavePatientRecordCTC_Constella", ClsUtility.ObjectEnum.DataTable); //--------- Illness ---------- if (ht["Mode"].ToString() == "Add") { VisitId = dtresult.Rows[0][0].ToString(); } else { VisitId = ht["VisitId"].ToString(); } for (int i = 0; i < arrIllness.Length; i++) { if (arrIllness.GetValue(i) == null) { break; } ClsUtility.Init_Hashtable(); ClsUtility.AddParameters("@Mode", SqlDbType.VarChar, ht["Mode"].ToString()); ClsUtility.AddParameters("@UserID", SqlDbType.VarChar, ht["UserID"].ToString()); ClsUtility.AddParameters("@Ptn_Pk", SqlDbType.VarChar, ht["Ptn_Pk"].ToString()); ClsUtility.AddParameters("@VisitId", SqlDbType.VarChar, VisitId.ToString()); ClsUtility.AddParameters("@SymptomID", SqlDbType.Int, arrIllness.GetValue(i).ToString()); retval = (int)PatientRecord.ReturnObject(ClsUtility.theParams, "pr_Clinical_SavePatientRecordIllnessCTC_Constella", ClsUtility.ObjectEnum.ExecuteNonQuery); } //--------- ReferredTo ---------- for (int i = 0; i < arrReferredTo.Length; i++) { if (arrReferredTo.GetValue(i, 0) == null) { break; } ClsUtility.Init_Hashtable(); ClsUtility.AddParameters("@Mode", SqlDbType.VarChar, ht["Mode"].ToString()); ClsUtility.AddParameters("@UserID", SqlDbType.VarChar, ht["UserID"].ToString()); ClsUtility.AddParameters("@Ptn_Pk", SqlDbType.VarChar, ht["Ptn_Pk"].ToString()); ClsUtility.AddParameters("@VisitId", SqlDbType.VarChar, VisitId.ToString()); ClsUtility.AddParameters("@PatientRefID", SqlDbType.Int, arrReferredTo.GetValue(i, 0).ToString()); ClsUtility.AddParameters("@PatientRefDesc", SqlDbType.VarChar, arrReferredTo.GetValue(i, 1).ToString()); retval = (int)PatientRecord.ReturnObject(ClsUtility.theParams, "pr_Clinical_SavePatientRecordReferredToCTC_Constella", ClsUtility.ObjectEnum.ExecuteNonQuery); } //--------- arrAdhReason ---------- for (int i = 0; i < arrAdhReason.Length; i++) { if (arrAdhReason.GetValue(i, 0) == null) { break; } ClsUtility.Init_Hashtable(); ClsUtility.AddParameters("@Mode", SqlDbType.VarChar, ht["Mode"].ToString()); //ClsUtility.AddParameters("@LocationID", SqlDbType.VarChar, ht["LocationID"].ToString()); ClsUtility.AddParameters("@UserID", SqlDbType.VarChar, ht["UserID"].ToString()); ClsUtility.AddParameters("@Ptn_Pk", SqlDbType.VarChar, ht["Ptn_Pk"].ToString()); ClsUtility.AddParameters("@VisitId", SqlDbType.VarChar, VisitId.ToString()); ClsUtility.AddParameters("@AdherenceReason", SqlDbType.Int, arrAdhReason.GetValue(i, 0).ToString()); ClsUtility.AddParameters("@AdherenceReasonOther", SqlDbType.VarChar, arrAdhReason.GetValue(i, 1).ToString()); retval = (int)PatientRecord.ReturnObject(ClsUtility.theParams, "pr_Clinical_SavePatientRecordAdhReasonCTC_Constella", ClsUtility.ObjectEnum.ExecuteNonQuery); } //--------- arrARVReason4 ---------- for (int i = 0; i < arrARVReason4.Length; i++) { if (arrARVReason4.GetValue(i, 0) == null) { break; } ClsUtility.Init_Hashtable(); ClsUtility.AddParameters("@Mode", SqlDbType.VarChar, ht["Mode"].ToString()); //ClsUtility.AddParameters("@LocationID", SqlDbType.VarChar, ht["LocationID"].ToString()); ClsUtility.AddParameters("@UserID", SqlDbType.VarChar, ht["UserID"].ToString()); ClsUtility.AddParameters("@Ptn_Pk", SqlDbType.VarChar, ht["Ptn_Pk"].ToString()); ClsUtility.AddParameters("@VisitId", SqlDbType.VarChar, VisitId.ToString()); ClsUtility.AddParameters("@ARVReasonChange", SqlDbType.VarChar, arrARVReason4.GetValue(i, 0).ToString()); ClsUtility.AddParameters("@ARVReasonChangeOther", SqlDbType.VarChar, arrARVReason4.GetValue(i, 1).ToString()); ClsUtility.AddParameters("@ARVStatus", SqlDbType.Int, ht["ARVStatus"].ToString()); ClsUtility.AddParameters("@ARVReason", SqlDbType.Int, ht["ARVReason"].ToString()); ClsUtility.AddParameters("@EligibleReason", SqlDbType.Int, ht["EligibleReason"].ToString()); ClsUtility.AddParameters("@EligibleDate", SqlDbType.VarChar, ht["EligibleDate"].ToString()); ClsUtility.AddParameters("@ReadyDate", SqlDbType.VarChar, ht["ReadyDate"].ToString()); retval = (int)PatientRecord.ReturnObject(ClsUtility.theParams, "pr_Clinical_SavePatientRecordARVReasonChangeCTC_Constella", ClsUtility.ObjectEnum.ExecuteNonQuery); } //string[] mValues = strCustomField.Split(new char[] { '!' }); //foreach (string str in mValues) //{ // if (str.ToString() != "") // { // string sqlStrNew = str.Replace("77777", dtresult.Rows[0][0].ToString()); // string sqlStrFinal = sqlStrNew.Replace("1900-01-01", dtresult.Rows[0][1].ToString()); // ClsUtility.Init_Hashtable(); // ClsUtility.AddParameters("@QryString", SqlDbType.VarChar, sqlStrFinal); // theRowAffected = (int)PatientRecord.ReturnObject(ClsUtility.theParams, "pr_General_Dynamic_Insert", ClsUtility.ObjectEnum.ExecuteNonQuery); // } // if (theRowAffected == 0) // { // MsgBuilder theMsg = new MsgBuilder(); // theMsg.DataElements["MessageText"] = "Error in Saving Custom Fields. Try Again.."; // AppException.Create("#C1", theMsg); // } //} //// Custom Fields ////////////// ////////////PreSet Values Used///////////////// /// #99# --- Ptn_Pk /// #88# --- LocationId /// #77# --- Visit_Pk /// #66# --- Visit_Date /// #55# --- Ptn_Pharmacy_Pk /// #44# --- OrderedByDate /// #33# --- LabId /// #22# --- TrackingId /// #11# --- CareEndedId /// #00# --- HomeVisitId /////////////////////////////////////////////// //ClsObject theCustomManager = new ClsObject(); for (Int32 i = 0; i < theCustomFieldData.Rows.Count; i++) { ClsUtility.Init_Hashtable(); string theQuery = theCustomFieldData.Rows[i]["Query"].ToString(); theQuery = theQuery.Replace("#99#", ht["Ptn_Pk"].ToString()); theQuery = theQuery.Replace("#88#", ht["LocationID"].ToString()); theQuery = theQuery.Replace("#77#", dtresult.Rows[0][0].ToString()); theQuery = theQuery.Replace("#66#", "'" + dtresult.Rows[0][1].ToString() + "'"); ClsUtility.AddParameters("@QryString", SqlDbType.VarChar, theQuery); int RowsAffected = (Int32)PatientRecord.ReturnObject(ClsUtility.theParams, "pr_General_Dynamic_Insert", ClsUtility.ObjectEnum.ExecuteNonQuery); } DataMgr.CommitTransaction(this.Transaction); DataMgr.ReleaseConnection(this.Connection); return(dtresult); } catch { DataMgr.RollBackTransation(this.Transaction); throw; } finally { PatientRecord = null; if (this.Connection != null) { DataMgr.ReleaseConnection(this.Connection); } } //return Convert.ToInt32(VisitId); 05May09 //return dtresult; }
public int SaveUpdateCusomtField(int ID, string FieldName, int ControlID, int DeleteFlag, int UserID, int CareEnd, int flag, string SelectList, DataTable business, int Predefined, int SystemID, DataTable dtconditionalFields, DataTable dtICD10Fields) { try { this.Connection = DataMgr.GetConnection(); this.Transaction = DataMgr.BeginTransaction(this.Connection); ClsObject CustomField = new ClsObject(); CustomField.Connection = this.Connection; CustomField.Transaction = this.Transaction; int theRowAffected = 0; DataRow theDR; /************ Delete Previous Business Rule **********/ if (ID != 0 && flag != 4) { ClsUtility.Init_Hashtable(); ClsUtility.AddParameters("@ID", SqlDbType.Int, ID.ToString()); ClsUtility.AddParameters("@Predefined", SqlDbType.Int, Predefined.ToString()); theRowAffected = (int)CustomField.ReturnObject(ClsUtility.theParams, "Pr_PMTCT_Delete_FieldBusinessRule_Futures", ClsUtility.ObjectEnum.ExecuteNonQuery); if (theRowAffected == 0) { MsgBuilder theMsg = new MsgBuilder(); theMsg.DataElements["MessageText"] = "Error in Updating Custom Field. Try Again.."; AppException.Create("#C1", theMsg); } } ClsUtility.Init_Hashtable(); ClsUtility.AddParameters("@ID", SqlDbType.Int, ID.ToString()); ClsUtility.AddParameters("@FieldName", SqlDbType.VarChar, FieldName); ClsUtility.AddParameters("@ControlID", SqlDbType.Int, ControlID.ToString()); ClsUtility.AddParameters("@DeleteFlag", SqlDbType.Int, DeleteFlag.ToString()); ClsUtility.AddParameters("@UserID", SqlDbType.Int, UserID.ToString()); ClsUtility.AddParameters("@CareEnd", SqlDbType.Int, CareEnd.ToString()); ClsUtility.AddParameters("@flag", SqlDbType.Int, flag.ToString()); ClsUtility.AddParameters("@SelectList", SqlDbType.VarChar, SelectList); ClsUtility.AddParameters("@Predefined", SqlDbType.Int, Predefined.ToString()); ClsUtility.AddParameters("@SystemID", SqlDbType.Int, SystemID.ToString()); theDR = (DataRow)CustomField.ReturnObject(ClsUtility.theParams, "Pr_PMTCT_SaveUpdateCustomFields_Futures", ClsUtility.ObjectEnum.DataRow); int FieldID = Convert.ToInt32(theDR[0].ToString()); if (FieldID == 0) { MsgBuilder theBL = new MsgBuilder(); theBL.DataElements["MessageText"] = "Error in Saving Custom Field. Try Again.."; AppException.Create("#C1", theBL); } /************************Add Business Rule*************************/ for (int i = 0; i < business.Rows.Count; i++) { if (FieldName == business.Rows[i]["FieldName"].ToString()) { ClsUtility.Init_Hashtable(); ClsUtility.AddParameters("@FieldID", SqlDbType.Int, FieldID.ToString()); ClsUtility.AddParameters("@BusRuleID", SqlDbType.Int, business.Rows[i]["BusRuleId"].ToString()); ClsUtility.AddParameters("@Value", SqlDbType.VarChar, business.Rows[i]["Value"].ToString()); ClsUtility.AddParameters("@UserID", SqlDbType.Int, UserID.ToString()); ClsUtility.AddParameters("@Predefined", SqlDbType.Int, Predefined.ToString()); //12may2011 ClsUtility.AddParameters("@Value1", SqlDbType.VarChar, business.Rows[i]["Value1"].ToString()); theRowAffected = (int)CustomField.ReturnObject(ClsUtility.theParams, "Pr_PMTCT_SaveBusinessRules_Futures", ClsUtility.ObjectEnum.ExecuteNonQuery); if (theRowAffected == 0) { MsgBuilder theMsg = new MsgBuilder(); theMsg.DataElements["MessageText"] = "Error in Saving Custom Field. Try Again.."; AppException.Create("#C1", theMsg); } } } /**************************Add Conditional Fields*************************************/ int Rec = 0; if (dtconditionalFields != null && dtconditionalFields.Rows.Count == 0) { if (CareEnd == 0) { ClsUtility.Init_Hashtable(); string theTSQL = ""; if (Predefined == 1) { theTSQL = "delete from dbo.lnk_conditionalfields where ConFieldId =" + ID.ToString().Replace("9999", ""); } else if (Predefined == 0) { theTSQL = "delete from dbo.lnk_conditionalfields where ConFieldId =" + ID.ToString().Replace("8888", ""); } Int32 theRow = (Int32)CustomField.ReturnObject(ClsUtility.theParams, theTSQL, ClsUtility.ObjectEnum.ExecuteNonQuery); } else if (CareEnd == 2) { ClsUtility.Init_Hashtable(); string theTSQL = ""; if (Predefined == 1) { theTSQL = "delete from dbo.lnk_PatientRegconditionalfields where ConFieldId =" + ID.ToString().Replace("9999", ""); } else if (Predefined == 0) { theTSQL = "delete from dbo.lnk_PatientRegconditionalfields where ConFieldId =" + ID.ToString().Replace("8888", ""); } Int32 theRow = (Int32)CustomField.ReturnObject(ClsUtility.theParams, theTSQL, ClsUtility.ObjectEnum.ExecuteNonQuery); } else { ClsUtility.Init_Hashtable(); string theTSQL = ""; if (Predefined == 1) { theTSQL = "delete from dbo.lnk_CareEndConditionalFields where ConFieldId =" + ID.ToString().Replace("9999", ""); } else if (Predefined == 0) { theTSQL = "delete from dbo.lnk_CareEndConditionalFields where ConFieldId =" + ID.ToString().Replace("8888", ""); } //string theTSQL = "delete from dbo.lnk_CareEndConditionalFields where ConFieldId =" + ID.ToString(); Int32 theRow = (Int32)CustomField.ReturnObject(ClsUtility.theParams, theTSQL, ClsUtility.ObjectEnum.ExecuteNonQuery); } } foreach (DataRow theDRCon in dtconditionalFields.Rows) { ClsUtility.Init_Hashtable(); Rec = Rec + 1; if (theDRCon["ConPredefine"].ToString() == "1" && CareEnd == 0) { ClsUtility.AddParameters("@ConfieldId", SqlDbType.Int, theDRCon["ConfieldId"].ToString().Replace("9999", "")); } else if (theDRCon["ConPredefine"].ToString() == "1" && CareEnd == 1) { ClsUtility.AddParameters("@ConfieldId", SqlDbType.Int, theDRCon["ConfieldId"].ToString().Replace("9999", "")); } else if (theDRCon["ConPredefine"].ToString() == "1" && CareEnd == 2) { ClsUtility.AddParameters("@ConfieldId", SqlDbType.Int, theDRCon["ConfieldId"].ToString().Replace("9999", "")); } if (theDRCon["ConPredefine"].ToString() == "0" && CareEnd == 0) { ClsUtility.AddParameters("@ConfieldId", SqlDbType.Int, theDRCon["ConfieldId"].ToString().Replace("8888", "")); } else if (theDRCon["ConPredefine"].ToString() == "0" && CareEnd == 1) { ClsUtility.AddParameters("@ConfieldId", SqlDbType.Int, theDRCon["ConfieldId"].ToString().Replace("8888", "")); } else if (theDRCon["ConPredefine"].ToString() == "0" && CareEnd == 2) { ClsUtility.AddParameters("@ConfieldId", SqlDbType.Int, theDRCon["ConfieldId"].ToString().Replace("8888", "")); } ClsUtility.AddParameters("@SectionId", SqlDbType.Int, theDRCon["SectionId"].ToString()); if (CareEnd == 1) { //ClsUtility.AddParameters("@FieldId", SqlDbType.Int, theDRCon["FieldId"].ToString()); if (theDRCon["Predefined"].ToString() == "1") { ClsUtility.AddParameters("@FieldId", SqlDbType.Int, theDRCon["FieldId"].ToString().Replace("9999", "")); } else { ClsUtility.AddParameters("@FieldId", SqlDbType.Int, theDRCon["FieldId"].ToString().Replace("8888", "")); } } else { if (theDRCon["Predefined"].ToString() == "1") { ClsUtility.AddParameters("@FieldId", SqlDbType.Int, theDRCon["FieldId"].ToString().Replace("9999", "")); } else { ClsUtility.AddParameters("@FieldId", SqlDbType.Int, theDRCon["FieldId"].ToString().Replace("8888", "")); } } ClsUtility.AddParameters("@FieldLabel", SqlDbType.VarChar, theDRCon["FieldLabel"].ToString()); ClsUtility.AddParameters("@Predefined", SqlDbType.Int, theDRCon["Predefined"].ToString()); ClsUtility.AddParameters("@Seq", SqlDbType.Int, Rec.ToString()); ClsUtility.AddParameters("@UserId", SqlDbType.Int, UserID.ToString()); ClsUtility.AddParameters("@FieldName", SqlDbType.VarChar, theDRCon["SectionName"].ToString()); ClsUtility.AddParameters("@Conpredefine", SqlDbType.Int, theDRCon["Conpredefine"].ToString()); if (Rec == 1) { ClsUtility.AddParameters("@Delete", SqlDbType.Int, "1"); } ClsUtility.AddParameters("@CareEnd", SqlDbType.Int, CareEnd.ToString()); theRowAffected = (int)CustomField.ReturnObject(ClsUtility.theParams, "Pr_FormBuilder_SavelnkConditionalForm_Futures", ClsUtility.ObjectEnum.ExecuteNonQuery); } // int Deleted = 0; foreach (DataRow theDRCon in dtICD10Fields.Rows) { ClsUtility.Init_Hashtable(); ClsUtility.AddParameters("@FieldId", SqlDbType.Int, FieldID.ToString()); ClsUtility.AddParameters("@BlockId", SqlDbType.Int, theDRCon["BlockId"].ToString().Replace("'", "")); ClsUtility.AddParameters("@SubBlockId", SqlDbType.Int, theDRCon["SubBlockId"].ToString().Replace("'", "")); ClsUtility.AddParameters("@CodeId", SqlDbType.Int, theDRCon["CodeId"].ToString().Replace("'", "")); ClsUtility.AddParameters("@Predefined", SqlDbType.Int, Predefined.ToString()); ClsUtility.AddParameters("@UserId", SqlDbType.Int, UserID.ToString()); ClsUtility.AddParameters("@DeleteFlag", SqlDbType.Int, theDRCon["Deleteflag"].ToString()); theRowAffected = (int)CustomField.ReturnObject(ClsUtility.theParams, "Pr_FormBuilder_SaveICD10CodeItems_Futures", ClsUtility.ObjectEnum.ExecuteNonQuery); // Deleted = 1; } /**************************************************************************************/ DataMgr.CommitTransaction(this.Transaction); DataMgr.ReleaseConnection(this.Connection); return(FieldID); } catch { DataMgr.RollBackTransation(this.Transaction); throw; } finally { if (this.Connection != null) { DataMgr.ReleaseConnection(this.Connection); } } }
public int UpsizeData(DataTable theDT, DataTable tblDataTypes, string DBName, string TableName) { //////SqlConnection theCon = (SqlConnection)Entity.GetConnection(ConStr); //////SqlTransaction theTran = theCon.BeginTransaction(); int i = 0; ///////////////////////////// //StreamWriter theWriter = new StreamWriter("c:\\miglog.txt"); //theWriter = File.AppendText("c:\\miglog.txt"); //////////////////////////// try { //////this.Connection = theCon; //////this.Transaction = theTran; this.Connection = DataMgr.GetConnection(); this.Transaction = DataMgr.BeginTransaction(this.Connection); //////Entity theObject = new Entity(); //////theObject.Connection = this.Connection; //////theObject.Transaction = this.Transaction; ClsObject objUpsize = new ClsObject(); objUpsize.Connection = this.Connection; objUpsize.Transaction = this.Transaction; /////// Table Creation////// string ColumnList = ""; foreach (DataColumn theCol in theDT.Columns) { DataView theDV = new DataView(tblDataTypes); theDV.RowFilter = "COLUMN_NAME ='" + theCol.ColumnName.ToString() + "'"; if (ColumnList == "") { ColumnList = "[" + theCol.ColumnName.ToString() + "]"; if (theDV[0]["CHARACTER_MAXIMUM_LENGTH"].ToString() != "") { ColumnList = ColumnList + " " + dbType(theCol.DataType.Name, theDV[0]["CHARACTER_MAXIMUM_LENGTH"].ToString()); } else { ColumnList = ColumnList + " " + dbType(theCol.DataType.Name, theDV[0]["NUMERIC_PRECISION"].ToString()); } } else { ColumnList = ColumnList + "," + "[" + theCol.ColumnName.ToString() + "]"; if (theDV[0]["CHARACTER_MAXIMUM_LENGTH"].ToString() != "") { ColumnList = ColumnList + " " + dbType(theCol.DataType.Name, theDV[0]["CHARACTER_MAXIMUM_LENGTH"].ToString()); } else { ColumnList = ColumnList + " " + dbType(theCol.DataType.Name, theDV[0]["NUMERIC_PRECISION"].ToString()); } } } string cmd = "create table " + TableName + "( " + ColumnList + ")"; ClsUtility.Init_Hashtable(); int RowsAffected = (Int32)objUpsize.ReturnObject(ClsUtility.theParams, cmd, ClsUtility.ObjectEnum.ExecuteNonQuery); //////////////////////////////// //////////////////////////////// /////Export Data///////////// ColumnList = ""; cmd = ""; string theColumns = ""; foreach (DataRow theDR in theDT.Rows) { cmd = "insert into " + TableName + " values("; theColumns = ""; for (i = 0; i < theDT.Columns.Count; i++) { if (theColumns == "") { theColumns = FString(theDR[i].ToString()); } else { theColumns = theColumns + "," + FString(theDR[i].ToString()); } } cmd = cmd + theColumns + ")"; ClsUtility.Init_Hashtable(); RowsAffected = (Int32)objUpsize.ReturnObject(ClsUtility.theParams, cmd, ClsUtility.ObjectEnum.ExecuteNonQuery); } //////theTran.Commit(); //////theCon.Close(); DataMgr.CommitTransaction(this.Transaction); DataMgr.ReleaseConnection(this.Connection); return(RowsAffected); } //////////////////////////////// //////catch (SqlException ex) catch { //theWriter.WriteLine(ex.Message.ToString()+"-"+ TableName + "-" + i.ToString()); //////theTran.Rollback(); DataMgr.RollBackTransation(this.Transaction); throw; } finally { if (this.Connection != null) { DataMgr.ReleaseConnection(this.Connection); } } }