/// <summary>
        /// 更新一条数据
        /// </summary>
        public bool Update1(XHD.Model.crm_set_pubpri_detail model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("update crm_set_pubpri set ");
            strSql.Append("factory_Id=@factory_Id,");
            strSql.Append("dept_Qty=@dept_Qty");
            strSql.Append(" where Id=@Id ");
            MySqlParameter[] parameters =
            {
                new MySqlParameter("@factory_Id", MySqlDbType.VarChar, 60),
                new MySqlParameter("@dept_Qty",   MySqlDbType.Int32,   11),
                new MySqlParameter("@Id",         MySqlDbType.Int32, 11)
            };
            parameters[0].Value = model.factory_Id;
            parameters[1].Value = model.emp_Qty;
            parameters[2].Value = model.Id;

            int rows = DbHelperMySQL.ExecuteSql(strSql.ToString(), parameters);

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
 /// <summary>
 /// 得到一个对象实体
 /// </summary>
 public XHD.Model.crm_set_pubpri_detail DataRowToModel(DataRow row)
 {
     XHD.Model.crm_set_pubpri_detail model = new XHD.Model.crm_set_pubpri_detail();
     if (row != null)
     {
         if (row["Id"] != null && row["Id"].ToString() != "")
         {
             model.Id = int.Parse(row["Id"].ToString());
         }
         if (row["pubpri_id"] != null && row["pubpri_id"].ToString() != "")
         {
             model.pubpri_id = int.Parse(row["pubpri_id"].ToString());
         }
         if (row["factory_Id"] != null)
         {
             model.factory_Id = row["factory_Id"].ToString();
         }
         if (row["date_start"] != null && row["date_start"].ToString() != "")
         {
             model.date_start = int.Parse(row["date_start"].ToString());
         }
         if (row["date_end"] != null && row["date_end"].ToString() != "")
         {
             model.date_end = int.Parse(row["date_end"].ToString());
         }
         if (row["emp_Id"] != null && row["emp_Id"].ToString() != "")
         {
             model.emp_Id = int.Parse(row["emp_Id"].ToString());
         }
         if (row["emp_name"] != null)
         {
             model.emp_name = row["emp_name"].ToString();
         }
         if (row["emp_Qty"] != null && row["emp_Qty"].ToString() != "")
         {
             model.emp_Qty = int.Parse(row["emp_Qty"].ToString());
         }
         if (row["emp_Qty_used"] != null && row["emp_Qty_used"].ToString() != "")
         {
             model.emp_Qty_used = int.Parse(row["emp_Qty_used"].ToString());
         }
         if (row["C_createId"] != null && row["C_createId"].ToString() != "")
         {
             model.C_createId = int.Parse(row["C_createId"].ToString());
         }
         if (row["C_createName"] != null)
         {
             model.C_createName = row["C_createName"].ToString();
         }
         if (row["C_createDate"] != null && row["C_createDate"].ToString() != "")
         {
             model.C_createDate = DateTime.Parse(row["C_createDate"].ToString());
         }
     }
     return(model);
 }
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public bool Add(XHD.Model.crm_set_pubpri_detail model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("insert into crm_set_pubpri_detail(");
            strSql.Append("Id,pubpri_id,factory_Id,date_start,date_end,emp_Id,emp_name,emp_Qty,emp_Qty_used,C_createId,C_createName,C_createDate)");
            strSql.Append(" values (");
            strSql.Append("@Id,@pubpri_id,@factory_Id,@date_start,@date_end,@emp_Id,@emp_name,@emp_Qty,@emp_Qty_used,@C_createId,@C_createName,@C_createDate)");
            MySqlParameter[] parameters =
            {
                new MySqlParameter("@Id",           MySqlDbType.Int32,   11),
                new MySqlParameter("@pubpri_id",    MySqlDbType.Int32,   11),
                new MySqlParameter("@factory_Id",   MySqlDbType.VarChar, 60),
                new MySqlParameter("@date_start",   MySqlDbType.Int32,   11),
                new MySqlParameter("@date_end",     MySqlDbType.Int32,   11),
                new MySqlParameter("@emp_Id",       MySqlDbType.Int32,   11),
                new MySqlParameter("@emp_name",     MySqlDbType.VarChar, 60),
                new MySqlParameter("@emp_Qty",      MySqlDbType.Int32,   11),
                new MySqlParameter("@emp_Qty_used", MySqlDbType.Int32,   11),
                new MySqlParameter("@C_createId",   MySqlDbType.Int32,   11),
                new MySqlParameter("@C_createName", MySqlDbType.VarChar, 60),
                new MySqlParameter("@C_createDate", MySqlDbType.DateTime)
            };
            parameters[0].Value  = model.Id;
            parameters[1].Value  = model.pubpri_id;
            parameters[2].Value  = model.factory_Id;
            parameters[3].Value  = model.date_start;
            parameters[4].Value  = model.date_end;
            parameters[5].Value  = model.emp_Id;
            parameters[6].Value  = model.emp_name;
            parameters[7].Value  = model.emp_Qty;
            parameters[8].Value  = model.emp_Qty_used;
            parameters[9].Value  = model.C_createId;
            parameters[10].Value = model.C_createName;
            parameters[11].Value = model.C_createDate;

            int rows = DbHelperMySQL.ExecuteSql(strSql.ToString(), parameters);

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public XHD.Model.crm_set_pubpri_detail GetModel(int Id)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select Id,pubpri_id,factory_Id,date_start,date_end,emp_Id,emp_name,emp_Qty,emp_Qty_used,C_createId,C_createName,C_createDate from crm_set_pubpri_detail ");
            strSql.Append(" where Id=@Id ");
            MySqlParameter[] parameters =
            {
                new MySqlParameter("@Id", MySqlDbType.Int32, 11)
            };
            parameters[0].Value = Id;

            XHD.Model.crm_set_pubpri_detail model = new XHD.Model.crm_set_pubpri_detail();
            DataSet ds = DbHelperMySQL.Query(strSql.ToString(), parameters);

            if (ds.Tables[0].Rows.Count > 0)
            {
                return(DataRowToModel(ds.Tables[0].Rows[0]));
            }
            else
            {
                return(null);
            }
        }