private void submitButton_Click(object sender, EventArgs e)
        {
            DialogResult dialogResult;

            dialogResult = MessageBox.Show(@"Are you sure, you want to submit and save all this record?", @"Message Box", MessageBoxButtons.YesNo,
                                           MessageBoxIcon.Question);
            if (dialogResult == DialogResult.Yes)
            {
                try
                {
                    if (_salesManager.AddSale(_sales))
                    {
                        salesDataGridView.DataSource = null;
                        MessageBox.Show(@"Saved SuccessFully", @"Message Box", MessageBoxButtons.OK);
                        _sales.Clear();
                        //get next purchase code
                        GenerateSaleCodeBeforeSubmit();
                    }
                    else
                    {
                        MessageBox.Show(@"Not saved", @"Message Box", MessageBoxButtons.OK);
                    }
                }
                catch (Exception exception)
                {
                    MessageBox.Show(exception.Message);
                }
            }
        }
예제 #2
0
        public override void Execute(string[] commandArgs)
        {
            string id       = commandArgs[1];
            var    item     = this.AppEngine.Supplies.FirstOrDefault(pair => pair.Key.ID == id).Key;
            var    saleDate = ToDateTime(commandArgs[2]);

            if (item == null)
            {
                throw new ArgumentNullException(string.Format("No item {0} in supplies stock.", id));
            }

            if (this.AppEngine.Supplies[item] == 0)
            {
                throw new InsufficientSuppliesException("There are not enough supplies to sell this item.");
            }

            SalesManager.AddSale(item, saleDate);
            this.AppEngine.Supplies[item]--;
        }
예제 #3
0
        private void submitButton_Click(object sender, EventArgs e)
        {
            DialogResult dialogResult;

            dialogResult = MessageBox.Show(@"Are you sure, you want to submit and save all this record?", @"Message Box", MessageBoxButtons.YesNo,
                                           MessageBoxIcon.Question);
            if (dialogResult == DialogResult.Yes)
            {
                try
                {
                    if (_salesManager.AddSale(_sales))
                    {
                        _customerManager.UpdateCustomerLoyaltyPoint(Convert.ToInt32(customerComboBox.SelectedValue),
                                                                    customerLoyaltyPoint);

                        salesDataGridView.DataSource = null;
                        MessageBox.Show(@"Saved SuccessFully", @"Message Box", MessageBoxButtons.OK);
                        _sales.Clear();
                        //get next purchase code
                        GenerateSaleCodeBeforeSubmit();
                        grandtotalTextBox.Text     = "";
                        discountTextbox.Text       = "";
                        discountAmountTextBox.Text = "";
                        payableAmountTextBox.Text  = "";
                    }
                    else
                    {
                        MessageBox.Show(@"Not saved", @"Message Box", MessageBoxButtons.OK);
                    }
                }
                catch (Exception exception)
                {
                    MessageBox.Show(exception.Message);
                }
            }
        }