Пример #1
0
        public void LoadVendors()
        {
            AutoCompleteStringCollection namesCollection = new AutoCompleteStringCollection();

            var dbconnect = new dbconnector();

            using (MySqlConnection conn = connect.connector())
            {
                conn.Open();
                String       getCustomer = "SELECT SUPPLIERNAME FROM SUPPLIER ";
                MySqlCommand comm        = new MySqlCommand(getCustomer, conn);
                comm.CommandText = getCustomer;
                MySqlDataReader drd = comm.ExecuteReader();

                if (drd.HasRows == true)
                {
                    while (drd.Read())
                    {
                        namesCollection.Add(drd["SUPPLIERNAME"].ToString());
                    }
                }

                drd.Close();
                conn.Close();
                vendorName.AutoCompleteMode         = AutoCompleteMode.SuggestAppend;
                vendorName.AutoCompleteSource       = AutoCompleteSource.CustomSource;
                vendorName.AutoCompleteCustomSource = namesCollection;
            }
        }
Пример #2
0
        private void updateinventory()
        {
            var dbconnect = new dbconnector();

            using (dbconnection = dbconnect.connector())
            {
                using (var command = new MySqlCommand("UPDATE minventory SET quantity = @quantity WHERE idmInventory = @ayd;", dbconnection))
                {
                    dbconnection.Open();
                    command.Parameters.AddWithValue("@quantity", quantityadd());
                    command.Parameters.AddWithValue("@ayd", inventoryid);
                    command.ExecuteNonQuery();
                }
            }
        }
Пример #3
0
        private void stockout()
        {
            var dbconnect = new dbconnector();

            using (dbconnection = dbconnect.connector())
            {
                dbconnection.Open();
                using (var com = new MySqlCommand("INSERT INTO mstkout(idmInventory, quantity, stockout_date) VALUES(@inventoryid, @quantity, @date)", dbconnection))
                {
                    com.Parameters.AddWithValue("@inventoryid", inventoryid);
                    com.Parameters.AddWithValue("@date", DateTime.Now.ToString("yyyy/MM/dd HH:mm:ss"));
                    com.Parameters.AddWithValue("@quantity", textBox2.Text);

                    com.ExecuteNonQuery();
                }
            }
        }