private void button2_Click(object sender, EventArgs e)
        {
            if (bill_dgv.RowCount > 0 && cash_nud.Value >= Convert.ToDecimal(total))
            {
                TransactionControl.updateDatabase(bill_dgv, invoiceno_lbl.Text, Program.logged_id.ToString());
                PrintReceipt();
                invoiceno_lbl.Text = TransactionControl.genrateInvoiceNo().ToString();
                bill_dgv.Rows.Clear();
                total_lbl.ResetText();
                change_lbl.ResetText();
                if (parentCashierForm != null)
                {
                    parentCashierForm.parentButtonActivation(true);
                }
            }
            else if (cash_nud.Value < Convert.ToDecimal(total))
            {
                cash_nud.ResetText();
                MessageBox.Show("Insufficient Money", "Error", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
            }
            else
            {
                MessageBox.Show("Select Atleast One Product!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
            }

            // thic.close();
        }
Beispiel #2
0
        private void button1_Click_1(object sender, EventArgs e)
        {
            try
            {
                SqlCon.con.Open();
                MySqlDataAdapter sAdapter = new MySqlDataAdapter("Select * from pharmacy.people where Username= '******' and Password = '******';", SqlCon.con);
                DataTable        dt       = new DataTable("CharacterInfo");
                sAdapter.Fill(dt);
                SqlCon.con.Close();

                if (dt.Rows.Count == 1 && dt.Rows[0][3].ToString() == "Owner")
                {
                    Program.logged_id = Convert.ToInt32(dt.Rows[0][0].ToString());
                    owner_form of = new owner_form();
                    this.Hide();
                    of.Show();
                    if (Program.isNotification)
                    {
                        NotificationForm exProd = new NotificationForm();
                        exProd.Show();
                    }
                }
                else if (dt.Rows.Count == 1 && dt.Rows[0][3].ToString() == "Cashier")
                {
                    Program.logged_id = Convert.ToInt32(dt.Rows[0][0].ToString());
                    logged_id         = Program.logged_id;

                    cashierForm cashier = cashierForm.getCashierForm(Program.logged_id, TransactionControl.findBranch(Program.logged_id.ToString()));
                    this.Hide();
                    cashier.Show();
                }
                else if (dt.Rows.Count == 1 && dt.Rows[0][3].ToString() == "StockManager")
                {
                    Program.logged_id = Convert.ToInt32(dt.Rows[0][0].ToString());
                    StockManagerForm of = new StockManagerForm(Program.logged_id, TransactionControl.findBranch(Program.logged_id.ToString()));
                    this.Hide();
                    of.Show();
                }
                else
                {
                    MessageBox.Show("Incorrect Password or Username!");
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
 private void create_order_Load(object sender, EventArgs e)
 {
     load_dgv1();
     invoiceno_lbl.Text = TransactionControl.genrateInvoiceNo().ToString();
 }