private bool InputFormDataValidation()
        {
            DateTime nextDrawDate = (radioBtnPreferredDate.Checked) ? dtPickPreferredDate.Value :
                                    this.lotteryDataServices.GetNextDrawDate();

            DisplayLog(ResourcesUtils.GetMessage("abtmlt_form_msg_31"));
            //RADIO BUTTON
            if (nextDrawDate.Date.CompareTo(DateTime.Now.Date) < 0)
            {
                DisplayLog(ResourcesUtils.GetMessage("abtmlt_form_msg_32"));
            }
            DisplayLog(ResourcesUtils.GetMessage("abtmlt_form_msg_33"));
            if (cmbOutlet.SelectedItem == null || String.IsNullOrWhiteSpace(cmbOutlet.SelectedItem.ToString()))
            {
                throw new Exception(ResourcesUtils.GetMessage("abtmlt_form_msg_34"));
            }

            DisplayLog(ResourcesUtils.GetMessage("abtmlt_form_msg_35"));
            if (!radioBtnNextDrawDate.Checked && !radioBtnPreferredDate.Checked)
            {
                throw new Exception(ResourcesUtils.GetMessage("abtmlt_form_msg_36"));
            }
            if (radioBtnPreferredDate.Checked)
            {
                if (!lotterySchedule.IsDrawDateMatchLotterySchedule(dtPickPreferredDate.Value))
                {
                    String msg = String.Format(ResourcesUtils.GetMessage("abtmlt_form_msg_37"), Environment.NewLine) +
                                 String.Format(ResourcesUtils.GetMessage("abtmlt_form_msg_38"),
                                               dtPickPreferredDate.Value.Date.ToString("MMMM d - dddd"),
                                               this.lotterySchedule.DrawDateEvery());
                    throw new Exception(msg);
                }
            }
            return(true);
        }
Exemple #2
0
        private bool IsValidated()
        {
            DateTime newDateTime = dtDrawDate.Value.Date;

            if (!lotterySchedule.IsDrawDateMatchLotterySchedule(newDateTime))
            {
                log(String.Format(ResourcesUtils.GetMessage("mdd_form_validation_msg2"),
                                  newDateTime.Date.ToString("dddd"),
                                  lotterySchedule.DrawDateEvery()));
                return(false);
            }
            else if (newDateTime.CompareTo(DateTimeConverterUtils.GetYear2011()) < 0) //if earlier
            {
                log(ResourcesUtils.GetMessage("mdd_form_validation_msg5"));
                return(false);
            }
            else if (newDateTime.CompareTo(DateTime.Now.Date) == 0) //if the same
            {
                if (lotteryDataServices.IsPastTicketSellingCutoffTime())
                {
                    DialogResult drPassCutOfftime = MessageBox.Show(ResourcesUtils.GetMessage("mdd_form_validation_msg8"),
                                                                    ResourcesUtils.GetMessage("mdd_form_others_mgs7"), MessageBoxButtons.OKCancel, MessageBoxIcon.Exclamation);
                    if (drPassCutOfftime != DialogResult.OK)
                    {
                        log(ResourcesUtils.GetMessage("mdd_form_validation_msg6"));
                        return(false);
                    }
                }
            }
            return(true);
        }
Exemple #3
0
        private List <DashboardReportItemSetup> GetNextDrawDates()
        {
            List <DashboardReportItemSetup> itemsList = new List <DashboardReportItemSetup>();
            int             ctrDays              = 14;
            LotterySchedule lotterySchedule      = LotteryDataServices.GetLotterySchedule();
            DateTime        dateStartingTommorow = DateTime.Now.AddDays(1);
            int             idxLabel             = 1;

            for (int ctr = 1; ctr <= ctrDays; ctr++)
            {
                if (lotterySchedule.IsDrawDateMatchLotterySchedule(dateStartingTommorow))
                {
                    String key   = String.Format("{0} ({1})", ResourcesUtils.GetMessage("drpt_next_lottery_sched"), idxLabel++);
                    String value = DateTimeConverterUtils.ConvertToFormat(dateStartingTommorow, DateTimeConverterUtils.DATE_FORMAT_LONG);

                    DashboardReportItemSetup itm2 = GenModel(key, value);
                    itm2.GroupKeyName = ResourcesUtils.GetMessage("drpt_lottery_schedules");
                    itemsList.Add(itm2);
                }
                dateStartingTommorow = dateStartingTommorow.AddDays(1);
            }
            return(itemsList);
        }
Exemple #4
0
        private List <DashboardReportItemSetup> GetPreviousDrawDates()
        {
            List <DashboardReportItemSetup> itemsList = new List <DashboardReportItemSetup>();
            int             ctrDays         = 14;
            LotterySchedule lotterySchedule = LotteryDataServices.GetLotterySchedule();
            DateTime        dateLastXDays   = DateTime.Now.AddDays(-ctrDays);
            int             idxLabel        = 1;

            //for one week schedule only
            for (int ctr = 1; ctr <= ctrDays; ctr++)
            {
                if (lotterySchedule.IsDrawDateMatchLotterySchedule(dateLastXDays))
                {
                    String key   = String.Format("{0} ({1})", ResourcesUtils.GetMessage("drpt_prev_lottery_sched"), idxLabel++);
                    String value = DateTimeConverterUtils.ConvertToFormat(dateLastXDays, DateTimeConverterUtils.DATE_FORMAT_LONG);
                    DashboardReportItemSetup dshSetup = GenModel(key, value);
                    dshSetup.ReportItemDecoration.FontColor = ReportItemDecoration.COLOR_NO_FOCUS;
                    dshSetup.GroupKeyName = ResourcesUtils.GetMessage("drpt_lottery_schedules");
                    itemsList.Add(dshSetup);
                }
                dateLastXDays = dateLastXDays.AddDays(1);
            }
            return(itemsList);
        }