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

            db.AddInParameter(dbCommand, "ApplicationItemID", DbType.Int32, model.ApplicationItemID);
            db.AddInParameter(dbCommand, "ApplicationItemType", DbType.String, model.ApplicationItemType);
            db.ExecuteNonQuery(dbCommand);
        }
Beispiel #2
0
        /// <summary>
        ///  增加一条数据
        /// </summary>
        public int Add(MesWeb.Model.T_ApplicationItem model)
        {
            Database  db        = DatabaseFactory.CreateDatabase();
            DbCommand dbCommand = db.GetStoredProcCommand("T_ApplicationItem_ADD");

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

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

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

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