Ejemplo n.º 1
0
        /// <summary>
        /// 更新一条数据
        /// </summary>
        public bool Update(WK.Model.sys_sequence model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("update sys_sequence set ");
            strSql.Append("value=@value");
            strSql.Append(" where sequence_name=@sequence_name ");
            MySqlParameter[] parameters =
            {
                new MySqlParameter("@value",         MySqlDbType.Int32,   11),
                new MySqlParameter("@sequence_name", MySqlDbType.VarChar, 200)
            };
            parameters[0].Value = model.value;
            parameters[1].Value = model.sequence_name;

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

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

            strSql.Append("insert into sys_sequence(");
            strSql.Append("sequence_name,value)");
            strSql.Append(" values (");
            strSql.Append("@sequence_name,@value)");
            MySqlParameter[] parameters =
            {
                new MySqlParameter("@sequence_name", MySqlDbType.VarChar, 200),
                new MySqlParameter("@value",         MySqlDbType.Int32, 11)
            };
            parameters[0].Value = model.sequence_name;
            parameters[1].Value = model.value;

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

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Ejemplo n.º 3
0
 /// <summary>
 /// 得到一个对象实体
 /// </summary>
 public WK.Model.sys_sequence DataRowToModel(DataRow row)
 {
     WK.Model.sys_sequence model = new WK.Model.sys_sequence();
     if (row != null)
     {
         if (row["sequence_name"] != null)
         {
             model.sequence_name = row["sequence_name"].ToString();
         }
         if (row["value"] != null && row["value"].ToString() != "")
         {
             model.value = int.Parse(row["value"].ToString());
         }
     }
     return(model);
 }
Ejemplo n.º 4
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public WK.Model.sys_sequence GetModel(string sequence_name)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select sequence_name,value from sys_sequence ");
            strSql.Append(" where sequence_name=@sequence_name ");
            MySqlParameter[] parameters =
            {
                new MySqlParameter("@sequence_name", MySqlDbType.VarChar, 200)
            };
            parameters[0].Value = sequence_name;

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

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