/// <summary> /// Gets basic search parameters to pass to the data store based on the filter /// </summary> /// <param name="filter">The filter.</param> /// <returns></returns> public static DynamicParameters GetParametersFromFilter(FilterBase filter) { var para = new DynamicParameters(); if (filter.PageIndex.HasValue) { para.Add("@PageIndex", filter.PageIndex.Value, dbType: DbType.Int32); } if (filter.PageSize.HasValue) { para.Add("@PageSize", filter.PageSize.Value, dbType: DbType.Int32); } if (filter.SortIndex.HasValue) { para.Add("@SortIndex", filter.SortIndex.Value, dbType: DbType.Int32); } if (filter.SortDirection != SortDirection.NotSet) { para.Add("@SortDirection", (int)filter.SortDirection, dbType: DbType.Int32); } return para; }
public TakeRateDataItem TakeRateModelSummaryItemGet(TakeRateFilter filter) { TakeRateDataItem retVal; using (var conn = DbHelper.GetDBConnection()) { try { var para = new DynamicParameters(); para.Add("@FdpVolumeHeaderId", filter.TakeRateId, DbType.Int32); para.Add("@MarketId", filter.MarketId, DbType.Int32); para.Add("@ModelId", filter.ModelId, DbType.Int32); para.Add("@FdpModelId", filter.FdpModelId, DbType.Int32); var results = conn.QueryMultiple(fdpTakeRateModelSummaryItemGetStoredProcedureName, para, commandType: CommandType.StoredProcedure); retVal = results.Read<TakeRateDataItem>().First(); retVal.Notes = results.Read<TakeRateDataItemNote>(); retVal.History = results.Read<TakeRateDataItemAudit>(); } catch (Exception ex) { Log.Error(ex); throw; } } return retVal; }
public User FdpUserSave(User userToAdd) { User retVal = new EmptyUser(); using (var conn = DbHelper.GetDBConnection()) { try { var para = new DynamicParameters(); para.Add("@CDSId", userToAdd.CDSId, DbType.String); para.Add("@FullName", userToAdd.FullName, DbType.String); para.Add("@Mail", userToAdd.Mail, DbType.String); para.Add("@IsAdmin", userToAdd.IsAdmin, DbType.Boolean); para.Add("@CreatorCDSId", CurrentCDSID, DbType.String); var results = conn.Query<UserDataItem>("dbo.Fdp_User_Save", para, commandType: CommandType.StoredProcedure); var enumerable = results as IList<UserDataItem> ?? results.ToList(); if (enumerable.Any()) { retVal = enumerable.First().ToUser(); } } catch (Exception ex) { Log.Error(ex); throw; } } return retVal; }
public EngineCodeMapping EngineCodeMappingSave(EngineCodeMapping mapping) { var retVal = mapping; using (var conn = DbHelper.GetDBConnection()) { try { var para = new DynamicParameters(); para.Add("@ProgrammeId", mapping.ProgrammeId, DbType.Int32); para.Add("@EngineId", mapping.EngineId, DbType.Int32); para.Add("@ExternalEngineCode", string.IsNullOrEmpty(mapping.ExternalEngineCode) ? null : mapping.ExternalEngineCode, DbType.String); para.Add("@MappingId", null, DbType.Int32, ParameterDirection.Output); conn.Execute("dbo.Fdp_EngineCode_Save", para, commandType: CommandType.StoredProcedure); if (!mapping.MappingId.HasValue) { mapping.MappingId = para.Get<int>("@MappingId"); } } catch (Exception ex) { Log.Error(ex); throw; } } return mapping; }
public IEnumerable<OXORuleResult> RuleResultGetMany(int docid, int progid, string level, int objid, bool? showWhat) { IEnumerable<OXORuleResult> retVal = null; using (IDbConnection conn = DbHelper.GetDBConnection()) { try { var para = new DynamicParameters(); para.Add("@p_oxo_doc_id", docid, dbType: DbType.Int32); para.Add("@p_prog_id", progid, dbType: DbType.Int32); para.Add("@p_Level", level, dbType: DbType.String, size: 3); para.Add("@p_ObjectId", objid, dbType: DbType.Int32); para.Add("@p_show_what", showWhat, dbType: DbType.Boolean); retVal = conn.Query<OXORuleResult>("dbo.OXO_Programme_Rule_Result_GetMany", para, commandType: CommandType.StoredProcedure); } catch (Exception ex) { Log.Error(ex); throw; } } return retVal; }
public FdpDerivativeMapping FdpDerivativeMappingDelete(FdpDerivativeMapping derivativeMapping) { FdpDerivativeMapping retVal = new EmptyFdpDerivativeMapping(); using (IDbConnection conn = DbHelper.GetDBConnection()) { try { var para = new DynamicParameters(); para.Add("@FdpDerivativeMappingId", derivativeMapping.FdpDerivativeMappingId, DbType.Int32); para.Add("@CDSId", CurrentCDSID, DbType.String); var results = conn.Query<FdpDerivativeMapping>("Fdp_DerivativeMapping_Delete", para, commandType: CommandType.StoredProcedure); if (results.Any()) { retVal = results.First(); } } catch (Exception ex) { Log.Error(ex); throw; } } return retVal; }
public bool ConfigurationSave(ConfigurationItem obj) { var retVal = true; const string procName = "dbo.Fdp_Configuration_Edit"; using (var conn = DbHelper.GetDBConnection()) { try { var para = new DynamicParameters(); para.Add("@p_ConfigurationKey", obj.ConfigurationKey, DbType.String, size: 50); para.Add("@p_Value", obj.Value, DbType.String, size: -1); para.Add("@p_Description", obj.Description, DbType.String, size: -1); para.Add("@p_DataType", obj.DataType, DbType.String, size: 50); conn.Execute(procName, para, commandType: CommandType.StoredProcedure); } catch (Exception ex) { Log.Error(ex); throw; } } return retVal; }
public bool ChangeDiarySave(ChangeDiary obj) { bool retVal = true; string procName = (obj.Id == 0 ? "dbo.OXO_ChangeDiary_New" : "dbo.OXO_ChangeDiary_Edit"); using (IDbConnection conn = DbHelper.GetDBConnection()) { try { var para = new DynamicParameters(); para.Add("@p_OXO_Doc_Id", obj.OXODocId, dbType: DbType.Int32); para.Add("@p_Programme_Id", obj.ProgrammeId, dbType: DbType.Int32); para.Add("@p_Version_Info", obj.VersionInfo, dbType: DbType.String, size: 500); para.Add("@p_Entry_Header", obj.EntryHeader, dbType: DbType.String, size: -1); para.Add("@p_Entry_Date", obj.EntryDate, dbType: DbType.DateTime); para.Add("@p_Markets", obj.Markets, dbType: DbType.String, size: -1); para.Add("@p_Models", obj.Models, dbType: DbType.String, size: -1); para.Add("@p_Features", obj.Features, dbType: DbType.String, size: -1); para.Add("@p_Current_Fitment", obj.CurrentFitment, dbType: DbType.String, size: 50); para.Add("@p_Proposed_Fitment", obj.ProposedFitment, dbType: DbType.String, size: 50); para.Add("@p_Comment", obj.Comment, dbType: DbType.String, size: -1); para.Add("@p_Pricing_Status", obj.PricingStatus, dbType: DbType.String, size: 500); para.Add("@p_Digital_Status", obj.DigitalStatus, dbType: DbType.String, size: 500); para.Add("@p_Requester", obj.Requester, dbType: DbType.String, size: 100); para.Add("@p_PACN", obj.PACN, dbType: DbType.String, size: 100); para.Add("@p_ETracker", obj.ETracker, dbType: DbType.String, size: 100); para.Add("@p_Order_Call", obj.OrderCall, dbType: DbType.String, size: 100); para.Add("@p_Build_Effective_Date", obj.BuildEffectiveDate, dbType: DbType.DateTime); if (obj.Id == 0) { para.Add("@p_Id", dbType: DbType.Int32, direction: ParameterDirection.Output); } else { para.Add("@p_Id", obj.Id, dbType: DbType.Int32); } conn.Execute(procName, para, commandType: CommandType.StoredProcedure); if (obj.Id == 0) { obj.Id = para.Get<int>("@p_Id"); } } catch (Exception ex) { Log.Error(ex); throw; } } return retVal; }
public bool OXOProgrammeFileSave(OXOProgrammeFile obj) { bool retVal = true; string procName = (obj.Id == 0 ? "dbo.OXO_Programme_File_New" : "dbo.OXO_Programme_File_Edit"); using (IDbConnection conn = DbHelper.GetDBConnection()) { try { obj.Save(this.CurrentCDSID); var para = new DynamicParameters(); para.Add("@p_Programme_Id", obj.ProgrammeId, dbType: DbType.Int32); para.Add("@p_File_Category", obj.FileCategory, dbType: DbType.String, size: 100); para.Add("@p_File_Comment", obj.FileComment, dbType: DbType.String, size: 2000); para.Add("@p_File_Name", obj.FileName, dbType: DbType.String, size: 100); para.Add("@p_File_Ext", obj.FileExt, dbType: DbType.String, size: 4); para.Add("@p_File_Type", obj.FileType, dbType: DbType.String, size: 20); para.Add("@p_File_Size", obj.FileSize, dbType: DbType.Int32); para.Add("@p_gateway", obj.Gateway, dbType: DbType.String, size: 100); para.Add("@p_PACN", obj.PACN, dbType: DbType.String, size: 10); para.Add("@p_File_Content", obj.FileContent, dbType: DbType.Binary); para.Add("@p_Created_By", obj.CreatedBy, dbType: DbType.String, size: 8); para.Add("@p_Created_On", obj.CreatedOn, dbType: DbType.DateTime); para.Add("@p_Updated_By", obj.UpdatedBy, dbType: DbType.String, size: 8); para.Add("@p_Last_Updated", obj.LastUpdated, dbType: DbType.DateTime); if (obj.Id == 0) { para.Add("@p_Id", dbType: DbType.Int32, direction: ParameterDirection.Output); } else { para.Add("@p_Id", obj.Id, dbType: DbType.Int32); } conn.Execute(procName, para, commandType: CommandType.StoredProcedure); if (obj.Id == 0) { obj.Id = para.Get<int>("@p_Id"); } } catch (Exception ex) { Log.Error(ex); throw; } } return retVal; }
public bool PermissionSave(Permission obj) { bool retVal = true; string procName = (obj.Id == 0 ? "dbo.OXO_Permission_New" : "dbo.OXO_Permission_Edit"); using (IDbConnection conn = DbHelper.GetDBConnection()) { try { var para = new DynamicParameters(); para.Add("@p_CDSID", obj.CDSID, dbType: DbType.String, size: 50); para.Add("@p_Object_Type", obj.ObjectType, dbType: DbType.String, size: 500); para.Add("@p_Object_Id", obj.ObjectId, dbType: DbType.Int32); para.Add("@p_Object_Val", obj.ObjectVal, dbType: DbType.String, size: 500); para.Add("@p_Operation", obj.Operation, dbType: DbType.String, size: 500); para.Add("@p_Created_By", obj.CreatedBy, dbType: DbType.String, size: 50); para.Add("@p_Created_On", obj.CreatedOn, dbType: DbType.DateTime); para.Add("@p_Updated_By", obj.UpdatedBy, dbType: DbType.String, size: 50); para.Add("@p_Last_Updated", obj.LastUpdated, dbType: DbType.DateTime); if (obj.Id == 0) { para.Add("@p_Id", dbType: DbType.Int32, direction: ParameterDirection.Output); } else { para.Add("@p_Id", obj.Id, dbType: DbType.Int32); } conn.Execute(procName, para, commandType: CommandType.StoredProcedure); if (obj.Id == 0) { obj.Id = para.Get<int>("@p_Id"); } } catch (Exception ex) { Log.Error(ex); throw; } } return retVal; }
public IEnumerable<UserRole> FdpUserGetRoles(User forUser) { IList<UserRole> retVal = new List<UserRole>{UserRole.None}; using (var conn = DbHelper.GetDBConnection()) { try { var para = new DynamicParameters(); para.Add("@CDSId", forUser.CDSId, DbType.String); var results = conn.Query<FdpUserRoleDataItem>("dbo.Fdp_UserRole_GetMany", para, commandType: CommandType.StoredProcedure); var fdpUserRoleDataItems = results as IList<FdpUserRoleDataItem> ?? results.ToList(); if (fdpUserRoleDataItems.Any()) { retVal = fdpUserRoleDataItems.Select(role => (UserRole) role.FdpUserRoleId).ToList(); } } catch (Exception ex) { Log.Error(ex); throw; } } return retVal; }
public IEnumerable<EngineCodeMapping> EngineCodeMappingGetMany() { IList<EngineCodeMapping> retVal; using (var conn = DbHelper.GetDBConnection()) { try { var para = new DynamicParameters(); para.Add("@TotalRecords", null, DbType.Int32, ParameterDirection.Output); var results = conn.Query<EngineCodeMapping>("dbo.Fdp_EngineCode_GetMany", para, commandType: CommandType.StoredProcedure); var totalRecords = para.Get<int?>("@TotalRecords"); retVal = new List<EngineCodeMapping>(); foreach (var result in results) { result.TotalRecords = totalRecords.Value; retVal.Add(result); } } catch (Exception ex) { Log.Error(ex); throw; } } return retVal; }
public IEnumerable<Vehicle> VehicleGetMany(string make, bool deepGet = false) { IEnumerable<Vehicle> retVal = null; using (IDbConnection conn = DbHelper.GetDBConnection()) { try { List<Vehicle> vehicles; var para = new DynamicParameters(); para.Add("@p_make", make, dbType: DbType.String, size: 500); using (var multi = conn.QueryMultiple("dbo.OXO_Vehicle_GetMany", para, commandType: CommandType.StoredProcedure)) { vehicles = multi.Read<Vehicle>().ToList(); if (deepGet) { var programmes = multi.Read<Programme>().ToList(); foreach (var vehicle in vehicles) { vehicle.Programmes = programmes.Where(c => c.ParentId == vehicle.Id).ToList(); } } } retVal = vehicles; } catch (Exception ex) { Log.Error(ex); throw; } } return retVal; }
public static DynamicParameters FromCDSId(string cdsId, string parameterName = "CDSId") { var parameters = new DynamicParameters(); parameters.Add("@" + parameterName, cdsId, dbType: DbType.String); return parameters; }
public Vehicle VehicleGet(int id, bool deepGet = false) { Vehicle retVal = null; using (IDbConnection conn = DbHelper.GetDBConnection()) { try { var para = new DynamicParameters(); para.Add("@p_Id", id, dbType: DbType.Int32); // para.Add("@p_deep_get", deepGet, dbType: DbType.Boolean); using (var multi = conn.QueryMultiple("dbo.OXO_Vehicle_Get", para, commandType: CommandType.StoredProcedure)) { retVal = multi.Read<Vehicle>().FirstOrDefault(); ; var programmes = multi.Read<Programme>().ToList(); if (retVal != null) retVal.Programmes = programmes.ToList(); } } catch (Exception ex) { Log.Error(ex); throw; } } return retVal; }
public bool ForecastComparisonSave(ForecastComparison obj) { bool retVal = true; string procName = (obj.Id == 0 ? "dbo.ForecastComparison_New" : "dbo.ForecastComparison_Edit"); using (IDbConnection conn = DbHelper.GetDBConnection()) { try { var para = new DynamicParameters(); para.Add("@p_ForecastComparisonId", obj.ForecastComparisonId, dbType: DbType.Int32); para.Add("@p_ForecastId", obj.ForecastId, dbType: DbType.Int32); para.Add("@p_ForecastVehicleId", obj.ForecastVehicleId, dbType: DbType.Int32); para.Add("@p_CreatedOn", obj.CreatedOn, dbType: DbType.DateTime); para.Add("@p_CreatedBy", obj.CreatedBy, dbType: DbType.String, size: 16); para.Add("@p_SortOrder", obj.SortOrder, dbType: DbType.Int32); para.Add("@p_IsActive", obj.IsActive, dbType: DbType.Boolean); if (obj.Id == 0) { para.Add("@p_Id", dbType: DbType.Int32, direction: ParameterDirection.Output); } else { para.Add("@p_Id", obj.Id, dbType: DbType.Int32); } conn.Execute(procName, para, commandType: CommandType.StoredProcedure); if (obj.Id == 0) { obj.Id = para.Get<int>("@p_Id"); } } catch (Exception ex) { Log.Error(ex); throw; } } return retVal; }
public bool OXORuleFeatureSave(RuleFeature obj, IDbConnection conn) { bool retVal = true; string procName = "dbo.OXO_Rule_Feature_New"; try { obj.Save(this.CurrentCDSID); var para = new DynamicParameters(); para.Add("@p_RuleId", obj.RuleId, dbType: DbType.Int32); para.Add("@p_ProgrammeId", obj.ProgrammeId, dbType: DbType.Int32); para.Add("@p_FeatureId", obj.FeatureId, dbType: DbType.Int32); para.Add("@p_CreatedBy", obj.CreatedBy, dbType: DbType.String, size: 8); para.Add("@p_CreatedOn", obj.CreatedOn, dbType: DbType.DateTime); para.Add("@p_UpdatedBy", obj.UpdatedBy, dbType: DbType.String, size: 8); para.Add("@p_LastUpdated", obj.LastUpdated, dbType: DbType.DateTime); conn.Execute(procName, para, commandType: CommandType.StoredProcedure); } catch (Exception ex) { Log.Error(ex); throw; } return retVal; }
public IEnumerable<Market> MarketGetMany(int progId, int docId) { var retVal = Enumerable.Empty<Market>(); using (var conn = DbHelper.GetDBConnection()) { try { var para = new DynamicParameters(); para.Add("@p_prog_id", progId, DbType.Int32); para.Add("@p_doc_id", docId, DbType.Int32); retVal = conn.Query<Market>("dbo.OXO_Programme_Market_GetMany", para, commandType: CommandType.StoredProcedure); } catch (Exception ex) { Log.Error(ex); throw; } } return retVal; }
public IEnumerable<OXODoc> FdpOxoDocumentsGetMany(ProgrammeFilter filter) { IEnumerable<OXODoc> retVal = Enumerable.Empty<OXODoc>(); using (IDbConnection conn = DbHelper.GetDBConnection()) { try { var para = new DynamicParameters(); para.Add("@ProgrammeId", filter.ProgrammeId, DbType.Int32); para.Add("@Gateway", filter.Gateway, DbType.String); retVal = conn.Query<OXODoc>("dbo.Fdp_OXODoc_GetMany", para, commandType: CommandType.StoredProcedure); } catch (Exception ex) { Log.Error(ex); throw; } } return retVal; }
public ImportQueue ImportQueueBulkImportProcess(ImportQueue importQueue) { TakeRateSummary takeRateFile = new EmptyTakeRateSummary(); using (var conn = DbHelper.GetDBConnection()) { using (var tran = conn.BeginTransaction()) { try { var para = new DynamicParameters(); para.Add("@FdpImportId", importQueue.ImportId, DbType.Int32); //para.Add("@FdpVolumeHeaderId", null, DbType.Int32, ParameterDirection.Output); if (importQueue.LineNumber.HasValue) { para.Add("@LineNumber", importQueue.LineNumber, DbType.Int32); } var results = conn.Query<TakeRateSummary>("dbo.Fdp_ImportData_Process", para, commandType: CommandType.StoredProcedure, commandTimeout: 600, transaction: tran); var takeRateSummaries = results as IList<TakeRateSummary> ?? results.ToList(); if (results != null && takeRateSummaries.Any()) { takeRateFile = takeRateSummaries.First(); } tran.Commit(); } catch (Exception ex) { Log.Error(ex); throw; } } } var retVal = ImportQueueGet(importQueue.ImportQueueId.GetValueOrDefault()); retVal.TakeRateId = takeRateFile.TakeRateId; return retVal; }
public bool ForecastComparisonViewSave(ForecastComparisonView obj) { bool retVal = true; string procName = (obj.Id == 0 ? "dbo.ForecastComparisonView_New" : "dbo.ForecastComparisonView_Edit"); using (IDbConnection conn = DbHelper.GetDBConnection()) { try { var para = new DynamicParameters(); para.Add("@p_ForecastId", obj.ForecastId, dbType: DbType.Int32); para.Add("@p_CreatedOn", obj.CreatedOn, dbType: DbType.DateTime); para.Add("@p_CreatedBy", obj.CreatedBy, dbType: DbType.String, size: 16); para.Add("@p_VehicleId", obj.VehicleId, dbType: DbType.Int32); para.Add("@p_ProgrammeId", obj.ProgrammeId, dbType: DbType.Int32); para.Add("@p_GatewayId", obj.GatewayId, dbType: DbType.Int32); para.Add("@p_Make", obj.Make, dbType: DbType.String, size: 500); para.Add("@p_Code", obj.Code, dbType: DbType.String, size: 500); para.Add("@p_Description", obj.Description, dbType: DbType.String, size: 1003); para.Add("@p_ModelYear", obj.ModelYear, dbType: DbType.String, size: 50); para.Add("@p_Gateway", obj.Gateway, dbType: DbType.String, size: 50); para.Add("@p_SortOrder", obj.SortOrder, dbType: DbType.Int32); if (obj.Id == 0) { para.Add("@p_Id", dbType: DbType.Int32, direction: ParameterDirection.Output); } else { para.Add("@p_Id", obj.Id, dbType: DbType.Int32); } conn.Execute(procName, para, commandType: CommandType.StoredProcedure); if (obj.Id == 0) { obj.Id = para.Get<int>("@p_Id"); } } catch (Exception ex) { Log.Error(ex); throw; } } return retVal; }
public IEnumerable<OXOProgrammeFile> OXOProgrammeFileGetMany(int? progid,string category = null) { IEnumerable<OXOProgrammeFile> retVal = null; using (IDbConnection conn = DbHelper.GetDBConnection()) { try { var para = new DynamicParameters(); para.Add("@p_prog_id", progid, dbType: DbType.Int32); para.Add("@p_category", category, dbType: DbType.String, size: 100); retVal = conn.Query<OXOProgrammeFile>("dbo.OXO_Programme_File_GetMany", para, commandType: CommandType.StoredProcedure); } catch (Exception ex) { Log.Error(ex); throw; } } return retVal; }
public IEnumerable<Permission> PermissionGetMany(string cdsid, string objectType) { IEnumerable<Permission> retVal = null; using (IDbConnection conn = DbHelper.GetDBConnection()) { try { var para = new DynamicParameters(); para.Add("@p_CDSID", cdsid, dbType: DbType.String, size: 50); para.Add("@p_Object_Type", objectType, dbType: DbType.String, size: 500); retVal = conn.Query<Permission>("dbo.OXO_Permission_GetMany", para, commandType: CommandType.StoredProcedure); } catch (Exception ex) { Log.Error(ex); throw; } } return retVal; }
public IEnumerable<ChangeSetDetail> ChangeSetDetailGetMany(int setId, int progId, int docId) { IEnumerable<ChangeSetDetail> retVal = null; using (IDbConnection conn = DbHelper.GetDBConnection()) { try { var para = new DynamicParameters(); para.Add("@p_set_id", setId, dbType: DbType.Int32); para.Add("@p_prog_id", progId, dbType: DbType.Int32); para.Add("@p_doc_id", docId, dbType: DbType.Int32); retVal = conn.Query<ChangeSetDetail>("dbo.OXO_ChangeSetDetail_GetMany", para, commandType: CommandType.StoredProcedure); } catch (Exception ex) { Log.Error(ex); throw; } } return retVal; }
public Pack PackGet(int id, int docid, bool deepGet = false) { Pack retVal = null; using (IDbConnection conn = DbHelper.GetDBConnection()) { try { var para = new DynamicParameters(); para.Add("@p_Id", id, dbType: DbType.Int32); para.Add("@p_doc_Id", docid, dbType: DbType.Int32); para.Add("@p_deep", id, dbType: DbType.Int32); retVal = conn.Query<Pack>("dbo.OXO_Pack_Get", para, commandType: CommandType.StoredProcedure).FirstOrDefault(); } catch (Exception ex) { Log.Error(ex); throw; } } return retVal; }
public IEnumerable<FdpModel> FdpAvailableModelByMarketGroupGetMany(TakeRateFilter filter) { IEnumerable<FdpModel> retVal = Enumerable.Empty<FdpModel>(); using (var conn = DbHelper.GetDBConnection()) { try { var para = new DynamicParameters(); para.Add("@FdpVolumeHeaderId", filter.TakeRateId, DbType.Int32); para.Add("@MarketGroupId", filter.MarketGroupId, DbType.Int32); retVal = conn.Query<FdpModel>("dbo.Fdp_AvailableModelByMarketGroup_GetMany", para, commandType: CommandType.StoredProcedure); } catch (Exception ex) { Log.Error(ex); throw; } } return retVal; }
public bool FeatureRequestSave(FeatureRequest obj) { bool retVal = true; string procName = (obj.Id == 0 ? "dbo.OXO_FeatureRequest_New" : "dbo.OXO_FeatureRequest_Edit"); using (IDbConnection conn = DbHelper.GetDBConnection()) { try { var para = new DynamicParameters(); para.Add("@p_Programme_Id", obj.Programme_Id, dbType: DbType.Int32); para.Add("@p_Description", obj.Description, dbType: DbType.String, size: 500); para.Add("@p_Marketing_Description", obj.Marketing_Description, dbType: DbType.String, size: 500); para.Add("@p_Notes", obj.Notes, dbType: DbType.String, size: 2000); para.Add("@p_Feature_Group", obj.Feature_Group, dbType: DbType.String, size: 500); para.Add("@p_Decision", obj.Decision, dbType: DbType.String, size: 500); para.Add("@p_Created_By", obj.Created_By, dbType: DbType.String, size: 8); para.Add("@p_Created_On", obj.Created_On, dbType: DbType.DateTime); para.Add("@p_Updated_By", obj.Updated_By, dbType: DbType.String, size: 8); para.Add("@p_Last_Updated", obj.Last_Updated, dbType: DbType.DateTime); if (obj.Id == 0) { para.Add("@p_Id", dbType: DbType.Int32, direction: ParameterDirection.Output); } else { para.Add("@p_Id", obj.Id, dbType: DbType.Int32); } conn.Execute(procName, para, commandType: CommandType.StoredProcedure); if (obj.Id == 0) { obj.Id = para.Get<int>("@p_Id"); } } catch (Exception ex) { Log.Error(ex); throw; } } return retVal; }
public IEnumerable<FdpModel> FdpAvailableModelByMarketGetMany(TakeRateFilter filter) { var retVal = Enumerable.Empty<FdpModel>(); using (var conn = DbHelper.GetDBConnection()) { try { var para = new DynamicParameters(); para.Add("@FdpVolumeHeaderId", filter.TakeRateId, DbType.Int32); para.Add("@MarketId", filter.MarketId, DbType.Int32); para.Add("@BMC", filter.BMC, DbType.String); para.Add("@DPCK", filter.DPCK, DbType.String); para.Add("@PageIndex", filter.PageIndex, DbType.Int32); para.Add("@PageSize", filter.PageSize, DbType.Int32); para.Add("@TotalPages", dbType: DbType.Int32, direction: ParameterDirection.Output); para.Add("@TotalRecords", dbType: DbType.Int32, direction: ParameterDirection.Output); para.Add("@TotalDisplayRecords", dbType: DbType.Int32, direction: ParameterDirection.Output); retVal = conn.Query<FdpModel>("dbo.Fdp_AvailableModelByMarket_GetMany", para, commandType: CommandType.StoredProcedure); if (retVal != null && retVal.Any()) { filter.TotalRecords = para.Get<int>("@TotalRecords"); filter.TotalDisplayRecords = para.Get<int>("@TotalDisplayRecords"); filter.TotalPages = para.Get<int>("@TotalPages"); } } catch (Exception ex) { Log.Error(ex); throw; } } return retVal; }
public bool PermissionOperationSave(PermissionOperation obj) { bool retVal = true; string procName = (obj.Id == 0 ? "dbo.PermissionOperation_New" : "dbo.PermissionOperation_Edit"); using (IDbConnection conn = DbHelper.GetDBConnection()) { try { var para = new DynamicParameters(); para.Add("@p_FdpPermissionOperationId", obj.FdpPermissionOperationId, dbType: DbType.Int32); para.Add("@p_FdpPermissionObjectType", obj.FdpPermissionObjectType, dbType: DbType.String, size: 50); para.Add("@p_Operation", obj.Operation, dbType: DbType.String, size: 25); para.Add("@p_Description", obj.Description, dbType: DbType.String, size: -1); if (obj.Id == 0) { para.Add("@p_Id", dbType: DbType.Int32, direction: ParameterDirection.Output); } else { para.Add("@p_Id", obj.Id, dbType: DbType.Int32); } conn.Execute(procName, para, commandType: CommandType.StoredProcedure); if (obj.Id == 0) { obj.Id = para.Get<int>("@p_Id"); } } catch (Exception ex) { Log.Error(ex); throw; } } return retVal; }
public bool RuleResultSave(OXORuleResult obj) { bool retVal = true; string procName = (obj.Id == 0 ? "dbo.OXO_Programme_Rule_Result_New" : "dbo.OXO_Programme_Rule_Result_Edit"); using (IDbConnection conn = DbHelper.GetDBConnection()) { try { obj.Save(this.CurrentCDSID); var para = new DynamicParameters(); para.Add("@p_OXODocId", obj.OXODocId, dbType: DbType.Int32); para.Add("@p_ProgrammeId", obj.ProgrammeId, dbType: DbType.Int32); para.Add("@p_Level", obj.ObjectLevel, dbType: DbType.String, size: 3); para.Add("@p_ObjectId", obj.ObjectId, dbType: DbType.Int32); para.Add("@p_RuleId", obj.RuleId, dbType: DbType.Int32); para.Add("@p_ModelId", obj.ModelId, dbType: DbType.Int32); para.Add("@p_RuleResult", obj.RuleResult, dbType: DbType.Boolean); para.Add("@p_CreatedBy", obj.CreatedBy, dbType: DbType.String, size: 8); para.Add("@p_CreatedOn", obj.CreatedOn, dbType: DbType.DateTime); if (obj.Id == 0) { para.Add("@p_Id", dbType: DbType.Int32, direction: ParameterDirection.Output); } else { para.Add("@p_Id", obj.Id, dbType: DbType.Int32); } conn.Execute(procName, para, commandType: CommandType.StoredProcedure); if (obj.Id == 0) { obj.Id = para.Get<int>("@p_Id"); } } catch (Exception ex) { Log.Error(ex); throw; } } return retVal; }