Exemplo n.º 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;
            }
        }
Exemplo n.º 2
0
 public void readdata()
 {
     using (MySqlConnection conn = connect.connector())
     {
         string query = "SELECT NAME, IDMINVENTORY, QUANTITY FROM MENUITEM, MINVENTORY WHERE ID = PRODUCT_ID";
         dt      = new DataTable();
         adapter = new MySqlDataAdapter(query, conn);
         adapter.Fill(dt);
         datagridview_inventory.DataSource = dt;
     }
     datagridview_inventory.Columns["idmInventory"].Visible = false;
     datagridview_inventory.Columns["name"].HeaderText      = "Item Name";
     datagridview_inventory.Columns["quantity"].HeaderText  = "Quantity";
 }
Exemplo n.º 3
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();
                }
            }
        }
Exemplo n.º 4
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();
                }
            }
        }
Exemplo n.º 5
0
        private void viewproducts_Load(object sender, EventArgs e)
        {
            using (MySqlConnection conn = connect.connector())
            {
                string query = "SELECT * FROM menuitem WHERE status = 0";
                dt      = new DataTable();
                adapter = new MySqlDataAdapter(query, conn);
                adapter.Fill(dt);
                dtgvarc.DataSource = dt;

                dtgvarc.Columns["id"].Visible            = false;
                dtgvarc.Columns["status"].Visible        = false;
                dtgvarc.Columns["name"].HeaderText       = "Name";
                dtgvarc.Columns["sell_price"].HeaderText = "Sell Price";
                dtgvarc.Columns["cost_price"].HeaderText = "Cost Price";
            }
        }
Exemplo n.º 6
0
        public void readdata()
        {
            using (MySqlConnection conn = connect.connector())
            {
                //string query = "SELECT idmInventory, mInventorycol, stock_in_date, product_id, stock_out_date, quantity, status FROM minventory, menu_item WHERE minventory.status = 1 and menu_item.id = '" + Inventorymgt.inventoryid +"'";
                string query = "select * from mstkout";
                dt      = new DataTable();
                adapter = new MySqlDataAdapter(query, conn);
                adapter.Fill(dt);
                datagridview_stockout.DataSource = dt;

                datagridview_stockout.Columns["idmstkout"].Visible        = false;
                datagridview_stockout.Columns["idmInventory"].Visible     = false;
                datagridview_stockout.Columns["stockout_date"].HeaderText = "Stock Out Date";
                datagridview_stockout.Columns["quantity"].HeaderText      = "Quantity";
                datagridview_stockout.Columns["mstkoutcol"].Visible       = false;
            }
        }
Exemplo n.º 7
0
        public void supp()
        {
            using (MySqlConnection conn = connect.connector())
            {
                String query = "SELECT supplierName FROM supplier";


                MySqlCommand comm = new MySqlCommand(query, conn);
                comm.CommandText = query;
                conn.Open();
                MySqlDataReader drd = comm.ExecuteReader();

                cmbSup.Items.Clear();
                while (drd.Read())
                {
                    cmbSup.Items.Add(drd["supplierName"].ToString());
                }
                conn.Close();
            }
        }