public int UpdateSection(int SectionId, string SectionName, int UserID) { try { ClsObject SectionManager = new ClsObject(); SectionManager.Connection = this.Connection; SectionManager.Transaction = this.Transaction; ClsUtility.Init_Hashtable(); ClsUtility.AddParameters("@SectionName", SqlDbType.VarChar, SectionName); ClsUtility.AddParameters("@UserId", SqlDbType.Int, UserID.ToString()); ClsUtility.AddParameters("@SectionId", SqlDbType.Int, SectionId.ToString()); DataRow theDR; theDR = (DataRow)SectionManager.ReturnObject(ClsUtility.theParams, "Pr_Admin_UpdateSection_Constella", ClsUtility.ObjectEnum.DataRow); if (Convert.ToInt32(theDR[0]) == 0) { MsgBuilder theBL = new MsgBuilder(); theBL.DataElements["MessageText"] = "Error in Saving Section record. Try Again.."; AppException.Create("#C1", theBL); } return(Convert.ToInt32(theDR[0])); } catch { throw; } finally { if (this.Connection != null) { DataMgr.ReleaseConnection(this.Connection); } } }
public int SaveNewVisitType(string VisitName, int userId) { try { ClsObject VisitTypeManager = new ClsObject(); ClsUtility.Init_Hashtable(); ClsUtility.AddParameters("@VisitName", SqlDbType.VarChar, VisitName); ClsUtility.AddExtendedParameters("@UserId", SqlDbType.Int, userId); DataRow theDR; theDR = (DataRow)VisitTypeManager.ReturnObject(ClsUtility.theParams, "Pr_Admin_AddVisitType_Constella", ClsUtility.ObjectEnum.DataRow); if (Convert.ToInt32(theDR[0]) == 0) { MsgBuilder theBL = new MsgBuilder(); theBL.DataElements["MessageText"] = "Error in Saving Visit type record. Try Again.."; AppException.Create("#C1", theBL); } return(Convert.ToInt32(theDR[0])); } catch { throw; } finally { if (this.Connection != null) { DataMgr.ReleaseConnection(this.Connection); } } }
public DataTable SaveNewEmployee(string FirstName, string LastName, int DesignationID, int EmployeeID, int DeleteFlag, int UserID) { try { this.Connection = DataMgr.GetConnection(); this.Transaction = DataMgr.BeginTransaction(this.Connection); DataTable theAffectedDT; ClsObject EmployeeManager = new ClsObject(); EmployeeManager.Connection = this.Connection; EmployeeManager.Transaction = this.Transaction; oUtility.Init_Hashtable(); oUtility.AddParameters("@FirstName", SqlDbType.VarChar, FirstName); oUtility.AddParameters("@LastName", SqlDbType.VarChar, LastName); oUtility.AddParameters("@DesignationID", SqlDbType.Int, DesignationID.ToString()); oUtility.AddParameters("@UserId", SqlDbType.Int, UserID.ToString()); if (EmployeeID == 0) { theAffectedDT = (DataTable)EmployeeManager.ReturnObject(oUtility.theParams, "Pr_Admin_InsertEmployee_Constella", ClsUtility.ObjectEnum.DataTable); if (theAffectedDT.Rows[0][0].ToString() == "-1") { MsgBuilder theBL = new MsgBuilder(); theBL.DataElements["MessageText"] = "Error in Saving Employee record. Try Again.."; Exception ex = AppException.Create("#C1", theBL); throw ex; } } else { oUtility.AddParameters("@DeleteFlag", SqlDbType.Int, DeleteFlag.ToString()); oUtility.AddParameters("@EmployeeID", SqlDbType.Int, EmployeeID.ToString()); theAffectedDT = (DataTable)EmployeeManager.ReturnObject(oUtility.theParams, "Pr_Admin_UpdateEmployee_Constella", ClsUtility.ObjectEnum.DataTable); if (theAffectedDT.Rows[0][0].ToString() == "-1") { MsgBuilder theBL = new MsgBuilder(); theBL.DataElements["MessageText"] = "Error in Saving Employee record. Try Again.."; Exception ex = AppException.Create("#C1", theBL); throw ex; } } DataMgr.CommitTransaction(this.Transaction); DataMgr.ReleaseConnection(this.Connection); return(theAffectedDT); } catch { throw; } finally { if (this.Connection != null) { DataMgr.ReleaseConnection(this.Connection); } } }
public int SaveExposedInfant(int Id, int Ptn_Pk, int ExposedInfantId, string FirstName, string LastName, DateTime DOB, string FeedingPractice3mos, string CTX2mos, string HIVTestType, string HIVResult, string FinalStatus, DateTime?DeathDate, int UserID) { int theRowAffected = 0; ClsObject VisitManager = new ClsObject(); try { this.Connection = DataMgr.GetConnection(); this.Transaction = DataMgr.BeginTransaction(this.Connection); VisitManager.Connection = this.Connection; VisitManager.Transaction = this.Transaction; ClsUtility.Init_Hashtable(); ClsUtility.AddParameters("@Id", SqlDbType.Int, Id.ToString()); ClsUtility.AddParameters("@Ptn_Pk", SqlDbType.Int, Ptn_Pk.ToString()); ClsUtility.AddParameters("@ExposedInfantId", SqlDbType.Int, ExposedInfantId.ToString()); ClsUtility.AddParameters("@FirstName", SqlDbType.VarChar, FirstName.ToString()); ClsUtility.AddParameters("@LastName", SqlDbType.VarChar, LastName.ToString()); ClsUtility.AddParameters("@DOB", SqlDbType.DateTime, DOB.ToString()); ClsUtility.AddParameters("@FeedingPractice3mos", SqlDbType.VarChar, FeedingPractice3mos.ToString()); ClsUtility.AddParameters("@CTX2mos", SqlDbType.VarChar, CTX2mos.ToString()); ClsUtility.AddParameters("@HIVResult", SqlDbType.VarChar, HIVResult.ToString()); ClsUtility.AddParameters("@HIVTestType", SqlDbType.VarChar, HIVTestType.ToString()); ClsUtility.AddParameters("@FinalStatus", SqlDbType.VarChar, FinalStatus.ToString()); ClsUtility.AddParameters("@UserID", SqlDbType.VarChar, UserID.ToString()); if (DeathDate != null) { ClsUtility.AddParameters("@DeathDate", SqlDbType.VarChar, DeathDate == null ? null : DeathDate.ToString()); } theRowAffected = (int)VisitManager.ReturnObject(ClsUtility.theParams, "pr_Clinical_SaveExposedInfant", ClsUtility.ObjectEnum.ExecuteNonQuery); if (theRowAffected == 0) { MsgBuilder theMsg = new MsgBuilder(); theMsg.DataElements["MessageText"] = "Error in Saving Custom Field. Try Again.."; AppException.Create("#C1", theMsg); } else { DataMgr.CommitTransaction(this.Transaction); DataMgr.ReleaseConnection(this.Connection); } } catch { DataMgr.RollBackTransation(this.Transaction); throw; } finally { VisitManager = null; if (this.Connection != null) { DataMgr.ReleaseConnection(this.Connection); } } return(theRowAffected); }
public int SaveUpdateImmunisationDetail(List <BIQTouchmmunisationFields> immnisationFields) { ClsObject immunisation = new ClsObject(); int theRowAffected = 0; try { this.Connection = DataMgr.GetConnection(); this.Transaction = DataMgr.BeginTransaction(this.Connection); immunisation.Connection = this.Connection; immunisation.Transaction = this.Transaction; DataRow theDR; foreach (var Value in immnisationFields) { oUtility.Init_Hashtable(); oUtility.AddParameters("@Ptn_pk", SqlDbType.Int, Value.Ptnpk.ToString()); oUtility.AddParameters("@LocationId", SqlDbType.Int, Value.LocationId.ToString()); oUtility.AddParameters("@Immunisation_code", SqlDbType.VarChar, Value.ImmunisationCode.ToString()); if (Value.ImmunisationDate.Year.ToString() != "1900") { oUtility.AddParameters("@ImmunisationDate", SqlDbType.VarChar, String.Format("{0:dd-MMM-yyyy}", Value.ImmunisationDate)); } oUtility.AddParameters("@ImmunisationCU", SqlDbType.Int, Value.ImmunisationCU.ToString()); oUtility.AddParameters("@UserId", SqlDbType.Int, Value.UserId.ToString()); oUtility.AddParameters("@CardAvailabe", SqlDbType.Int, Value.CardAvailable.ToString()); oUtility.AddParameters("@ImmunisationOther", SqlDbType.VarChar, Value.ImmunisationOther); oUtility.AddParameters("@Flag", SqlDbType.Int, Value.Flag.ToString()); theRowAffected = (int)immunisation.ReturnObject(oUtility.theParams, "Pr_IQTouch_Pharmacy_AddUpdateImmunisation", ClsUtility.ObjectEnum.ExecuteNonQuery); if (theRowAffected == 0) { MsgBuilder theMsg = new MsgBuilder(); theMsg.DataElements["MessageText"] = "Error in Saving Immunisation Details. Try Again.."; AppException.Create("#C1", theMsg); } } DataMgr.CommitTransaction(this.Transaction); DataMgr.ReleaseConnection(this.Connection); } catch { DataMgr.RollBackTransation(this.Transaction); throw; } finally { immunisation = null; if (this.Connection != null) { DataMgr.ReleaseConnection(this.Connection); } } return(theRowAffected); }
public int SaveNewLabselectList(int testid, DataTable theDTselectList, int UserID) { try { int theRowAffected = 0; this.Connection = DataMgr.GetConnection(); this.Transaction = DataMgr.BeginTransaction(this.Connection); ClsObject LabManager = new ClsObject(); LabManager.Connection = this.Connection; LabManager.Transaction = this.Transaction; oUtility.Init_Hashtable(); oUtility.AddParameters("@testID", SqlDbType.Int, testid.ToString()); theRowAffected = (Int32)LabManager.ReturnObject(oUtility.theParams, "pr_Admin_deleteLabTestselectList_Constella", ClsUtility.ObjectEnum.ExecuteNonQuery); if (theRowAffected == 0) { MsgBuilder theBL = new MsgBuilder(); theBL.DataElements["MessageText"] = "Error in delete Lab Result record. Try Again.."; AppException.Create("#C1", theBL); } for (int i = 0; i < theDTselectList.Rows.Count; i++) { oUtility.Init_Hashtable(); oUtility.AddParameters("@LabName", SqlDbType.VarChar, theDTselectList.Rows[i]["selectlist"].ToString()); oUtility.AddParameters("@UserId", SqlDbType.Int, UserID.ToString()); oUtility.AddParameters("@testID", SqlDbType.Int, testid.ToString()); theRowAffected = (Int32)LabManager.ReturnObject(oUtility.theParams, "pr_Admin_AddLabTestselectList_Constella", ClsUtility.ObjectEnum.ExecuteNonQuery); if (theRowAffected == 0) { MsgBuilder theBL = new MsgBuilder(); theBL.DataElements["MessageText"] = "Error in Saving Lab record. Try Again.."; AppException.Create("#C1", theBL); } } DataMgr.CommitTransaction(this.Transaction); DataMgr.ReleaseConnection(this.Connection); return(theRowAffected); } catch { throw; } finally { if (this.Connection != null) { DataMgr.ReleaseConnection(this.Connection); } } }
public int SaveUpdateSatellite(String ID, String SatelliteID, String SatelliteName, String status, int priority, int Flag, int UserID, String Createdate) { try { this.Connection = DataMgr.GetConnection(); this.Transaction = DataMgr.BeginTransaction(this.Connection); ClsObject SatelliteMgr = new ClsObject(); SatelliteMgr.Connection = this.Connection; SatelliteMgr.Transaction = this.Transaction; oUtility.Init_Hashtable(); oUtility.AddParameters("@SatelliteID", SqlDbType.VarChar, SatelliteID); oUtility.AddParameters("@SatelliteName", SqlDbType.VarChar, SatelliteName); oUtility.AddParameters("@DeleteFlag", SqlDbType.Int, status.ToString()); oUtility.AddParameters("@SRNo", SqlDbType.Int, priority.ToString()); oUtility.AddParameters("@UserID", SqlDbType.Int, UserID.ToString()); int RowsAffected = 0; if (Flag == 0) { RowsAffected = (Int32)SatelliteMgr.ReturnObject(oUtility.theParams, "pr_Admin_SaveSatellite_Constella", ClsUtility.ObjectEnum.ExecuteNonQuery); } else if (Flag == 1) { oUtility.AddParameters("@ID", SqlDbType.Int, ID.ToString()); RowsAffected = (Int32)SatelliteMgr.ReturnObject(oUtility.theParams, "pr_Admin_UpdateSatellite_Constella", ClsUtility.ObjectEnum.ExecuteNonQuery); } /*********/ if (RowsAffected == 0) { MsgBuilder theBL = new MsgBuilder(); theBL.DataElements["MessageText"] = "Error in Saving Reason record. Try Again.."; AppException.Create("#C1", theBL); } DataMgr.CommitTransaction(this.Transaction); DataMgr.ReleaseConnection(this.Connection); return(Convert.ToInt32(RowsAffected)); } catch { throw; } finally { if (this.Connection != null) { DataMgr.ReleaseConnection(this.Connection); } } }
//public int SaveNewLabType(string LabTypeName, int UserID) //{ // try // { // this.Connection = DataMgr.GetConnection(); // this.Transaction = DataMgr.BeginTransaction(this.Connection); // ClsObject LabManager = new ClsObject(); // LabManager.Connection = this.Connection; // LabManager.Transaction = this.Transaction; // ClsUtility.Init_Hashtable(); // ClsUtility.AddParameters("@LabTypeName", SqlDbType.VarChar, LabTypeName); // ClsUtility.AddParameters("@UserId", SqlDbType.Int, UserID.ToString()); // DataRow theDR; // int RowsAffected = (Int32)LabManager.ReturnObject(ClsUtility.theParams, "pr_Admin_AddLabtype_Constella", ClsDBUtility.ObjectEnum.ExecuteNonQuery); // if (RowsAffected == 0) // { // MsgBuilder theBL = new MsgBuilder(); // theBL.DataElements["MessageText"] = "Error in Saving Lab type record. Try Again.."; // AppException.Create("#C1", theBL); // } // DataMgr.CommitTransaction(this.Transaction); // DataMgr.ReleaseConnection(this.Connection); // return Convert.ToInt32(RowsAffected); // } // catch // { // throw; // } // finally // { // if (this.Connection != null) // DataMgr.ReleaseConnection(this.Connection); // } //} //public int UpdateLabType(int LabTypeID, string LabTypeName, int UserID) //{ // try // { // this.Connection = DataMgr.GetConnection(); // this.Transaction = DataMgr.BeginTransaction(this.Connection); // ClsObject LabManager = new ClsObject(); // LabManager.Connection = this.Connection; // LabManager.Transaction = this.Transaction; // ClsUtility.Init_Hashtable(); // ClsUtility.AddParameters("@LabTypeName", SqlDbType.VarChar, LabTypeName); // ClsUtility.AddParameters("@LabTypeID", SqlDbType.Int, LabTypeID.ToString()); // ClsUtility.AddParameters("@UserId", SqlDbType.Int, UserID.ToString()); // DataRow theDR; // int RowsAffected = (Int32)LabManager.ReturnObject(ClsUtility.theParams, "Pr_Admin_UpdateLabType_Constella", ClsDBUtility.ObjectEnum.ExecuteNonQuery); // if (RowsAffected == 0) // { // MsgBuilder theBL = new MsgBuilder(); // theBL.DataElements["MessageText"] = "Error in Saving Lab type record. Try Again.."; // AppException.Create("#C1", theBL); // } // DataMgr.CommitTransaction(this.Transaction); // DataMgr.ReleaseConnection(this.Connection); // return Convert.ToInt32(RowsAffected); // } // catch // { // throw; // } // finally // { // if (this.Connection != null) // DataMgr.ReleaseConnection(this.Connection); // } //} public DataTable UpdateLab(int LabID, string LabName, int LabDepartmentID, int LabTypeID, int UserID, int DeleteFlag, string DataType, decimal MaxBoundary, decimal MinBoundary, int LabValueId, int Sequence, int UnitId) { try { DataTable theAffectedDT; this.Connection = DataMgr.GetConnection(); this.Transaction = DataMgr.BeginTransaction(this.Connection); ClsObject LabManager = new ClsObject(); LabManager.Connection = this.Connection; LabManager.Transaction = this.Transaction; ClsUtility.Init_Hashtable(); ClsUtility.AddParameters("@LabName", SqlDbType.VarChar, LabName); ClsUtility.AddParameters("@UserId", SqlDbType.Int, UserID.ToString()); ClsUtility.AddParameters("@LabDepartmentId", SqlDbType.Int, LabDepartmentID.ToString()); ClsUtility.AddParameters("@LabTypeId", SqlDbType.Int, LabTypeID.ToString()); ClsUtility.AddParameters("@LabTestId", SqlDbType.Int, LabID.ToString()); ClsUtility.AddParameters("@DeleteFlag", SqlDbType.Int, DeleteFlag.ToString()); ClsUtility.AddParameters("@DataType", SqlDbType.NVarChar, DataType.ToString()); ClsUtility.AddParameters("@MaxBoundary", SqlDbType.Decimal, MaxBoundary.ToString()); ClsUtility.AddParameters("@MinBoundary", SqlDbType.Decimal, MinBoundary.ToString()); ClsUtility.AddParameters("@LabValueId", SqlDbType.Int, LabValueId.ToString()); ClsUtility.AddParameters("@Sequence", SqlDbType.Int, Sequence.ToString()); ClsUtility.AddParameters("@UnitId", SqlDbType.Int, UnitId.ToString()); //DataRow theDR; theAffectedDT = (DataTable)LabManager.ReturnObject(ClsUtility.theParams, "Pr_Admin_UpdateLabTest_Constella", ClsDBUtility.ObjectEnum.DataTable); if (theAffectedDT.Rows[0][0].ToString() == "-1") { MsgBuilder theBL = new MsgBuilder(); theBL.DataElements["MessageText"] = "Error in Saving Lab test record. Try Again.."; AppException.Create("#C1", theBL); } DataMgr.CommitTransaction(this.Transaction); DataMgr.ReleaseConnection(this.Connection); return(theAffectedDT); } catch { throw; } finally { if (this.Connection != null) { DataMgr.ReleaseConnection(this.Connection); } } }
public int SaveUpdateRegimenGeneric(string RegimenName, string RegimenCode, int RegimenID, string Stage, int Status, string GenericID, int UserID, int SRNo, int flag) { try { this.Connection = DataMgr.GetConnection(); this.Transaction = DataMgr.BeginTransaction(this.Connection); ClsObject DrugManager = new ClsObject(); DrugManager.Connection = this.Connection; DrugManager.Transaction = this.Transaction; ClsUtility.Init_Hashtable(); ClsUtility.AddParameters("@RegimenName", SqlDbType.VarChar, RegimenName); ClsUtility.AddParameters("@RegimenCode", SqlDbType.VarChar, RegimenCode); ClsUtility.AddParameters("@Rid", SqlDbType.Int, RegimenID.ToString()); ClsUtility.AddParameters("@Stage", SqlDbType.VarChar, Stage); ClsUtility.AddParameters("@Status", SqlDbType.Int, Status.ToString()); ClsUtility.AddParameters("@GenericID", SqlDbType.VarChar, GenericID); ClsUtility.AddParameters("@UserId", SqlDbType.Int, UserID.ToString()); ClsUtility.AddParameters("@SRNo", SqlDbType.Int, SRNo.ToString()); ClsUtility.AddParameters("@flag", SqlDbType.Int, flag.ToString()); Int32 RowsAffected = (Int32)DrugManager.ReturnObject(ClsUtility.theParams, "pr_Admin_SaveRegimenGeneric_Constella", ClsDBUtility.ObjectEnum.ExecuteNonQuery); if (RowsAffected == 0) { MsgBuilder theBL = new MsgBuilder(); theBL.DataElements["MessageText"] = "Error in Saving Regimen Generic Combinations. Try Again.."; Exception ex = AppException.Create("#C1", theBL); throw ex; } DrugManager = null; DataMgr.CommitTransaction(this.Transaction); DataMgr.ReleaseConnection(this.Connection); return(RowsAffected); } catch { throw; } finally { if (this.Connection != null) { DataMgr.ReleaseConnection(this.Connection); } } }
public int SaveNewReason(string ReasonName, int CategoryID, int SRNo, int UserID) { try { this.Connection = DataMgr.GetConnection(); this.Transaction = DataMgr.BeginTransaction(this.Connection); ClsObject ReasonManager = new ClsObject(); ReasonManager.Connection = this.Connection; ReasonManager.Transaction = this.Transaction; ClsUtility.Init_Hashtable(); ClsUtility.AddParameters("@ReasonName", SqlDbType.VarChar, ReasonName); ClsUtility.AddParameters("@CategoryID", SqlDbType.Int, CategoryID.ToString()); ClsUtility.AddParameters("@SRNo", SqlDbType.Int, SRNo.ToString()); ClsUtility.AddParameters("@UserId", SqlDbType.Int, UserID.ToString()); // ClsUtility.AddParameters("@DeleteFlag", SqlDbType.Int, DeleteFlag.ToString()); // DataRow theDR; int RowsAffected = (Int32)ReasonManager.ReturnObject(ClsUtility.theParams, "Pr_Admin_InsertReason_Constella", ClsUtility.ObjectEnum.ExecuteNonQuery); if (RowsAffected == 0) { MsgBuilder theBL = new MsgBuilder(); theBL.DataElements["MessageText"] = "Error in Saving Reason record. Try Again.."; AppException.Create("#C1", theBL); } DataMgr.CommitTransaction(this.Transaction); DataMgr.ReleaseConnection(this.Connection); return(Convert.ToInt32(RowsAffected)); } catch { throw; } finally { if (this.Connection != null) { DataMgr.ReleaseConnection(this.Connection); } } }
public int UpdateOccupation(int OccupationID, string OccupationName, int UserID, int DeleteFlag, int Sequence) { try { this.Connection = DataMgr.GetConnection(); this.Transaction = DataMgr.BeginTransaction(this.Connection); ClsObject OccupationManager = new ClsObject(); OccupationManager.Connection = this.Connection; OccupationManager.Transaction = this.Transaction; ClsUtility.Init_Hashtable(); ClsUtility.AddParameters("@OccupationName", SqlDbType.VarChar, OccupationName); ClsUtility.AddParameters("@OccupationID", SqlDbType.Int, OccupationID.ToString()); ClsUtility.AddParameters("@UserId", SqlDbType.Int, UserID.ToString()); ClsUtility.AddParameters("@DeleteFlag", SqlDbType.Int, DeleteFlag.ToString()); ClsUtility.AddParameters("@Sequence", SqlDbType.Int, Sequence.ToString()); int RowsAffected = (Int32)OccupationManager.ReturnObject(ClsUtility.theParams, "Pr_Admin_UpdateOccupation_Constella", ClsUtility.ObjectEnum.ExecuteNonQuery); if (RowsAffected == 0) { MsgBuilder theBL = new MsgBuilder(); theBL.DataElements["MessageText"] = "Error in Saving Occupation record. Try Again.."; AppException.Create("#C1", theBL); } DataMgr.CommitTransaction(this.Transaction); DataMgr.ReleaseConnection(this.Connection); return(RowsAffected); } catch { throw; } finally { if (this.Connection != null) { DataMgr.ReleaseConnection(this.Connection); } } }
public int SaveUpdate(string ID, string PatientId, string TransferfromId, string TransfertoId, string TransfertoDate, int userId, string createdate, int flag) { try { this.Connection = DataMgr.GetConnection(); this.Transaction = DataMgr.BeginTransaction(this.Connection); ClsObject SaveUpdateMgr = new ClsObject(); SaveUpdateMgr.Connection = this.Connection; SaveUpdateMgr.Transaction = this.Transaction; ClsUtility.Init_Hashtable(); ClsUtility.AddParameters("@ID", SqlDbType.VarChar, ID); ClsUtility.AddParameters("@PatientId", SqlDbType.VarChar, PatientId); //ClsUtility.AddParameters("@LocationId", SqlDbType.VarChar, LocationId); ClsUtility.AddParameters("@TransferfromId", SqlDbType.VarChar, TransferfromId); ClsUtility.AddParameters("@TransfertoId", SqlDbType.VarChar, TransfertoId); ClsUtility.AddParameters("@TransfertoDate", SqlDbType.VarChar, TransfertoDate); ClsUtility.AddParameters("@UserId", SqlDbType.Int, userId.ToString()); ClsUtility.AddParameters("@Createdate", SqlDbType.VarChar, createdate); ClsUtility.AddParameters("@Flag", SqlDbType.Int, flag.ToString()); int RowsAffected = (Int32)SaveUpdateMgr.ReturnObject(ClsUtility.theParams, "pr_Clinical_PatientSatelliteTransferSaveUpdate_Constella", ClsUtility.ObjectEnum.ExecuteNonQuery); if (RowsAffected == 0) { MsgBuilder theBL = new MsgBuilder(); theBL.DataElements["MessageText"] = "Error in Saving Reason record. Try Again.."; AppException.Create("#C1", theBL); } DataMgr.CommitTransaction(this.Transaction); DataMgr.ReleaseConnection(this.Connection); return(Convert.ToInt32(RowsAffected)); } catch { throw; } finally { if (this.Connection != null) { DataMgr.ReleaseConnection(this.Connection); } } }
public int SaveNewEducation(int UserID, string EducationName, int Sequence) { try { this.Connection = DataMgr.GetConnection(); this.Transaction = DataMgr.BeginTransaction(this.Connection); ClsObject EducationManager = new ClsObject(); EducationManager.Connection = this.Connection; EducationManager.Transaction = this.Transaction; ClsUtility.Init_Hashtable(); ClsUtility.AddParameters("@UserID", SqlDbType.Int, UserID.ToString()); ClsUtility.AddParameters("@EducationName", SqlDbType.VarChar, EducationName); ClsUtility.AddParameters("@Sequence", SqlDbType.Int, Sequence.ToString()); DataRow theDR; theDR = (DataRow)EducationManager.ReturnObject(ClsUtility.theParams, "Pr_Admin_Insert_Education_Constella", ClsDBUtility.ObjectEnum.DataRow); if (Convert.ToInt32(theDR[0]) == 0) { MsgBuilder theBL = new MsgBuilder(); theBL.DataElements["MessageText"] = "Error in Saving Education record. Try Again.."; AppException.Create("#C1", theBL); } DataMgr.CommitTransaction(this.Transaction); DataMgr.ReleaseConnection(this.Connection); return(Convert.ToInt32(theDR[0])); } catch { throw; } finally { if (this.Connection != null) { DataMgr.ReleaseConnection(this.Connection); } } }
public DataTable SaveLabUnitLinks(int ID, int SubTestID, decimal MinBoundaryValue, decimal MaxBoundaryValue, int UnitID, int DefaultUnit, int Undetectable) { try { DataTable theAffectedDT; this.Connection = DataMgr.GetConnection(); this.Transaction = DataMgr.BeginTransaction(this.Connection); ClsObject LabManager = new ClsObject(); LabManager.Connection = this.Connection; LabManager.Transaction = this.Transaction; ClsUtility.Init_Hashtable(); ClsUtility.AddParameters("@ID", SqlDbType.Int, ID.ToString()); ClsUtility.AddParameters("@SubTestID", SqlDbType.Int, SubTestID.ToString()); ClsUtility.AddParameters("@MinBoundaryValue", SqlDbType.Decimal, MinBoundaryValue.ToString()); ClsUtility.AddParameters("@MaxBoundaryValue", SqlDbType.Decimal, MaxBoundaryValue.ToString()); ClsUtility.AddParameters("@UnitID", SqlDbType.Int, UnitID.ToString()); ClsUtility.AddParameters("@DefaultUnit", SqlDbType.Int, DefaultUnit.ToString()); ClsUtility.AddParameters("@Undetectable", SqlDbType.Int, Undetectable.ToString()); DataRow theDR; theAffectedDT = (DataTable)LabManager.ReturnObject(ClsUtility.theParams, "pr_Admin_SaveLabUnitLinks_Constella", ClsDBUtility.ObjectEnum.DataTable); if (theAffectedDT.Rows[0][0].ToString() == "-1") { MsgBuilder theBL = new MsgBuilder(); theBL.DataElements["MessageText"] = "Error in Saving Lab record. Try Again.."; AppException.Create("#C1", theBL); } DataMgr.CommitTransaction(this.Transaction); DataMgr.ReleaseConnection(this.Connection); return(theAffectedDT); } catch { throw; } finally { if (this.Connection != null) { DataMgr.ReleaseConnection(this.Connection); } } }
public int UpdateAssessment(int AssessmentId, int AssessmentCategoryID, string AssessmentName, int UserId) { try { this.Connection = DataMgr.GetConnection(); this.Transaction = DataMgr.BeginTransaction(this.Connection); ClsObject AssessmentManager = new ClsObject(); AssessmentManager.Connection = this.Connection; AssessmentManager.Transaction = this.Transaction; ClsUtility.Init_Hashtable(); ClsUtility.AddParameters("@AssessmentID", SqlDbType.Int, AssessmentId.ToString()); ClsUtility.AddParameters("@AssessmentCategoryID", SqlDbType.Int, AssessmentCategoryID.ToString()); ClsUtility.AddParameters("@AssessmentName", SqlDbType.VarChar, AssessmentName); ClsUtility.AddParameters("@UserId", SqlDbType.Int, UserId.ToString()); DataRow theDR; theDR = (DataRow)AssessmentManager.ReturnObject(ClsUtility.theParams, "Pr_Admin_UpdateAssessment_Constella", ClsDBUtility.ObjectEnum.DataRow); if (Convert.ToInt32(theDR[0]) == 0) { MsgBuilder theBL = new MsgBuilder(); theBL.DataElements["MessageText"] = "Error in updating Assessment record. Try Again.."; AppException.Create("#C1", theBL); } DataMgr.CommitTransaction(this.Transaction); DataMgr.ReleaseConnection(this.Connection); return(Convert.ToInt32(theDR[0])); } catch { throw; } finally { if (this.Connection != null) { DataMgr.ReleaseConnection(this.Connection); } } }
public int UpdateControl(int ControlId, string Name, string sDataType, int UserID) { try { this.Connection = DataMgr.GetConnection(); this.Transaction = DataMgr.BeginTransaction(this.Connection); ClsObject ControlManager = new ClsObject(); ControlManager.Connection = this.Connection; ControlManager.Transaction = this.Transaction; oUtility.Init_Hashtable(); oUtility.AddParameters("@Name", SqlDbType.VarChar, Name); oUtility.AddParameters("@DataType", SqlDbType.VarChar, sDataType); oUtility.AddParameters("@ControlId", SqlDbType.Int, ControlId.ToString()); oUtility.AddParameters("@UserId", SqlDbType.Int, UserID.ToString()); DataRow theDR; theDR = (DataRow)ControlManager.ReturnObject(oUtility.theParams, "Pr_Admin_UpdateControl_Constella", ClsUtility.ObjectEnum.DataRow); if (Convert.ToInt32(theDR[0]) == 0) { MsgBuilder theBL = new MsgBuilder(); theBL.DataElements["MessageText"] = "Error in Saving Control record. Try Again.."; AppException.Create("#C1", theBL); } DataMgr.CommitTransaction(this.Transaction); DataMgr.ReleaseConnection(this.Connection); return(Convert.ToInt32(theDR[0])); } catch { throw; } finally { if (this.Connection != null) { DataMgr.ReleaseConnection(this.Connection); } } }
public int DeleteCustomField(int fieldID, int flag) { lock (this) { ClsObject CustomField = new ClsObject(); ClsUtility.Init_Hashtable(); int theRowAffected = 0; ClsUtility.AddParameters("@ID", SqlDbType.Int, fieldID.ToString()); ClsUtility.AddParameters("@flag", SqlDbType.Int, flag.ToString()); theRowAffected = (int)CustomField.ReturnObject(ClsUtility.theParams, "Pr_PMTCT_DeleteCustomFields_Future", ClsUtility.ObjectEnum.ExecuteNonQuery); if (theRowAffected == 0) { MsgBuilder theMsg = new MsgBuilder(); theMsg.DataElements["MessageText"] = "Error in Deleting Custom Field. Try Again.."; AppException.Create("#C1", theMsg); } return(theRowAffected); } }
public int UpdatePassword(int userID, string Password) { try { int RowsAffected; this.Connection = DataMgr.GetConnection(); this.Transaction = DataMgr.BeginTransaction(this.Connection); ClsObject PasswordManager = new ClsObject(); PasswordManager.Connection = this.Connection; PasswordManager.Transaction = this.Transaction; Utility theUtil = new Utility(); Password = theUtil.Encrypt(Password); ClsUtility.Init_Hashtable(); ClsUtility.AddParameters("@userID", SqlDbType.Int, userID.ToString()); ClsUtility.AddParameters("@password", SqlDbType.VarChar, Password); RowsAffected = (int)PasswordManager.ReturnObject(ClsUtility.theParams, "pr_Admin_Update_UserIDPassword_Constella", ClsDBUtility.ObjectEnum.ExecuteNonQuery); if (RowsAffected == 0) { MsgBuilder theMsg = new MsgBuilder(); theMsg.DataElements["MessageText"] = "Error in Updating password. Try Again.."; AppException.Create("#C1", theMsg); } DataMgr.CommitTransaction(this.Transaction); DataMgr.ReleaseConnection(this.Connection); return(RowsAffected); } catch { DataMgr.RollBackTransation(this.Transaction); throw; } finally { if (this.Connection != null) { DataMgr.ReleaseConnection(this.Connection); } } }
public void SaveUserLock(int UserId, int locationID, string code, string lastURL) { ClsObject UserManager = new ClsObject(); try { this.Connection = DataMgr.GetConnection(); this.Transaction = DataMgr.BeginTransaction(this.Connection); int RowsAffected = 0; Utility theUtil = new Utility(); ClsUtility.Init_Hashtable(); ClsUtility.AddParameters("@UserID", SqlDbType.Int, UserId.ToString()); ClsUtility.AddParameters("@locationID", SqlDbType.Int, locationID.ToString()); ClsUtility.AddParameters("@code", SqlDbType.VarChar, code); ClsUtility.AddParameters("@lastURL", SqlDbType.VarChar, lastURL); RowsAffected = (int)UserManager.ReturnObject(ClsUtility.theParams, "Pr_IQTouch_ptrnLock_Update", ClsDBUtility.ObjectEnum.ExecuteNonQuery); if (RowsAffected < 0) { MsgBuilder theBL = new MsgBuilder(); theBL.DataElements["MessageText"] = "Error in Updating User Record. Try Again.."; AppException.Create("#C1", theBL); } DataMgr.CommitTransaction(this.Transaction); DataMgr.ReleaseConnection(this.Connection); } catch { DataMgr.RollBackTransation(this.Transaction); throw; } finally { UserManager = null; if (this.Connection != null) { DataMgr.ReleaseConnection(this.Connection); } } }
public int ResetFormStatus(Int32 iFormId, string strValue, Int32 iUserID) { lock (this) { ClsObject FormDetail = new ClsObject(); ClsUtility.Init_Hashtable(); int theRowAffected = 0; ClsUtility.AddParameters("@FormId", SqlDbType.VarChar, iFormId.ToString()); ClsUtility.AddParameters("@FormValue", SqlDbType.VarChar, strValue); ClsUtility.AddParameters("@UserID", SqlDbType.Int, iUserID.ToString()); theRowAffected = (int)FormDetail.ReturnObject(ClsUtility.theParams, "Pr_ManageForm_ResetFormStatus_Futures", ClsDBUtility.ObjectEnum.ExecuteNonQuery); if (theRowAffected == 0) { MsgBuilder theMsg = new MsgBuilder(); theMsg.DataElements["MessageText"] = "Error in Saving Custom Field. Try Again.."; AppException.Create("#C1", theMsg); } return(theRowAffected); } }
public int ResetCustomFieldRules(int fieldID, int flag, int predefine, string FieldName) { lock (this) { ClsObject CustomField = new ClsObject(); ClsUtility.Init_Hashtable(); int theRowAffected = 0; ClsUtility.AddParameters("@ID", SqlDbType.Int, fieldID.ToString()); ClsUtility.AddParameters("@flag", SqlDbType.Int, flag.ToString()); ClsUtility.AddParameters("@Predefined", SqlDbType.Int, predefine.ToString()); ClsUtility.AddParameters("@FieldName", SqlDbType.VarChar, FieldName); theRowAffected = (int)CustomField.ReturnObject(ClsUtility.theParams, "Pr_PMTCT_SaveUpdateCustomFields_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); } return(theRowAffected); } }
public int SaveNewDesignation(string DesignationName, int UserID, int Sequence, int DisplayMode, int SystemId) { try { this.Connection = DataMgr.GetConnection(); this.Transaction = DataMgr.BeginTransaction(this.Connection); ClsObject DesignationManager = new ClsObject(); DesignationManager.Connection = this.Connection; DesignationManager.Transaction = this.Transaction; ClsUtility.Init_Hashtable(); ClsUtility.AddParameters("@Designation_Name", SqlDbType.VarChar, DesignationName); ClsUtility.AddParameters("@UserId", SqlDbType.Int, UserID.ToString()); ClsUtility.AddParameters("@Sequence", SqlDbType.Int, Sequence.ToString()); ClsUtility.AddParameters("@DisplayMode", SqlDbType.Int, DisplayMode.ToString()); ClsUtility.AddParameters("@SystemId", SqlDbType.Int, SystemId.ToString()); int RowsAffected = (Int32)DesignationManager.ReturnObject(ClsUtility.theParams, "Pr_Admin_InsertDesignation_Constella", ClsDBUtility.ObjectEnum.ExecuteNonQuery); if (RowsAffected == 0) { MsgBuilder theBL = new MsgBuilder(); theBL.DataElements["MessageText"] = "Error in Saving Designation record. Try Again.."; AppException.Create("#C1", theBL); } DataMgr.CommitTransaction(this.Transaction); DataMgr.ReleaseConnection(this.Connection); return(Convert.ToInt32(RowsAffected)); } catch { throw; } finally { if (this.Connection != null) { DataMgr.ReleaseConnection(this.Connection); } } }
public DataTable ChangeDefaultUnit(int ID) { try { DataTable theAffectedDT; this.Connection = DataMgr.GetConnection(); this.Transaction = DataMgr.BeginTransaction(this.Connection); ClsObject LabManager = new ClsObject(); LabManager.Connection = this.Connection; LabManager.Transaction = this.Transaction; oUtility.Init_Hashtable(); oUtility.AddParameters("@ID", SqlDbType.Int, ID.ToString()); DataRow theDR; theAffectedDT = (DataTable)LabManager.ReturnObject(oUtility.theParams, "pr_Admin_ChangeDefaultUnit_Constella", ClsUtility.ObjectEnum.DataTable); if (theAffectedDT.Rows[0][0].ToString() == "-1") { MsgBuilder theBL = new MsgBuilder(); theBL.DataElements["MessageText"] = "Error in Saving Lab record. Try Again.."; AppException.Create("#C1", theBL); } DataMgr.CommitTransaction(this.Transaction); DataMgr.ReleaseConnection(this.Connection); return(theAffectedDT); } catch { throw; } finally { if (this.Connection != null) { DataMgr.ReleaseConnection(this.Connection); } } }
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); } } }
private int CallSaveVisitDetails(objVisit theVisit, bool IsUpdate = false) { ClsObject TheVisit = new ClsObject(); //System.Threading.Thread.Sleep(10000); int NewVisitID = 0; int theRowAffected = 0; try { this.Connection = DataMgr.GetConnection(); this.Transaction = DataMgr.BeginTransaction(this.Connection); TheVisit.Connection = this.Connection; TheVisit.Transaction = this.Transaction; //first save the single fields ClsUtility.Init_Hashtable(); if (IsUpdate) { ClsUtility.AddParameters("@OldVisitID", SqlDbType.Int, theVisit.OldVisitID.ToString()); } ClsUtility.AddParameters("@Ptn_pk", SqlDbType.Int, theVisit.PatientID.ToString()); ClsUtility.AddParameters("@Password", SqlDbType.VarChar, ApplicationAccess.DBSecurity); ClsUtility.AddParameters("@LocationId", SqlDbType.Int, theVisit.LocationID.ToString()); ClsUtility.AddParameters("@UserId", SqlDbType.Int, theVisit.UserID.ToString()); ClsUtility.AddParameters("@Scheduled", SqlDbType.Int, theVisit.Scheduled.ToString()); ClsUtility.AddParameters("@IQtouchVisitType", SqlDbType.Int, theVisit.VisitType.ToString()); ClsUtility.AddParameters("@Present", SqlDbType.Int, theVisit.Present.ToString()); ClsUtility.AddParameters("@SupporterName", SqlDbType.VarChar, theVisit.CGName); ClsUtility.AddParameters("@TreatmentSupporterContact", SqlDbType.VarChar, theVisit.CGPhoneNumber); ClsUtility.AddParameters("@MUAC", SqlDbType.Int, theVisit.MUAC.ToString()); ClsUtility.AddParameters("@Pregnancystatus", SqlDbType.Int, theVisit.PregnantYN.ToString()); ClsUtility.AddParameters("@Admittedtohospital", SqlDbType.Int, theVisit.AdmittedtoHospital.ToString()); ClsUtility.AddParameters("@HospitalizedNumberofdays", SqlDbType.Int, theVisit.NumDaysHosp.ToString()); ClsUtility.AddParameters("@HospitalName", SqlDbType.Int, theVisit.WhereHosp.ToString()); ClsUtility.AddParameters("@Dischargediagnosis", SqlDbType.VarChar, theVisit.DischargeDiagnosis); ClsUtility.AddParameters("@Dischargenote", SqlDbType.VarChar, theVisit.DischargeNote); ClsUtility.AddParameters("@DevelopmentalScreening", SqlDbType.Int, theVisit.DevScreening.ToString()); ClsUtility.AddParameters("@TannerStage", SqlDbType.Int, theVisit.TannerStage.ToString()); ClsUtility.AddParameters("@SexuallyActive", SqlDbType.Int, theVisit.SexuallyActiveYN.ToString()); ClsUtility.AddParameters("@Protectedsex", SqlDbType.Int, theVisit.ProtectedSexYN.ToString()); ClsUtility.AddParameters("@NewTBContact", SqlDbType.Int, theVisit.NewTBContactYN.ToString()); ClsUtility.AddParameters("@ContactSensitiveTB", SqlDbType.Int, theVisit.SensitivityTBYN.ToString()); ClsUtility.AddParameters("@ContactTBTreatment", SqlDbType.Int, theVisit.TreatmentYN.ToString()); ClsUtility.AddParameters("@ContactDailyInjection", SqlDbType.Int, theVisit.DailyInjectionsYN.ToString()); //ClsUtility.AddParameters("@ContactTBTreatmentRcvd", SqlDbType.Int, "0");//theVisit.Treatment.ToString()); ClsUtility.AddParameters("@ContactTBTreatmentRcvd", SqlDbType.Int, theVisit.FormOfTreatment.ToString()); ClsUtility.AddParameters("@ContactOtherTBProphylaxis", SqlDbType.VarChar, theVisit.ContactOtherTBProphylaxis); ClsUtility.AddParameters("@Disease_pk", SqlDbType.Int, "0"); ClsUtility.AddParameters("@FamilyPlanningMethod", SqlDbType.VarChar, theVisit.FamilyPlanning.ToString()); ClsUtility.AddParameters("@OtherFPmethods", SqlDbType.VarChar, theVisit.FamilyPlanningOther); ClsUtility.AddParameters("@Temp", SqlDbType.Decimal, theVisit.Temp.ToString()); ClsUtility.AddParameters("@RR", SqlDbType.Decimal, theVisit.RespRate.ToString()); ClsUtility.AddParameters("@HR", SqlDbType.Decimal, theVisit.Pulse.ToString()); ClsUtility.AddParameters("@BPDiastolic", SqlDbType.Decimal, theVisit.BPDiast.ToString()); ClsUtility.AddParameters("@BPSystolic", SqlDbType.Decimal, theVisit.BPSyst.ToString()); ClsUtility.AddParameters("@Weight", SqlDbType.Decimal, theVisit.Weight.ToString()); ClsUtility.AddParameters("@Height", SqlDbType.Decimal, theVisit.Height.ToString()); ClsUtility.AddParameters("@Headcircumference", SqlDbType.Decimal, theVisit.HeadCirc.ToString()); ClsUtility.AddParameters("@TBRxStartDate", SqlDbType.VarChar, theVisit.TBRxStartDate.ToString()); ClsUtility.AddParameters("@TBRxEndDate", SqlDbType.VarChar, theVisit.TBRxEndDate.ToString()); ClsUtility.AddParameters("@TBStatus", SqlDbType.Int, theVisit.TBStatus.ToString()); ClsUtility.AddParameters("@StillTreatement", SqlDbType.Int, theVisit.StillOnTreatment.ToString()); ClsUtility.AddParameters("@NewSensitiveInformation", SqlDbType.Int, theVisit.NewSensitivityInfoYN.ToString()); ClsUtility.AddParameters("@PatientTBTreatmentRcvd", SqlDbType.Int, theVisit.PatientTBTreatment.ToString()); ClsUtility.AddParameters("@PatientOtherTBProphylaxis", SqlDbType.VarChar, theVisit.PatientOtherTBProphylaxis); ClsUtility.AddParameters("@WHOStage", SqlDbType.Int, theVisit.ClinicalStage.ToString()); ClsUtility.AddParameters("@ClinicalNotes", SqlDbType.VarChar, theVisit.ClinicalNotes); //To be included after UAT //ClsUtility.AddParameters("@AdverseEventOther", SqlDbType.VarChar, theVisit //ClsUtility.AddParameters("@AdverseEventSeverityID", SqlDbType.Int, theVisit ClsUtility.AddParameters("@CorrectlyDispensed", SqlDbType.Int, theVisit.DispensedYN.ToString()); ClsUtility.AddParameters("@NotDispensedNote", SqlDbType.VarChar, theVisit.ReasonNotDispensed.ToString()); ClsUtility.AddParameters("@CotrimoxazoleAdhere", SqlDbType.Int, theVisit.CTXAdherance.ToString()); ClsUtility.AddParameters("@ARVAdhere", SqlDbType.Int, theVisit.ARVAdherance.ToString()); ClsUtility.AddParameters("@ARTenddate", SqlDbType.VarChar, theVisit.ARTEndDate.ToString()); ClsUtility.AddParameters("@FeedingOption", SqlDbType.Int, theVisit.FeedingPractice.ToString()); ClsUtility.AddParameters("@NutritionalSupport", SqlDbType.Int, theVisit.NutrionalSupport.ToString()); ClsUtility.AddParameters("@NutritionalProblem", SqlDbType.Int, theVisit.NutritionalProblems.ToString()); string therapyReasons = string.Empty; if (theVisit.ChangeRegimenReasons.Count > 0) { foreach (var item in theVisit.ChangeRegimenReasons) { if (therapyReasons.Length > 0) { therapyReasons += "|" + item.ChangeReasonID.ToString(); } else { therapyReasons += item.ChangeReasonID.ToString(); } } ClsUtility.AddParameters("@TherapyOther", SqlDbType.VarChar, theVisit.ChangeReasonOther); } else if (theVisit.StopRegimenReasons.Count > 0) { foreach (var item in theVisit.StopRegimenReasons) { if (therapyReasons.Length > 0) { therapyReasons += "|" + item.StopReasonID.ToString(); } else { therapyReasons += item.StopReasonID.ToString(); } } ClsUtility.AddParameters("@TherapyOther", SqlDbType.VarChar, theVisit.StopReasonOther); } else { ClsUtility.AddParameters("@TherapyOther", SqlDbType.VarChar, string.Empty); } ClsUtility.AddParameters("@TherapyReasons", SqlDbType.VarChar, therapyReasons); ClsUtility.AddParameters("@TherapyPlan", SqlDbType.Int, theVisit.SubsInterruptions.ToString()); ClsUtility.AddParameters("@DisclosureID", SqlDbType.Int, theVisit.LevelofDisclosure.ToString()); ClsUtility.AddParameters("@DisclosureChild", SqlDbType.Int, theVisit.DisclosedToChild.ToString()); //ClsUtility.AddParameters("@PatientRefID", SqlDbType.Int, theVisit.ReferredToServiceList[0].RefferredID.ToString()); //ClsUtility.AddParameters("@PatientRefDesc", SqlDbType.VarChar, theVisit.RefferredToOther); ClsUtility.AddParameters("@PatientExitReason", SqlDbType.Int, theVisit.TransferOut.ToString()); ClsUtility.AddParameters("@AppDate", SqlDbType.VarChar, theVisit.NextAppointmentDate); ClsUtility.AddParameters("@EmployeeID", SqlDbType.Int, theVisit.UserID.ToString()); ClsUtility.AddParameters("@SignatureID", SqlDbType.Int, theVisit.UserID.ToString()); ClsUtility.AddParameters("@VisitDate", SqlDbType.VarChar, theVisit.VisitDate); ClsUtility.AddParameters("@AdverseEventYN", SqlDbType.Int, theVisit.AdverseEventYN.ToString()); ClsUtility.AddDirectionParameter("@idNEW", SqlDbType.Int, ParameterDirection.Output); NewVisitID = (int)TheVisit.ReturnObject(ClsUtility.theParams, "Pr_IQTouch_Clinical_Visit_Add", ClsDBUtility.ObjectEnum.ExecuteNonQuery); if (NewVisitID == 0) { MsgBuilder theMsg = new MsgBuilder(); theMsg.DataElements["MessageText"] = "Error saving the Visit. Please contact the Administrator"; AppException.Create("#C1", theMsg); } DataMgr.CommitTransaction(this.Transaction); this.Connection = DataMgr.GetConnection(); this.Transaction = DataMgr.BeginTransaction(this.Connection); //save TB Treatment if (IsUpdate) { ClsUtility.Init_Hashtable(); ClsUtility.AddParameters("@Ptn_pk", SqlDbType.Int, theVisit.PatientID.ToString()); ClsUtility.AddParameters("@Visit_Pk", SqlDbType.Int, theVisit.OldVisitID.ToString()); ClsUtility.AddParameters("@LocationId", SqlDbType.Int, theVisit.LocationID.ToString()); theRowAffected = (int)TheVisit.ReturnObject(ClsUtility.theParams, "Pr_IQTouch_Clinical_Visit_Update_TBTreatment", ClsDBUtility.ObjectEnum.ExecuteNonQuery); DataMgr.CommitTransaction(this.Transaction); this.Connection = DataMgr.GetConnection(); this.Transaction = DataMgr.BeginTransaction(this.Connection); } if (theVisit.Treatment.Count > 0) { foreach (var item in theVisit.Treatment) { ClsUtility.Init_Hashtable(); ClsUtility.AddParameters("@Ptn_pk", SqlDbType.Int, theVisit.PatientID.ToString()); ClsUtility.AddParameters("@Visit_Pk", SqlDbType.Int, NewVisitID.ToString()); ClsUtility.AddParameters("@LocationId", SqlDbType.Int, theVisit.LocationID.ToString()); ClsUtility.AddParameters("@UserId", SqlDbType.Int, theVisit.UserID.ToString()); ClsUtility.AddParameters("@Drug", SqlDbType.VarChar, item.ToString()); ClsUtility.AddParameters("@IsPatient", SqlDbType.Int, "0"); theRowAffected = (int)TheVisit.ReturnObject(ClsUtility.theParams, "Pr_IQTouch_Clinical_Visit_Add_TBTreatment", ClsDBUtility.ObjectEnum.ExecuteNonQuery); DataMgr.CommitTransaction(this.Transaction); this.Connection = DataMgr.GetConnection(); this.Transaction = DataMgr.BeginTransaction(this.Connection); } } //then save the multi selects if (IsUpdate) { ClsUtility.Init_Hashtable(); ClsUtility.AddParameters("@Ptn_pk", SqlDbType.Int, theVisit.PatientID.ToString()); ClsUtility.AddParameters("@Visit_Pk", SqlDbType.Int, theVisit.OldVisitID.ToString()); ClsUtility.AddParameters("@LocationId", SqlDbType.Int, theVisit.LocationID.ToString()); theRowAffected = (int)TheVisit.ReturnObject(ClsUtility.theParams, "Pr_IQTouch_Clinical_Visit_Update_TBSensitivityList", ClsDBUtility.ObjectEnum.ExecuteNonQuery); DataMgr.CommitTransaction(this.Transaction); this.Connection = DataMgr.GetConnection(); this.Transaction = DataMgr.BeginTransaction(this.Connection); } if (theVisit.NewSensitvityList.Count > 0) { foreach (var item in theVisit.NewSensitvityList) { ClsUtility.Init_Hashtable(); ClsUtility.AddParameters("@Ptn_pk", SqlDbType.Int, theVisit.PatientID.ToString()); ClsUtility.AddParameters("@Visit_Pk", SqlDbType.Int, NewVisitID.ToString()); ClsUtility.AddParameters("@LocationId", SqlDbType.Int, theVisit.LocationID.ToString()); ClsUtility.AddParameters("@UserId", SqlDbType.Int, theVisit.UserID.ToString()); ClsUtility.AddParameters("@Drug", SqlDbType.VarChar, item.RegimenID.ToString()); ClsUtility.AddParameters("@Sensitivity", SqlDbType.VarChar, item.SensitivityYN.ToString()); ClsUtility.AddParameters("@Resistance", SqlDbType.VarChar, item.ResistanceYN.ToString()); ClsUtility.AddParameters("@IsPatient", SqlDbType.Int, "1"); theRowAffected = (int)TheVisit.ReturnObject(ClsUtility.theParams, "Pr_IQTouch_Clinical_Visit_Add_TBSensitivityList", ClsDBUtility.ObjectEnum.ExecuteNonQuery); DataMgr.CommitTransaction(this.Transaction); this.Connection = DataMgr.GetConnection(); this.Transaction = DataMgr.BeginTransaction(this.Connection); } } if (theVisit.SensitvityList.Count > 0) { foreach (var item in theVisit.SensitvityList) { ClsUtility.Init_Hashtable(); ClsUtility.AddParameters("@Ptn_pk", SqlDbType.Int, theVisit.PatientID.ToString()); ClsUtility.AddParameters("@Visit_Pk", SqlDbType.Int, NewVisitID.ToString()); ClsUtility.AddParameters("@LocationId", SqlDbType.Int, theVisit.LocationID.ToString()); ClsUtility.AddParameters("@UserId", SqlDbType.Int, theVisit.UserID.ToString()); ClsUtility.AddParameters("@Drug", SqlDbType.VarChar, item.RegimenID.ToString()); ClsUtility.AddParameters("@Sensitivity", SqlDbType.VarChar, item.SensitivityYN.ToString()); ClsUtility.AddParameters("@Resistance", SqlDbType.VarChar, item.ResistanceYN.ToString()); ClsUtility.AddParameters("@IsPatient", SqlDbType.Int, "0"); theRowAffected = (int)TheVisit.ReturnObject(ClsUtility.theParams, "Pr_IQTouch_Clinical_Visit_Add_TBSensitivityList", ClsDBUtility.ObjectEnum.ExecuteNonQuery); DataMgr.CommitTransaction(this.Transaction); this.Connection = DataMgr.GetConnection(); this.Transaction = DataMgr.BeginTransaction(this.Connection); } } if (IsUpdate) { ClsUtility.Init_Hashtable(); ClsUtility.AddParameters("@Ptn_pk", SqlDbType.Int, theVisit.PatientID.ToString()); ClsUtility.AddParameters("@Visit_Pk", SqlDbType.Int, theVisit.OldVisitID.ToString()); ClsUtility.AddParameters("@LocationId", SqlDbType.Int, theVisit.LocationID.ToString()); theRowAffected = (int)TheVisit.ReturnObject(ClsUtility.theParams, "Pr_IQTouch_Clinical_Visit_Update_PhysicalFindings", ClsDBUtility.ObjectEnum.ExecuteNonQuery); DataMgr.CommitTransaction(this.Transaction); this.Connection = DataMgr.GetConnection(); this.Transaction = DataMgr.BeginTransaction(this.Connection); } if (theVisit.PhysicalFindings.Count > 0) { foreach (var item in theVisit.PhysicalFindings) { ClsUtility.Init_Hashtable(); ClsUtility.AddParameters("@Ptn_pk", SqlDbType.Int, theVisit.PatientID.ToString()); ClsUtility.AddParameters("@Visit_Pk", SqlDbType.Int, NewVisitID.ToString()); ClsUtility.AddParameters("@LocationId", SqlDbType.Int, theVisit.LocationID.ToString()); ClsUtility.AddParameters("@UserId", SqlDbType.Int, theVisit.UserID.ToString()); ClsUtility.AddParameters("@SymptomID", SqlDbType.Int, item.SymptomID.ToString()); ClsUtility.AddParameters("@SymptomDescription", SqlDbType.VarChar, item.SymptomDescription); theRowAffected = (int)TheVisit.ReturnObject(ClsUtility.theParams, "Pr_IQTouch_Clinical_Visit_Add_PhysicalFindings", ClsDBUtility.ObjectEnum.ExecuteNonQuery); DataMgr.CommitTransaction(this.Transaction); this.Connection = DataMgr.GetConnection(); this.Transaction = DataMgr.BeginTransaction(this.Connection); } } if (IsUpdate) { ClsUtility.Init_Hashtable(); ClsUtility.AddParameters("@Ptn_pk", SqlDbType.Int, theVisit.PatientID.ToString()); ClsUtility.AddParameters("@Visit_Pk", SqlDbType.Int, theVisit.OldVisitID.ToString()); ClsUtility.AddParameters("@LocationId", SqlDbType.Int, theVisit.LocationID.ToString()); theRowAffected = (int)TheVisit.ReturnObject(ClsUtility.theParams, "Pr_IQTouch_Clinical_Visit_Update_AdverseEvent", ClsDBUtility.ObjectEnum.ExecuteNonQuery); DataMgr.CommitTransaction(this.Transaction); this.Connection = DataMgr.GetConnection(); this.Transaction = DataMgr.BeginTransaction(this.Connection); } if (theVisit.AdverseEvents.Count > 0) { foreach (var item in theVisit.AdverseEvents) { ClsUtility.Init_Hashtable(); ClsUtility.AddParameters("@Ptn_pk", SqlDbType.Int, theVisit.PatientID.ToString()); ClsUtility.AddParameters("@Visit_Pk", SqlDbType.Int, NewVisitID.ToString()); ClsUtility.AddParameters("@LocationId", SqlDbType.Int, theVisit.LocationID.ToString()); ClsUtility.AddParameters("@UserId", SqlDbType.Int, theVisit.UserID.ToString()); ClsUtility.AddParameters("@AdverseEventID", SqlDbType.Int, item.AdverseEventID.ToString()); ClsUtility.AddParameters("@AdverseEventDescription", SqlDbType.VarChar, item.AdverseEventDescription); ClsUtility.AddParameters("@AdverseEventSeverityID", SqlDbType.Int, item.AdvereEventSeverityID.ToString()); ClsUtility.AddParameters("@AdverseEventOther", SqlDbType.VarChar, item.AdverseEventOther); theRowAffected = (int)TheVisit.ReturnObject(ClsUtility.theParams, "Pr_IQTouch_Clinical_Visit_Add_AdverseEvent", ClsDBUtility.ObjectEnum.ExecuteNonQuery); DataMgr.CommitTransaction(this.Transaction); this.Connection = DataMgr.GetConnection(); this.Transaction = DataMgr.BeginTransaction(this.Connection); } } if (IsUpdate) { ClsUtility.Init_Hashtable(); ClsUtility.AddParameters("@Ptn_pk", SqlDbType.Int, theVisit.PatientID.ToString()); ClsUtility.AddParameters("@Visit_Pk", SqlDbType.Int, theVisit.OldVisitID.ToString()); ClsUtility.AddParameters("@LocationId", SqlDbType.Int, theVisit.LocationID.ToString()); theRowAffected = (int)TheVisit.ReturnObject(ClsUtility.theParams, "Pr_IQTouch_Clinical_Visit_Update_WhyARVAdherances", ClsDBUtility.ObjectEnum.ExecuteNonQuery); DataMgr.CommitTransaction(this.Transaction); this.Connection = DataMgr.GetConnection(); this.Transaction = DataMgr.BeginTransaction(this.Connection); } if (theVisit.WhyARVAdherances.Count > 0) { foreach (var item in theVisit.WhyARVAdherances) { ClsUtility.Init_Hashtable(); ClsUtility.AddParameters("@Ptn_pk", SqlDbType.Int, theVisit.PatientID.ToString()); ClsUtility.AddParameters("@Visit_Pk", SqlDbType.Int, NewVisitID.ToString()); ClsUtility.AddParameters("@LocationId", SqlDbType.Int, theVisit.LocationID.ToString()); ClsUtility.AddParameters("@UserId", SqlDbType.Int, theVisit.UserID.ToString()); ClsUtility.AddParameters("@MissedReasonID", SqlDbType.Int, item.ARVAdheranceID.ToString()); ClsUtility.AddParameters("@Other_Desc", SqlDbType.VarChar, theVisit.OtherARVReason.ToString()); theRowAffected = (int)TheVisit.ReturnObject(ClsUtility.theParams, "Pr_IQTouch_Clinical_Visit_Add_WhyARVAdherances", ClsDBUtility.ObjectEnum.ExecuteNonQuery); DataMgr.CommitTransaction(this.Transaction); this.Connection = DataMgr.GetConnection(); this.Transaction = DataMgr.BeginTransaction(this.Connection); } } if (IsUpdate) { ClsUtility.Init_Hashtable(); ClsUtility.AddParameters("@Ptn_pk", SqlDbType.Int, theVisit.PatientID.ToString()); ClsUtility.AddParameters("@Visit_Pk", SqlDbType.Int, theVisit.OldVisitID.ToString()); ClsUtility.AddParameters("@LocationId", SqlDbType.Int, theVisit.LocationID.ToString()); theRowAffected = (int)TheVisit.ReturnObject(ClsUtility.theParams, "Pr_IQTouch_Clinical_Visit_Update_ReferredToServiceList", ClsDBUtility.ObjectEnum.ExecuteNonQuery); DataMgr.CommitTransaction(this.Transaction); this.Connection = DataMgr.GetConnection(); this.Transaction = DataMgr.BeginTransaction(this.Connection); } if (theVisit.ReferredToServiceList.Count > 0) { foreach (var item in theVisit.ReferredToServiceList) { ClsUtility.Init_Hashtable(); ClsUtility.AddParameters("@Ptn_pk", SqlDbType.Int, theVisit.PatientID.ToString()); ClsUtility.AddParameters("@Visit_Pk", SqlDbType.Int, NewVisitID.ToString()); ClsUtility.AddParameters("@LocationId", SqlDbType.Int, theVisit.LocationID.ToString()); ClsUtility.AddParameters("@UserId", SqlDbType.Int, theVisit.UserID.ToString()); ClsUtility.AddParameters("@PatientRefID", SqlDbType.Int, item.RefferredID.ToString()); ClsUtility.AddParameters("@PatientRefDesc", SqlDbType.VarChar, theVisit.RefferredToOther); theRowAffected = (int)TheVisit.ReturnObject(ClsUtility.theParams, "Pr_IQTouch_Clinical_Visit_Add_ReferredToServiceList", ClsDBUtility.ObjectEnum.ExecuteNonQuery); DataMgr.CommitTransaction(this.Transaction); this.Connection = DataMgr.GetConnection(); this.Transaction = DataMgr.BeginTransaction(this.Connection); } } if (IsUpdate) { ClsUtility.Init_Hashtable(); ClsUtility.AddParameters("@Ptn_pk", SqlDbType.Int, theVisit.PatientID.ToString()); ClsUtility.AddParameters("@Visit_Pk", SqlDbType.Int, theVisit.OldVisitID.ToString()); ClsUtility.AddParameters("@LocationId", SqlDbType.Int, theVisit.LocationID.ToString()); theRowAffected = (int)TheVisit.ReturnObject(ClsUtility.theParams, "pr_IQTouch_Clinical_Visit_Update_TBDiagnosis", ClsDBUtility.ObjectEnum.ExecuteNonQuery); DataMgr.CommitTransaction(this.Transaction); this.Connection = DataMgr.GetConnection(); this.Transaction = DataMgr.BeginTransaction(this.Connection); } if (theVisit.TBDiagnosisList != null && theVisit.TBDiagnosisList.Count > 0) { foreach (var item in theVisit.TBDiagnosisList) { ClsUtility.Init_Hashtable(); ClsUtility.AddParameters("@Ptn_pk", SqlDbType.Int, theVisit.PatientID.ToString()); ClsUtility.AddParameters("@Visit_Pk", SqlDbType.Int, NewVisitID.ToString()); ClsUtility.AddParameters("@LocationId", SqlDbType.Int, theVisit.LocationID.ToString()); ClsUtility.AddParameters("@UserId", SqlDbType.Int, theVisit.UserID.ToString()); ClsUtility.AddParameters("@DiagnosisMade", SqlDbType.Int, item.TBDiagnosisID.ToString()); theRowAffected = (int)TheVisit.ReturnObject(ClsUtility.theParams, "pr_IQTouch_Clinical_Visit_Add_TBDiagnosis", ClsDBUtility.ObjectEnum.ExecuteNonQuery); DataMgr.CommitTransaction(this.Transaction); this.Connection = DataMgr.GetConnection(); this.Transaction = DataMgr.BeginTransaction(this.Connection); } } DataMgr.CommitTransaction(this.Transaction); DataMgr.ReleaseConnection(this.Connection); } catch (Exception e) { DataMgr.RollBackTransation(this.Transaction); BErrorLogging ErrorMan = new BErrorLogging(); ErrorMan.LogError("DataAccess", e.Message, ErrorType.Error); throw e; } finally { if (this.Connection != null) { DataMgr.ReleaseConnection(this.Connection); } } return(theRowAffected); }
public int UpdateFacility(int FacilityId, 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 Status, int SystemId, int thePreferred, int Paperless, int UserID, DataTable dtModule, Hashtable ht, DataTable Stores) { try { this.Connection = DataMgr.GetConnection(); this.Transaction = DataMgr.BeginTransaction(this.Connection); ClsObject FacilityManager = new ClsObject(); FacilityManager.Connection = this.Connection; FacilityManager.Transaction = this.Transaction; oUtility.Init_Hashtable(); oUtility.AddParameters("@FacilityName", SqlDbType.VarChar, FacilityName); oUtility.AddParameters("@CountryID", SqlDbType.VarChar, CountryID.ToString()); oUtility.AddParameters("@PosID", SqlDbType.VarChar, PosID.ToString()); oUtility.AddParameters("@SatelliteID", SqlDbType.VarChar, SatelliteID.ToString()); oUtility.AddParameters("@NationalID", SqlDbType.VarChar, NationalID.ToString()); oUtility.AddParameters("@ProvinceId", SqlDbType.Int, ProvinceId.ToString()); oUtility.AddParameters("@DistrictId", SqlDbType.Int, DistrictId.ToString()); oUtility.AddParameters("@image", SqlDbType.VarChar, image.ToString()); oUtility.AddParameters("@currency", SqlDbType.Int, currency.ToString()); oUtility.AddParameters("@AppGracePeriod", SqlDbType.Int, AppGracePeriod.ToString()); oUtility.AddParameters("@dateformat", SqlDbType.VarChar, dateformat.ToString()); oUtility.AddParameters("@PepFarStartDate", SqlDbType.DateTime, PepFarStartDate.ToString()); oUtility.AddParameters("@Status", SqlDbType.Int, Status.ToString()); oUtility.AddParameters("@UserId", SqlDbType.Int, UserID.ToString()); oUtility.AddParameters("@SystemId", SqlDbType.Int, SystemId.ToString()); oUtility.AddParameters("@Preferred", SqlDbType.Int, thePreferred.ToString()); oUtility.AddParameters("@Paperless", SqlDbType.Int, Paperless.ToString()); oUtility.AddParameters("@FacilityId", SqlDbType.Int, FacilityId.ToString()); oUtility.AddParameters("@FacilityLogo", SqlDbType.VarChar, ht["FacilityLogo"].ToString()); oUtility.AddParameters("@FacilityAddress", SqlDbType.VarChar, ht["FacilityAddress"].ToString()); oUtility.AddParameters("@FacilityTel", SqlDbType.VarChar, ht["FacilityTel"].ToString()); oUtility.AddParameters("@FacilityCell", SqlDbType.VarChar, ht["FacilityCell"].ToString()); oUtility.AddParameters("@FacilityFax", SqlDbType.VarChar, ht["FacilityFax"].ToString()); oUtility.AddParameters("@FacilityEmail", SqlDbType.VarChar, ht["FacilityEmail"].ToString()); oUtility.AddParameters("@FacilityURL", SqlDbType.VarChar, ht["FacilityURL"].ToString()); oUtility.AddParameters("@FacilityFooter", SqlDbType.VarChar, ht["FacilityFootertext"].ToString()); oUtility.AddParameters("@FacilityTemplate", SqlDbType.Int, ht["Facilitytemplate"].ToString()); oUtility.AddParameters("@StrongPassword", SqlDbType.Int, ht["StrongPassword"].ToString()); oUtility.AddParameters("@ExpirePaswordFlag", SqlDbType.Int, ht["ExpirePaswordFlag"].ToString()); oUtility.AddParameters("@ExpirePaswordDays", SqlDbType.VarChar, ht["ExpirePaswordDays"].ToString()); int RowsAffected = (Int32)FacilityManager.ReturnObject(oUtility.theParams, "Pr_Admin_UpdateFacility_Constella", ClsUtility.ObjectEnum.ExecuteNonQuery); if (RowsAffected == 0) { MsgBuilder theBL = new MsgBuilder(); theBL.DataElements["MessageText"] = "Error in Saving Facility record. Try Again.."; AppException.Create("#C1", theBL); } int DeleteFlag = 0; if (DeleteFlag == 0) { string theSQL = string.Format("delete from lnk_FacilityModule where FacilityId = {0}", FacilityId); oUtility.Init_Hashtable(); int Rows = (int)FacilityManager.ReturnObject(oUtility.theParams, theSQL, ClsUtility.ObjectEnum.ExecuteNonQuery); DeleteFlag = 1; } for (int i = 0; i < dtModule.Rows.Count; i++) { oUtility.Init_Hashtable(); oUtility.AddParameters("@FacilityId", SqlDbType.Int, FacilityId.ToString()); oUtility.AddParameters("@ModuleId", SqlDbType.Int, dtModule.Rows[i]["ModuleID"].ToString()); oUtility.AddParameters("@UserId", SqlDbType.Int, UserID.ToString()); oUtility.AddParameters("@Flag", SqlDbType.Int, "1"); int RowsAffModule = (int)FacilityManager.ReturnObject(oUtility.theParams, "pr_Admin_SaveModule_Futures", ClsUtility.ObjectEnum.ExecuteNonQuery); if (RowsAffModule == 0) { MsgBuilder theBL = new MsgBuilder(); theBL.DataElements["MessageText"] = "Error in Saving Facility record. Try Again.."; AppException.Create("#C1", theBL); } } //update store string theSQLDelStore = string.Format("delete from lnk_locationStore where locationid = {0}", FacilityId); oUtility.Init_Hashtable(); int DelStore = (int)FacilityManager.ReturnObject(oUtility.theParams, theSQLDelStore, ClsUtility.ObjectEnum.ExecuteNonQuery); for (int i = 0; i < Stores.Rows.Count; i++) { oUtility.Init_Hashtable(); oUtility.AddParameters("@FacilityId", SqlDbType.Int, FacilityId.ToString()); oUtility.AddParameters("@StoreID", SqlDbType.Int, Stores.Rows[i]["value"].ToString()); oUtility.AddParameters("@UserId", SqlDbType.Int, UserID.ToString()); int RowsAffModule = (int)FacilityManager.ReturnObject(oUtility.theParams, "pr_Admin_SaveUpdate_LocationStoreLinking", ClsUtility.ObjectEnum.ExecuteNonQuery); if (RowsAffModule == 0) { MsgBuilder theBL = new MsgBuilder(); theBL.DataElements["MessageText"] = "Error in Saving Facility record. Try Again.."; 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 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 void UpdateUserRecord(string FName, string LName, string UserName, string Password, string Email, string Phone, int UserId, int OperatorId, int Designation, Hashtable UserGroup, Hashtable Store) { ClsObject UserManager = new ClsObject(); try { this.Connection = DataMgr.GetConnection(); this.Transaction = DataMgr.BeginTransaction(this.Connection); int RowsAffected = 0; Utility theUtil = new Utility(); Password = theUtil.Encrypt(Password); ClsUtility.Init_Hashtable(); ClsUtility.AddParameters("@UserLastName", SqlDbType.VarChar, LName); ClsUtility.AddParameters("@UserFirstName", SqlDbType.VarChar, FName); 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("@OperatorID", SqlDbType.Int, OperatorId.ToString()); ClsUtility.AddParameters("@Designation", SqlDbType.Int, Designation.ToString()); // ClsUtility.AddParameters("@EmpId", SqlDbType.Int, EmpId.ToString()); RowsAffected = (int)UserManager.ReturnObject(ClsUtility.theParams, "pr_Admin_UpdateUser_Constella", ClsDBUtility.ObjectEnum.ExecuteNonQuery); if (RowsAffected < 0) { MsgBuilder theBL = new MsgBuilder(); theBL.DataElements["MessageText"] = "Error in Updating User Record. Try Again.."; AppException.Create("#C1", theBL); } #region "Update User Groups and Store User" string theSQL = string.Format("Delete from Lnk_UserGroup where UserId = {0}", UserId); ClsUtility.Init_Hashtable(); RowsAffected = (int)UserManager.ReturnObject(ClsUtility.theParams, theSQL, ClsDBUtility.ObjectEnum.ExecuteNonQuery); int i = 1; for (i = 1; i <= UserGroup.Count; i++) { ClsUtility.Init_Hashtable(); ClsUtility.AddParameters("@UserId", SqlDbType.Int, UserId.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); } theSQL = string.Format("Delete from Lnk_StoreUser where UserId = {0}", UserId); ClsUtility.Init_Hashtable(); RowsAffected = (int)UserManager.ReturnObject(ClsUtility.theParams, theSQL, ClsDBUtility.ObjectEnum.ExecuteNonQuery); int k = 1; for (k = 1; k <= Store.Count; k++) { ClsUtility.Init_Hashtable(); ClsUtility.AddParameters("@UserId", SqlDbType.Int, UserId.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); } catch { DataMgr.RollBackTransation(this.Transaction); throw; } finally { UserManager = null; if (this.Connection != null) { DataMgr.ReleaseConnection(this.Connection); } } }
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); } } }