private static HK_TodayEntrustInfo ConvertHistoryEntrustTable(HK_HistoryEntrustInfo tet) { HK_TodayEntrustInfo tet2 = new HK_TodayEntrustInfo(); tet2.BuySellTypeID = tet.BuySellTypeID; //tet2.CallbackChannlID = tet. tet2.CancelAmount = tet.CancelAmount; //tet2.CancelLogo = tet.ca tet2.CapitalAccount = tet.CapitalAccount; tet2.CurrencyTypeID = tet.CurrencyTypeID; tet2.EntrustAmount = tet.EntrustMount; tet2.EntrustNumber = tet.EntrustNumber; tet2.EntrustPrice = tet.EntrustPrice; tet2.EntrustTime = tet.EntrustTime; tet2.HasDoneProfit = tet.HasDoneProfit; //tet2.IsMarketValue = tet.IsMarketValue; tet2.OrderPriceType = tet.OrderPriceType; tet2.McOrderID = tet.McOrderID; tet2.OfferTime = tet.OfferTime; tet2.OrderMessage = tet.OrderMessage; tet2.OrderStatusID = tet.OrderStatusID; tet2.PortfolioLogo = tet.PortfolioLogo; tet2.Code = tet.Code; tet2.HoldAccount = tet.HoldAccount; tet2.TradeAmount = tet.TradeAmount; tet2.TradeAveragePrice = tet.TradeAveragePrice; tet2.TradeUnitID = tet.TradeUnitID; tet2.IsModifyOrder = tet.IsModifyOrder; tet2.ModifyOrderNumber = tet.ModifyOrderNumber; return(tet2); }
/// <summary> /// 更新一条数据 /// <param name="model"></param> /// </summary> public void Update(HK_HistoryEntrustInfo model) { StringBuilder strSql = new StringBuilder(); strSql.Append("update HK_HistoryEntrust set "); strSql.Append("EntrustPrice=@EntrustPrice,"); strSql.Append("PortfolioLogo=@PortfolioLogo,"); strSql.Append("EntrustMount=@EntrustMount,"); strSql.Append("Code=@Code,"); strSql.Append("TradeAmount=@TradeAmount,"); strSql.Append("TradeAveragePrice=@TradeAveragePrice,"); strSql.Append("OrderPriceType=@OrderPriceType,"); strSql.Append("CancelAmount=@CancelAmount,"); strSql.Append("BuySellTypeID=@BuySellTypeID,"); strSql.Append("HoldAccount=@HoldAccount,"); strSql.Append("CapitalAccount=@CapitalAccount,"); strSql.Append("CurrencyTypeID=@CurrencyTypeID,"); strSql.Append("TradeUnitID=@TradeUnitID,"); strSql.Append("OrderStatusID=@OrderStatusID,"); strSql.Append("OrderMessage=@OrderMessage,"); strSql.Append("McOrderID=@McOrderID,"); strSql.Append("HasDoneProfit=@HasDoneProfit,"); strSql.Append("OfferTime=@OfferTime,"); strSql.Append("EntrustTime=@EntrustTime,"); strSql.Append("IsModifyOrder=@IsModifyOrder,"); strSql.Append("ModifyOrderNumber=@ModifyOrderNumber"); strSql.Append(" where EntrustNumber=@EntrustNumber "); Database db = DatabaseFactory.CreateDatabase(); DbCommand dbCommand = db.GetSqlStringCommand(strSql.ToString()); db.AddInParameter(dbCommand, "EntrustNumber", DbType.AnsiString, model.EntrustNumber); db.AddInParameter(dbCommand, "PortfolioLogo", DbType.AnsiString, model.PortfolioLogo); db.AddInParameter(dbCommand, "EntrustPrice", DbType.Decimal, model.EntrustPrice); db.AddInParameter(dbCommand, "EntrustMount", DbType.Int32, model.EntrustMount); db.AddInParameter(dbCommand, "Code", DbType.AnsiString, model.Code); db.AddInParameter(dbCommand, "TradeAmount", DbType.Int32, model.TradeAmount); db.AddInParameter(dbCommand, "TradeAveragePrice", DbType.Decimal, model.TradeAveragePrice); db.AddInParameter(dbCommand, "OrderPriceType", DbType.Int32, model.OrderPriceType); db.AddInParameter(dbCommand, "CancelAmount", DbType.Int32, model.CancelAmount); db.AddInParameter(dbCommand, "BuySellTypeID", DbType.Int32, model.BuySellTypeID); db.AddInParameter(dbCommand, "HoldAccount", DbType.AnsiString, model.HoldAccount); db.AddInParameter(dbCommand, "CapitalAccount", DbType.AnsiString, model.CapitalAccount); db.AddInParameter(dbCommand, "CurrencyTypeID", DbType.Int32, model.CurrencyTypeID); db.AddInParameter(dbCommand, "TradeUnitID", DbType.Int32, model.TradeUnitID); db.AddInParameter(dbCommand, "OrderStatusID", DbType.Int32, model.OrderStatusID); db.AddInParameter(dbCommand, "OrderMessage", DbType.AnsiString, model.OrderMessage); db.AddInParameter(dbCommand, "McOrderID", DbType.AnsiString, model.McOrderID); db.AddInParameter(dbCommand, "HasDoneProfit", DbType.Decimal, model.HasDoneProfit); db.AddInParameter(dbCommand, "OfferTime", DbType.DateTime, model.OfferTime); db.AddInParameter(dbCommand, "EntrustTime", DbType.DateTime, model.EntrustTime); db.AddInParameter(dbCommand, "IsModifyOrder", DbType.Boolean, model.IsModifyOrder); db.AddInParameter(dbCommand, "ModifyOrderNumber", DbType.AnsiString, model.ModifyOrderNumber); db.ExecuteNonQuery(dbCommand); }
/// <summary> /// 根据委托单号获取历史委托 /// </summary> /// <param name="entrustNumber">委托单号</param> /// <returns>今日委托</returns> public static HK_HistoryEntrustInfo GetHistoryEntrustTable(string entrustNumber) { HK_HistoryEntrustInfo tet = null; HK_HistoryEntrustDal dal = new HK_HistoryEntrustDal(); try { tet = dal.GetModel(entrustNumber); } catch (Exception ex) { LogHelper.WriteError(ex.Message, ex); } return(tet); }
/// <summary> /// 得到一个对象实体 /// <param name="entrustNumber"></param> /// </summary> public HK_HistoryEntrustInfo GetModel(string entrustNumber) { StringBuilder strSql = new StringBuilder(); strSql.Append("select EntrustNumber,PortfolioLogo,EntrustPrice,EntrustMount,Code,TradeAmount,TradeAveragePrice,OrderPriceType,CancelAmount,BuySellTypeID,HoldAccount,CapitalAccount,CurrencyTypeID,TradeUnitID,OrderStatusID,OrderMessage,McOrderID,HasDoneProfit,OfferTime,EntrustTime,IsModifyOrder,ModifyOrderNumber from HK_HistoryEntrust "); strSql.Append(" where EntrustNumber=@EntrustNumber "); Database db = DatabaseFactory.CreateDatabase(); DbCommand dbCommand = db.GetSqlStringCommand(strSql.ToString()); db.AddInParameter(dbCommand, "EntrustNumber", DbType.AnsiString, entrustNumber); HK_HistoryEntrustInfo model = null; using (IDataReader dataReader = db.ExecuteReader(dbCommand)) { if (dataReader.Read()) { model = ReaderBind(dataReader); } } return(model); }
/// <summary> /// 增加一条数据 /// <param name="model"></param> /// </summary> public void Add(HK_HistoryEntrustInfo model) { StringBuilder strSql = new StringBuilder(); strSql.Append("insert into HK_HistoryEntrust("); strSql.Append("EntrustNumber,PortfolioLogo,EntrustPrice,EntrustMount,Code,TradeAmount,TradeAveragePrice,OrderPriceType,CancelAmount,BuySellTypeID,HoldAccount,CapitalAccount,CurrencyTypeID,TradeUnitID,OrderStatusID,OrderMessage,McOrderID,HasDoneProfit,OfferTime,EntrustTime,IsModifyOrder,ModifyOrderNumber)"); strSql.Append(" values ("); strSql.Append("@EntrustNumber,@PortfolioLogo,@EntrustPrice,@EntrustMount,@Code,@TradeAmount,@TradeAveragePrice,@OrderPriceType,@CancelAmount,@BuySellTypeID,@HoldAccount,@CapitalAccount,@CurrencyTypeID,@TradeUnitID,@OrderStatusID,@OrderMessage,@McOrderID,@HasDoneProfit,@OfferTime,@EntrustTime,@IsModifyOrder,@ModifyOrderNumber)"); Database db = DatabaseFactory.CreateDatabase(); DbCommand dbCommand = db.GetSqlStringCommand(strSql.ToString()); db.AddInParameter(dbCommand, "EntrustNumber", DbType.AnsiString, model.EntrustNumber); db.AddInParameter(dbCommand, "PortfolioLogo", DbType.AnsiString, model.PortfolioLogo); db.AddInParameter(dbCommand, "EntrustPrice", DbType.Decimal, model.EntrustPrice); db.AddInParameter(dbCommand, "EntrustMount", DbType.Int32, model.EntrustMount); db.AddInParameter(dbCommand, "Code", DbType.AnsiString, model.Code); db.AddInParameter(dbCommand, "TradeAmount", DbType.Int32, model.TradeAmount); db.AddInParameter(dbCommand, "TradeAveragePrice", DbType.Decimal, model.TradeAveragePrice); db.AddInParameter(dbCommand, "OrderPriceType", DbType.Int32, model.OrderPriceType); db.AddInParameter(dbCommand, "CancelAmount", DbType.Int32, model.CancelAmount); db.AddInParameter(dbCommand, "BuySellTypeID", DbType.Int32, model.BuySellTypeID); db.AddInParameter(dbCommand, "HoldAccount", DbType.AnsiString, model.HoldAccount); db.AddInParameter(dbCommand, "CapitalAccount", DbType.AnsiString, model.CapitalAccount); db.AddInParameter(dbCommand, "CurrencyTypeID", DbType.Int32, model.CurrencyTypeID); db.AddInParameter(dbCommand, "TradeUnitID", DbType.Int32, model.TradeUnitID); db.AddInParameter(dbCommand, "OrderStatusID", DbType.Int32, model.OrderStatusID); db.AddInParameter(dbCommand, "OrderMessage", DbType.AnsiString, model.OrderMessage); db.AddInParameter(dbCommand, "McOrderID", DbType.AnsiString, model.McOrderID); db.AddInParameter(dbCommand, "HasDoneProfit", DbType.Decimal, model.HasDoneProfit); db.AddInParameter(dbCommand, "OfferTime", DbType.DateTime, model.OfferTime); db.AddInParameter(dbCommand, "EntrustTime", DbType.DateTime, model.EntrustTime); db.AddInParameter(dbCommand, "IsModifyOrder", DbType.Boolean, model.IsModifyOrder); db.AddInParameter(dbCommand, "ModifyOrderNumber", DbType.AnsiString, model.ModifyOrderNumber); db.ExecuteNonQuery(dbCommand); }
/// <summary> /// 对象实体绑定数据 /// <param name="dataReader"></param> /// </summary> public HK_HistoryEntrustInfo ReaderBind(IDataReader dataReader) { HK_HistoryEntrustInfo model = new HK_HistoryEntrustInfo(); object ojb; model.EntrustNumber = dataReader["EntrustNumber"].ToString(); model.PortfolioLogo = dataReader["PortfolioLogo"].ToString(); ojb = dataReader["EntrustPrice"]; if (ojb != null && ojb != DBNull.Value) { model.EntrustPrice = (decimal)ojb; } ojb = dataReader["EntrustMount"]; if (ojb != null && ojb != DBNull.Value) { model.EntrustMount = (int)ojb; } model.Code = dataReader["Code"].ToString(); ojb = dataReader["TradeAmount"]; if (ojb != null && ojb != DBNull.Value) { model.TradeAmount = (int)ojb; } ojb = dataReader["TradeAveragePrice"]; if (ojb != null && ojb != DBNull.Value) { model.TradeAveragePrice = (decimal)ojb; } ojb = dataReader["OrderPriceType"]; if (ojb != null && ojb != DBNull.Value) { model.OrderPriceType = (int)ojb; } ojb = dataReader["CancelAmount"]; if (ojb != null && ojb != DBNull.Value) { model.CancelAmount = (int)ojb; } ojb = dataReader["BuySellTypeID"]; if (ojb != null && ojb != DBNull.Value) { model.BuySellTypeID = (int)ojb; } model.HoldAccount = dataReader["HoldAccount"].ToString(); model.CapitalAccount = dataReader["CapitalAccount"].ToString(); ojb = dataReader["CurrencyTypeID"]; if (ojb != null && ojb != DBNull.Value) { model.CurrencyTypeID = (int)ojb; } ojb = dataReader["TradeUnitID"]; if (ojb != null && ojb != DBNull.Value) { model.TradeUnitID = (int)ojb; } ojb = dataReader["OrderStatusID"]; if (ojb != null && ojb != DBNull.Value) { model.OrderStatusID = (int)ojb; } model.OrderMessage = dataReader["OrderMessage"].ToString(); model.McOrderID = dataReader["McOrderID"].ToString(); ojb = dataReader["HasDoneProfit"]; if (ojb != null && ojb != DBNull.Value) { model.HasDoneProfit = (decimal)ojb; } ojb = dataReader["OfferTime"]; if (ojb != null && ojb != DBNull.Value) { model.OfferTime = (DateTime)ojb; } ojb = dataReader["EntrustTime"]; if (ojb != null && ojb != DBNull.Value) { model.EntrustTime = (DateTime)ojb; } ojb = dataReader["IsModifyOrder"]; if (ojb != null && ojb != DBNull.Value) { model.IsModifyOrder = (bool)ojb; } model.ModifyOrderNumber = dataReader["ModifyOrderNumber"].ToString(); return(model); }