示例#1
0
 /// <summary>
 /// 得到一个对象实体
 /// </summary>
 public MesWeb.Model.T_MouldUsed DataRowToModel(DataRow row)
 {
     MesWeb.Model.T_MouldUsed model = new MesWeb.Model.T_MouldUsed();
     if (row != null)
     {
         if (row["MouldUsedID"] != null && row["MouldUsedID"].ToString() != "")
         {
             model.MouldUsedID = int.Parse(row["MouldUsedID"].ToString());
         }
         if (row["MouldID"] != null && row["MouldID"].ToString() != "")
         {
             model.MouldID = int.Parse(row["MouldID"].ToString());
         }
         if (row["MouldUsedNumber"] != null && row["MouldUsedNumber"].ToString() != "")
         {
             model.MouldUsedNumber = int.Parse(row["MouldUsedNumber"].ToString());
         }
         if (row["MouldUsedPersonID"] != null && row["MouldUsedPersonID"].ToString() != "")
         {
             model.MouldUsedPersonID = int.Parse(row["MouldUsedPersonID"].ToString());
         }
         if (row["DateTime"] != null && row["DateTime"].ToString() != "")
         {
             model.DateTime = DateTime.Parse(row["DateTime"].ToString());
         }
         if (row["Comment"] != null)
         {
             model.Comment = row["Comment"].ToString();
         }
     }
     return(model);
 }
示例#2
0
        /// <summary>
        /// 对象实体绑定数据
        /// </summary>
        public MesWeb.Model.T_MouldUsed ReaderBind(IDataReader dataReader)
        {
            MesWeb.Model.T_MouldUsed model = new MesWeb.Model.T_MouldUsed();
            object ojb;

            ojb = dataReader["MouldUsedID"];
            if (ojb != null && ojb != DBNull.Value)
            {
                model.MouldUsedID = (int)ojb;
            }
            ojb = dataReader["MouldID"];
            if (ojb != null && ojb != DBNull.Value)
            {
                model.MouldID = (int)ojb;
            }
            ojb = dataReader["MouldUsedNumber"];
            if (ojb != null && ojb != DBNull.Value)
            {
                model.MouldUsedNumber = (int)ojb;
            }
            ojb = dataReader["MouldUsedPersonID"];
            if (ojb != null && ojb != DBNull.Value)
            {
                model.MouldUsedPersonID = (int)ojb;
            }
            ojb = dataReader["DateTime"];
            if (ojb != null && ojb != DBNull.Value)
            {
                model.DateTime = (DateTime)ojb;
            }
            model.Comment = dataReader["Comment"].ToString();
            return(model);
        }
示例#3
0
        /// <summary>
        ///  更新一条数据
        /// </summary>
        public void Update(MesWeb.Model.T_MouldUsed model)
        {
            Database  db        = DatabaseFactory.CreateDatabase();
            DbCommand dbCommand = db.GetStoredProcCommand("T_MouldUsed_Update");

            db.AddInParameter(dbCommand, "MouldUsedID", DbType.Int32, model.MouldUsedID);
            db.AddInParameter(dbCommand, "MouldID", DbType.Int32, model.MouldID);
            db.AddInParameter(dbCommand, "MouldUsedNumber", DbType.Int32, model.MouldUsedNumber);
            db.AddInParameter(dbCommand, "MouldUsedPersonID", DbType.Int32, model.MouldUsedPersonID);
            db.AddInParameter(dbCommand, "DateTime", DbType.DateTime, model.DateTime);
            db.AddInParameter(dbCommand, "Comment", DbType.String, model.Comment);
            db.ExecuteNonQuery(dbCommand);
        }
示例#4
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public MesWeb.Model.T_MouldUsed GetModel(int MouldUsedID)
        {
            Database  db        = DatabaseFactory.CreateDatabase();
            DbCommand dbCommand = db.GetStoredProcCommand("T_MouldUsed_GetModel");

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

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