/// <summary>
        /// 增加一条数据
        /// </summary>
        public void Add(XH_HistoryEntrustTableInfo model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("insert into XH_HistoryEntrustTable(");
            strSql.Append("EntrustNumber,PortfolioLogo,EntrustPrice,EntrustMount,SpotCode,TradeAmount,TradeAveragePrice,IsMarketValue,CancelAmount,BuySellTypeId,StockAccount,CapitalAccount,CurrencyTypeId,TradeUnitId,OrderStatusId,OrderMessage,McOrderId,HasDoneProfit,OfferTime,EntrustTime)");

            strSql.Append(" values (");
            strSql.Append("@EntrustNumber,@PortfolioLogo,@EntrustPrice,@EntrustMount,@SpotCode,@TradeAmount,@TradeAveragePrice,@IsMarketValue,@CancelAmount,@BuySellTypeId,@StockAccount,@CapitalAccount,@CurrencyTypeId,@TradeUnitId,@OrderStatusId,@OrderMessage,@McOrderId,@HasDoneProfit,@OfferTime,@EntrustTime)");
            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, "SpotCode", DbType.AnsiString, model.SpotCode);
            db.AddInParameter(dbCommand, "TradeAmount", DbType.Int32, model.TradeAmount);
            db.AddInParameter(dbCommand, "TradeAveragePrice", DbType.Decimal, model.TradeAveragePrice);
            db.AddInParameter(dbCommand, "IsMarketValue", DbType.Boolean, model.IsMarketValue);
            db.AddInParameter(dbCommand, "CancelAmount", DbType.Int32, model.CancelAmount);
            db.AddInParameter(dbCommand, "BuySellTypeId", DbType.Int32, model.BuySellTypeId);
            db.AddInParameter(dbCommand, "StockAccount", DbType.AnsiString, model.StockAccount);
            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.ExecuteNonQuery(dbCommand);
        }
コード例 #2
0
        private static XH_TodayEntrustTableInfo ConvertHistoryEntrustTable(XH_HistoryEntrustTableInfo tet)
        {
            XH_TodayEntrustTableInfo tet2 = new XH_TodayEntrustTableInfo();

            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.McOrderId         = tet.McOrderId;
            tet2.OfferTime         = tet.OfferTime;
            tet2.OrderMessage      = tet.OrderMessage;
            tet2.OrderStatusId     = tet.OrderStatusId;
            tet2.PortfolioLogo     = tet.PortfolioLogo;
            tet2.SpotCode          = tet.SpotCode;
            tet2.StockAccount      = tet.StockAccount;
            tet2.TradeAmount       = tet.TradeAmount;
            tet2.TradeAveragePrice = tet.TradeAveragePrice;
            tet2.TradeUnitId       = tet.TradeUnitId;

            return(tet2);
        }
        /// <summary>
        /// 更新一条数据
        /// </summary>
        public void Update(XH_HistoryEntrustTableInfo model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("update XH_HistoryEntrustTable set ");
            strSql.Append("PortfolioLogo=@PortfolioLogo,");
            strSql.Append("EntrustPrice=@EntrustPrice,");
            strSql.Append("EntrustMount=@EntrustMount,");
            strSql.Append("SpotCode=@SpotCode,");
            strSql.Append("TradeAmount=@TradeAmount,");
            strSql.Append("TradeAveragePrice=@TradeAveragePrice,");
            strSql.Append("IsMarketValue=@IsMarketValue,");
            strSql.Append("CancelAmount=@CancelAmount,");
            strSql.Append("BuySellTypeId=@BuySellTypeId,");
            strSql.Append("StockAccount=@StockAccount,");
            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(" 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, "SpotCode", DbType.AnsiString, model.SpotCode);
            db.AddInParameter(dbCommand, "TradeAmount", DbType.Int32, model.TradeAmount);
            db.AddInParameter(dbCommand, "TradeAveragePrice", DbType.Decimal, model.TradeAveragePrice);
            db.AddInParameter(dbCommand, "IsMarketValue", DbType.Boolean, model.IsMarketValue);
            db.AddInParameter(dbCommand, "CancelAmount", DbType.Int32, model.CancelAmount);
            db.AddInParameter(dbCommand, "BuySellTypeId", DbType.Int32, model.BuySellTypeId);
            db.AddInParameter(dbCommand, "StockAccount", DbType.AnsiString, model.StockAccount);
            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.ExecuteNonQuery(dbCommand);
        }
コード例 #4
0
        /// <summary>
        /// 根据委托单号获取历史委托
        /// </summary>
        /// <param name="entrustNumber">委托单号</param>
        /// <returns>今日委托</returns>
        public static XH_HistoryEntrustTableInfo GetHistoryEntrustTable(string entrustNumber)
        {
            XH_HistoryEntrustTableInfo tet = null;

            XH_HistoryEntrustTableDal dal = new XH_HistoryEntrustTableDal();

            try
            {
                tet = dal.GetModel(entrustNumber);
            }
            catch (Exception ex)
            {
                LogHelper.WriteError(ex.Message, ex);
            }

            return(tet);
        }
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public XH_HistoryEntrustTableInfo GetModel(string EntrustNumber)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select EntrustNumber,PortfolioLogo,EntrustPrice,EntrustMount,SpotCode,TradeAmount,TradeAveragePrice,IsMarketValue,CancelAmount,BuySellTypeId,StockAccount,CapitalAccount,CurrencyTypeId,TradeUnitId,OrderStatusId,OrderMessage,McOrderId,HasDoneProfit,OfferTime,EntrustTime from XH_HistoryEntrustTable ");
            strSql.Append(" where EntrustNumber=@EntrustNumber ");
            Database  db        = DatabaseFactory.CreateDatabase();
            DbCommand dbCommand = db.GetSqlStringCommand(strSql.ToString());

            db.AddInParameter(dbCommand, "EntrustNumber", DbType.AnsiString, EntrustNumber);
            XH_HistoryEntrustTableInfo model = null;

            using (IDataReader dataReader = db.ExecuteReader(dbCommand))
            {
                if (dataReader.Read())
                {
                    model = ReaderBind(dataReader);
                }
            }
            return(model);
        }
        /// <summary>
        /// 对象实体绑定数据
        /// </summary>
        public XH_HistoryEntrustTableInfo ReaderBind(IDataReader dataReader)
        {
            XH_HistoryEntrustTableInfo model = new XH_HistoryEntrustTableInfo();
            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.SpotCode = dataReader["SpotCode"].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["IsMarketValue"];
            if (ojb != null && ojb != DBNull.Value)
            {
                model.IsMarketValue = (bool)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.StockAccount   = dataReader["StockAccount"].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;
            }
            return(model);
        }