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

            db.AddInParameter(dbCommand, "LeaveApplicationID", DbType.Int32, model.LeaveApplicationID);
            db.AddInParameter(dbCommand, "EmployeeID", DbType.Int32, model.EmployeeID);
            db.AddInParameter(dbCommand, "FlowID", DbType.Int32, model.FlowID);
            db.AddInParameter(dbCommand, "LeaveApplicationTypeID", DbType.Int32, model.LeaveApplicationTypeID);
            db.AddInParameter(dbCommand, "LeaveApplicationDate", DbType.DateTime, model.LeaveApplicationDate);
            db.AddInParameter(dbCommand, "LeaveApplicationDays", DbType.Double, model.LeaveApplicationDays);
            db.AddInParameter(dbCommand, "State", DbType.String, model.State);
            db.ExecuteNonQuery(dbCommand);
        }
示例#2
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public MesWeb.Model.T_LeaveApplication GetModel(int LeaveApplicationID)
        {
            Database  db        = DatabaseFactory.CreateDatabase();
            DbCommand dbCommand = db.GetStoredProcCommand("T_LeaveApplication_GetModel");

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

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

            ojb = dataReader["LeaveApplicationID"];
            if (ojb != null && ojb != DBNull.Value)
            {
                model.LeaveApplicationID = (int)ojb;
            }
            ojb = dataReader["EmployeeID"];
            if (ojb != null && ojb != DBNull.Value)
            {
                model.EmployeeID = (int)ojb;
            }
            ojb = dataReader["FlowID"];
            if (ojb != null && ojb != DBNull.Value)
            {
                model.FlowID = (int)ojb;
            }
            ojb = dataReader["LeaveApplicationTypeID"];
            if (ojb != null && ojb != DBNull.Value)
            {
                model.LeaveApplicationTypeID = (int)ojb;
            }
            ojb = dataReader["LeaveApplicationDate"];
            if (ojb != null && ojb != DBNull.Value)
            {
                model.LeaveApplicationDate = (DateTime)ojb;
            }
            ojb = dataReader["LeaveApplicationDays"];
            if (ojb != null && ojb != DBNull.Value)
            {
                model.LeaveApplicationDays = (decimal)ojb;
            }
            model.State = dataReader["State"].ToString();
            return(model);
        }
示例#4
0
 /// <summary>
 /// 得到一个对象实体
 /// </summary>
 public MesWeb.Model.T_LeaveApplication DataRowToModel(DataRow row)
 {
     MesWeb.Model.T_LeaveApplication model = new MesWeb.Model.T_LeaveApplication();
     if (row != null)
     {
         if (row["LeaveApplicationID"] != null && row["LeaveApplicationID"].ToString() != "")
         {
             model.LeaveApplicationID = int.Parse(row["LeaveApplicationID"].ToString());
         }
         if (row["EmployeeID"] != null && row["EmployeeID"].ToString() != "")
         {
             model.EmployeeID = int.Parse(row["EmployeeID"].ToString());
         }
         if (row["FlowID"] != null && row["FlowID"].ToString() != "")
         {
             model.FlowID = int.Parse(row["FlowID"].ToString());
         }
         if (row["LeaveApplicationTypeID"] != null && row["LeaveApplicationTypeID"].ToString() != "")
         {
             model.LeaveApplicationTypeID = int.Parse(row["LeaveApplicationTypeID"].ToString());
         }
         if (row["LeaveApplicationDate"] != null && row["LeaveApplicationDate"].ToString() != "")
         {
             model.LeaveApplicationDate = DateTime.Parse(row["LeaveApplicationDate"].ToString());
         }
         if (row["LeaveApplicationDays"] != null && row["LeaveApplicationDays"].ToString() != "")
         {
             model.LeaveApplicationDays = decimal.Parse(row["LeaveApplicationDays"].ToString());
         }
         if (row["State"] != null)
         {
             model.State = row["State"].ToString();
         }
     }
     return(model);
 }