/// <summary> /// 通过数据读取器生成实体类 /// </summary> /// <param name="rdr"></param> /// <returns></returns> private static AddressEntity GetEntityFromrdr(NullableDataReader rdr) { AddressEntity info = new AddressEntity(); info.AddressID = rdr.GetInt32("AddressID"); info.UserName = rdr.GetString("UserName"); info.ConsigneeName = rdr.GetString("ConsigneeName"); info.HomePhone = rdr.GetString("HomePhone"); info.Mobile = rdr.GetString("Mobile"); info.Country = rdr.GetString("Country"); info.Province = rdr.GetString("Province"); info.City = rdr.GetString("City"); info.Area = rdr.GetString("Area"); info.Area1 = rdr.GetString("Area1"); info.Area2 = rdr.GetString("Area2"); info.Addresses = rdr.GetString("Addresses"); info.ZipCode = rdr.GetString("ZipCode"); info.IsDefault = rdr.GetBoolean("IsDefault"); return(info); }
/// <summary> /// 通过数据读取器生成实体类 /// </summary> /// <param name="rdr"></param> /// <returns></returns> private static PaymentLogEntity GetEntityFromrdr(NullableDataReader rdr) { PaymentLogEntity info = new PaymentLogEntity(); info.PaymentLogID = rdr.GetInt32("PaymentLogID"); info.UserName = rdr.GetString("UserName"); info.OrderID = rdr.GetInt32("OrderID"); info.PaymentNum = rdr.GetString("PaymentNum"); info.PlatformID = rdr.GetInt32("PlatformID"); info.MoneyPay = rdr.GetDecimal("MoneyPay"); info.MoneyTrue = rdr.GetDecimal("MoneyTrue"); info.PayTime = rdr.GetNullableDateTime("PayTime"); info.SuccessTime = rdr.GetNullableDateTime("SuccessTime"); info.Status = rdr.GetInt32("Status"); info.PlatformInfo = rdr.GetString("PlatformInfo"); info.Remark = rdr.GetString("Remark"); info.Exp = rdr.GetInt32("Exp"); info.Point = rdr.GetInt32("Point"); info.ValidDate = rdr.GetInt32("ValidDate"); info.GroupID = rdr.GetInt32("GroupID"); return(info); }
/// <summary> /// 通过数据读取器生成实体类 /// </summary> /// <param name="rdr"></param> /// <returns></returns> private static CollectionPagingRulesEntity GetEntityFromrdr(NullableDataReader rdr) { CollectionPagingRulesEntity info = new CollectionPagingRulesEntity(); info.PagingRuleID = rdr.GetInt32("PagingRuleID"); info.ItemID = rdr.GetInt32("ItemID"); info.RuleType = rdr.GetInt32("RuleType"); info.PagingType = rdr.GetInt32("PagingType"); info.PagingBeginCode = rdr.GetString("PagingBeginCode"); info.PagingEndCode = rdr.GetString("PagingEndCode"); info.LinkBeginCode = rdr.GetString("LinkBeginCode"); info.LinkEndCode = rdr.GetString("LinkEndCode"); info.DesignatedUrl = rdr.GetString("DesignatedUrl"); info.ScopeBegin = rdr.GetInt32("ScopeBegin"); info.ScopeEnd = rdr.GetInt32("ScopeEnd"); info.PagingUrlList = rdr.GetString("PagingUrlList"); info.CorrelationRuleId = rdr.GetInt32("CorrelationRuleId"); return(info); }
/// <summary> /// 通过数据读取器生成实体类 /// </summary> /// <param name="rdr"></param> /// <returns></returns> private static BankrollLogEntity GetEntityFromrdr(NullableDataReader rdr) { BankrollLogEntity info = new BankrollLogEntity(); info.ItemID = rdr.GetInt32("ItemID"); info.UserName = rdr.GetString("UserName"); info.ClientID = rdr.GetInt32("ClientID"); info.DateAndTime = rdr.GetNullableDateTime("DateAndTime"); info.Money = rdr.GetDecimal("Money"); info.MoneyType = rdr.GetInt32("MoneyType"); info.CurrencyType = rdr.GetInt32("CurrencyType"); info.EBankID = rdr.GetInt32("eBankID"); info.Bank = rdr.GetString("Bank"); info.OrderID = rdr.GetInt32("OrderID"); info.PaymentID = rdr.GetInt32("PaymentID"); info.Remark = rdr.GetString("Remark"); info.LogTime = rdr.GetNullableDateTime("LogTime"); info.Inputer = rdr.GetString("Inputer"); info.IP = rdr.GetString("IP"); info.Status = rdr.GetInt32("Status"); info.Memo = rdr.GetString("Memo"); return(info); }
/// <summary> /// 通过数据读取器生成实体类 /// </summary> /// <param name="rdr"></param> /// <returns></returns> private static CollectionHistoryEntity GetEntityFromrdr(NullableDataReader rdr) { CollectionHistoryEntity info = new CollectionHistoryEntity(); info.HistoryID = rdr.GetInt32("HistoryID"); info.ItemID = rdr.GetInt32("ItemID"); info.ModelID = rdr.GetInt32("ModelID"); info.NodeID = rdr.GetInt32("NodeID"); info.GeneralID = rdr.GetInt32("GeneralID"); info.Title = rdr.GetString("Title"); info.CollectionTime = rdr.GetNullableDateTime("CollectionTime"); info.Result = rdr.GetInt32("Result"); info.NewsUrl = rdr.GetString("NewsUrl"); info.Remark = rdr.GetString("Remark"); return(info); }
private static EasyOne.Model.UserManage.UserPointLogInfo UserPointLogInfo(NullableDataReader rdr) { EasyOne.Model.UserManage.UserPointLogInfo info = new EasyOne.Model.UserManage.UserPointLogInfo(); info.LogId = rdr.GetInt32("LogID"); info.UserName = rdr.GetString("UserName"); info.ModuleType = rdr.GetInt32("ModuleType"); info.InfoId = rdr.GetInt32("InfoID"); info.Point = rdr.GetInt32("Point"); info.LogTime = rdr.GetDateTime("LogTime"); info.Times = rdr.GetInt32("Times"); info.IncomePayOut = rdr.GetInt32("IncomePayOut"); info.Remark = rdr.GetString("Remark"); info.IP = rdr.GetString("IP"); info.Inputer = rdr.GetString("Inputer"); return(info); }
public IDictionary <int, string> GetListByUserName(string userName) { string str; IDictionary <int, string> dictionary = new Dictionary <int, string>(); if (string.IsNullOrEmpty(userName)) { str = "SELECT TOP 50 OrderID, OrderNum FROM PE_Orders WHERE Status = 0 ORDER BY OrderID DESC"; } else { str = "SELECT TOP 50 OrderID, OrderNum FROM PE_Orders WHERE Status = 0 AND UserName = @UserName ORDER BY OrderID DESC"; } using (NullableDataReader reader = new NullableDataReader(DBHelper.ExecuteReaderSql(str, new Parameters("@UserName", DbType.String, userName)))) { while (reader.Read()) { dictionary.Add(reader.GetInt32("OrderID"), reader.GetString("OrderNum")); } } return(dictionary); }
public DataTable GetNodeNameByModelId(int modelId, NodeType nodeType) { DataTable table = new DataTable(); table.Columns.Add("NodeId"); table.Columns.Add("NodeName"); Parameters cmdParams = new Parameters(); cmdParams.AddInParameter("@ModelId", DbType.Int32, modelId); cmdParams.AddInParameter("@NodeType", DbType.Int32, nodeType); using (NullableDataReader reader = DBHelper.ExecuteReaderSql("SELECT N.NodeId, N.NodeName FROM PE_Nodes_Model_Template R INNER JOIN PE_Nodes N ON R.NodeId = N.NodeId WHERE R.ModelId = @ModelId AND N.NodeType = @NodeType", cmdParams)) { while (reader.Read()) { DataRow row = table.NewRow(); row["NodeId"] = reader.GetInt32("NodeId"); row["NodeName"] = reader.GetString("NodeName"); table.Rows.Add(row); } } return(table); }
/// <summary> /// 得到指定管理员的所有角色ID,用“,”分隔。超级管理员直接返回“0”。 /// </summary> /// <param name="adminID">管理员ID</param> /// <returns></returns> public string GetRoleIDs(int adminID) { string strSQL = "SELECT AdminID FROM AdminRoles WHERE AdminID = @AdminID AND RoleId = 0"; Dictionary <string, object> dict = new Dictionary <string, object>(); dict.Add("AdminID", adminID); if (_DB.ExistData(strSQL, dict)) { return("0"); } strSQL = "SELECT RoleId FROM AdminRoles WHERE AdminID=@AdminID"; StringBuilder sb = new StringBuilder(); using (NullableDataReader reader = _DB.GetDataReader(strSQL, dict)) { while (reader.Read()) { StringHelper.AppendString(sb, reader.GetInt32("RoleId").ToString()); } } return(sb.ToString()); }
public IList <RegionInfo> GetRegionList(int startRowIndexId, int maxiNumRows, string searchType, string keyword) { IList <RegionInfo> list = new List <RegionInfo>(); Database database = DatabaseFactory.CreateDatabase(); DbCommand storedProcCommand = database.GetStoredProcCommand("PR_Common_GetList"); database.AddInParameter(storedProcCommand, "@StartRows", DbType.Int32, startRowIndexId); database.AddInParameter(storedProcCommand, "@PageSize", DbType.Int32, maxiNumRows); database.AddInParameter(storedProcCommand, "@SortColumn", DbType.String, "RegionID"); database.AddInParameter(storedProcCommand, "@StrColumn", DbType.String, "*"); database.AddInParameter(storedProcCommand, "@Sorts", DbType.String, "DESC"); if (!string.IsNullOrEmpty(searchType) && !string.IsNullOrEmpty(keyword)) { database.AddInParameter(storedProcCommand, "@Filter", DbType.String, searchType + " LIKE '%" + DBHelper.FilterBadChar(keyword) + "%'"); } else { database.AddInParameter(storedProcCommand, "@Filter", DbType.String, ""); } database.AddInParameter(storedProcCommand, "@TableName", DbType.String, "PE_Region"); database.AddOutParameter(storedProcCommand, "@Total", DbType.Int32, 10); using (NullableDataReader reader = new NullableDataReader(database.ExecuteReader(storedProcCommand))) { while (reader.Read()) { RegionInfo item = new RegionInfo(); item.RegionId = reader.GetInt32("RegionId"); item.Country = reader.GetString("Country"); item.Province = reader.GetString("Province"); item.City = Convert.IsDBNull(reader["City"]) ? "" : reader.GetString("City"); item.Area = Convert.IsDBNull(reader["Area"]) ? "" : reader.GetString("Area"); item.PostCode = reader.GetString("PostCode"); item.AreaCode = reader.GetString("AreaCode"); list.Add(item); } } this.m_TotalOfRegion = (int)database.GetParameterValue(storedProcCommand, "@Total"); return(list); }
public RefundInfo GetByOrderId(int orderId) { Parameters cmdParams = new Parameters(); cmdParams.AddInParameter("OrderId", DbType.Int32, orderId); using (NullableDataReader reader = new NullableDataReader(DBHelper.ExecuteReaderProc("PR_Shop_Refund_GetByOrderId", cmdParams))) { if (reader.Read()) { RefundInfo info = new RefundInfo(); info.UserName = reader.GetString("UserName"); info.ClientId = reader.GetInt32("ClientID"); info.OrderNum = reader.GetString("OrderNum"); info.ClientName = reader.GetString("ClientName"); info.MoneyTotal = reader.GetDecimal("MoneyTotal"); info.MoneyReceipt = reader.GetDecimal("MoneyReceipt"); info.Email = reader.GetString("Email"); return(info); } return(new RefundInfo(true)); } }
/// <summary> /// 通过数据读取器生成实体类 /// </summary> /// <param name="rdr"></param> /// <returns></returns> private static StockOutEntity GetEntityFromrdr(NullableDataReader rdr) { StockOutEntity info = new StockOutEntity(); info.ID = rdr.GetInt32("ID"); info.Email = rdr.GetString("Email"); info.UserId = rdr.GetInt32("UserId"); info.Mobile = rdr.GetString("Mobile"); info.ProductId = rdr.GetInt32("ProductId"); info.OrderNum = rdr.GetInt32("OrderNum"); info.InputTime = rdr.GetNullableDateTime("InputTime"); info.IP = rdr.GetString("IP"); info.EmailStatus = rdr.GetInt32("EmailStatus"); info.MobileStatus = rdr.GetInt32("MobileStatus"); info.Property = rdr.GetString("Property"); return(info); }
/// <summary> /// 通过数据读取器生成实体类 /// </summary> /// <param name="rdr"></param> /// <returns></returns> private static PointLogEntity GetEntityFromrdr(NullableDataReader rdr) { PointLogEntity info = new PointLogEntity(); info.LogID = rdr.GetInt32("LogID"); info.UserName = rdr.GetString("UserName"); info.ModuleType = rdr.GetInt32("ModuleType"); info.InfoID = rdr.GetInt32("InfoID"); info.Point = rdr.GetInt32("Point"); info.LogTime = rdr.GetNullableDateTime("LogTime"); info.Times = rdr.GetInt32("Times"); info.IncomePayOut = rdr.GetInt32("IncomePayOut"); info.Remark = rdr.GetString("Remark"); info.IP = rdr.GetString("IP"); info.Inputer = rdr.GetString("Inputer"); info.Memo = rdr.GetString("Memo"); return(info); }
public IList <MemberOrderlinessInfo> GetMemberOrderlinessList(int startRowIndexId, int maxNumberRows, string userName, DateTime time, bool isAll) { Database database = DatabaseFactory.CreateDatabase(); DbCommand storedProcCommand = database.GetStoredProcCommand("PR_Shop_Statistics_GetList"); StringBuilder builder = new StringBuilder(); builder.Append("O.UserName = '******' AND O.MoneyReceipt >= O.MoneyTotal"); if (!isAll) { builder.Append(" AND DATEDIFF(m, O.InputTime, '" + time + "') = 0"); } database.AddInParameter(storedProcCommand, "@StartRows", DbType.Int32, startRowIndexId); database.AddInParameter(storedProcCommand, "@PageSize", DbType.Int32, maxNumberRows); database.AddInParameter(storedProcCommand, "@SortColumn", DbType.String, "SUM(I.SubTotal)"); database.AddInParameter(storedProcCommand, "@StrColumn", DbType.String, "MAX(P.ProductName) AS ProductName, SUM(I.Amount) AS Amount, SUM(I.SubTotal) AS SubTotal"); database.AddInParameter(storedProcCommand, "@Sorts", DbType.String, "DESC"); database.AddInParameter(storedProcCommand, "@TableName", DbType.String, "PE_Orders AS O INNER JOIN PE_OrderItem AS I INNER JOIN PE_CommonProduct AS P ON I.ProductID = P.ProductID AND I.TableName = P.TableName ON O.OrderID = I.OrderID"); database.AddInParameter(storedProcCommand, "@Filter", DbType.String, builder.ToString()); database.AddInParameter(storedProcCommand, "@ID", DbType.String, " P.ProductID"); database.AddInParameter(storedProcCommand, "@Group", DbType.String, "GROUP BY P.ProductID"); database.AddOutParameter(storedProcCommand, "@Total", DbType.Int32, maxNumberRows); IList <MemberOrderlinessInfo> list = new List <MemberOrderlinessInfo>(); using (NullableDataReader reader = new NullableDataReader(database.ExecuteReader(storedProcCommand))) { while (reader.Read()) { MemberOrderlinessInfo item = new MemberOrderlinessInfo(); item.ProductName = reader.GetString("ProductName"); item.Amount = reader.GetInt32("Amount"); item.SubTotal = reader.GetDecimal("SubTotal"); list.Add(item); } } this.m_TotalOfMemberOrderliness = (int)database.GetParameterValue(storedProcCommand, "@Total"); return(list); }
public static List <RelacionConceptoCantCuotas> Traer_CantCuotas_TxPrestadorCodConceptoLiquidacion(long idPrestador, int codConceptoLiq) { List <RelacionConceptoCantCuotas> listCuotas = new List <RelacionConceptoCantCuotas>(); string sql = "RelacionConceptoCantCuotas_T"; Database db = DatabaseFactory.CreateDatabase("DAT_V01"); DbCommand dbCommand = db.GetStoredProcCommand(sql); try { db.AddInParameter(dbCommand, "@idPrestador", DbType.Int64, idPrestador); db.AddInParameter(dbCommand, "@codConceptoLiq", DbType.Int32, codConceptoLiq); using (NullableDataReader ds = new NullableDataReader(db.ExecuteReader(dbCommand))) { while (ds.Read()) { RelacionConceptoCantCuotas oCantCuotas = new RelacionConceptoCantCuotas(); oCantCuotas.CantCuotas = ds.GetInt32("cantcuotas"); listCuotas.Add(oCantCuotas); } } return(listCuotas); } catch (Exception ex) { log.Error(string.Format("{0}->{1}-> Error:{2}->{3}", DateTime.Now, System.Reflection.MethodBase.GetCurrentMethod(), ex.Source, ex.Message)); throw ex; } finally { db = null; dbCommand.Dispose(); } }
protected Dictionary <string, int> GetDictionary(int startRowIndexId, int maxiNumRows, string tableName, string key, string value) { Database database = DatabaseFactory.CreateDatabase(); Dictionary <string, int> dictionary = new Dictionary <string, int>(); DbCommand storedProcCommand = database.GetStoredProcCommand("PR_Common_GetList"); database.AddInParameter(storedProcCommand, "@StartRows", DbType.Int32, startRowIndexId); database.AddInParameter(storedProcCommand, "@PageSize", DbType.Int32, maxiNumRows); database.AddInParameter(storedProcCommand, "@SortColumn", DbType.String, value); database.AddInParameter(storedProcCommand, "@StrColumn", DbType.String, "*"); database.AddInParameter(storedProcCommand, "@Sorts", DbType.String, "DESC"); database.AddInParameter(storedProcCommand, "@Filter", DbType.String, ""); database.AddInParameter(storedProcCommand, "@TableName", DbType.String, tableName); database.AddOutParameter(storedProcCommand, "@Total", DbType.Int32, maxiNumRows); using (NullableDataReader reader = new NullableDataReader(database.ExecuteReader(storedProcCommand))) { while (reader.Read()) { dictionary.Add(reader.GetString(key), reader.GetInt32(value)); } } this.m_ItemTotal = (int)database.GetParameterValue(storedProcCommand, "@Total"); return(dictionary); }
/// <summary> /// 通过数据读取器生成实体类 /// </summary> /// <param name="rdr"></param> /// <returns></returns> private static SurveyEntity GetEntityFromrdr(NullableDataReader rdr) { SurveyEntity info = new SurveyEntity(); info.SurveyID = rdr.GetInt32("SurveyID"); info.SurveyName = rdr.GetString("SurveyName"); info.Description = rdr.GetString("Description"); info.FileName = rdr.GetString("FileName"); info.IPRepeat = rdr.GetInt32("IPRepeat"); info.CreateDate = rdr.GetNullableDateTime("CreateDate"); info.EndTime = rdr.GetNullableDateTime("EndTime"); info.IsOpen = rdr.GetInt32("IsOpen"); info.NeedLogin = rdr.GetInt32("NeedLogin"); info.PresentPoint = rdr.GetInt32("PresentPoint"); info.LockIPType = rdr.GetInt32("LockIPType"); info.SetIPLock = rdr.GetString("SetIPLock"); info.LockUrl = rdr.GetString("LockUrl"); info.SetPassword = rdr.GetString("SetPassword"); info.Template = rdr.GetString("Template"); info.QuestionField = rdr.GetString("QuestionField"); info.QuestionMaxID = rdr.GetInt32("QuestionMaxID"); return(info); }
/// <summary> /// 通过数据读取器生成实体类 /// </summary> /// <param name="rdr"></param> /// <returns></returns> private static ShoppingCartsEntity GetEntityFromrdr(NullableDataReader rdr) { ShoppingCartsEntity info = new ShoppingCartsEntity(); info.CartItemID = rdr.GetInt32("CartItemID"); info.UserName = rdr.GetString("UserName"); info.CartID = rdr.GetString("CartID"); info.ProductID = rdr.GetInt32("ProductID"); info.Quantity = rdr.GetInt32("Quantity"); info.IsPresent = rdr.GetBoolean("IsPresent"); info.UpdateTime = rdr.GetNullableDateTime("UpdateTime"); info.TableName = rdr.GetString("TableName"); info.Property = rdr.GetString("Property"); info.InformResult = rdr.GetInt32("InformResult"); info.BelongsToProductID = rdr.GetInt32("BelongsToProductID"); info.Remark = rdr.GetString("Remark"); info.Deadline = rdr.GetInt32("Deadline"); info.DownPayment = rdr.GetDecimal("DownPayment"); return(info); }
/// <summary> /// 通过数据读取器生成实体类 /// </summary> /// <param name="rdr"></param> /// <returns></returns> private static IntegralProductEntity GetEntityFromrdr(NullableDataReader rdr) { IntegralProductEntity info = new IntegralProductEntity(); info.ID = rdr.GetInt32("ID"); info.Title = rdr.GetString("Title"); info.Price = rdr.GetDecimal("Price"); info.NeedIntegral = rdr.GetInt32("NeedIntegral"); info.Picture = rdr.GetString("Picture"); info.TypeID = rdr.GetInt32("TypeID"); info.Stocks = rdr.GetInt32("Stocks"); info.UpdateTime = rdr.GetNullableDateTime("UpdateTime"); info.PictureBig = rdr.GetString("PictureBig"); info.Content = rdr.GetString("Content"); info.Description = rdr.GetString("Description"); info.Keyword = rdr.GetString("Keyword"); info.ExchangeTimes = rdr.GetInt32("ExchangeTimes"); info.EliteLevel = rdr.GetInt32("EliteLevel"); return(info); }
private static SaleListInfo CreateSaleListInfo(NullableDataReader rdr) { SaleListInfo info = new SaleListInfo(); info.SaleType = rdr.GetInt32("SaleType"); info.ProductId = rdr.GetInt32("ProductID"); info.OrderId = rdr.GetInt32("OrderID"); info.ClientId = rdr.GetInt32("ClientID"); info.ItemId = rdr.GetInt32("ItemID"); info.ProductName = rdr.GetString("ProductName"); info.UserName = rdr.GetString("UserName"); info.ClientName = rdr.GetString("ClientName"); info.Unit = rdr.GetString("Unit"); info.PresentExp = rdr.GetInt32("PresentExp"); info.Price = rdr.GetDecimal("Price"); info.TruePrice = rdr.GetDecimal("TruePrice"); info.Amount = rdr.GetInt32("Amount"); info.OrderNum = rdr.GetString("OrderNum"); info.InputTime = rdr.GetDateTime("InputTime"); info.TableName = rdr.GetString("TableName"); info.Property = rdr.GetString("Property"); info.SubTotal = info.TruePrice * DataConverter.CDecimal(info.Amount); return(info); }
private static EasyOne.Model.Collection.CollectionExclosionInfo CollectionExclosionInfo(NullableDataReader rdr) { EasyOne.Model.Collection.CollectionExclosionInfo info = new EasyOne.Model.Collection.CollectionExclosionInfo(); info.ExclosionId = rdr.GetInt32("ExclosionID"); info.ExclosionName = rdr.GetString("ExclosionName"); info.ExclosionType = rdr.GetInt32("ExclosionType"); info.ExclosionStringType = rdr.GetInt32("ExclosionStringType"); info.ExclosionString = rdr.GetString("ExclosionString"); info.ExclosionDesignatedNumber = rdr.GetInt32("ExclosionDesignatedNumber"); info.ExclosionMaxNumber = rdr.GetInt32("ExclosionMaxNumber"); info.ExclosionMinNumber = rdr.GetInt32("ExclosionMinNumber"); info.ExclosionDesignatedDateTime = new DateTime?(rdr.GetDateTime("ExclosionDesignatedDateTime")); info.ExclosionMaxDateTime = new DateTime?(rdr.GetDateTime("ExclosionMaxDateTime")); info.ExclosionMinDateTime = new DateTime?(rdr.GetDateTime("ExclosionMinDateTime")); info.IsExclosionDesignatedNumber = rdr.GetBoolean("IsExclosionDesignatedNumber"); info.IsExclosionMaxNumber = rdr.GetBoolean("IsExclosionMaxNumber"); info.IsExclosionMinNumber = rdr.GetBoolean("IsExclosionMinNumber"); info.IsExclosionDesignatedDateTime = rdr.GetBoolean("IsExclosionDesignatedDateTime"); info.IsExclosionMaxDateTime = rdr.GetBoolean("IsExclosionMaxDateTime"); info.IsExclosionMinDateTime = rdr.GetBoolean("IsExclosionMinDateTime"); return(info); }
/// <summary> /// 通过数据读取器生成实体类 /// </summary> /// <param name="rdr"></param> /// <returns></returns> private static CardsEntity GetEntityFromrdr(NullableDataReader rdr) { CardsEntity info = new CardsEntity(); info.CardID = rdr.GetInt32("CardID"); info.CardType = rdr.GetInt32("CardType"); info.ProductID = rdr.GetInt32("ProductID"); info.TableName = rdr.GetString("TableName"); info.CardNum = rdr.GetString("CardNum"); info.Password = rdr.GetString("Password"); info.AgentName = rdr.GetString("AgentName"); info.Money = rdr.GetDecimal("Money"); info.ValidNum = rdr.GetInt32("ValidNum"); info.ValidUnit = rdr.GetInt32("ValidUnit"); info.EndDate = rdr.GetNullableDateTime("EndDate"); info.UserName = rdr.GetString("UserName"); info.UseTime = rdr.GetNullableDateTime("UseTime"); info.CreateTime = rdr.GetNullableDateTime("CreateTime"); info.OrderItemID = rdr.GetInt32("OrderItemID"); info.ProductName = rdr.GetString("ProductName"); return(info); }
/// <summary> /// 通过数据读取器生成实体类 /// </summary> /// <param name="rdr"></param> /// <returns></returns> private static CouponEntity GetEntityFromrdr(NullableDataReader rdr) { CouponEntity info = new CouponEntity(); info.CouponID = rdr.GetInt32("CouponID"); info.CouponName = rdr.GetString("CouponName"); info.CouponNumPattern = rdr.GetString("CouponNumPattern"); info.Money = rdr.GetDecimal("Money"); info.State = rdr.GetInt32("State"); info.UserGroup = rdr.GetString("UserGroup"); info.BeginDate = rdr.GetNullableDateTime("BeginDate"); info.EndDate = rdr.GetNullableDateTime("EndDate"); info.LimitNum = rdr.GetInt32("LimitNum"); info.ProductLimitType = rdr.GetInt32("ProductLimitType"); info.ProductLimitContent = rdr.GetString("ProductLimitContent"); info.CouponCreateType = rdr.GetInt32("CouponCreateType"); info.CouponCreateContent = rdr.GetString("CouponCreateContent"); info.OrderTotalMoney = rdr.GetDecimal("OrderTotalMoney"); info.UseBeginDate = rdr.GetNullableDateTime("UseBeginDate"); info.UseEndDate = rdr.GetNullableDateTime("UseEndDate"); info.CouponItemNum = rdr.GetInt32("CouponItemNum"); return(info); }
/// <summary> /// 通过数据读取器生成实体类 /// </summary> /// <param name="rdr"></param> /// <returns></returns> private static CollectionExclosionEntity GetEntityFromrdr(NullableDataReader rdr) { CollectionExclosionEntity info = new CollectionExclosionEntity(); info.ExclosionID = rdr.GetInt32("ExclosionID"); info.ExclosionName = rdr.GetString("ExclosionName"); info.ExclosionType = rdr.GetInt32("ExclosionType"); info.ExclosionStringType = rdr.GetInt32("ExclosionStringType"); info.ExclosionString = rdr.GetString("ExclosionString"); info.IsExclosionDesignatedNumber = rdr.GetBoolean("IsExclosionDesignatedNumber"); info.ExclosionDesignatedNumber = rdr.GetInt32("ExclosionDesignatedNumber"); info.IsExclosionMaxNumber = rdr.GetBoolean("IsExclosionMaxNumber"); info.ExclosionMaxNumber = rdr.GetInt32("ExclosionMaxNumber"); info.IsExclosionMinNumber = rdr.GetBoolean("IsExclosionMinNumber"); info.ExclosionMinNumber = rdr.GetInt32("ExclosionMinNumber"); info.IsExclosionDesignatedDateTime = rdr.GetBoolean("IsExclosionDesignatedDateTime"); info.ExclosionDesignatedDateTime = rdr.GetNullableDateTime("ExclosionDesignatedDateTime"); info.IsExclosionMaxDateTime = rdr.GetBoolean("IsExclosionMaxDateTime"); info.ExclosionMaxDateTime = rdr.GetNullableDateTime("ExclosionMaxDateTime"); info.IsExclosionMinDateTime = rdr.GetBoolean("IsExclosionMinDateTime"); info.ExclosionMinDateTime = rdr.GetNullableDateTime("ExclosionMinDateTime"); return(info); }
private static PresentInfo PresentFromrdr(NullableDataReader rdr) { PresentInfo info = new PresentInfo(); info.PresentId = rdr.GetInt32("PresentID"); info.PresentName = rdr.GetString("PresentName"); info.PresentPic = rdr.GetString("PresentPic"); info.PresentThumb = rdr.GetString("PresentThumb"); info.Unit = rdr.GetString("Unit"); info.PresentNum = rdr.GetString("PresentNum"); info.ServiceTermUnit = (ServiceTermUnit)rdr.GetInt32("ServiceTermUnit"); info.ServiceTerm = rdr.GetInt32("ServiceTerm"); info.Price = rdr.GetDecimal("Price"); info.PriceMarket = rdr.GetDecimal("Price_Market"); info.Weight = rdr.GetDouble("Weight"); info.ProductCharacter = (ProductCharacter)rdr.GetInt32("ProductCharacter"); info.Stocks = rdr.GetInt32("Stocks"); info.DownloadUrl = rdr.GetString("DownloadUrl"); info.Remark = rdr.GetString("Remark"); info.AlarmNum = rdr.GetInt32("AlarmNum"); info.PresentIntro = rdr.GetString("PresentIntro"); info.PresentExplain = rdr.GetString("PresentExplain"); return(info); }
private static void ProductFromrdr <T>(NullableDataReader rdr, T productInfo) where T : ProductInfo { productInfo.ProductId = rdr.GetInt32("ProductId"); productInfo.TableName = rdr.GetString("TableName"); productInfo.ProductName = rdr.GetString("ProductName"); productInfo.ProductType = (ProductType)rdr.GetInt32("ProductType"); productInfo.ProductPic = rdr.GetString("ProductPic"); productInfo.ProductThumb = rdr.GetString("ProductThumb"); productInfo.Unit = rdr.GetString("Unit"); productInfo.ProductNum = rdr.GetString("ProductNum"); productInfo.ServiceTermUnit = (ServiceTermUnit)rdr.GetInt32("ServiceTermUnit"); productInfo.ServiceTerm = rdr.GetInt32("ServiceTerm"); productInfo.PriceInfo.Price = rdr.GetDecimal("Price"); productInfo.PriceMarket = rdr.GetDecimal("Price_Market"); productInfo.PriceInfo.PriceMember = rdr.GetDecimal("Price_Member"); productInfo.PriceInfo.PriceAgent = rdr.GetDecimal("Price_Agent"); productInfo.EnableWholesale = rdr.GetBoolean("EnableWholesale"); productInfo.PriceInfo.PriceWholesale1 = rdr.GetDecimal("Price_Wholesale1"); productInfo.PriceInfo.PriceWholesale2 = rdr.GetDecimal("Price_Wholesale2"); productInfo.PriceInfo.PriceWholesale3 = rdr.GetDecimal("Price_Wholesale3"); productInfo.PriceInfo.NumberWholesale1 = rdr.GetInt32("Number_Wholesale1"); productInfo.PriceInfo.NumberWholesale2 = rdr.GetInt32("Number_Wholesale2"); productInfo.PriceInfo.NumberWholesale3 = rdr.GetInt32("Number_Wholesale3"); productInfo.PresentId = rdr.GetInt32("PresentID"); productInfo.PresentNumber = rdr.GetInt32("PresentNumber"); productInfo.PresentPoint = rdr.GetInt32("PresentPoint"); productInfo.PresentExp = rdr.GetInt32("PresentExp"); productInfo.PresentMoney = rdr.GetDecimal("PresentMoney"); productInfo.StocksProject = (StocksProject)rdr.GetInt32("StocksProject"); productInfo.SalePromotionType = rdr.GetInt32("SalePromotionType"); productInfo.MinNumber = rdr.GetInt32("MinNumber"); productInfo.Discount = rdr.GetDouble("Discount"); productInfo.IncludeTax = (TaxRateType)rdr.GetInt32("IncludeTax"); productInfo.TaxRate = rdr.GetDouble("TaxRate"); productInfo.Properties = rdr.GetString("Properties"); productInfo.Weight = rdr.GetDouble("Weight"); productInfo.LimitNum = rdr.GetInt32("LimitNum"); productInfo.EnableSingleSell = rdr.GetBoolean("EnableSingleSell"); productInfo.DependentProducts = rdr.GetString("DependentProducts"); productInfo.ProductKind = (ProductKind)rdr.GetInt32("ProductKind"); productInfo.OrderNum = rdr.GetInt32("OrderNum"); productInfo.Stocks = rdr.GetInt32("Stocks"); productInfo.EnableSale = rdr.GetBoolean("EnableSale"); productInfo.EnableBuyWhenOutofstock = rdr.GetBoolean("EnableBuyWhenOutofstock"); productInfo.BarCode = rdr.GetString("BarCode"); productInfo.ProductExplain = rdr.GetString("ProductExplain"); productInfo.ProducerName = rdr.GetString("ProducerName"); productInfo.TrademarkName = rdr.GetString("TrademarkName"); productInfo.Keyword = rdr.GetString("Keyword"); productInfo.Stars = rdr.GetInt32("Stars"); productInfo.ProductIntro = rdr.GetString("ProductIntro"); productInfo.IsNew = rdr.GetBoolean("IsNew"); productInfo.IsHot = rdr.GetBoolean("IsHot"); productInfo.IsBest = rdr.GetBoolean("IsBest"); productInfo.ProductCharacter = (ProductCharacter)rdr.GetInt32("ProductCharacter"); productInfo.DownloadUrl = rdr.GetString("DownloadUrl"); productInfo.Remark = rdr.GetString("Remark"); productInfo.AlarmNum = rdr.GetInt32("AlarmNum"); productInfo.BuyTimes = rdr.GetInt32("BuyTimes"); productInfo.Minimum = rdr.GetInt32("Minimum"); }
private IList <ProductDetailInfo> GetProductsList(int startRowIndexId, int maxNumberRows, string searchType, string keyword, string nodeIds, int listType, int status, int modelId, bool wholesale) { string str; string str2; Database database = DatabaseFactory.CreateDatabase(); GetSortParameter(listType, out str, out str2); string str3 = ""; string temp = " AND "; if (!string.IsNullOrEmpty(nodeIds)) { str3 = " M.NodeId IN (" + DBHelper.ToValidId(nodeIds) + ") "; } else { str3 = " M.TableName IS NOT null "; } if ((status < 100) && (status > -4)) { str3 = string.Concat(new object[] { str3, temp, "M.Status = ", status, " " }); } if (status == 100) { str3 = str3 + temp + "M.Status <= 99 AND M.Status >= 0 "; } if (status == 0x65) { str3 = str3 + temp + "M.Status < 99 AND M.Status >0 "; } if (modelId > 0) { str3 = string.Concat(new object[] { str3, temp, "M.ModelID =", modelId }); } if (wholesale) { str3 = str3 + temp + "P.EnableWholesale = 1"; } DbCommand storedProcCommand = database.GetStoredProcCommand("PR_Common_GetList"); database.AddInParameter(storedProcCommand, "@StartRows", DbType.Int32, startRowIndexId); database.AddInParameter(storedProcCommand, "@PageSize", DbType.Int32, maxNumberRows); database.AddInParameter(storedProcCommand, "@SortColumn", DbType.String, str); database.AddInParameter(storedProcCommand, "@StrColumn", DbType.String, "N.NodeName, M.EliteLevel, M.CreateTime, M.UpdateTime, M.NodeId, M.GeneralId, M.ModelId, M.LinkType, P.*"); database.AddInParameter(storedProcCommand, "@Sorts", DbType.String, str2); database.AddInParameter(storedProcCommand, "@TableName", DbType.String, "PE_CommonProduct P INNER JOIN (PE_CommonModel M RIGHT JOIN PE_Nodes N ON M.NodeID= N.NodeID) ON P.ProductID = M.ItemID AND P.TableName = M.TableName AND M.Status<>-3"); if (string.IsNullOrEmpty(searchType)) { database.AddInParameter(storedProcCommand, "@Filter", DbType.String, str3); } else if (searchType == "SpeedSearch") { str3 = GetSpeedSearchFilter(keyword, str3, temp); database.AddInParameter(storedProcCommand, "@Filter", DbType.String, str3); } else { database.AddInParameter(storedProcCommand, "@Filter", DbType.String, str3 + temp + "P." + DBHelper.FilterBadChar(searchType) + " LIKE '%" + DBHelper.FilterBadChar(keyword) + "%'"); } database.AddOutParameter(storedProcCommand, "@Total", DbType.Int32, maxNumberRows); IList <ProductDetailInfo> list = new List <ProductDetailInfo>(); using (NullableDataReader reader = new NullableDataReader(database.ExecuteReader(storedProcCommand))) { while (reader.Read()) { ProductDetailInfo productInfo = new ProductDetailInfo(); ProductFromrdr <ProductDetailInfo>(reader, productInfo); productInfo.EliteLevel = reader.GetInt32("EliteLevel"); productInfo.UpdateTime = new DateTime?(reader.GetDateTime("UpdateTime")); productInfo.CreateTime = reader.IsDBNull("CreateTime") ? productInfo.UpdateTime : new DateTime?(reader.GetDateTime("CreateTime")); productInfo.NodeName = reader.GetString("NodeName"); productInfo.NodeId = reader.GetInt32("NodeId"); productInfo.GeneralId = reader.GetInt32("GeneralId"); productInfo.ModelId = reader.GetInt32("ModelId"); productInfo.LinkType = reader.GetInt32("LinkType"); list.Add(productInfo); } } this.m_TotalOfAllProducts = (int)database.GetParameterValue(storedProcCommand, "@Total"); return(list); }
public IList <ShoppingCartInfo> GetList(int startRowIndexId, int maxNumberRows, int searchType, string keyword) { Database database = DatabaseFactory.CreateDatabase(); IList <ShoppingCartInfo> list = new List <ShoppingCartInfo>(); DbCommand storedProcCommand = null; if (searchType == 4) { storedProcCommand = database.GetStoredProcCommand("PR_Common_GetList"); database.AddInParameter(storedProcCommand, "@SortColumn", DbType.String, "CartItemID"); database.AddInParameter(storedProcCommand, "@StrColumn", DbType.String, "C.*, P.*"); } else { storedProcCommand = database.GetStoredProcCommand("PR_Shop_ShoppingCart_GetList"); database.AddInParameter(storedProcCommand, "@SortColumn", DbType.String, "CartID"); database.AddInParameter(storedProcCommand, "@SortColumnDbType", DbType.String, "varchar(100)"); database.AddInParameter(storedProcCommand, "@StrColumn", DbType.String, "CartID, SUM(C.Quantity * P.Price) AS TotalMoney, SUM(Quantity) AS Quantity, Max(UserName) AS UserName, Max(UpdateTime) AS UpdateTime, Max(C.InformResult) AS InformResult"); } database.AddInParameter(storedProcCommand, "@StartRows", DbType.Int32, startRowIndexId); database.AddInParameter(storedProcCommand, "@PageSize", DbType.Int32, maxNumberRows); database.AddInParameter(storedProcCommand, "@Sorts", DbType.String, "DESC"); database.AddInParameter(storedProcCommand, "@Filter", DbType.String); switch (searchType) { case 0: database.SetParameterValue(storedProcCommand, "@Filter", ""); break; case 1: database.SetParameterValue(storedProcCommand, "@Filter", "DATEDIFF(dd, UpdateTime, GETDATE()) < 1"); break; case 2: database.SetParameterValue(storedProcCommand, "@Filter", "DATEDIFF(ww, UpdateTime, GETDATE()) < 1"); break; case 3: database.SetParameterValue(storedProcCommand, "@Filter", "DATEDIFF(m, UpdateTime, GETDATE()) < 1"); break; case 4: database.SetParameterValue(storedProcCommand, "@Filter", "CartID = '" + DBHelper.FilterBadChar(keyword) + "' AND C.IsPresent = 0"); break; case 10: database.SetParameterValue(storedProcCommand, "@Filter", "UserName IS NOT NULL AND UserName!=''"); break; } database.AddInParameter(storedProcCommand, "@TableName", DbType.String, "PE_ShoppingCarts C INNER JOIN PE_CommonProduct P ON C.ProductID = P.ProductID AND C.TableName = P.TableName"); database.AddOutParameter(storedProcCommand, "@Total", DbType.Int32, maxNumberRows); using (NullableDataReader reader = new NullableDataReader(database.ExecuteReader(storedProcCommand))) { while (reader.Read()) { if (searchType != 4) { ShoppingCartInfo item = new ShoppingCartInfo(); item.CartId = reader.GetString("CartId"); item.UserName = reader.GetString("UserName"); item.Quantity = reader.GetInt32("Quantity"); item.UpdateTime = reader.GetDateTime("UpdateTime"); item.TotalMoney = reader.GetDecimal("TotalMoney"); item.InformResult = reader.GetInt32("InformResult"); list.Add(item); } else { list.Add(ShoppingCartFromrdr(reader, true)); } } } this.m_TotalOfShoppingCart = (int)database.GetParameterValue(storedProcCommand, "@Total"); return(list); }
public static List <EstadoReclamo> Traer_Proximos(int idEstado) { string sql = "EstadoReclamo_Proximo"; Database db = DatabaseFactory.CreateDatabase("DAT_V01"); DbCommand dbCommand = db.GetStoredProcCommand(sql); DbParameterCollection dbParametros = null; db.AddInParameter(dbCommand, "@idEstado", DbType.Int32, idEstado); List <EstadoReclamo> ListEstado = new List <EstadoReclamo>(); EstadoReclamo oEst = null; try { dbParametros = dbCommand.Parameters; using (NullableDataReader ds = new NullableDataReader(db.ExecuteReader(dbCommand))) { while (ds.Read()) { oEst = new EstadoReclamo(); oEst.DescEstado = ds["DescEstado"].ToString(); oEst.IdEstado = int.Parse(ds["IdEstado"].ToString()); oEst.Control = ds.GetNullableString("Control"); oEst.ControlTexto = ds.GetNullableString("ControlTexto"); oEst.ControlIdModelo = ds.GetNullableInt32("ControlIdModelo") == null ? 0 : ds.GetInt32("ControlIdModelo"); oEst.EsFinal = ds.GetNullableBoolean("EsFinal") == null ? false : ds.GetBoolean("EsFinal"); oEst.FecManual = ds.GetNullableBoolean("FecManual") == null ? false : ds.GetBoolean("FecManual"); oEst.MensajeInfo = ds.GetNullableString("MensajeInfo"); oEst.EstadoAnme = ds.GetNullableInt32("EstadoAnme") == null ? 0 : ds.GetInt32("EstadoAnme"); oEst.PaseAutomatico = ds.GetNullableBoolean("PaseAutomatico") == null ? false : ds.GetBoolean("PaseAutomatico"); oEst.TieneObservacion = ds.GetNullableBoolean("TieneObservacion") == null ? false : ds.GetBoolean("TieneObservacion"); ListEstado.Add(oEst); } ds.Close(); ds.Dispose(); } return(ListEstado); } catch (Exception ex) { log.Error(string.Format("{0}->{1}->Error:{2}->{3}", DateTime.Now, System.Reflection.MethodBase.GetCurrentMethod(), ex.Source, ex.Message)); throw new Exception("Error en EstadoDAO.Trae_Todos", ex); } finally { db = null; dbCommand.Dispose(); } }
private void Fill(out TipoDocumentacion oObj, NullableDataReader dr) { oObj = new TipoDocumentacion(dr.GetInt32("codTipoDocumentacion"), dr.GetNullableString("descripcion") == null ? "" : dr.GetString("descripcion") ); }