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);
            }
        }
예제 #2
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);
        }
예제 #4
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);
            }
        }