Beispiel #1
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            int  choiceId      = dbOps.getChoice(sysMessages.msgSaveCap);
            bool validDate     = entryVal.validateDateEntry(choiceId, dtmDate.Text);
            bool validTime     = entryVal.validateTimeEntry(choiceId, dtmTime.Text);
            bool goodToProceed = entryVal.validateBoothEntry(choiceId,
                                                             cboTroop.Text,
                                                             txtLocation.Text,
                                                             dtmDate.Text,
                                                             dtmTime.Text,
                                                             cboPrimary.Text,
                                                             cboSecondary.Text,
                                                             cboAdditional.Text,
                                                             cboFirstGirl.Text,
                                                             cboSecondGirl.Text,
                                                             cboThirdGirl.Text);

            try
            {
                if (!validDate)
                {
                    MessageBox.Show(sysMessages.msgInvalidDate,
                                    sysMessages.msgAttention,
                                    MessageBoxButtons.OK,
                                    MessageBoxIcon.Error);
                }
                else if (!validTime)
                {
                    string msg = sysMessages.msgInvalidTime + sysMessages.msgSpace + sysMessages.msgOf + sysMessages.msgSpace +
                                 DateTime.Parse(sysMessages.defStartTime).ToShortTimeString() + sysMessages.msgSpace +
                                 sysMessages.msgAnd + sysMessages.msgSpace + DateTime.Parse(sysMessages.defEndTime).ToShortTimeString() + sysMessages.msgPeriod;
                    MessageBox.Show(msg,
                                    sysMessages.msgAttention,
                                    MessageBoxButtons.OK,
                                    MessageBoxIcon.Error);
                }
                else if (goodToProceed)
                {
                    addBooth.NewBooth(
                        troopId,
                        DateTime.Parse(dtmDate.Text),
                        DateTime.Parse(dtmTime.Text),
                        txtLocation.Text,
                        boothOps.getMemberId(cboPrimary.Text, troopId),
                        boothOps.getMemberId(cboSecondary.Text, troopId),
                        boothOps.getMemberId(cboAdditional.Text, troopId),
                        boothOps.getMemberId(cboFirstGirl.Text, troopId),
                        boothOps.getMemberId(cboSecondGirl.Text, troopId),
                        boothOps.getMemberId(cboThirdGirl.Text, troopId),
                        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
            {
                if (goodToProceed)
                {
                    clearEntries();
                }
            }
        }