Пример #1
0
        private void label16_Click(object sender, EventArgs e)
        {
            SessionData.SetNewOrderId(long.Parse(txt_selected_orderid.Text));
            Form_auth frmauth = new Form_auth();

            frmauth.ShowDialog();

            if (managerPassword)
            {
                //canceled order
                db     con   = new db();
                string query = "";
                query = "UPDATE `orders` SET `online`='0' WHERE id = '" + SessionData.newOrderId + "'";
                con.MysqlQuery(query);
                con.NonQueryEx();
                con.conClose();

                dataGridView2.Rows.Clear();
                dataGridView2.Refresh();
                loadOrderDetails();
            }
            else
            {
                MessageBox.Show("Authentication Faild!");
            }
        }
Пример #2
0
        private void btn_delete_item_Click(object sender, EventArgs e)
        {
            MessageBox.Show(updatemode.ToString());

            if (updatemode)
            {
                if (dataGridView_cart.SelectedCells.Count > 0)
                {
                    Form_auth frmauth = new Form_auth();
                    frmauth.ShowDialog();
                }


                if (authproceed)
                {
                    if (managerPassword)
                    {
                        if (dataGridView_cart.SelectedCells.Count > 0)
                        {
                            int             selectedrowindex = dataGridView_cart.SelectedCells[0].RowIndex;
                            DataGridViewRow selectedRow      = dataGridView_cart.Rows[selectedrowindex];
                            int             itemid           = int.Parse(selectedRow.Cells[0].Value.ToString());
                            voidOrderItems(itemid);
                            userLog(authid, "void order item : " + itemid);
                            dataGridView_cart.Rows.Clear();
                            dataGridView_cart.Refresh();

                            dataGridView2.Rows.Clear();
                            dataGridView2.Refresh();
                            loadOrderDetails();
                            reOpenOrder();
                        }
                    }
                }
            }
            else
            {
                if (dataGridView_cart.SelectedCells.Count > 0)
                {
                    int             selectedrowindex = dataGridView_cart.SelectedCells[0].RowIndex;
                    DataGridViewRow selectedRow      = dataGridView_cart.Rows[selectedrowindex];
                    double          itemprice        = double.Parse(selectedRow.Cells[6].Value.ToString());
                    //  MessageBox.Show(itemprice.ToString());
                    SessionData.UpdateCartTotal(itemprice);

                    foreach (DataGridViewRow item in this.dataGridView_cart.SelectedRows)
                    {
                        dataGridView_cart.Rows.RemoveAt(item.Index);
                    }
                }
                SessionData.DeleteItem();
                ShowCartTotal();
            }
        }
Пример #3
0
        //void ORDER
        private void btn_void_Click(object sender, EventArgs e)
        {
            string orid = "";

            if (dataGridView_cart.SelectedCells.Count > 0)
            {
                Form_auth frmauth = new Form_auth();
                frmauth.ShowDialog();

                if (authproceed)
                {
                    if (managerPassword)
                    {
                        //canceled order
                        db     con   = new db();
                        string query = "";
                        query = "UPDATE `order_details` SET `online`='0' WHERE order_id = '" + SessionData.newOrderId + "'";
                        con.MysqlQuery(query);
                        con.NonQueryEx();
                        con.conClose();
                        userLog(authid, "void order: " + SessionData.newOrderId);

                        dataGridView2.Rows.Clear();
                        dataGridView2.Refresh();
                        loadOrderDetails();

                        resetAll();
                        dataGridView_cart.Rows.Clear();
                        dataGridView_cart.Refresh();
                        printVoidReceipt();
                    }
                    else
                    {
                        MessageBox.Show("Authentication Faild!");
                    }
                }
            }
            else
            {
                MessageBox.Show("Empty Cart!");
            }
        }