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

            db.AddInParameter(dbCommand, "MaterialZoneID", DbType.Int32, model.MaterialZoneID);
            db.AddInParameter(dbCommand, "MaterialTypeID", DbType.Int32, model.MaterialTypeID);
            db.AddInParameter(dbCommand, "MaterialCode", DbType.String, model.MaterialCode);
            db.AddInParameter(dbCommand, "MaterialPic", DbType.String, model.MaterialPic);
            db.ExecuteNonQuery(dbCommand);
        }
Example #2
0
        /// <summary>
        ///  增加一条数据
        /// </summary>
        public int Add(MesWeb.Model.T_MaterialZone model)
        {
            Database  db        = DatabaseFactory.CreateDatabase();
            DbCommand dbCommand = db.GetStoredProcCommand("T_MaterialZone_ADD");

            db.AddOutParameter(dbCommand, "MaterialZoneID", DbType.Int32, 4);
            db.AddInParameter(dbCommand, "MaterialTypeID", DbType.Int32, model.MaterialTypeID);
            db.AddInParameter(dbCommand, "MaterialCode", DbType.String, model.MaterialCode);
            db.AddInParameter(dbCommand, "MaterialPic", DbType.String, model.MaterialPic);
            db.ExecuteNonQuery(dbCommand);
            return((int)db.GetParameterValue(dbCommand, "MaterialZoneID"));
        }
Example #3
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public MesWeb.Model.T_MaterialZone GetModel(int MaterialZoneID)
        {
            Database  db        = DatabaseFactory.CreateDatabase();
            DbCommand dbCommand = db.GetStoredProcCommand("T_MaterialZone_GetModel");

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

            MesWeb.Model.T_MaterialZone model = null;
            using (IDataReader dataReader = db.ExecuteReader(dbCommand))
            {
                if (dataReader.Read())
                {
                    model = ReaderBind(dataReader);
                }
            }
            return(model);
        }
Example #4
0
        /// <summary>
        /// 对象实体绑定数据
        /// </summary>
        public MesWeb.Model.T_MaterialZone ReaderBind(IDataReader dataReader)
        {
            MesWeb.Model.T_MaterialZone model = new MesWeb.Model.T_MaterialZone();
            object ojb;

            ojb = dataReader["MaterialZoneID"];
            if (ojb != null && ojb != DBNull.Value)
            {
                model.MaterialZoneID = (int)ojb;
            }
            ojb = dataReader["MaterialTypeID"];
            if (ojb != null && ojb != DBNull.Value)
            {
                model.MaterialTypeID = (int)ojb;
            }
            model.MaterialCode = dataReader["MaterialCode"].ToString();
            model.MaterialPic  = dataReader["MaterialPic"].ToString();
            return(model);
        }
Example #5
0
 /// <summary>
 /// 得到一个对象实体
 /// </summary>
 public MesWeb.Model.T_MaterialZone DataRowToModel(DataRow row)
 {
     MesWeb.Model.T_MaterialZone model = new MesWeb.Model.T_MaterialZone();
     if (row != null)
     {
         if (row["MaterialZoneID"] != null && row["MaterialZoneID"].ToString() != "")
         {
             model.MaterialZoneID = int.Parse(row["MaterialZoneID"].ToString());
         }
         if (row["MaterialTypeID"] != null && row["MaterialTypeID"].ToString() != "")
         {
             model.MaterialTypeID = int.Parse(row["MaterialTypeID"].ToString());
         }
         if (row["MaterialCode"] != null)
         {
             model.MaterialCode = row["MaterialCode"].ToString();
         }
         if (row["MaterialPic"] != null)
         {
             model.MaterialPic = row["MaterialPic"].ToString();
         }
     }
     return(model);
 }