Esempio n. 1
0
        /// <summary>
        /// 对象实体绑定数据
        /// </summary>
        public MesWeb.Model.T_TaskFinished ReaderBind(IDataReader dataReader)
        {
            MesWeb.Model.T_TaskFinished model = new MesWeb.Model.T_TaskFinished();
            object ojb;

            ojb = dataReader["TaskFinishedID"];
            if (ojb != null && ojb != DBNull.Value)
            {
                model.TaskFinishedID = (int)ojb;
            }
            ojb = dataReader["TaskID"];
            if (ojb != null && ojb != DBNull.Value)
            {
                model.TaskID = (int)ojb;
            }
            ojb = dataReader["DateTime"];
            if (ojb != null && ojb != DBNull.Value)
            {
                model.DateTime = (DateTime)ojb;
            }
            ojb = dataReader["FinishedValue"];
            if (ojb != null && ojb != DBNull.Value)
            {
                model.FinishedValue = (decimal)ojb;
            }
            return(model);
        }
Esempio n. 2
0
        /// <summary>
        ///  更新一条数据
        /// </summary>
        public void Update(MesWeb.Model.T_TaskFinished model)
        {
            Database  db        = DatabaseFactory.CreateDatabase();
            DbCommand dbCommand = db.GetStoredProcCommand("T_TaskFinished_Update");

            db.AddInParameter(dbCommand, "TaskFinishedID", DbType.Int32, model.TaskFinishedID);
            db.AddInParameter(dbCommand, "TaskID", DbType.Int32, model.TaskID);
            db.AddInParameter(dbCommand, "DateTime", DbType.DateTime, model.DateTime);
            db.AddInParameter(dbCommand, "FinishedValue", DbType.Double, model.FinishedValue);
            db.ExecuteNonQuery(dbCommand);
        }
Esempio n. 3
0
        /// <summary>
        ///  增加一条数据
        /// </summary>
        public int Add(MesWeb.Model.T_TaskFinished model)
        {
            Database  db        = DatabaseFactory.CreateDatabase();
            DbCommand dbCommand = db.GetStoredProcCommand("T_TaskFinished_ADD");

            db.AddOutParameter(dbCommand, "TaskFinishedID", DbType.Int32, 4);
            db.AddInParameter(dbCommand, "TaskID", DbType.Int32, model.TaskID);
            db.AddInParameter(dbCommand, "DateTime", DbType.DateTime, model.DateTime);
            db.AddInParameter(dbCommand, "FinishedValue", DbType.Double, model.FinishedValue);
            db.ExecuteNonQuery(dbCommand);
            return((int)db.GetParameterValue(dbCommand, "TaskFinishedID"));
        }
Esempio n. 4
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public MesWeb.Model.T_TaskFinished GetModel(int TaskFinishedID)
        {
            Database  db        = DatabaseFactory.CreateDatabase();
            DbCommand dbCommand = db.GetStoredProcCommand("T_TaskFinished_GetModel");

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

            MesWeb.Model.T_TaskFinished model = null;
            using (IDataReader dataReader = db.ExecuteReader(dbCommand))
            {
                if (dataReader.Read())
                {
                    model = ReaderBind(dataReader);
                }
            }
            return(model);
        }
Esempio n. 5
0
 /// <summary>
 /// 得到一个对象实体
 /// </summary>
 public MesWeb.Model.T_TaskFinished DataRowToModel(DataRow row)
 {
     MesWeb.Model.T_TaskFinished model = new MesWeb.Model.T_TaskFinished();
     if (row != null)
     {
         if (row["TaskFinishedID"] != null && row["TaskFinishedID"].ToString() != "")
         {
             model.TaskFinishedID = int.Parse(row["TaskFinishedID"].ToString());
         }
         if (row["TaskID"] != null && row["TaskID"].ToString() != "")
         {
             model.TaskID = int.Parse(row["TaskID"].ToString());
         }
         if (row["DateTime"] != null && row["DateTime"].ToString() != "")
         {
             model.DateTime = DateTime.Parse(row["DateTime"].ToString());
         }
         if (row["FinishedValue"] != null && row["FinishedValue"].ToString() != "")
         {
             model.FinishedValue = decimal.Parse(row["FinishedValue"].ToString());
         }
     }
     return(model);
 }