예제 #1
0
        /// <summary>
        ///  增加一条数据
        /// </summary>
        public void Save(ScoreRuleModel model)
        {
            Database  db        = CommDataAccess.DbWriter;
            DbCommand dbCommand = db.GetStoredProcCommand("UP_ScoreRule_Save");

            db.AddInParameter(dbCommand, "actiontype", DbType.AnsiString, model.ActionType);
            db.AddInParameter(dbCommand, "score", DbType.Int32, model.Score);
            db.AddInParameter(dbCommand, "remark", DbType.AnsiString, model.Remark);
            db.ExecuteNonQuery(dbCommand);
        }
예제 #2
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public ScoreRuleModel GetModel(string actiontype)
        {
            Database  db        = CommDataAccess.DbReader;
            string    sql       = "select actiontype,score,remark,inserttime,updatetime from umscorerule where actiontype=@actiontype";
            DbCommand dbCommand = db.GetSqlStringCommand(sql);

            db.AddInParameter(dbCommand, "actiontype", DbType.AnsiString, actiontype);

            ScoreRuleModel model = null;

            using (IDataReader dataReader = db.ExecuteReader(dbCommand))
            {
                if (dataReader.Read())
                {
                    model = ReaderBind(dataReader);
                }
            }
            return(model);
        }
예제 #3
0
        /// <summary>
        /// 对象实体绑定数据
        /// </summary>
        public ScoreRuleModel ReaderBind(IDataReader dataReader)
        {
            ScoreRuleModel model = new ScoreRuleModel();
            object         ojb;

            model.ActionType = dataReader["actiontype"].ToString();
            ojb = dataReader["score"];
            if (ojb != null && ojb != DBNull.Value)
            {
                model.Score = Convert.ToInt32(ojb);
            }
            model.Remark = dataReader["remark"].ToString();
            ojb          = dataReader["inserttime"];
            if (ojb != null && ojb != DBNull.Value)
            {
                model.InsertTime = Convert.ToDateTime(ojb);
            }
            ojb = dataReader["updatetime"];
            if (ojb != null && ojb != DBNull.Value)
            {
                model.UpdateTime = Convert.ToDateTime(ojb);
            }
            return(model);
        }
 /// <summary>
 /// 增加一条数据
 /// </summary>
 public void Save(ScoreRuleModel model)
 {
     dal.Save(model);
 }