Example #1
0
        /// <summary>
        /// 更新一条数据
        /// </summary>
        public bool Update(Gunark.Model.group model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("update gunark_group set ");
            strSql.Append("GROUP_LEADER=@GROUP_LEADER,");
            strSql.Append("AVAILABLE=@AVAILABLE");
            strSql.Append(" where GROUP_ID=@GROUP_ID ");
            MySqlParameter[] parameters =
            {
                new MySqlParameter("@GROUP_LEADER", MySqlDbType.VarChar, 255),
                new MySqlParameter("@AVAILABLE",    MySqlDbType.Int32,    10),
                new MySqlParameter("@GROUP_ID",     MySqlDbType.VarChar, 50)
            };
            parameters[0].Value = model.GROUP_LEADER;
            parameters[1].Value = model.AVAILABLE;
            parameters[2].Value = model.GROUP_ID;

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

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

            strSql.Append("insert into gunark_group(");
            strSql.Append("GROUP_ID,GROUP_LEADER,AVAILABLE)");
            strSql.Append(" values (");
            strSql.Append("@GROUP_ID,@GROUP_LEADER,@AVAILABLE)");
            MySqlParameter[] parameters =
            {
                new MySqlParameter("@GROUP_ID",     MySqlDbType.VarChar,  50),
                new MySqlParameter("@GROUP_LEADER", MySqlDbType.VarChar, 255),
                new MySqlParameter("@AVAILABLE",    MySqlDbType.Int32, 10)
            };
            parameters[0].Value = model.GROUP_ID;
            parameters[1].Value = model.GROUP_LEADER;
            parameters[2].Value = model.AVAILABLE;

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

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Example #3
0
 /// <summary>
 /// 得到一个对象实体
 /// </summary>
 public Gunark.Model.group DataRowToModel(DataRow row)
 {
     Gunark.Model.group model = new Gunark.Model.group();
     if (row != null)
     {
         if (row["GROUP_ID"] != null)
         {
             model.GROUP_ID = row["GROUP_ID"].ToString();
         }
         if (row["GROUP_LEADER"] != null)
         {
             model.GROUP_LEADER = row["GROUP_LEADER"].ToString();
         }
         if (row["AVAILABLE"] != null && row["AVAILABLE"].ToString() != "")
         {
             model.AVAILABLE = int.Parse(row["AVAILABLE"].ToString());
         }
     }
     return(model);
 }
Example #4
0
 /// <summary>
 /// 得到一个对象实体
 /// </summary>
 public Gunark.Model.group DataRowToModel(DataRow row)
 {
     Gunark.Model.group model = new Gunark.Model.group();
     if (row != null)
     {
         if (row["GROUP_ID"] != null)
         {
             model.GROUP_ID = row["GROUP_ID"].ToString();
         }
         if (row["GROUP_LEADER"] != null)
         {
             model.GROUP_LEADER = row["GROUP_LEADER"].ToString();
         }
         if (row["AVAILABLE"] != null && row["AVAILABLE"].ToString() != "")
         {
             model.AVAILABLE = int.Parse(row["AVAILABLE"].ToString());
         }
     }
     return model;
 }
Example #5
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public Gunark.Model.group GetModel(string GROUP_ID)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select GROUP_ID,GROUP_LEADER,AVAILABLE from gunark_group ");
            strSql.Append(" where GROUP_ID=@GROUP_ID ");
            MySqlParameter[] parameters =
            {
                new MySqlParameter("@GROUP_ID", MySqlDbType.VarChar, 50)
            };
            parameters[0].Value = GROUP_ID;

            Gunark.Model.group model = new Gunark.Model.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);
            }
        }
Example #6
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public Gunark.Model.group GetModel(string GROUP_ID)
        {
            StringBuilder strSql = new StringBuilder();
            strSql.Append("select GROUP_ID,GROUP_LEADER,AVAILABLE from gunark_group ");
            strSql.Append(" where GROUP_ID=@GROUP_ID ");
            MySqlParameter[] parameters = {
                    new MySqlParameter("@GROUP_ID", MySqlDbType.VarChar,50)			};
            parameters[0].Value = GROUP_ID;

            Gunark.Model.group model = new Gunark.Model.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;
            }
        }