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

            strSql.Append("update crm_customer_group set ");
            strSql.Append("factory_id=@factory_id,");
            strSql.Append("group_code=@group_code,");
            strSql.Append("group_name=@group_name,");
            strSql.Append("group_order=@group_order,");
            strSql.Append("create_id=@create_id,");
            strSql.Append("create_name=@create_name");
            strSql.Append(" where group_id=@group_id ");
            MySqlParameter[] parameters =
            {
                new MySqlParameter("@factory_id",  MySqlDbType.VarChar, 50),
                new MySqlParameter("@group_code",  MySqlDbType.VarChar,  0),
                new MySqlParameter("@group_name",  MySqlDbType.VarChar, 50),
                new MySqlParameter("@group_order", MySqlDbType.Int32,   11),
                new MySqlParameter("@create_id",   MySqlDbType.Int32,   11),
                new MySqlParameter("@create_name", MySqlDbType.VarChar, 50),
                new MySqlParameter("@group_id",    MySqlDbType.Int32, 11)
            };
            parameters[0].Value = model.factory_id;
            parameters[1].Value = model.group_code;
            parameters[2].Value = model.group_name;
            parameters[3].Value = model.group_order;
            parameters[4].Value = model.create_id;
            parameters[5].Value = model.create_name;
            parameters[6].Value = model.group_id;

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

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public bool Add(XHD.Model.crm_customer_group model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("insert into crm_customer_group(");
            strSql.Append("group_id,factory_id,group_code,group_name,group_order,create_id,create_name)");
            strSql.Append(" values (");
            strSql.Append("@group_id,@factory_id,@group_code,@group_name,@group_order,@create_id,@create_name)");
            MySqlParameter[] parameters =
            {
                new MySqlParameter("@group_id",    MySqlDbType.Int32,   11),
                new MySqlParameter("@factory_id",  MySqlDbType.VarChar, 50),
                new MySqlParameter("@group_code",  MySqlDbType.VarChar,  0),
                new MySqlParameter("@group_name",  MySqlDbType.VarChar, 50),
                new MySqlParameter("@group_order", MySqlDbType.Int32,   11),
                new MySqlParameter("@create_id",   MySqlDbType.Int32,   11),
                new MySqlParameter("@create_name", MySqlDbType.VarChar, 50)
            };
            parameters[0].Value = model.group_id;
            parameters[1].Value = model.factory_id;
            parameters[2].Value = model.group_code;
            parameters[3].Value = model.group_name;
            parameters[4].Value = model.group_order;
            parameters[5].Value = model.create_id;
            parameters[6].Value = model.create_name;

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

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
 /// <summary>
 /// 得到一个对象实体
 /// </summary>
 public XHD.Model.crm_customer_group DataRowToModel(DataRow row)
 {
     XHD.Model.crm_customer_group model = new XHD.Model.crm_customer_group();
     if (row != null)
     {
         if (row["group_id"] != null && row["group_id"].ToString() != "")
         {
             model.group_id = int.Parse(row["group_id"].ToString());
         }
         if (row["factory_id"] != null)
         {
             model.factory_id = row["factory_id"].ToString();
         }
         if (row["group_code"] != null)
         {
             model.group_code = row["group_code"].ToString();
         }
         if (row["group_name"] != null)
         {
             model.group_name = row["group_name"].ToString();
         }
         if (row["group_order"] != null && row["group_order"].ToString() != "")
         {
             model.group_order = int.Parse(row["group_order"].ToString());
         }
         if (row["create_id"] != null && row["create_id"].ToString() != "")
         {
             model.create_id = int.Parse(row["create_id"].ToString());
         }
         if (row["create_name"] != null)
         {
             model.create_name = row["create_name"].ToString();
         }
     }
     return(model);
 }
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public XHD.Model.crm_customer_group GetModel(int group_id)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select group_id,factory_id,group_code,group_name,group_order,create_id,create_name from crm_customer_group ");
            strSql.Append(" where group_id=@group_id ");
            MySqlParameter[] parameters =
            {
                new MySqlParameter("@group_id", MySqlDbType.Int32, 11)
            };
            parameters[0].Value = group_id;

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

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