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

            ojb = dataReader["MergeAxisID"];
            if (ojb != null && ojb != DBNull.Value)
            {
                model.MergeAxisID = (int)ojb;
            }
            ojb = dataReader["AxisTaskID"];
            if (ojb != null && ojb != DBNull.Value)
            {
                model.AxisTaskID = (int)ojb;
            }
            ojb = dataReader["SpecificationID"];
            if (ojb != null && ojb != DBNull.Value)
            {
                model.SpecificationID = (int)ojb;
            }
            ojb = dataReader["Task"];
            if (ojb != null && ojb != DBNull.Value)
            {
                model.Task = (int)ojb;
            }
            ojb = dataReader["Meters"];
            if (ojb != null && ojb != DBNull.Value)
            {
                model.Meters = (int)ojb;
            }
            return(model);
        }
示例#3
0
        /// <summary>
        ///  更新一条数据
        /// </summary>
        public void Update(MesWeb.Model.T_MergeAxis model)
        {
            Database  db        = DatabaseFactory.CreateDatabase();
            DbCommand dbCommand = db.GetStoredProcCommand("T_MergeAxis_Update");

            db.AddInParameter(dbCommand, "MergeAxisID", DbType.Int32, model.MergeAxisID);
            db.AddInParameter(dbCommand, "AxisTaskID", DbType.Int32, model.AxisTaskID);
            db.AddInParameter(dbCommand, "SpecificationID", DbType.Int32, model.SpecificationID);
            db.AddInParameter(dbCommand, "Task", DbType.Int32, model.Task);
            db.AddInParameter(dbCommand, "Meters", DbType.Int32, model.Meters);
            db.ExecuteNonQuery(dbCommand);
        }
示例#4
0
        /// <summary>
        ///  增加一条数据
        /// </summary>
        public int Add(MesWeb.Model.T_MergeAxis model)
        {
            Database  db        = DatabaseFactory.CreateDatabase();
            DbCommand dbCommand = db.GetStoredProcCommand("T_MergeAxis_ADD");

            db.AddOutParameter(dbCommand, "MergeAxisID", DbType.Int32, 4);
            db.AddInParameter(dbCommand, "AxisTaskID", DbType.Int32, model.AxisTaskID);
            db.AddInParameter(dbCommand, "SpecificationID", DbType.Int32, model.SpecificationID);
            db.AddInParameter(dbCommand, "Task", DbType.Int32, model.Task);
            db.AddInParameter(dbCommand, "Meters", DbType.Int32, model.Meters);
            db.ExecuteNonQuery(dbCommand);
            return((int)db.GetParameterValue(dbCommand, "MergeAxisID"));
        }
示例#5
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public MesWeb.Model.T_MergeAxis GetModel(int MergeAxisID)
        {
            Database  db        = DatabaseFactory.CreateDatabase();
            DbCommand dbCommand = db.GetStoredProcCommand("T_MergeAxis_GetModel");

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

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