示例#1
0
        public bool UpdateProduct(int?id, string name, int idType, uint price, string description, int inew)
        {
            const string query = "UPDATE product SET name=@name, id_type=@ty, price=@pr, " +
                                 "description=@des, new=@n WHERE id=@id";

            var sqlParameters = new MySqlParameter[6];

            sqlParameters[0] = new MySqlParameter("@name", MySqlDbType.String)
            {
                Value = name
            };
            sqlParameters[1] = new MySqlParameter("@ty", MySqlDbType.Int32)
            {
                Value = idType
            };
            sqlParameters[2] = new MySqlParameter("@pr", MySqlDbType.UInt32)
            {
                Value = price
            };
            sqlParameters[3] = new MySqlParameter("@des", MySqlDbType.String)
            {
                Value = description
            };
            sqlParameters[4] = new MySqlParameter("@n", MySqlDbType.Int32)
            {
                Value = inew
            };
            sqlParameters[5] = new MySqlParameter("@id", MySqlDbType.Int32)
            {
                Value = id
            };
            return(_mySqlDbConnection.ExecuteUpdateQuery(query, sqlParameters));
        }
示例#2
0
        public bool UpdateSupplier(int?supplierId, string supplierName, string supplierAddress, string supplierEmail, string supplierPhone)
        {
            const string query         = "UPDATE suppliers set name = @name, addr = @addr, email= @mail, phone =@phone where id = @id";
            var          sqlParameters = new MySqlParameter[5];

            sqlParameters[0] = new MySqlParameter("@name", MySqlDbType.VarChar)
            {
                Value = supplierName
            };
            sqlParameters[1] = new MySqlParameter("@addr", MySqlDbType.VarChar)
            {
                Value = supplierAddress
            };
            sqlParameters[2] = new MySqlParameter("@mail", MySqlDbType.VarChar)
            {
                Value = supplierEmail
            };
            sqlParameters[3] = new MySqlParameter("@phone", MySqlDbType.VarChar)
            {
                Value = supplierPhone
            };
            sqlParameters[4] = new MySqlParameter("@id", MySqlDbType.Int32)
            {
                Value = supplierId
            };
            return(_mySqlDbConnection.ExecuteUpdateQuery(query, sqlParameters));
        }
        public bool UpdateBillNote(int?BillId, string note)
        {
            const string query         = "UPDATE bill set note = @note where id = @id";
            var          sqlParameters = new MySqlParameter[2];

            sqlParameters[0] = new MySqlParameter("@note", MySqlDbType.VarChar)
            {
                Value = note
            };
            sqlParameters[1] = new MySqlParameter("@id", MySqlDbType.Int32)
            {
                Value = BillId
            };
            return(_mySqlDbConnection.ExecuteUpdateQuery(query, sqlParameters));
        }
示例#4
0
        public bool UpdateProductType(int?productTypeId, string productTypeName, string productTypeImage)
        {
            const string query         = "UPDATE product_type set name = @name, image = @image where id = @id";
            var          sqlParameters = new MySqlParameter[3];

            sqlParameters[0] = new MySqlParameter("@name", MySqlDbType.VarChar)
            {
                Value = productTypeName
            };
            sqlParameters[1] = new MySqlParameter("@image", MySqlDbType.VarChar)
            {
                Value = productTypeImage
            };
            sqlParameters[2] = new MySqlParameter("@id", MySqlDbType.Int32)
            {
                Value = productTypeId
            };
            return(_mySqlDbConnection.ExecuteUpdateQuery(query, sqlParameters));
        }
示例#5
0
        public bool ChangePassword(string pass)
        {
            const string query         = "UPDATE user_administrator SET user_administrator.password = @pass";
            var          sqlParameters = new MySqlParameter[1];

            sqlParameters[0] = new MySqlParameter("@pass", MySqlDbType.VarChar)
            {
                Value = pass
            };

            return(_mySqlDbConnection.ExecuteUpdateQuery(query, sqlParameters));
        }
        public bool UpdateImage(int?idSp, string imageLink)
        {
            const string query         = "UPDATE images SET link=@link WHERE id_product = @idSp";
            var          sqlParameters = new MySqlParameter[2];

            sqlParameters[0] = new MySqlParameter("@link", MySqlDbType.String)
            {
                Value = imageLink
            };
            sqlParameters[1] = new MySqlParameter("@idSp", MySqlDbType.String)
            {
                Value = idSp
            };
            return(mySqlDbConnection.ExecuteUpdateQuery(query, sqlParameters));
        }
示例#7
0
        public bool UpdateImportProduct(int?Id, int supplierId, string supplierName, int productId, string productName, uint quantity, uint unitPrice)
        {
            const string query = "UPDATE import set supplierId = @supplierId, supplierName = @supplierName, productId = @productId, productName = @productName, quantity = @quantity, unitPrice = @unitPrice, totalPrice = @totalPrice  where id = @id";

            var sqlParameters = new MySqlParameter[8];

            sqlParameters[0] = new MySqlParameter("@supplierId", MySqlDbType.Int32)
            {
                Value = supplierId
            };
            sqlParameters[1] = new MySqlParameter("@supplierName", MySqlDbType.VarChar)
            {
                Value = supplierName
            };
            sqlParameters[2] = new MySqlParameter("@productId", MySqlDbType.Int32)
            {
                Value = productId
            };
            sqlParameters[3] = new MySqlParameter("@productName", MySqlDbType.VarChar)
            {
                Value = productName
            };
            sqlParameters[4] = new MySqlParameter("@quantity", MySqlDbType.Int32)
            {
                Value = quantity
            };
            sqlParameters[5] = new MySqlParameter("@unitPrice", MySqlDbType.Int32)
            {
                Value = unitPrice
            };
            sqlParameters[6] = new MySqlParameter("@totalPrice", MySqlDbType.Int32)
            {
                Value = quantity * unitPrice
            };
            sqlParameters[7] = new MySqlParameter("@id", MySqlDbType.Int32)
            {
                Value = Id
            };
            return(_mySqlDbConnection.ExecuteUpdateQuery(query, sqlParameters));
        }