Esempio n. 1
0
        private void CheckOutButton_Click(object sender, EventArgs e)
        {
            CashForm _CashForm = new CashForm();

            _CashForm.TotalBillBox.Text = TotalBillBox.Text;

            if (_CashForm.ShowDialog() == DialogResult.OK)
            {
                ArrayList ProductsList = new ArrayList();

                foreach (DataGridViewRow Row in ProductsGridView.Rows)
                {
                    try
                    {
                        string  ProductName     = Row.Cells["ProductNameColumn"].Value.ToString();
                        decimal ProductPrice    = Convert.ToDecimal(Row.Cells["ProductPriceColumn"].Value);
                        int     ProductQuantity = Convert.ToInt32(Row.Cells["ProductQuantityColumn"].Value);
                        decimal ProductTotal    = Convert.ToDecimal(Row.Cells["TotalPriceColumn"].Value);

                        ProductsList.Add(new Details()
                        {
                            Name = ProductName, Price = ProductPrice, Quantity = ProductQuantity, Total = ProductTotal
                        });
                    }
                    catch
                    {
                        //means Rows are ended
                    }
                }

                DataAccess _DataAccess = new DataAccess();

                if (_DataAccess.RecordASale(ProductsList, DateTime.Now, SalesmanID, Convert.ToDecimal(_CashForm.CashGivenBox.Text), Convert.ToDecimal(_CashForm.TotalBillBox.Text), Convert.ToDecimal(_CashForm.CashReturnBox.Text)))
                {
                    MessageBox.Show("Sale Added");
                }
                else
                {
                    MessageBox.Show("Sale Not Added");
                }
            }
        }
Esempio n. 2
0
        private void CheckOutButton_Click(object sender, EventArgs e)
        {
            CashForm _CashForm = new CashForm();

            _CashForm.TotalBillBox.Text = State.GetTotal().ToString();

            if (_CashForm.ShowDialog() == DialogResult.OK)
            {
                if (State.PersistBill(SalesmanID, 2, _CashForm.TotalBillBox.Text))
                {
                    ArrayList ProductsList = new ArrayList();

                    MessageBox.Show("Fatura u ruajt me sukses!");
                }

                DataAccess _DA = new DataAccess();

                State = _DA.GetState();

                Render();
            }
        }