Esempio n. 1
0
        /// <summary>
        ///  更新一条数据
        /// </summary>
        public bool Update(ZhongLi.Model.Person_Report model)
        {
            int rowsAffected = 0;

            SqlParameter[] parameters =
            {
                new SqlParameter("@ID",           SqlDbType.Int,         4),
                new SqlParameter("@PerID",        SqlDbType.Int,         4),
                new SqlParameter("@SerUserID",    SqlDbType.Int,         4),
                new SqlParameter("@ReportReason", SqlDbType.NVarChar,  500),
                new SqlParameter("@ReportTime",   SqlDbType.DateTime),
                new SqlParameter("@ColValue",     SqlDbType.NVarChar, 50)
            };
            parameters[0].Value = model.ID;
            parameters[1].Value = model.PerID;
            parameters[2].Value = model.SerUserID;
            parameters[3].Value = model.ReportReason;
            parameters[4].Value = model.ReportTime;
            parameters[5].Value = model.ColValue;

            DbHelperSQL.RunProcedure("Person_Report_Update", parameters, out rowsAffected);
            if (rowsAffected > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Esempio n. 2
0
 /// <summary>
 /// 得到一个对象实体
 /// </summary>
 public ZhongLi.Model.Person_Report DataRowToModel(DataRow row)
 {
     ZhongLi.Model.Person_Report model = new ZhongLi.Model.Person_Report();
     if (row != null)
     {
         if (row["ID"] != null && row["ID"].ToString() != "")
         {
             model.ID = int.Parse(row["ID"].ToString());
         }
         if (row["PerID"] != null && row["PerID"].ToString() != "")
         {
             model.PerID = int.Parse(row["PerID"].ToString());
         }
         if (row["SerUserID"] != null && row["SerUserID"].ToString() != "")
         {
             model.SerUserID = int.Parse(row["SerUserID"].ToString());
         }
         if (row["ReportReason"] != null)
         {
             model.ReportReason = row["ReportReason"].ToString();
         }
         if (row["ReportTime"] != null && row["ReportTime"].ToString() != "")
         {
             model.ReportTime = DateTime.Parse(row["ReportTime"].ToString());
         }
         if (row["ColValue"] != null)
         {
             model.ColValue = row["ColValue"].ToString();
         }
     }
     return(model);
 }
Esempio n. 3
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public ZhongLi.Model.Person_Report GetModel(int ID)
        {
            SqlParameter[] parameters =
            {
                new SqlParameter("@ID", SqlDbType.Int, 4)
            };
            parameters[0].Value = ID;

            ZhongLi.Model.Person_Report model = new ZhongLi.Model.Person_Report();
            DataSet ds = DbHelperSQL.RunProcedure("Person_Report_GetModel", parameters, "ds");

            if (ds.Tables[0].Rows.Count > 0)
            {
                return(DataRowToModel(ds.Tables[0].Rows[0]));
            }
            else
            {
                return(null);
            }
        }
Esempio n. 4
0
        /// <summary>
        ///  增加一条数据
        /// </summary>
        public int Add(ZhongLi.Model.Person_Report model)
        {
            int rowsAffected;

            SqlParameter[] parameters =
            {
                new SqlParameter("@ID",           SqlDbType.Int,         4),
                new SqlParameter("@PerID",        SqlDbType.Int,         4),
                new SqlParameter("@SerUserID",    SqlDbType.Int,         4),
                new SqlParameter("@ReportReason", SqlDbType.NVarChar,  500),
                new SqlParameter("@ReportTime",   SqlDbType.DateTime),
                new SqlParameter("@ColValue",     SqlDbType.NVarChar, 50)
            };
            parameters[0].Direction = ParameterDirection.Output;
            parameters[1].Value     = model.PerID;
            parameters[2].Value     = model.SerUserID;
            parameters[3].Value     = model.ReportReason;
            parameters[4].Value     = model.ReportTime;
            parameters[5].Value     = model.ColValue;

            DbHelperSQL.RunProcedure("Person_Report_ADD", parameters, out rowsAffected);
            return((int)parameters[0].Value);
        }