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

            SqlParameter[] parameters =
            {
                new SqlParameter("@ID",         SqlDbType.Int,         4),
                new SqlParameter("@PerID",      SqlDbType.Int,         4),
                new SqlParameter("@RealName",   SqlDbType.NVarChar,   50),
                new SqlParameter("@OrderNum",   SqlDbType.NVarChar,   50),
                new SqlParameter("@Reason",     SqlDbType.NVarChar,  500),
                new SqlParameter("@CreateTime", SqlDbType.DateTime),
                new SqlParameter("@State",      SqlDbType.Int, 4)
            };
            parameters[0].Value = model.ID;
            parameters[1].Value = model.PerID;
            parameters[2].Value = model.RealName;
            parameters[3].Value = model.OrderNum;
            parameters[4].Value = model.Reason;
            parameters[5].Value = model.CreateTime;
            parameters[6].Value = model.State;

            DbHelperSQL.RunProcedure("Person_Representations_Update", parameters, out rowsAffected);
            if (rowsAffected > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
        /// <summary>
        ///  增加一条数据
        /// </summary>
        public int Add(ZhongLi.Model.Person_Representations model)
        {
            int rowsAffected;

            SqlParameter[] parameters =
            {
                new SqlParameter("@ID",         SqlDbType.Int,         4),
                new SqlParameter("@PerID",      SqlDbType.Int,         4),
                new SqlParameter("@RealName",   SqlDbType.NVarChar,   50),
                new SqlParameter("@OrderNum",   SqlDbType.NVarChar,   50),
                new SqlParameter("@Reason",     SqlDbType.NVarChar,  500),
                new SqlParameter("@CreateTime", SqlDbType.DateTime),
                new SqlParameter("@State",      SqlDbType.Int, 4)
            };
            parameters[0].Direction = ParameterDirection.Output;
            parameters[1].Value     = model.PerID;
            parameters[2].Value     = model.RealName;
            parameters[3].Value     = model.OrderNum;
            parameters[4].Value     = model.Reason;
            parameters[5].Value     = model.CreateTime;
            parameters[6].Value     = model.State;

            DbHelperSQL.RunProcedure("Person_Representations_ADD", parameters, out rowsAffected);
            return((int)parameters[0].Value);
        }
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public ZhongLi.Model.Person_Representations GetModel(int ID)
        {
            SqlParameter[] parameters =
            {
                new SqlParameter("@ID", SqlDbType.Int, 4)
            };
            parameters[0].Value = ID;

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

            if (ds.Tables[0].Rows.Count > 0)
            {
                return(DataRowToModel(ds.Tables[0].Rows[0]));
            }
            else
            {
                return(null);
            }
        }
 /// <summary>
 /// 得到一个对象实体
 /// </summary>
 public ZhongLi.Model.Person_Representations DataRowToModel(DataRow row)
 {
     ZhongLi.Model.Person_Representations model = new ZhongLi.Model.Person_Representations();
     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["RealName"] != null)
         {
             model.RealName = row["RealName"].ToString();
         }
         if (row["OrderNum"] != null)
         {
             model.OrderNum = row["OrderNum"].ToString();
         }
         if (row["Reason"] != null)
         {
             model.Reason = row["Reason"].ToString();
         }
         if (row["CreateTime"] != null && row["CreateTime"].ToString() != "")
         {
             model.CreateTime = DateTime.Parse(row["CreateTime"].ToString());
         }
         if (row["State"] != null && row["State"].ToString() != "")
         {
             model.State = int.Parse(row["State"].ToString());
         }
     }
     return(model);
 }