当前位置: 首页>>代码示例>>C#>>正文


C# DynamicParameters.Get方法代码示例

本文整理汇总了C#中FeatureDemandPlanning.Model.Dapper.DynamicParameters.Get方法的典型用法代码示例。如果您正苦于以下问题:C# DynamicParameters.Get方法的具体用法?C# DynamicParameters.Get怎么用?C# DynamicParameters.Get使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在FeatureDemandPlanning.Model.Dapper.DynamicParameters的用法示例。


在下文中一共展示了DynamicParameters.Get方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: EngineCodeMappingGetMany

        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;
        }
开发者ID:digimonsta,项目名称:FeatureDemandPlanning,代码行数:30,代码来源:ProgrammeDataStore.cs

示例2: FdpAvailableModelByMarketGetMany

        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;
        }
开发者ID:digimonsta,项目名称:FeatureDemandPlanning,代码行数:37,代码来源:ModelDataStore.cs

示例3: OXOCloneGatewayDoc

        public int OXOCloneGatewayDoc(int docId, int progId, string gateway, string nextGateway, decimal versionId)
        {
            int newDocId = 0;

            using (IDbConnection conn = DbHelper.GetDBConnection())
            {
                IDbTransaction transaction = null;
                try
                {
                    conn.Open();
                    transaction = conn.BeginTransaction();
                    var para = new DynamicParameters();
                    para.Add("@p_doc_id", docId, dbType: DbType.Int32);
                    para.Add("@p_prog_id", progId, dbType: DbType.Int32);
                    para.Add("@p_gateway", gateway, dbType: DbType.String, size: 50);
                    para.Add("@p_next_gateway", nextGateway, dbType: DbType.String, size: 50);               
                    para.Add("@p_version_id", versionId, dbType: DbType.Decimal);
                    para.Add("@p_clone_by", CurrentCDSID, dbType: DbType.String, size: 50);
                    para.Add("@p_new_doc_id", newDocId, dbType: DbType.Int32, direction: ParameterDirection.InputOutput);             
                    conn.Execute("dbo.OXO_Doc_Clone_Gateway_Doc", para, transaction, commandType: CommandType.StoredProcedure);
                    newDocId = para.Get<int>("@p_new_doc_id");
                    transaction.Commit();                   

                }
                catch (Exception ex)
                {
                    transaction.Rollback();
                    Log.Error(ex);
                    throw;
                }
                finally
                {
                    conn.Close();
                }

            }

            return newDocId;
        }
开发者ID:digimonsta,项目名称:FeatureDemandPlanning,代码行数:39,代码来源:OXODocDS.cs

示例4: ReferenceListSave

        public bool ReferenceListSave(ReferenceList obj)
        {
            bool retVal = true;
            string procName = (obj.IsNew ? "dbo.OXO_Reference_List_New" : "dbo.OXO_Reference_List_Edit");

            using (IDbConnection conn = DbHelper.GetDBConnection())
            {
                try
                {
                    var para = new DynamicParameters();

                    para.Add("@p_Code", obj.Code, dbType: DbType.String, size: 50);
                    para.Add("@p_Description", obj.Description, dbType: DbType.String, size: 500);
                    para.Add("@p_List_Name", obj.ListName, dbType: DbType.String, size: 100);
                    para.Add("@p_Display_Order", obj.DisplayOrder, 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;
            
        }
开发者ID:digimonsta,项目名称:FeatureDemandPlanning,代码行数:37,代码来源:OXOReferenceListDS.cs

示例5: OXORuleSave

        public bool OXORuleSave(OXORule obj, Array aRuleFeats)
        {
            bool retVal = true;
            string procName = (obj.Id == 0 ? "dbo.OXO_Programme_Rule_New" : "dbo.OXO_Programme_Rule_Edit");

			using (IDbConnection conn = DbHelper.GetDBConnection())
            {
				try
				{

                    obj.Save(this.CurrentCDSID);

                    var para = new DynamicParameters();

					 para.Add("@p_ProgrammeId", obj.ProgrammeId, dbType: DbType.Int32);
					 para.Add("@p_RuleCategory", obj.RuleCategory, dbType: DbType.String, size: 50);
                     para.Add("@p_RuleGroup", obj.RuleGroup, dbType: DbType.String, size: 50);
					 para.Add("@p_RuleAssertLogic", obj.RuleAssertLogic, dbType: DbType.String, size: -1);
					 para.Add("@p_RuleReportLogic", obj.RuleReportLogic, dbType: DbType.String, size: -1);
					 para.Add("@p_RuleResponse", obj.RuleResponse, dbType: DbType.String, size: -1);
                     para.Add("@p_RuleReason", obj.RuleReason, dbType: DbType.String, size: -1);
					 para.Add("@p_Owner", obj.Owner, dbType: DbType.String, size: 50);
					 para.Add("@p_Active", obj.Active, dbType: DbType.Boolean);
					 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);
					    

					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");
					}

                    para = new DynamicParameters();
                    
                    procName = "dbo.OXO_Rule_Feature_Delete";

                    try
                    {
                        para.Add("@p_RuleId", obj.Id, dbType: DbType.Int32);
                        para.Add("@p_ProgrammeId", obj.ProgrammeId, dbType: DbType.Int32);

                        conn.Execute(procName, para, commandType: CommandType.StoredProcedure);

                    }
                    catch (Exception ex)
                    {
                        Log.Error(ex);
                        throw;
                    }

                    procName = "dbo.OXO_Rule_Feature_New";

                    foreach (var item in aRuleFeats) {

                        para = new DynamicParameters();
                        
                        try
                        {

                            para.Add("@p_RuleId", obj.Id, dbType: DbType.Int32);
                            para.Add("@p_ProgrammeId", obj.ProgrammeId, dbType: DbType.Int32);
                            para.Add("@p_FeatureId", item, dbType: DbType.Int32);
                            para.Add("@p_CreatedBy", "pbriscoe", dbType: DbType.String, size: 8);
                            para.Add("@p_CreatedOn", DateTime.Now, 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;
                        }

                    }
				}
				catch (Exception ex)
				{
                    Log.Error(ex);
                    throw;
				}
			}

            return retVal;
            
//.........这里部分代码省略.........
开发者ID:digimonsta,项目名称:FeatureDemandPlanning,代码行数:101,代码来源:OXORuleDS.cs

示例6: OXOProgrammeFileSave

        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;
            
        }
开发者ID:digimonsta,项目名称:FeatureDemandPlanning,代码行数:57,代码来源:OXOProgrammeFileDS.cs

示例7: PermissionObjectTypeSave

        public bool PermissionObjectTypeSave(PermissionObjectType obj)
        {
            bool retVal = true;
            string procName = (obj.Id == 0 ? "dbo.PermissionObjectType_New" : "dbo.PermissionObjectType_Edit");

			using (IDbConnection conn = DbHelper.GetDBConnection())
            {
				try
				{
					var para = new DynamicParameters();

					 para.Add("@p_FdpPermissionObjectType", obj.FdpPermissionObjectType, dbType: DbType.String, size: 50);
					 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;
            
        }
开发者ID:digimonsta,项目名称:FeatureDemandPlanning,代码行数:42,代码来源:PermissionObjectTypeDal.cs

示例8: ForecastViewSave

        public bool ForecastViewSave(ForecastView obj)
        {
            bool retVal = true;
            string procName = (obj.Id == 0 ? "dbo.ForecastView_New" : "dbo.ForecastView_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);
					    

					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;
            
        }
开发者ID:digimonsta,项目名称:FeatureDemandPlanning,代码行数:51,代码来源:ForecastViewDal.cs

示例9: FeatureRequestSave

        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;
            
        }
开发者ID:digimonsta,项目名称:FeatureDemandPlanning,代码行数:50,代码来源:OXOFeatureRequestDS.cs

示例10: RuleResultSave

        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;
            
        }
开发者ID:digimonsta,项目名称:FeatureDemandPlanning,代码行数:51,代码来源:OXORuleResultDS.cs

示例11: ModelSave

        public bool ModelSave(Model.Model obj)
        {
            bool retVal = true;
            string procName = (obj.IsNew ? "dbo.OXO_Model_New" : "dbo.OXO_Model_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_Body_Id", obj.BodyId, dbType: DbType.Int32);
                    para.Add("@p_Engine_Id", obj.EngineId, dbType: DbType.Int32);
                    para.Add("@p_Transmission_Id", obj.TransmissionId, dbType: DbType.Int32);
                    para.Add("@p_Trim_Id", obj.TrimId, dbType: DbType.Int32);
                    para.Add("@p_BMC", obj.BMC, dbType: DbType.String, size: 10);
                    para.Add("@p_CoA", obj.CoA, dbType: DbType.String, size: 10);
                    para.Add("@p_KD", obj.KD, dbType: DbType.Boolean);
                    para.Add("@p_Active", obj.Active, dbType: DbType.Boolean);
                    para.Add("@p_ChangeSet_Id", obj.ChangesetId, dbType: DbType.Int32);
                    if (obj.IsNew)
                    {
                        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);
                    para.Add("@p_Id", obj.Id, dbType: DbType.Int32, direction: ParameterDirection.InputOutput);    

                    conn.Execute(procName, para, commandType: CommandType.StoredProcedure);
                    obj.Id = para.Get<int>("@p_Id");
			

				}
				catch (Exception ex)
				{
                    Log.Error(ex);
                    throw;
				}
			}

            return retVal;
            
        }
开发者ID:digimonsta,项目名称:FeatureDemandPlanning,代码行数:47,代码来源:ModelDataStore.cs

示例12: ImportQueueGetMany

        public PagedResults<ImportQueue> ImportQueueGetMany(ImportQueueFilter filter)
        {
            PagedResults<ImportQueue> retVal = null;

            using (IDbConnection conn = DbHelper.GetDBConnection())
            {
                try
                {
                    var para = new DynamicParameters();
                    var totalRecords = 0;
                    var totalDisplayRecords = 0;

                    if (filter.PageIndex.HasValue)
                    {
                        para.Add("@PageIndex", filter.PageIndex.Value, DbType.Int32);
                    }
                    if (filter.PageSize.HasValue)
                    {
                        para.Add("@PageSize", filter.PageSize.Value, DbType.Int32);
                    }
                    if (filter.ImportStatus != enums.ImportStatus.NotSet)
                    {
                        para.Add("@FdpImportStatusId", (int)filter.ImportStatus, DbType.Int32);
                    }
                    if (!string.IsNullOrEmpty(filter.FilterMessage))
                    {
                        para.Add("@FilterMessage", filter.FilterMessage, DbType.String, size: 50);
                    }
                    //if (filter.SortIndex.HasValue)
                    //{
                    //    para.Add("@SortIndex", filter.SortIndex.Value, dbType: DbType.Int32);
                    //}
                    para.Add("@SortIndex", filter.SortIndex.GetValueOrDefault(), DbType.Int32);
                    if (filter.SortDirection != enums.SortDirection.NotSet)
                    {
                        var direction = filter.SortDirection == enums.SortDirection.Descending ? "DESC" : "ASC";
                        para.Add("@SortDirection", direction, DbType.String);
                    }
                    else
                    {
                        para.Add("@SortDirection", "DESC", DbType.String);
                    }
                    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);

                    var results = conn.Query<ImportQueueDataItem>("dbo.Fdp_ImportQueue_GetMany", para, commandType: CommandType.StoredProcedure);
                    
                    if (results.Any())
                    {
                        totalRecords = para.Get<int>("@TotalRecords");
                        totalDisplayRecords = para.Get<int>("@TotalDisplayRecords");
                    }
                    retVal = new PagedResults<ImportQueue>
                    {
                        PageIndex = filter.PageIndex ?? 1,
                        TotalRecords = totalRecords,
                        TotalDisplayRecords = totalDisplayRecords,
                        PageSize = filter.PageSize ?? totalRecords
                    };

                    var currentPage = new List<ImportQueue>();
                    
                    foreach (var result in results)
                    {
                        result.ImportType = ImportTypeDataItem.ToImportType(result);
                        result.ImportStatus = ImportStatusDataItem.ToImportStatus(result);
                        //HydrateImportErrors(result, conn);

                        currentPage.Add(ImportQueueDataItem.ToImportQueue(result));
                    }

                    retVal.CurrentPage = currentPage;
                }
                catch (Exception ex)
                {
                    Log.Error(ex);
                    throw;
                }
            }

            return retVal;
        }
开发者ID:digimonsta,项目名称:FeatureDemandPlanning,代码行数:83,代码来源:ImportQueueDataStore.cs

示例13: ImportErrorGetMany

        public PagedResults<ImportError> ImportErrorGetMany(ImportQueueFilter filter)
        {
            PagedResults<ImportError> retVal = null;

            using (IDbConnection connection = DbHelper.GetDBConnection())
            {
                try
                {
                    var para = new DynamicParameters();
                    var totalRecords = 0;
                    var totalDisplayRecords = 0;
                    var totalImportedRecords = 0;
                    var totalFailedRecords = 0;

                    para.Add("@FdpImportQueueId", filter.ImportQueueId.Value, DbType.Int32);

                    if (filter.ExceptionType != enums.ImportExceptionType.NotSet)
                    {
                        para.Add("@FdpImportExceptionTypeId", (int)filter.ExceptionType, DbType.Int32);
                    }
                    if (!string.IsNullOrEmpty(filter.FilterMessage))
                    {
                        para.Add("@FilterMessage", filter.FilterMessage, DbType.String, size: 50);
                    }
                    if (filter.PageIndex.HasValue)
                    {
                        para.Add("@PageIndex", filter.PageIndex.Value, DbType.Int32);
                    }
                    para.Add("@PageSize", filter.PageSize.HasValue ? filter.PageSize.Value : 100, DbType.Int32);
                    
                    if (filter.SortIndex.HasValue)
                    {
                        para.Add("@SortIndex", filter.SortIndex.Value, DbType.Int32);
                    }
                    if (filter.SortIndex.HasValue)
                    {
                        para.Add("@SortIndex", filter.SortIndex.GetValueOrDefault(), DbType.Int32);
                    }
                    if (filter.SortDirection != enums.SortDirection.NotSet)
                    {
                        var direction = filter.SortDirection == enums.SortDirection.Descending ? "DESC" : "ASC";
                        para.Add("@SortDirection", direction, DbType.String);
                    }
                    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);
                    para.Add("@TotalImportedRecords", dbType: DbType.Int32, direction: ParameterDirection.Output);
                    para.Add("@TotalFailedRecords", dbType: DbType.Int32, direction: ParameterDirection.Output);

                    var results = connection.Query<ImportError>("dbo.Fdp_ImportError_GetMany", para, commandType: CommandType.StoredProcedure);

                    if (results.Any())
                    {
                        totalRecords = para.Get<int>("@TotalRecords");
                        totalDisplayRecords = para.Get<int>("@TotalDisplayRecords");
                        totalImportedRecords = para.Get<int>("@TotalImportedRecords");
                        totalFailedRecords = para.Get<int>("@TotalFailedRecords");
                    }
                    retVal = new PagedResults<ImportError>
                    {
                        PageIndex = filter.PageIndex.HasValue ? filter.PageIndex.Value : 1,
                        TotalRecords = totalRecords,
                        TotalDisplayRecords = totalDisplayRecords,
                        TotalSuccess = totalImportedRecords,
                        TotalFail = totalFailedRecords,
                        PageSize = filter.PageSize.HasValue ? filter.PageSize.Value : totalRecords
                    };

                    retVal.CurrentPage = results;
                }
                catch (Exception ex)
                {
                    Log.Error(ex);
                    throw;
                }
            }

            return retVal;
        }
开发者ID:digimonsta,项目名称:FeatureDemandPlanning,代码行数:79,代码来源:ImportQueueDataStore.cs

示例14: ModelTrimSave

        public bool ModelTrimSave(ModelTrim obj)
        {
            bool retVal = true;
            string procName = (obj.IsNew ? "dbo.OXO_ModelTrim_New" : "dbo.OXO_ModelTrim_Edit");

			using (IDbConnection conn = DbHelper.GetDBConnection())
            {
				try
				{
                    obj.Save(CurrentCDSID);

					var para = new DynamicParameters();

					para.Add("@p_Programme_Id", obj.ProgrammeId, DbType.Int32);
					para.Add("@p_Name", obj.Name, DbType.String, size: 500);
                    para.Add("@p_Abbreviation", obj.Abbreviation, DbType.String, size: 50);
					para.Add("@p_Level", obj.Level, DbType.String, size: 500);
                    para.Add("@p_DPCK", obj.DPCK, DbType.String, size: 10);
					para.Add("@p_Active", obj.Active, DbType.Boolean);
                    if (obj.IsNew)
                    {
                        para.Add("@p_Created_By", obj.CreatedBy, DbType.String, size: 8);
                        para.Add("@p_Created_On", obj.CreatedOn, DbType.DateTime);
                    }
                    para.Add("@p_Updated_By", obj.UpdatedBy, DbType.String, size: 8);
                    para.Add("@p_Last_Updated", obj.LastUpdated, DbType.DateTime);
                    para.Add("@p_Id", obj.Id, DbType.Int32, ParameterDirection.InputOutput);
   
					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;
            
        }
开发者ID:digimonsta,项目名称:FeatureDemandPlanning,代码行数:46,代码来源:ModelTrimDataStore.cs

示例15: FdpTakeRateHeaderGetManyByUsername

        public PagedResults<TakeRateSummary> FdpTakeRateHeaderGetManyByUsername(TakeRateFilter filter)
        {
            using (var conn = DbHelper.GetDBConnection())
            {
                PagedResults<TakeRateSummary> retVal;
                try
                {
                    var para = new DynamicParameters();
                    var totalRecords = 0;
                    var totalDisplayRecords = 0;

                    if (filter.DocumentId.HasValue)
                    {
                        para.Add("@DocumentId", filter.DocumentId, DbType.Int32);
                    }
                    if (filter.TakeRateId.HasValue)
                    {
                        para.Add("@FdpVolumeHeaderId", filter.TakeRateId, DbType.Int32);
                    }
                    if (!string.IsNullOrEmpty(filter.FilterMessage))
                    {
                        para.Add("@FilterMessage", filter.FilterMessage, DbType.String, size: 50);
                    }
                    if (filter.TakeRateStatusId.HasValue)
                    {
                        para.Add("@FdpTakeRateStatusId", filter.TakeRateStatusId, DbType.Int32);
                    }
                    if (filter.PageIndex.HasValue)
                    {
                        para.Add("@PageIndex", filter.PageIndex.Value, DbType.Int32);
                    }
                    if (filter.PageSize.HasValue)
                    {
                        para.Add("@PageSize", filter.PageSize.Value, DbType.Int32);
                    }
                    if (filter.SortIndex.HasValue)
                    {
                        para.Add("@SortIndex", filter.SortIndex.Value, DbType.Int32);
                    }
                    if (filter.SortDirection != SortDirection.NotSet)
                    {
                        var direction = filter.SortDirection == SortDirection.Descending ? "DESC" : "ASC";
                        para.Add("@SortDirection", direction, DbType.String);
                    }

                    // TODO implement the CDSId to get only those forecasts the user has permissions for
                    para.Add("@CDSId", CurrentCDSID, DbType.String);
                    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);

                    var results = conn.Query<TakeRateSummary>("dbo.Fdp_TakeRateHeader_GetManyByUsername", para, commandType: CommandType.StoredProcedure);
                    var takeRateSummaries = results as IList<TakeRateSummary> ?? results.ToList();
                    if (takeRateSummaries.Any())
                    {
                        totalRecords = para.Get<int>("@TotalRecords");
                        totalDisplayRecords = para.Get<int>("@TotalDisplayRecords");
                    }
                    retVal = new PagedResults<TakeRateSummary>
                    {
                        PageIndex = filter.PageIndex ?? 1,
                        TotalRecords = totalRecords,
                        TotalDisplayRecords = totalDisplayRecords,
                        PageSize = filter.PageSize ?? totalRecords
                    };

                    var currentPage = takeRateSummaries.ToList();

                    retVal.CurrentPage = currentPage;
                }
                catch (Exception ex)
                {
                    Log.Error(ex);
                    throw;
                }

                return retVal;
            }
        }
开发者ID:digimonsta,项目名称:FeatureDemandPlanning,代码行数:79,代码来源:TakeRateDataStore.cs


注:本文中的FeatureDemandPlanning.Model.Dapper.DynamicParameters.Get方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。