private void dgv_CellContentClick(object sender, DataGridViewCellEventArgs e)
        {
            if (e.ColumnIndex == 0 | e.ColumnIndex == 1)
            {
                transactionEL.Transactionid = Convert.ToInt32(dgv.SelectedRows[0].Cells["TRANSACTION ID"].Value);
                transactionEL = transactionBL.Select(transactionEL);
            }


            if (e.ColumnIndex == 0)
            {
                customerEL.Customerid = transactionEL.Customerid;
                customerBL.Select(customerEL);


                lblCustomerNameAndContactNumber.Text = customerEL.Fullname + "\n" + customerEL.Contactnumber;

                lblTransactionDate.Text = transactionEL.Transactiondatetime.ToString();
                lblTotalAmount.Text     = methods.ConvertToMoneyFormat(transactionEL.Totalamount);
                lblAmountTendered.Text  = methods.ConvertToMoneyFormat(transactionEL.Amounttendered);
                lblChangeAmount.Text    = methods.ConvertToMoneyFormat(transactionEL.ChangeAmount);

                if (transactionEL.Isvoid == 0)
                {
                    pnlVoid.Visible = false;
                }
                else
                {
                    pnlVoid.Visible = true;
                }

                PopulateDGVCartDetails(transactionEL.Transactionid.ToString());


                lblTitle.Text = "VIEW TRANSACTION DETAILS OF TRANSACTION ID " + transactionEL.Transactionid;

                ShowView(true);
            }

            if (e.ColumnIndex == 1)
            {
                if (transactionEL.Isvoid == 0)
                {
                    DialogResult dialogResult = MessageBox.Show("ARE YOU SURE TO VOID THIS SELECTED TRANSACTION?", "VOIDING", MessageBoxButtons.YesNo);
                    if (dialogResult == DialogResult.Yes)
                    {
                        transactionEL.Isvoid = 1;
                        ShowResult(transactionBL.Update(transactionEL));
                    }
                }
                else
                {
                    MessageBox.Show("THIS TRANSACTION IS ALREADY VOIDED");
                }
            }
        }
        private void ResetForm()
        {
            lblTotalItems.ResetText();
            lblTotalAmount.ResetText();
            dgvCart.Rows.Clear();
            lblNameAndNumber.ResetText();

            CalculateCart();

            txtSearchCustomers.ResetText();
            txtSearchProducts.ResetText();

            PopulateDGVCustomers();
            PopulateDGVProducts();

            customerEL              = new EL.Registrations.customers();
            productEL               = new EL.Registrations.products();
            transactionEL           = new EL.Transactions.transactions();
            productsintransactionEL = new EL.Transactions.productsintransactions();
        }
        public EL.Transactions.transactions Select(EL.Transactions.transactions transactionEL)
        {
            var dt = Helper.executeQuery("select * from transactions where transactionid = '" + transactionEL.Transactionid + "'");

            if (dt.Rows.Count > 0)
            {
                transactionEL.Transactionid       = Convert.ToInt32(dt.Rows[0]["transactionid"].ToString());
                transactionEL.Customerid          = Convert.ToInt32(dt.Rows[0]["customerid"].ToString());
                transactionEL.Transactiondatetime = dt.Rows[0]["transactiondatetime"].ToString();
                transactionEL.Totalamount         = Convert.ToSingle(dt.Rows[0]["totalamount"].ToString());
                transactionEL.Amounttendered      = Convert.ToSingle(dt.Rows[0]["amounttendered"].ToString());
                transactionEL.ChangeAmount        = Convert.ToSingle(dt.Rows[0]["changeamount"].ToString());
                transactionEL.Isvoid = Convert.ToInt32(dt.Rows[0]["isvoid"]);

                return(transactionEL);
            }
            else
            {
                return(null);
            }
        }
 public bool Delete(EL.Transactions.transactions transactionEL)
 {
     return(Helper.executeNonQueryBool("delete from transactions where transactionid = '" + transactionEL.Transactionid + "'"));
 }
 public bool Update(EL.Transactions.transactions transactionEL)
 {
     return(Helper.executeNonQueryBool("update transactions set customerid = '" + transactionEL.Customerid + "', transactiondatetime = '" + transactionEL.Transactiondatetime + "', totalamount = '" + transactionEL.Totalamount + "', amounttendered = '" + transactionEL.Amounttendered + "', changeamount = '" + transactionEL.ChangeAmount + "', isvoid = '" + transactionEL.Isvoid + "' where transactionid = '" + transactionEL.Transactionid + "'"));
 }
 public long Insert(EL.Transactions.transactions transactionEL)
 {
     return(Helper.executeNonQueryLong("insert into transactions (customerid, transactiondatetime, totalamount, amounttendered, changeamount, isvoid) values ('" + transactionEL.Customerid + "', '" + transactionEL.Transactiondatetime + "', '" + transactionEL.Totalamount + "', '" + transactionEL.Amounttendered + "', '" + transactionEL.ChangeAmount + "', '" + transactionEL.Isvoid + "')"));
 }
 public bool Delete(EL.Transactions.transactions transactionEL)
 {
     return(transactionDL.Delete(transactionEL));
 }
 public bool Update(EL.Transactions.transactions transactionEL)
 {
     return(transactionDL.Update(transactionEL));
 }
 public long Insert(EL.Transactions.transactions transactionEL)
 {
     return(transactionDL.Insert(transactionEL));
 }
 public EL.Transactions.transactions Select(EL.Transactions.transactions transactionEL)
 {
     return(transactionDL.Select(transactionEL));
 }