Ejemplo n.º 1
0
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public bool Add(Model.storagelocation model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("insert into storagelocation(");
            strSql.Append("sl_store_type_id,sl_store_min,sl_store_max,sl_store_area,sl_comment,sl_remain_bulk,sl_belong_chest)");
            strSql.Append(" values (");
            strSql.Append("@sl_store_type_id,@sl_store_min,@sl_store_max,@sl_store_area,@sl_comment,@sl_remain_bulk,@sl_belong_chest)");
            MySqlParameter[] parameters =
            {
                new MySqlParameter("@sl_store_type_id", MySqlDbType.Int32,    32),
                new MySqlParameter("@sl_store_min",     MySqlDbType.Decimal,  10),
                new MySqlParameter("@sl_store_max",     MySqlDbType.Decimal,  10),
                new MySqlParameter("@sl_store_area",    MySqlDbType.Decimal,  10),
                new MySqlParameter("@sl_comment",       MySqlDbType.VarChar, 255),
                new MySqlParameter("@sl_remain_bulk",   MySqlDbType.Decimal,  10),
                new MySqlParameter("@sl_belong_chest",  MySqlDbType.Int32, 32)
            };
            parameters[0].Value = model.sl_store_type_id;
            parameters[1].Value = model.sl_store_min;
            parameters[2].Value = model.sl_store_max;
            parameters[3].Value = model.sl_store_area;
            parameters[4].Value = model.sl_comment;
            parameters[5].Value = model.sl_remain_bulk;
            parameters[6].Value = model.sl_belong_chest;

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

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// 更新一条数据
        /// </summary>
        public bool Update(Model.material_info model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("update material_info set ");
            strSql.Append("mat_name=@mat_name,");
            strSql.Append("mat_father_id=@mat_father_id,");
            strSql.Append("mat_create_time=@mat_create_time,");
            strSql.Append("mat_fengdu=@mat_fengdu,");
            strSql.Append("mat_state=@mat_state,");
            strSql.Append("mat_colour=@mat_colour,");
            strSql.Append("mat_smell=@mat_smell,");
            strSql.Append("mat_type=@mat_type,");
            strSql.Append("mat_type_id=@mat_type_id,");
            strSql.Append("mat_purpose=@mat_purpose,");
            strSql.Append("mat_source=@mat_source,");
            strSql.Append("mat_suanjianxing=@mat_suanjianxing,");
            strSql.Append("mat_yuansuzhanbi=@mat_yuansuzhanbi,");
            strSql.Append("mat_yuansuliang=@mat_yuansuliang");
            strSql.Append(" where mat_id=@mat_id ");
            MySqlParameter[] parameters =
            {
                new MySqlParameter("@mat_name",         MySqlDbType.VarChar,    32),
                new MySqlParameter("@mat_father_id",    MySqlDbType.Int32,      11),
                new MySqlParameter("@mat_create_time",  MySqlDbType.DateTime),
                new MySqlParameter("@mat_fengdu",       MySqlDbType.Decimal,    16),
                new MySqlParameter("@mat_state",        MySqlDbType.Int32,      10),
                new MySqlParameter("@mat_colour",       MySqlDbType.Int32,      10),
                new MySqlParameter("@mat_smell",        MySqlDbType.Int32,      10),
                new MySqlParameter("@mat_type",         MySqlDbType.Int32,      10),
                new MySqlParameter("@mat_type_id",      MySqlDbType.Int32,      32),
                new MySqlParameter("@mat_purpose",      MySqlDbType.VarChar,   255),
                new MySqlParameter("@mat_source",       MySqlDbType.VarChar,   255),
                new MySqlParameter("@mat_suanjianxing", MySqlDbType.VarChar,   255),
                new MySqlParameter("@mat_yuansuzhanbi", MySqlDbType.VarChar,   255),
                new MySqlParameter("@mat_yuansuliang",  MySqlDbType.VarChar,   255),
                new MySqlParameter("@mat_id",           MySqlDbType.Int32, 32)
            };
            parameters[0].Value  = model.mat_name;
            parameters[1].Value  = model.mat_father_id;
            parameters[2].Value  = model.mat_create_time;
            parameters[3].Value  = model.mat_fengdu;
            parameters[4].Value  = model.mat_state;
            parameters[5].Value  = model.mat_colour;
            parameters[6].Value  = model.mat_smell;
            parameters[7].Value  = model.mat_type;
            parameters[8].Value  = model.mat_type_id;
            parameters[9].Value  = model.mat_purpose;
            parameters[10].Value = model.mat_source;
            parameters[11].Value = model.mat_suanjianxing;
            parameters[12].Value = model.mat_yuansuzhanbi;
            parameters[13].Value = model.mat_yuansuliang;
            parameters[14].Value = model.mat_id;

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

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }