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


C# Dapper.DynamicParameters类代码示例

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


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

示例1: FdpUserGetRoles

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

示例2: FromCDSId

        public static DynamicParameters FromCDSId(string cdsId, string parameterName = "CDSId")
        {
            var parameters = new DynamicParameters();
            parameters.Add("@" + parameterName, cdsId, dbType: DbType.String);

            return parameters;
        }
开发者ID:digimonsta,项目名称:FeatureDemandPlanning,代码行数:7,代码来源:DynamicParameters.cs

示例3: TakeRateModelSummaryItemGet

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

示例4: 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

示例5: FdpDerivativeMappingDelete

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

示例6: EngineCodeMappingSave

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

示例7: GetParametersFromFilter

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

示例8: ConfigurationSave

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

示例9: VehicleGetMany

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

示例10: VehicleGet

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

示例11: RuleResultGetMany

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

示例12: FdpUserSave

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

示例13: OXORuleFeatureSave

        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;

        }
开发者ID:digimonsta,项目名称:FeatureDemandPlanning,代码行数:32,代码来源:OXORuleFeatureDS.cs

示例14: ChangeDiarySave

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

示例15: 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


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