Example #1
0
        public override void Save()
        {
            try
            {
                var dialog = MessageBox.Show("Do you really want to process the order?", "", MessageBoxButtons.OKCancel, MessageBoxIcon.Question);
                if (dialog == DialogResult.OK)
                {
                    Purshase.ProcessSaleOrder(this.id_purshase);
                    _cusotmer            = new CustomerModel();
                    this.id_purshase     = "SHP" + Security.Security.generateIdNumber();
                    txtCustomerName.Text = "";
                    txtCode.Text         = "";
                    dgvProducts.Rows.Clear();
                }
                MessageBox.Show("Order Processed!", "", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                dialog = MessageBox.Show("Do you want to process a new order?", "", MessageBoxButtons.OKCancel, MessageBoxIcon.Question);
                if (dialog == DialogResult.OK)
                {
                    InitializeSale();
                }
                else
                {
                    this.Close();
                }
            }
            catch (Exception)
            {
                //The sale could not be completed

                MessageBox.Show("The sale could not be completed.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                this.Close();
            }
        }
Example #2
0
        public override void Save()
        {
            if (dgvProducts.Rows.Count != 0)
            {
                var dialog = MessageBox.Show("Do you really want to process the order?", "", MessageBoxButtons.OKCancel, MessageBoxIcon.Question);
                if (dialog == DialogResult.OK)
                {
                    try
                    {
                        Purshase.ProcessSaleOrder(this.id_purshase);
                        Billing bill = new Billing(this.id_purshase);
                        bill.ShowDialog();
                    }
                    catch (Exception ex)
                    {
                        //The sale could not be completed

                        MessageBox.Show("Error: " + ex.Message, "", MessageBoxButtons.OK, MessageBoxIcon.Error);
                        this.Close();
                    }
                }
                dialog = MessageBox.Show("Do you want to process a new order?", "", MessageBoxButtons.OKCancel, MessageBoxIcon.Question);
                if (dialog == DialogResult.OK)
                {
                    InitializeSale();
                }
                else
                {
                    this.Close();
                }
            }
            else
            {
                MessageBox.Show("We can't process this purshase without products.", "", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }