Exemplo n.º 1
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            int  choiceId         = dbOps.getChoice(sysMessages.msgClear);
            int  totalCookieSales = boothOps.getCookieSalesTotal();
            bool goodToProceed    = true;

            if (totalCookieSales > 0)
            {
                goodToProceed = entryVal.validateBoothDetailEntry(choiceId,
                                                                  totalCookieSales,
                                                                  txtSplit1.Text,
                                                                  txtSplit2.Text,
                                                                  txtSplit3.Text);
            }

            try
            {
                if (goodToProceed)
                {
                    int boothId      = boothOps.getBoothId(cboBooth.Text);
                    int firstGirlId  = boothOps.getFirstGirlId(boothId);
                    int secondGirlId = boothOps.getSecondGirlId(boothId);
                    int thirdGirlId  = boothOps.getThirdGirlId(boothId);

                    boothClose.BoothClose(boothId,
                                          firstGirlId,
                                          secondGirlId,
                                          thirdGirlId,
                                          Convert.ToDouble(txtSplit1.Text),
                                          Convert.ToDouble(txtSplit2.Text),
                                          Convert.ToDouble(txtSplit3.Text),
                                          userId);
                }
                else
                {
                    MessageBox.Show(sysMessages.msgIncompleteEntry,
                                    sysMessages.msgAttention,
                                    MessageBoxButtons.OK,
                                    MessageBoxIcon.Information);
                }
            }
            catch (Exception e1)
            {
                MessageBox.Show(e1.ToString(),
                                sysMessages.dbError,
                                MessageBoxButtons.OK,
                                MessageBoxIcon.Error);
            }
            finally
            {
                resetEntries();
                boothOps.resetVisibility(lblGirl1, lblGirl2, lblGirl2, txtSplit1, txtSplit2, txtSplit3);
                boothOps.fillBooth(cboBooth);
                cboBooth.Focus();
            }
        }