Example #1
0
        private void SaveChanges()
        {
            try
            {
                txtStatus.Text = "";
                if (oblViewBets.CheckedItems.Count <= 0)
                {
                    log(ResourcesUtils.GetMessage("mdd_form_validation_msg1"));
                    return;
                }
                log(ResourcesUtils.GetMessage("mdd_form_others_mgs2"));
                if (!IsValidated())
                {
                    log(ResourcesUtils.GetMessage("mdd_form_others_mgs4"));
                    return;
                }

                log(ResourcesUtils.GetMessage("mdd_form_others_mgs1"));
                DateTime newDateTime = dtDrawDate.Value.Date;

                foreach (OLVListItem item in oblViewBets.CheckedItems)
                {
                    LotteryBetSetup bet = (LotteryBetSetup)item.RowObject;
                    bet.TargetDrawDate = newDateTime;

                    if (lotteryDataServices.IsLotteryBetExist(bet))
                    {
                        log(String.Format(ResourcesUtils.GetMessage("mdd_form_validation_msg3"),
                                          bet.GetTargetDrawDateFormatted(), bet.GetGNUFormat()));
                    }
                    else
                    {
                        this.lotteryDataServices.SaveLotteryBetChange(bet);
                        hasDataUpdate = true;
                        log(String.Format(ResourcesUtils.GetMessage("mdd_form_validation_msg4"),
                                          bet.GetTargetDrawDateFormatted(), bet.GetGNUFormat()));
                    }
                }

                log(ResourcesUtils.GetMessage("mdd_form_others_mgs3"));
                log(ResourcesUtils.GetMessage("mdd_form_others_mgs5"));
                FillUpBetList();
                log(ResourcesUtils.GetMessage("mdd_form_others_mgs6"));
            }
            catch (Exception ex)
            {
                log(ex.Message);
                log(ResourcesUtils.GetMessage("mdd_form_others_mgs4"));
            }
        }