private void ObjectListViewBets_CellEditFinished(object sender, BrightIdeasSoftware.CellEditEventArgs e)
        {
            try
            {
                if (e.NewValue.ToString() == e.Value.ToString())
                {
                    e.Cancel = true;
                }
                if (e.Cancel == false)
                {
                    int newValue = int.Parse(e.NewValue.ToString());
                    if (!lotteryTicketPanel.IsWithinMinMax(newValue))
                    {
                        throw new Exception(String.Format(ResourcesUtils.GetMessage("mod_clm_stat_msg_6"),
                                                          lotteryTicketPanel.GetMin(), lotteryTicketPanel.GetMax()));
                    }

                    ObjectListView  lv    = (ObjectListView)sender;
                    LotteryBetSetup setup = (LotteryBetSetup)e.RowObject;
                    setup.FillNumberBySeq(e.SubItemIndex - 1, newValue);
                    e.ListViewItem.Tag = MODIFIED_TAG;
                    lv.RefreshObject(e.RowObject);
                    lv.Refresh();
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, ResourcesUtils.GetMessage("mod_clm_stat_msg_7"));
                e.Cancel = true;
            }
            finally
            {
                ColorListViewItemIfModified(e.ListViewItem);
            }
        }
 private void CompleteLotteryBetDetails(LotteryBetSetup lotteryBet)
 {
     lotteryBet.GameCode       = this.lotteryDataServices.LotteryDetails.GameCode;
     lotteryBet.LotterySeqGen  = (LotterySequenceGenerator)cmbSeqGenType.SelectedItem;
     lotteryBet.TargetDrawDate = GetUserSelectedDrawDate();
     lotteryBet.BetAmount      = lotteryDataServices.LotteryDetails.Lottery.GetPricePerBet();
     lotteryBet.OutletCode     = ((LotteryOutlet)cmbOutlet.SelectedItem).GetOutletCode();
 }
        private List <LotteryBet> ValidateAndCompileData()
        {
            List <LotteryBet> lotteryBetArr = new List <LotteryBet>();

            try
            {
                if (tabControlInputs.SelectedTab == tabPageDelimiters)
                {
                    foreach (string line in StringUtils.GetLines(textBoxDelimitersInput.Text))
                    {
                        if (String.IsNullOrWhiteSpace(line))
                        {
                            continue;
                        }
                        DisplayLog(ResourcesUtils.GetMessage("abtmlt_form_msg_26") + line);
                        //validation
                        String[] splitted = null;
                        foreach (String delimiter in StringUtils.COMMON_DELIMITERS)
                        {
                            splitted = line.Split(delimiter.ToCharArray());
                            if (splitted == null)
                            {
                                continue;
                            }
                            if (splitted.Length != lotteryTicketPanel.GetGameDigitCount())
                            {
                                continue;
                            }
                            if (IsNumberSequenceValid(splitted))
                            {
                                break;
                            }
                        }
                        LotteryBetSetup lotteryBet = new LotteryBetSetup();
                        lotteryBet.PutNumberSequence(line);
                        CompleteLotteryBetDetails(lotteryBet);
                        lotteryBetArr.Add(lotteryBet);
                    }
                    if (lotteryBetArr.Count <= 0)
                    {
                        throw new Exception(ResourcesUtils.GetMessage("abtmlt_form_msg_27"));
                    }
                }
                else if (tabControlInputs.SelectedTab == tabPageClick)
                {
                    DisplayLog(ResourcesUtils.GetMessage("abtmlt_form_msg_28"));
                    LotteryBetSetup lotteryBet = new LotteryBetSetup();
                    lotteryBet.PutNumberSequence(lblSelectedNumber.Text.Replace(" ", ""));
                    CompleteLotteryBetDetails(lotteryBet);
                    lotteryBetArr.Add(lotteryBet);
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return(lotteryBetArr);
        }
Exemplo n.º 4
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"));
            }
        }
Exemplo n.º 5
0
        private void DisplayGeneratedSequence(List <int[]> seqArr)
        {
            List <LotteryBet> arrLottery = new List <LotteryBet>();
            int ctrId = 0;

            foreach (int[] seq in seqArr)
            {
                LotteryBetSetup bet = new LotteryBetSetup();
                bet.Id = ++ctrId;
                for (int seqCtr = 0; seqCtr < seq.Length; seqCtr++)
                {
                    bet.FillNumberBySeq(seqCtr + 1, seq[seqCtr]);
                }
                arrLottery.Add(bet);
            }
            objLvGenSeq.Tag = lvGenType.SelectedObject;
            objLvGenSeq.SetObjects(arrLottery);
        }
        public List <int[]> GenerateSequence()
        {
            StartPickGeneration();
            int          maximumPickCount = GetFieldParamValueForCount(0);
            int          matchPerc        = GetFieldParamValueForCount(1);
            int          maxLoopBreaker   = int.MaxValue - 100;
            int          maxLoopCtr       = 0;
            List <int[]> results          = new List <int[]>();
            LottoMatchCountInputModel sampleData;
            LotteryBetSetup           lotteryBet = new LotteryBetSetup();

            lotteryBet.GameCode = lotteryDataServices.LotteryDetails.GameCode;
            Random ran = new Random();

            while (results.Count < maximumPickCount)
            {
                int[] randomSeq = LuckyPickGenerator(ran);
                lotteryBet.ResetSequenceToZero();
                lotteryBet.FillNumberBySeq(randomSeq);
                sampleData = lotteryBet.GetLottoMatchCountInputModel();
                LottoMatchCountOutputModel output = LottoMatchCountPredictor.Predict(sampleData);
                int score = (int)(output.Score * 100);
                PickGenerationProgressEvent.IncrementGenerationAttemptCount();
                if (score >= matchPerc)
                {
                    Array.Sort(randomSeq);
                    results.Add(randomSeq);
                    PickGenerationProgressEvent.IncrementGeneratedPickCount();
                }
                if (!IsContinuePickGenerationProgress())
                {
                    break;
                }
                if (maxLoopCtr++ > maxLoopBreaker)
                {
                    break;
                }
            }
            return(results);
        }
Exemplo n.º 7
0
        private void ObjectListViewBets_CellEditFinished(object sender, BrightIdeasSoftware.CellEditEventArgs e)
        {
            try
            {
                if (e.Column == this.olvLottoOutlet)
                {
                    LotteryOutlet oldval = (LotteryOutlet)e.Value;
                    LotteryOutlet newval = (LotteryOutlet)e.NewValue;
                    if (newval == null)
                    {
                        e.Cancel = true; return;
                    }
                    if (oldval.GetOutletCode() == newval.GetOutletCode())
                    {
                        e.Cancel = true;
                    }
                    if (e.Cancel == false)
                    {
                        ObjectListView  lv    = (ObjectListView)sender;
                        LotteryBetSetup setup = (LotteryBetSetup)e.RowObject;
                        setup.OutletCode    = newval.GetOutletCode();
                        e.ListViewItem.Tag  = MODIFIED_TAG;
                        setup.LotteryOutlet = GetOutletObject(newval.GetOutletCode());
                        lv.RefreshObject(e.RowObject);
                        lv.Refresh();
                    }
                }
                else if (e.Column == this.olvLottoSeqGen)
                {
                    LotterySequenceGenerator oldval = (LotterySequenceGenerator)e.Value;
                    LotterySequenceGenerator newval = (LotterySequenceGenerator)e.NewValue;
                    if (newval == null)
                    {
                        e.Cancel = true; return;
                    }
                    if (oldval.GetSeqGenCode() == newval.GetSeqGenCode())
                    {
                        e.Cancel = true;
                    }
                    if (e.Cancel == false)
                    {
                        ObjectListView  lv    = (ObjectListView)sender;
                        LotteryBetSetup setup = (LotteryBetSetup)e.RowObject;
                        e.ListViewItem.Tag  = MODIFIED_TAG;
                        setup.LotterySeqGen = GetSeqGenObject(newval.GetSeqGenCode());
                        lv.RefreshObject(e.RowObject);
                        lv.Refresh();
                    }
                }
                else
                {
                    if (e.NewValue.ToString() == e.Value.ToString())
                    {
                        e.Cancel = true;
                    }
                    if (e.Cancel == false)
                    {
                        int newValue = int.Parse(e.NewValue.ToString());
                        if (!lotteryTicketPanel.IsWithinMinMax(newValue))
                        {
                            throw new Exception(String.Format(ResourcesUtils.GetMessage("modfy_bets_msg_5"),
                                                              lotteryTicketPanel.GetMin(), lotteryTicketPanel.GetMax()));
                        }

                        ObjectListView  lv    = (ObjectListView)sender;
                        LotteryBetSetup setup = (LotteryBetSetup)e.RowObject;
                        setup.FillNumberBySeq(e.SubItemIndex - 1, newValue);
                        e.ListViewItem.Tag = MODIFIED_TAG;
                        lv.RefreshObject(e.RowObject);
                        lv.Refresh();
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, ResourcesUtils.GetMessage("modfy_bets_msg_6"));
                e.Cancel = true;
            }
            finally
            {
                ColorListViewItemIfModified(e.ListViewItem);
            }
        }