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); } }
public List <int[]> GenerateSequence() { LotteryTicketPanel lotteryTicketPanel = lotteryDataServices.GetLotteryTicketPanel(); List <int[]> sequenceArr = new List <int[]>(); Random rnd = new Random(); for (int ctr = 0; ctr < GetFieldParamValueForCount(); ctr++) { int[] result = new int[lotteryTicketPanel.GetGameDigitCount()]; while (true) { for (int seqCtr = 0; seqCtr < lotteryTicketPanel.GetGameDigitCount(); seqCtr++) { while (true) { int anyDigit = rnd.Next(lotteryTicketPanel.GetMin(), lotteryTicketPanel.GetMax() + 1); if (anyDigit <= 0) { anyDigit = 1; } if (!result.Contains(anyDigit)) { result[seqCtr] = anyDigit; break; } } } int sum = 0; foreach (int i in result) { sum += i; } if (sum >= IN_BETWEEN_SUM_MIN && sum <= IN_BETWEEN_SUM_MAX) { break; } result = new int[lotteryTicketPanel.GetGameDigitCount()]; } Array.Sort(result); sequenceArr.Add(result); } return(sequenceArr); }
public List <int[]> GenerateSequence() { LotteryTicketPanel lotteryTicketPanel = lotteryDataServices.GetLotteryTicketPanel(); List <LotteryBet> betsThisSeason = lotteryDataServices.GetLotteryBetsCurrentSeason(); List <int> merge = new List <int>(); List <int> rawResult = new List <int>(); foreach (LotteryBet bet in betsThisSeason) { merge.AddRange(bet.GetAllNumberSequence()); } for (int ctr = lotteryTicketPanel.GetMin(); ctr < lotteryTicketPanel.GetMax(); ctr++) { if (!merge.Contains(ctr)) { rawResult.Add(ctr); } } int[] result = rawResult.ToArray(); Array.Sort(result); return(GroupAndCountAndSlice(result)); }
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); } }