Example #1
0
        /// <summary>
        /// 更新一条数据
        /// </summary>
        public void Update(ManagementCenter.Model.CM_ExchangeRatio model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("update CM_ExchangeRatio set ");
            strSql.Append("Ratio=@Ratio,");
            strSql.Append("Remarks=@Remarks");
            strSql.Append(" where CurrencyExchangeID=@CurrencyExchangeID ");
            Database  db        = DatabaseFactory.CreateDatabase();
            DbCommand dbCommand = db.GetSqlStringCommand(strSql.ToString());

            db.AddInParameter(dbCommand, "Ratio", DbType.Decimal, model.Ratio);
            db.AddInParameter(dbCommand, "Remarks", DbType.String, model.Remarks);
            db.AddInParameter(dbCommand, "CurrencyExchangeID", DbType.Int32, model.CurrencyExchangeID);
            db.ExecuteNonQuery(dbCommand);
        }
Example #2
0
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public void Add(ManagementCenter.Model.CM_ExchangeRatio model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("insert into CM_ExchangeRatio(");
            strSql.Append("Ratio,Remarks,CurrencyExchangeID)");

            strSql.Append(" values (");
            strSql.Append("@Ratio,@Remarks,@CurrencyExchangeID)");
            Database  db        = DatabaseFactory.CreateDatabase();
            DbCommand dbCommand = db.GetSqlStringCommand(strSql.ToString());

            db.AddInParameter(dbCommand, "Ratio", DbType.Decimal, model.Ratio);
            db.AddInParameter(dbCommand, "Remarks", DbType.String, model.Remarks);
            db.AddInParameter(dbCommand, "CurrencyExchangeID", DbType.Int32, model.CurrencyExchangeID);
            db.ExecuteNonQuery(dbCommand);
        }
Example #3
0
        /// <summary>
        /// 对象实体绑定数据
        /// </summary>
        public ManagementCenter.Model.CM_ExchangeRatio ReaderBind(IDataReader dataReader)
        {
            ManagementCenter.Model.CM_ExchangeRatio model = new ManagementCenter.Model.CM_ExchangeRatio();
            object ojb;

            ojb = dataReader["Ratio"];
            if (ojb != null && ojb != DBNull.Value)
            {
                model.Ratio = (decimal)ojb;
            }
            model.Remarks = dataReader["Remarks"].ToString();
            ojb           = dataReader["CurrencyExchangeID"];
            if (ojb != null && ojb != DBNull.Value)
            {
                model.CurrencyExchangeID = (int)ojb;
            }
            return(model);
        }
Example #4
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public ManagementCenter.Model.CM_ExchangeRatio GetModel(int CurrencyExchangeID)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select Ratio,Remarks,CurrencyExchangeID from CM_ExchangeRatio ");
            strSql.Append(" where CurrencyExchangeID=@CurrencyExchangeID ");
            Database  db        = DatabaseFactory.CreateDatabase();
            DbCommand dbCommand = db.GetSqlStringCommand(strSql.ToString());

            db.AddInParameter(dbCommand, "CurrencyExchangeID", DbType.Int32, CurrencyExchangeID);
            ManagementCenter.Model.CM_ExchangeRatio model = null;
            using (IDataReader dataReader = db.ExecuteReader(dbCommand))
            {
                if (dataReader.Read())
                {
                    model = ReaderBind(dataReader);
                }
            }
            return(model);
        }