예제 #1
0
        /// <summary>
        ///  更新一条数据
        /// </summary>
        public void Update(MesWeb.Model.T_Duty model)
        {
            Database  db        = DatabaseFactory.CreateDatabase();
            DbCommand dbCommand = db.GetStoredProcCommand("T_Duty_Update");

            db.AddInParameter(dbCommand, "DutyID", DbType.Int32, model.DutyID);
            db.AddInParameter(dbCommand, "DutyType", DbType.String, model.DutyType);
            db.ExecuteNonQuery(dbCommand);
        }
예제 #2
0
        /// <summary>
        ///  增加一条数据
        /// </summary>
        public int Add(MesWeb.Model.T_Duty model)
        {
            Database  db        = DatabaseFactory.CreateDatabase();
            DbCommand dbCommand = db.GetStoredProcCommand("T_Duty_ADD");

            db.AddOutParameter(dbCommand, "DutyID", DbType.Int32, 4);
            db.AddInParameter(dbCommand, "DutyType", DbType.String, model.DutyType);
            db.ExecuteNonQuery(dbCommand);
            return((int)db.GetParameterValue(dbCommand, "DutyID"));
        }
예제 #3
0
        /// <summary>
        /// 对象实体绑定数据
        /// </summary>
        public MesWeb.Model.T_Duty ReaderBind(IDataReader dataReader)
        {
            MesWeb.Model.T_Duty model = new MesWeb.Model.T_Duty();
            object ojb;

            ojb = dataReader["DutyID"];
            if (ojb != null && ojb != DBNull.Value)
            {
                model.DutyID = (int)ojb;
            }
            model.DutyType = dataReader["DutyType"].ToString();
            return(model);
        }
예제 #4
0
 /// <summary>
 /// 得到一个对象实体
 /// </summary>
 public MesWeb.Model.T_Duty DataRowToModel(DataRow row)
 {
     MesWeb.Model.T_Duty model = new MesWeb.Model.T_Duty();
     if (row != null)
     {
         if (row["DutyID"] != null && row["DutyID"].ToString() != "")
         {
             model.DutyID = int.Parse(row["DutyID"].ToString());
         }
         if (row["DutyType"] != null)
         {
             model.DutyType = row["DutyType"].ToString();
         }
     }
     return(model);
 }
예제 #5
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public MesWeb.Model.T_Duty GetModel(int DutyID)
        {
            Database  db        = DatabaseFactory.CreateDatabase();
            DbCommand dbCommand = db.GetStoredProcCommand("T_Duty_GetModel");

            db.AddInParameter(dbCommand, "DutyID", DbType.Int32, DutyID);

            MesWeb.Model.T_Duty model = null;
            using (IDataReader dataReader = db.ExecuteReader(dbCommand))
            {
                if (dataReader.Read())
                {
                    model = ReaderBind(dataReader);
                }
            }
            return(model);
        }