Example #1
0
        public bool CreateNewProduct(string name, int idType, uint price, string description, int inew)
        {
            const string query =
                "INSERT INTO product (name, id_type, price, description, new) VALUES (@name,@type,@pri,@des,@inew)";

            var sqlParameters = new MySqlParameter[5];

            sqlParameters[0] = new MySqlParameter("@name", MySqlDbType.String)
            {
                Value = name
            };
            sqlParameters[1] = new MySqlParameter("@type", MySqlDbType.Int32)
            {
                Value = idType
            };
            sqlParameters[2] = new MySqlParameter("@pri", MySqlDbType.UInt32)
            {
                Value = price
            };
            sqlParameters[3] = new MySqlParameter("@des", MySqlDbType.String)
            {
                Value = description
            };
            sqlParameters[4] = new MySqlParameter("@inew", MySqlDbType.Int32)
            {
                Value = inew
            };
            return(_mySqlDbConnection.ExecuteInsertQuery(query, sqlParameters));
        }
Example #2
0
        public bool CreateNewProductType(string name, string image)
        {
            const string query         = "INSERT INTO product_type(name, image) values (@name, @img)";
            var          sqlParameters = new MySqlParameter[2];

            sqlParameters[0] = new MySqlParameter("@name", MySqlDbType.String)
            {
                Value = name
            };
            sqlParameters[1] = new MySqlParameter("@img", MySqlDbType.String)
            {
                Value = image
            };
            return(_mySqlDbConnection.ExecuteInsertQuery(query, sqlParameters));
        }
        public bool CreateImage(string link, int?sp)
        {
            const string query         = "insert into images(link,id_product) values (@link, @sp)";
            var          sqlParameters = new MySqlParameter[2];

            sqlParameters[0] = new MySqlParameter("@link", MySqlDbType.VarChar)
            {
                Value = link
            };
            sqlParameters[1] = new MySqlParameter("@sp", MySqlDbType.Int32)
            {
                Value = sp
            };

            return(mySqlDbConnection.ExecuteInsertQuery(query, sqlParameters));
        }
        public bool CreateNewBill(int idCus, DateTime dateOrder, DateTime expectedDateOrder, int total, string addr, string dis, string city, string note, int status, int idShipper)
        {
            const string query         = "INSERT INTO bill (id_customer, date_order, expected_date_order, total, address, district, city, note, status, id_shipper) VALUES (@cus, @dateOrder, @expDateOrder, @total, @addr, @dis, @city, @note, @stt, @shipper)";
            var          sqlParameters = new MySqlParameter[6];

            sqlParameters[0] = new MySqlParameter("@cus", MySqlDbType.Int32)
            {
                Value = idCus
            };
            sqlParameters[1] = new MySqlParameter("@dateOrder", MySqlDbType.DateTime)
            {
                Value = dateOrder
            };
            sqlParameters[2] = new MySqlParameter("@expDateOrder", MySqlDbType.DateTime)
            {
                Value = expectedDateOrder
            };
            sqlParameters[3] = new MySqlParameter("@total", MySqlDbType.String)
            {
                Value = total
            };
            sqlParameters[4] = new MySqlParameter("@addr", MySqlDbType.String)
            {
                Value = addr
            };
            sqlParameters[5] = new MySqlParameter("@dis", MySqlDbType.String)
            {
                Value = dis
            };
            sqlParameters[6] = new MySqlParameter("@city", MySqlDbType.String)
            {
                Value = city
            };
            sqlParameters[7] = new MySqlParameter("@note", MySqlDbType.Text)
            {
                Value = note
            };
            sqlParameters[8] = new MySqlParameter("@stt", MySqlDbType.Int32)
            {
                Value = status
            };
            sqlParameters[9] = new MySqlParameter("@shipper", MySqlDbType.Int32)
            {
                Value = idShipper
            };
            return(_mySqlDbConnection.ExecuteInsertQuery(query, sqlParameters));
        }
        public bool CreateNewShipper(string name, string phone, string mail)
        {
            const string query         = "INSERT INTO shippers (name, phone, email) VALUES(@name, @phone, @mail)";
            var          sqlParameters = new MySqlParameter[3];

            sqlParameters[0] = new MySqlParameter("@name", MySqlDbType.VarChar)
            {
                Value = name
            };
            sqlParameters[1] = new MySqlParameter("@mail", MySqlDbType.VarChar)
            {
                Value = mail
            };
            sqlParameters[2] = new MySqlParameter("@phone", MySqlDbType.VarChar)
            {
                Value = phone
            };
            return(_mySqlDbConnection.ExecuteInsertQuery(query, sqlParameters));
        }
Example #6
0
        public bool CreateImportProduct(int supplierId, string supplierName, int productId, string productName, uint quantity, uint unitPrice)
        {
            const string query = "INSERT INTO import (supplierId, supplierName, productId, productName, quantity, unitPrice, totalPrice) VALUES (@supplierId, @supplierName, @productId, @productName, @quantity, @unitPrice, @totalPrice)";

            var sqlParameters = new MySqlParameter[7];

            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
            };

            return(_mySqlDbConnection.ExecuteInsertQuery(query, sqlParameters));
        }