private void button1_Click(object sender, EventArgs e)
        {
            newCon Add_Brewery = new newCon(Logon.Log, Logon.Password);

            Add_Brewery.Add_Brew(B_name, B_location, B_address, B_postal_code, B_Telephone, B_Email, B_WWW);
            this.Close();
        }
        private void Add_Click(object sender, EventArgs e)
        {
            try
            {
                newCon Check_P_Brewery = new newCon(Logon.Log, Logon.Password);
                Check_brewery = Check_P_Brewery.Chceck_Brewery(ref P_brewery);

                if (Check_brewery == "0")
                {
                    MessageBox.Show("We don't have this brewery in our database. First of all, you have to add it to database.");
                    this.Close();
                }

                newCon Check_Product_type = new newCon(Logon.Log, Logon.Password);
                Check_P_type = Check_Product_type.Chceck_P_type(ref P_type);

                if (Check_P_type == "0")
                {
                    newCon Add_Product_type = new newCon(Logon.Log, Logon.Password);
                    Add_Product_type.Add_P_type(P_type);
                }

                newCon Add_product = new newCon(Logon.Log, Logon.Password);
                Add_product.INTO_PRODUCTS(Product_price, Product_amount, P_name, P_brewery, P_distributor, P_price, P_type, P_unit_of_measurement, P_bar_code);
                this.Close();

                newCon Add_exp_date = new newCon(Logon.Log, Logon.Password);
                Add_exp_date.INTO_EXP_DATE(P_name, serial_number, P_Exp_date);
            }
            catch
            {
                MessageBox.Show("You have to fill all the text boxes.");
            }
        }
示例#3
0
        private void button1_Click(object sender, EventArgs e)
        {
            string check_product_name;
            newCon Check_p_name = new newCon(Logon.Log, Logon.Password);

            check_product_name = Check_p_name.Check_Product_Name(ref p_name);
            if (p_name == check_product_name)
            {
                int    final_amount;
                newCon Check_amount = new newCon(Logon.Log, Logon.Password);
                check_p_amount = Check_amount.Check_Amount(ref p_name);
                final_amount   = check_p_amount + p_amount;

                newCon Update_amount = new newCon(Logon.Log, Logon.Password);
                Update_amount.Amount_Update(final_amount, p_name);

                try
                {
                    newCon Add_expiration_date = new newCon(Logon.Log, Logon.Password);
                    Add_expiration_date.INTO_EXP_DATE(p_name, Serial_num, Expiration_date);
                }
                catch
                {
                    MessageBox.Show("Error data format.");
                }
            }
            else
            {
                MessageBox.Show("Add this product to database.");
            }
            MessageBox.Show("Delivery Success");
        }
示例#4
0
        private void button1_Click(object sender, EventArgs e)
        {
            newCon Add_Dis = new newCon(Logon.Log, Logon.Password);

            Add_Dis.Add_Distrib(d_name, d_location, d_address, d_postal_code, d_tel, d_email, d_www);
            this.Close();
        }
        private void Add_Click(object sender, EventArgs e)
        {
            newCon Add_Cus = new newCon(Logon.Log, Logon.Password);

            Add_Cus.Add_Cust(Cus_name, C_NIP, C_City, C_Address, C_Postal_code, C_Tel, C_Email, C_WWW, C_Cus_type);
            this.Close();
        }
示例#6
0
        private void NIP_number_Click(object sender, EventArgs e)
        {
            newCon Get_NIP = new newCon(Logon.Log, Logon.Password);

            NIP             = Get_NIP.Check_NIP(ref Cus_name);
            NIP_number.Text = NIP;
        }
示例#7
0
        private void Bar_code_TextChanged(object sender, EventArgs e)
        {
            P_bar_code = long.Parse(Bar_code.Text);

            newCon Check_P_name = new newCon(Logon.Log, Logon.Password);

            Product_name.Text = Check_P_name.Chceck_P_name(ref P_bar_code);
        }
示例#8
0
        private void Info_Invoices_Click(object sender, EventArgs e)
        {
            DataTable DT = null;

            if (DT != null)
            {
                DT.Clear();
            }
            newCon baza_win = new newCon(Logon.Log, Logon.Password);

            dataGridView1.DataSource = baza_win.pobierz_dane("Select * FROM Invoice_headers");
        }
示例#9
0
        private void button1_Click(object sender, EventArgs e)
        {
            DataTable DT = null;

            if (DT != null)
            {
                DT.Clear();
            }
            newCon baza_win = new newCon(Logon.Log, Logon.Password);

            dataGridView1.DataSource = baza_win.pobierz_dane("Select * FROM Distributors");
        }
示例#10
0
        private void End_Sale_Click(object sender, EventArgs e)
        {
            int    Cus_ID, Invoice_ID;
            newCon Check_Cus_ID = new newCon(Logon.Log, Logon.Password);

            Cus_ID = Check_Cus_ID.GetID(ref Cus_name);

            newCon Check_Invoice_ID = new newCon(Logon.Log, Logon.Password);

            Invoice_ID  = Check_Invoice_ID.Get_Invoice_ID();
            Invoice_ID += 1;

            newCon Check_Discount = new newCon(Logon.Log, Logon.Password);

            Discount = Check_Discount.Get_Discount(ref Cus_name);

            newCon Check_Employee_ID = new newCon(Logon.Log, Logon.Password);

            Employee_ID = Check_Employee_ID.Get_Employee_ID(ref Logon.Log);

            sum_with_discount = sum - (sum * (Discount / 100));

            newCon Add2 = new newCon(Logon.Log, Logon.Password);

            Add2.INTO_INV_HEAD(Cus_ID, sum_with_discount, payment, Discount);

            newCon Add1 = new newCon(Logon.Log, Logon.Password);

            Add1.INTO_SALE(Employee_ID, Cus_name, Invoice_ID);

            foreach (ListViewItem lvi in listView1.Items)
            {
                P_name              = lvi.SubItems[1].Text;
                P_amount            = lvi.SubItems[2].Text;
                P_price             = Convert.ToInt32(lvi.SubItems[3].Text);
                unit_of_measurement = lvi.SubItems[4].Text;
                serial_number       = lvi.SubItems[5].Text;
                exp_date            = lvi.SubItems[6].Text;

                newCon Add3 = new newCon(Logon.Log, Logon.Password);
                Add3.INTO_INV_ITEMS(P_name, Invoice_ID, Convert.ToInt32(P_amount), unit_of_measurement, P_price, P_bar_code);

                newCon GetAmount = new newCon(Logon.Log, Logon.Password);
                Amount_base = GetAmount.Check_Amount(ref P_name);

                residual = Amount_base - Convert.ToInt32(P_amount);

                newCon Update1 = new newCon(Logon.Log, Logon.Password);
                Update1.Amount_Update(residual, P_name);
            }

            this.Close();
        }
        private void Prod_name_TextChanged(object sender, EventArgs e)
        {
            string check_p_name;

            P_name = Prod_name.Text;
            newCon Check_prod_name = new newCon(Logon.Log, Logon.Password);

            check_p_name = Check_prod_name.Check_Product_Name(ref P_name);
            if (P_name == check_p_name)
            {
                MessageBox.Show("This product is in database.");
            }
        }
        public void Login_Click(object sender, EventArgs e)
        {
            try
            {
                var user = new Employee(Log, Password);

                newCon baza = new newCon(Log, Password);
                this.Hide();


                Form1 form1 = new Form1();
                form1.Visible = true;
                form1.TopMost = true;
                form1.Closed += (s, args) => this.Close();
                form1.Show();
            }
            catch (Exception exception)
            {
                MessageBox.Show(exception.Message);
            }
        }
示例#13
0
        private void dataGridView1_CellContentClick_1(object sender, DataGridViewCellEventArgs e)
        {
            cell_text = dataGridView1.CurrentCell.Value.ToString();
            switch (dataGridView1.CurrentCell.OwningColumn.HeaderText.ToString())
            {
            case "Invoice_ID":
                DataTable DT = null;
                if (DT != null)
                {
                    DT.Clear();
                }
                newCon baza_win = new newCon(Logon.Log, Logon.Password);
                dataGridView1.DataSource = baza_win.pobierz_dane("Select * FROM Invoice_items WHERE Invoice_ID =" + cell_text + ";");
                break;

            case "Customer_name":

                DataTable DT1 = null;
                if (DT1 != null)
                {
                    DT1.Clear();
                }
                newCon baza_win1 = new newCon(Logon.Log, Logon.Password);
                dataGridView1.DataSource = baza_win1.pobierz_dane("SELECT IH.Customer_ID, IH.Invoice_ID, IH.Invoice_value, IH.Discount, IH.Date_time, IH.Payment FROM Customers AS C JOIN Invoice_headers AS IH ON C.Customer_ID=IH.Customer_ID WHERE Customer_name ='" + cell_text + "';");

                break;

            case "Br_name":

                DataTable DT2 = null;
                if (DT2 != null)
                {
                    DT2.Clear();
                }
                newCon baza_win2 = new newCon(Logon.Log, Logon.Password);
                dataGridView1.DataSource = baza_win2.pobierz_dane("SELECT * FROM Products WHERE Brewery ='" + cell_text + "';");

                break;

            case "Dis_name":

                DataTable DT3 = null;
                if (DT3 != null)
                {
                    DT3.Clear();
                }
                newCon baza_win3 = new newCon(Logon.Log, Logon.Password);
                dataGridView1.DataSource = baza_win3.pobierz_dane("SELECT * FROM Products WHERE Distributor ='" + cell_text + "';");

                break;

            case "P_type":

                DataTable DT4 = null;
                if (DT4 != null)
                {
                    DT4.Clear();
                }
                newCon baza_win4 = new newCon(Logon.Log, Logon.Password);
                dataGridView1.DataSource = baza_win4.pobierz_dane("SELECT * FROM Products WHERE P_type ='" + cell_text + "';");
                break;

            case "Product_name":
                DataTable DT5 = null;
                if (DT5 != null)
                {
                    DT5.Clear();
                }
                newCon baza_win5 = new newCon(Logon.Log, Logon.Password);
                dataGridView1.DataSource = baza_win5.pobierz_dane("SELECT * FROM Expiration_dates WHERE Product_name ='" + cell_text + "';");
                break;
            }
        }
示例#14
0
        private void Products_Click(object sender, EventArgs e)
        {
            newCon Check_amount = new newCon(Logon.Log, Logon.Password);

            check_amount = Check_amount.Check_Amount(ref P_name);
            int P_amount_test = Convert.ToInt32(P_amount);

            if (P_amount_test <= check_amount)
            {
                ListViewItem itm;

                IDatabaseConnection _databaseConnection = new DatabaseConnection();
                _databaseConnection.OpenNewConnection(user);
                GetterPriceOfBeer getterPriceOfBeer = new GetterPriceOfBeer()

                                                      int price = 0;
                newCon a = new newCon(Logon.Log, Logon.Password);
                price = a.GetPrice(ref P_name);

                string[] arr = new string[7];


                if (price != 0)
                {
                    if (serial_number != "0")
                    {
                        if (exp_date != "0")
                        {
                            newCon Check_Unit_of_measurement = new newCon(Logon.Log, Logon.Password);
                            unit_of_measurement = Check_Unit_of_measurement.Get_unit_of_measurement(ref P_name);
                            arr[0] = Convert.ToString(x);
                            arr[1] = P_name;
                            arr[2] = P_amount;
                            arr[3] = Convert.ToString(price);
                            arr[4] = unit_of_measurement;
                            arr[5] = serial_number;
                            arr[6] = exp_date;
                            arr[7] = Convert.ToString(P_bar_code);
                            itm    = new ListViewItem(arr);
                            listView1.Items.Add(itm);
                            x++;
                        }
                        else
                        {
                            MessageBox.Show("Enter a expiration date.");
                        }
                    }
                    else
                    {
                        MessageBox.Show("Enter a serial number.");
                    }
                }
                else
                {
                    MessageBox.Show("Incorrect name of beer");
                }



                try
                {
                    string Product_Name = P_name;

                    newCon b = new newCon(Logon.Log, Logon.Password);

                    Unit_price  = b.GetPrice(ref Product_Name);
                    sum        += Unit_price * int.Parse(Amount.Text);
                    amount_sum += int.Parse(Amount.Text);
                }
                catch
                {
                    MessageBox.Show("Incorrect name of beer");
                }



                Quantity_TextBox.Text = Convert.ToString(amount_sum);
                Invoice_value.Text    = Convert.ToString(sum);
            }
            else
            {
                MessageBox.Show("Too much bottles.");
            }
        }