protected void Button1_Click(object sender, EventArgs e)
    {
        try
        {
            string rivi = "";

            Random rnd = new Random();

            if (t == 0 /*DropDownList1.SelectedItem.Text=="Suomi"*/)
            {
                rivi = Lotto.Luvut(7, 39, rnd);                                                // KIRJOITIN UUDESTAAN JA ... yms. ... // VIEW BROWSER
            }
            if (t == 1 /*DropDownList1.SelectedItem.Text == "Viking"*/)
            {
                rivi = Lotto.Luvut(6, 48, rnd);                                                     // KIRJOITIN UUDESTAAN JA ... yms. ... // VIEW BROWSER
            }
            TextBox1.Text = rivi;

            //rivi = l.Luvut(7, 39, rnd);
        }
        catch (Exception)
        {
            throw;
        }
    }
示例#2
0
        private void setLotto(String rowId)
        {
            Lotto lot = new Lotto();

            lot = lc.lotdb.selectByPk(rowId);
            if (!lot.rowId.Equals(""))
            {
                gBLotto.Visible = true;
            }
            else
            {
                gBLotto.Visible = false;
            }
            if (lot.Active.Equals("1"))
            {
                chkActive.Checked   = true;
                ChkUnActive.Checked = false;
                btnUnActive.Visible = false;
            }
            else
            {
                chkActive.Checked   = false;
                ChkUnActive.Checked = true;
                btnUnActive.Visible = true;
            }
            txtDown.Text  = lot.down;
            txtInput.Text = lot.number;
            txtTod.Text   = lot.tod;
            txtUp.Text    = lot.up;
            txtRowId.Text = lot.rowId;
        }
示例#3
0
        private void bValitseRivit_Click(object sender, RoutedEventArgs e)
        {
            int    rivit = int.Parse(txtbRivienLkm.Text);
            string value = cmbValinta.SelectedValue.ToString();
            string tulos = "";


            for (int i = 0; i < rivit; i++)
            {
                if (value == "Lotto")
                {
                    Lotto lotto = new Lotto(40, 7);
                    tulos += (numerot.ToString() + "\n");
                }
                else if (value == "VikingLotto")
                {
                    Lotto vikinglotto = new Lotto(48, 6);
                    tulos += (numerot.ToString() + "\n");
                }
                else if (value == "EuroJackpot")
                {
                    Lotto eurojackpot = new Lotto(50, 5);
                    tulos += (numerot.ToString() + "\n");
                }
            }
            txtbNaytaNrot.Text = tulos;
        }
示例#4
0
        public void GetRoundsDifferance(int rounds)
        {
            var testGame = (BasicGame)_games.GameTypes[(int)GameType.Lotto];
            var start    = testGame.CurrentRound - rounds;
            var labels   = Enumerable.Range(start, testGame.CurrentRound - start + 1).Reverse().ToList();
            var ltj      = new Lotto();

            ltj.GetResultsModel(SavePath, labels, true);
            var roundsDifferance = new List <int[]>();
            var ballsPrevious    = new int[8];

            for (var i = 0; i < rounds; i++)
            {
                var ballsDifferance = new int[8];
                if (i > 0)
                {
                    for (var j = 0; j < 8; j++)
                    {
                        ballsDifferance[j] = Math.Abs(ballsPrevious[j] - (int)ltj.Model[j].Data[i]);
                    }
                    roundsDifferance.Add(ballsDifferance.OrderBy(q => q).ToArray());
                }

                for (var j = 0; j < 8; j++)
                {
                    ballsPrevious[j] = (int)ltj.Model[j].Data[i];
                }
            }
            System.IO.File.WriteAllLines(SavePath + "DifferanceUnsigned.txt", roundsDifferance.Select(a => string.Join(" ", a)));
        }
示例#5
0
 private void init()
 {
   // Create instance of Lotto
   lotto = new Lotto();
   // Create instance of business logic
   business = new BusinessLogic();
 }
示例#6
0
        private void saveLotto()
        {
            Lotto  lot = new Lotto();
            String lotId = "", Cbdl = "";

            //if (lotNew)
            //{
            lotId = lot.getGenID();
            Cbdl  = lc.lotdb.selectCDbl();
            //}
            for (int i = 0; i < dgv1.RowCount; i++)
            {
                if (dgv1[colNumber, i].Value == null)
                {
                    continue;
                }
                lot = setLotto(i);
                if (lot.lottoId.Equals(""))
                {
                    if (lotNew)
                    {
                        lot.lottoId = lotId;
                        lot.CDbl    = Cbdl;
                    }
                    else
                    {
                        lot.lottoId = lotId1;
                    }
                }
                lc.saveLotto(lot);
                dgv1.Rows[i].DefaultCellStyle.BackColor = Color.DarkKhaki;
            }
            refresh();
        }
示例#7
0
        public String saveLotto(Lotto p)
        {
            String chk = "";

            p.macName = initC.MacName;
            chk       = lotdb.insertLotto(p);
            return(chk);
        }
示例#8
0
        private void saveLotto()
        {
            Lotto  lot = new Lotto();
            String lotId = "", Cbdl = "";

            //if (lotNew)
            //{
            lotId = lot.getGenID();
            Cbdl  = lc.lotdb.selectCDbl();
            //}
            pB1.Visible = true;
            pB1.Minimum = 0;
            pB1.Maximum = dgv1.Rows.Count;

            if (!chkMoveAll.Checked && !chkMoveImage.Checked && !chkVoidImage.Checked)
            {
                MessageBox.Show("กรุณาเลือกรายการ ย้าย", "");
                return;
            }
            if (chkVoidImage.Checked)
            {
                if (MessageBox.Show("ต้องการยกเลิก", "", MessageBoxButtons.YesNo) == System.Windows.Forms.DialogResult.Yes)
                {
                    if (lc.imgdb.VoidImage(img.Id, sf.Id).Equals("1"))
                    {
                        lc.lotdb.VoidImage(img.Id, sf.Id);
                        MessageBox.Show("ยกเลิก เรียบร้อย", "");
                    }
                }
            }
            else if (chkMoveAll.Checked)
            {
                if (MessageBox.Show("ต้องการย้ายรูป และข้อมูล", "", MessageBoxButtons.YesNo) == System.Windows.Forms.DialogResult.Yes)
                {
                    if (lc.imgdb.UpdateSale(img.Id, lc.cf.getValueCboItem(cboSaleNew)).Equals("1"))
                    {
                        lc.lotdb.UpdateSaleFromImage(img.Id, lc.cf.getValueCboItem(cboSaleNew), sf.Id);
                        MessageBox.Show("ย้ายรูป และข้อมูล เรียบร้อย", "");
                    }
                }
            }
            else if (chkMoveImage.Checked)
            {
                if (MessageBox.Show("ต้องการย้ายแต่รูป และยกเลิกข้อมูล", "", MessageBoxButtons.YesNo) == System.Windows.Forms.DialogResult.Yes)
                {
                    if (lc.imgdb.UpdateSale(img.Id, lc.cf.getValueCboItem(cboSaleNew)).Equals("1"))
                    {
                        lc.lotdb.VoidImage(img.Id, sf.Id);
                        MessageBox.Show("ยกเลิก เรียบร้อย", "");
                    }
                }
            }

            pB1.Visible = false;
            refresh();
        }
示例#9
0
        public static void Main(string[] args)
        {
            var draws = Lotto.GetDraws();

            foreach (var draw in draws)
            {
                PlotDraw(draw);
                Console.WriteLine();
            }
        }
示例#10
0
        public void CheckRoundYear_2018()
        {
            var testGame = (BasicGame)_games.GameTypes[(int)GameType.Lotto];
            var start    = (int)Math.Floor((new DateTime(2018, 1, 1).Subtract(testGame.Init.InitialDate).TotalDays - 1) / 7) + 2;
            var end      = (int)Math.Floor((new DateTime(2018, 12, 31).Subtract(testGame.Init.InitialDate).TotalDays - 1) / 7) + 2;

            for (var i = start; i < end; i++)
            {
                var res = Lotto.GetNumbers(SavePath + testGame.Init.Name, i);
                Trace.WriteLine(res.MainTable.ToString() + "," + res.DrawDate);
            }
        }
示例#11
0
        static void Main(string[] args)
        {
            var lotto = new Lotto();


            foreach (var i in lotto.LottoLine())
            {
                Console.WriteLine(i);
            }

            Console.ReadLine();
        }
示例#12
0
        private Lotto setLotto(int row)
        {
            Lotto lot = new Lotto();

            lot.rowNumber  = row.ToString();
            lot.Active     = "1";
            lot.dateCancel = "";
            lot.dateCreate = "";
            lot.dateModi   = "";


            lot.lottoId = dgv1[colLottoId1, row].Value.ToString();
            lot.yearId  = cboYear.Text;
            lot.monthId = cboMonth.SelectedValue.ToString();

            lot.periodId = cboPeriod.SelectedValue.ToString();
            lot.Remark   = "";
            lot.rowId    = dgv1[colRowId, row].Value.ToString();
            //lot.saleId = cboSale.SelectedValue.ToString();

            lot.saleId        = lc.cf.getValueCboItem(cboSale);
            lot.staffId       = lc.cf.getValueCboItem(cboStaff);
            lot.thooId        = lc.cf.getValueCboItem(cboThoo);
            lot.thooTranferId = lot.thooId;

            lot.staffCancel = "";
            lot.staffCreate = "";

            lot.staffModi = "";

            lot.number      = lc.cf.LottoNull(dgv1[colNumber, row].Value);
            lot.down        = lc.cf.LottoNull(dgv1[colDown, row].Value);
            lot.tod         = lc.cf.LottoNull(dgv1[colTod, row].Value);
            lot.up          = lc.cf.LottoNull(dgv1[colUp, row].Value);
            lot.statusInput = "2";
            lot.imgId       = img.Id;
            lot.number      = lot.number.Trim();
            lot.numberReal  = lc.cf.LottoNull(dgv1[colNumberReal, row].Value);
            //if (txtImgId.Text.IndexOf("_0") > 0)
            //{
            //    lot.imgId = txtImgId.Text.Replace(txtImgId.Text.Substring(txtImgId.Text.IndexOf("_0")), "");
            //}
            //else
            //{
            //    lc.imgdb.UpdateStatusInput(txtImgId.Text, sf.Id, sf.Name);
            //}

            return(lot);
        }
示例#13
0
        private void initConfig(String sfCode, String rowId, LottoryControl l)
        {
            lot      = new Lotto();
            lc       = l;
            cboThoo  = lc.thodb.getCboThoo(cboThoo);
            cboStaff = lc.sfdb.getCboStaff(cboStaff);
            cboSale  = lc.saledb.getCboSale(cboSale);
            //cboThoo = lc.cboThoo;
            //cboStaff = lc.cboStaff;
            //cboSale = lc.cboSale;

            cboMonth  = lc.cf.setCboMonth(cboMonth);
            cboPeriod = lc.cf.setCboPeriod(cboPeriod);
            cboYear   = lc.cf.setCboYear(cboYear);
            setControl(rowId);
        }
    protected void btnDraw_Click(object sender, EventArgs e)
    {
        divRows.InnerHtml = "Arvotut rivit: <br>";
        Lotto lotto = new Lotto();

        lotto.Tyyppi = ddlType.SelectedValue;
        for (int i = 0; i < Convert.ToInt32(ddlRows.SelectedValue); i++)
        {
            ArrayList drawnRows = lotto.Draw();
            foreach (var number in drawnRows)
            {
                divRows.InnerHtml += number + "   ";
            }
            divRows.InnerHtml += "<br>";
        }
    }
    protected void btnDraws_Click(object sender, EventArgs e)
    {
        try
        {
            List <int> results = new List <int>();

            Regex pattern = new Regex("^[1-9]+$");
            if (!pattern.IsMatch(txtDraws.Text))
            {
                lblAlert.Text = "Please specify a number higher than 0 for the lottery";
            }
            else if (txtDraws.Text == "")
            {
                lblAlert.Text = "Please specify a number higher than 0 for the lottery";
            }
            else
            {
                int drawnumber = int.Parse(txtDraws.Text);

                for (int i = 0; i != drawnumber; i++)
                {
                    if (i >= 1 || lsbNumbers.Items.Count == 0)
                    {
                        lsbNumbers.Items.Add("Next lottery");
                    }

                    Lotto lotto = new Lotto(ddlLottery.SelectedValue);

                    results = lotto.ArvoRivi();

                    for (int nro = 0; nro < results.Count; nro++)
                    {
                        lsbNumbers.Items.Add(results[nro].ToString());
                    }
                }

                lblAlert.Text = "...";
            }
        }
        catch (Exception er)
        {
            lblAlert.Text = "Invalid input: " + er;
        }
    }
示例#16
0
        private void setControl(String rowId)
        {
            //ComboBoxItem aa = new ComboBoxItem();
            lot = lc.selectLottobyPk(rowId);

            txtInput.Text = lot.number;
            txtUp.Text    = lot.up;
            txtTod.Text   = lot.tod;
            txtDown.Text  = lot.down;
            txtRowId.Text = lot.rowId;

            txtLotId.Text = lot.lottoId;

            cboThoo.SelectedItem  = lc.getCboItem(cboThoo, lot.thooId);
            cboStaff.SelectedItem = lc.getCboItem(cboStaff, lot.staffId);
            cboSale.SelectedItem  = lc.getCboItem(cboSale, lot.saleId);
            //cboThoo.SelectedValue = lc.getCboItem(cboThoo, lot.thooId);
            cboYear.Text            = lot.yearId;
            cboMonth.SelectedValue  = lot.monthId;
            cboPeriod.SelectedValue = lot.periodId;
            //rw.dateReward;
        }
示例#17
0
        private Lotto setLotto(int row)
        {
            Lotto lot = new Lotto();

            lot.rowNumber  = row.ToString();
            lot.Active     = "1";
            lot.dateCancel = "";
            lot.dateCreate = "";
            lot.dateModi   = "";


            lot.lottoId = dgv1[colLottoId1, row].Value.ToString();
            lot.yearId  = cboYear.Text;
            lot.monthId = cboMonth.SelectedValue.ToString();

            lot.periodId = cboPeriod.SelectedValue.ToString();
            lot.Remark   = "";
            lot.rowId    = dgv1[colRowId, row].Value.ToString();
            //lot.saleId = cboSale.SelectedValue.ToString();

            lot.saleId        = lc.cf.getValueCboItem(cboSale);
            lot.staffId       = lc.cf.getValueCboItem(cboStaff);
            lot.thooId        = lc.cf.getValueCboItem(cboThoo);
            lot.thooTranferId = lot.thooId;

            lot.staffCancel = "";
            lot.staffCreate = "";

            lot.staffModi = "";

            lot.number      = lc.cf.LottoNull(dgv1[colNumber, row].Value);
            lot.down        = lc.cf.LottoNull(dgv1[colDown, row].Value);
            lot.tod         = lc.cf.LottoNull(dgv1[colTod, row].Value);
            lot.up          = lc.cf.LottoNull(dgv1[colUp, row].Value);
            lot.statusInput = "1";
            lot.imgId       = "";

            return(lot);
        }
示例#18
0
        private void saveLotto()
        {
            Lotto  lot = new Lotto();
            String lotId = "", Cbdl = "";

            //Double amt = 0;
            //if (lotNew)
            //{
            lotId = lot.getGenID();
            Cbdl  = lc.lotdb.selectCDbl();
            //}
            pB1.Visible = true;
            pB1.Minimum = 0;
            pB1.Maximum = dgv1.Rows.Count;
            for (int i = 0; i < dgv1.RowCount; i++)
            {
                if (dgv1[colNumber, i].Value == null)
                {
                    continue;
                }
                if (!dgv1[colEdit, i].Value.ToString().Equals("1"))//Check ว่ามีการแก้ไข หรือเป็นข้อมูลใหม่
                {
                    continue;
                }
                lot = setLotto(i);
                //amt += Double.Parse(lc.cf.NumberNull1(lot.up)) + Double.Parse(lc.cf.NumberNull1(lot.tod))+Double.Parse(lc.cf.NumberNull1(lot.down));

                if (lot.lottoId.Equals(""))
                {
                    if (lotNew)
                    {
                        lot.lottoId = lotId;
                        lot.CDbl    = Cbdl;
                    }
                    else
                    {
                        lot.lottoId = lotId1;
                    }
                }
                lot.lottoId = lc.saveLotto(lot);
                if (StatusCheck)// มาจากหน้าจอ inputImage
                {
                    //lot.numberOld = lot.numberOld;
                    lot.SfCheck1Id = lot.staffId;
                    if (StatusCheck2)
                    {
                        lc.lotdb.updateCheck2(lot);
                    }
                    else
                    {
                        lc.lotdb.updateCheck(lot);
                    }
                }

                dgv1.Rows[i].DefaultCellStyle.BackColor = Color.DarkKhaki;
                pB1.Value = i;
                //lV1.Items[txtIndex.Text].Checked = true;
            }
            if (pic1.Image != null)
            {
                pic1.CancelAsync();
                pic1.Image.Dispose();
                //lc.renameFileImage(lc.initC.pathImage + "\\" + cboYear.Text + "\\" + cboMonth.SelectedValue.ToString() + "\\" + cboPeriod.SelectedValue.ToString() + "\\" + txtImgId.Text);           //580216
                //lc.renameFileImage(lc.initC.pathImage + "\\" + cboYear.Text + "\\" + cboMonth.SelectedValue.ToString() + "\\" + cboPeriod.SelectedValue.ToString() + "\\" + txtImgId.Text.Replace(".lotto", ".thumb"));       //580216
                //ListViewItem i = lV1.SelectedItems[0];
                //txtImgId.Text = name[i.ImageIndex];

                //if (txtImgId.Text.IndexOf("_0") > 0)
                //{
                if (!StatusCheck)// มาจากหน้าจอ inputImage
                {
                    lc.imgdb.UpdateStatusInput(img.Id, sf.Id, sf.Name, lc.cf.getValueCboItem(cboThoo), lbAmt.Text.Replace(",", "").Replace("รวม", "").Replace(":", "").Trim());
                }
                else// มาจากหน้าจอ inputImageCheck
                {
                    if (StatusCheck2)
                    {
                        lc.imgdb.UpdateStatusCheck2(img.Id, sf.Id, lc.cf.getValueCboItem(cboThoo), lbAmt.Text.Replace(",", "").Replace("รวม", "").Replace(":", "").Trim());
                    }
                    else
                    {
                        lc.imgdb.UpdateStatusCheck(img.Id, sf.Id, lc.cf.getValueCboItem(cboThoo), lbAmt.Text.Replace(",", "").Replace("รวม", "").Replace(":", "").Trim());
                    }
                }

                //}
                //else
                //{
                //    lc.imgdb.UpdateStatusInput(img.Id, sf.Id, sf.Name,lc.cf.getValueCboItem(cboThoo));
                //}
                //name[rowImage] = name[rowImage].Replace("_0", "_1");          //580216
            }

            lc.imgdb.UpdateUnLock(img.Id);
            //if (txtIndex.Text.Equals("."))
            //{
            if (lV1.Items.Count > int.Parse(txtIndex.Text))
            {
                //txtIndex.Text = String.Concat(int.Parse(txtIndex.Text) + 1);
                lV1.Items[int.Parse(txtIndex.Text)].Checked = true;
            }
            //}
            pB1.Visible = false;
            refresh();
        }
示例#19
0
        private void initConfig()
        {
            iniFile = new IniFile(Environment.CurrentDirectory + "\\" + Application.ProductName + ".ini");
            initC   = new InitConfig();
            //regE = new RegEdit();
            //MessageBox.Show("aaa " + Environment.CurrentDirectory + "\\" + Application.ProductName + ".ini", "LottoryControl StatusServer" + initC.StatusServer.ToLower());
            GetConfig();
            //MessageBox.Show("bbb", "LottoryControl");
            cf = new Config1();
            //MessageBox.Show("ccc", "LottoryControl");
            conn   = new ConnectDB(initC);
            ratedb = new RateDB(conn);
            saledb = new SaleDB(conn);
            sfdb   = new StaffDB(conn);
            thodb  = new ThooDB(conn);
            lotdb  = new LottoDB(conn);
            rwdb   = new RewardDB(conn);
            fldb   = new FlockDB(conn);
            srdb   = new SaleRateDB(conn);
            cudb   = new CustomerDB(conn);
            imgdb  = new ImageDB(conn);
            nldb   = new NumberLimitDB(conn);
            //MessageBox.Show("ddd", "LottoryControl");
            rate  = new Rate();
            sale  = new Sale();
            staff = new Staff();
            tho   = new Thoo();
            lot   = new Lotto();
            rw    = new Reward();
            fl    = new FLock();
            sr    = new SaleRate();
            cu    = new Customer();
            img   = new Image1();
            nl    = new NumberLimit();

            r2Down = new Rate();
            r2Tod  = new Rate();
            r2Up   = new Rate();
            r3Up   = new Rate();
            r3Tod  = new Rate();
            r3Down = new Rate();
            rUp    = new Rate();
            rDown  = new Rate();
            //MessageBox.Show("bbb", "LottoryControl");
            rUp    = ratedb.selectByPk("up");
            rDown  = ratedb.selectByPk("down");
            r3Up   = ratedb.selectByPk("3up");
            r3Tod  = ratedb.selectByPk("3tod");
            r3Down = ratedb.selectByPk("3down");
            r2Down = ratedb.selectByPk("2down");
            r2Up   = ratedb.selectByPk("2up");
            lTho   = thodb.setData();
            setThoColor();
            lsr = srdb.selectSRAll();
            ls  = saledb.selectSAll();
            lnl = selectByNumberLimit();
            //cboThoo = new ComboBox();
            cbosf = new ComboBox();
            //cboSale = new ComboBox();
            //cboThoo = thodb.getCboThoo(cboThoo);
            cbosf = sfdb.getCboStaff(cbosf);
            //cboSale = saledb.getCboSale(cboSale);
        }
示例#20
0
 static void Main(string[] args)
 {
     Lotto MyLotto = new Lotto();
 }
示例#21
0
 public Lotto selectLottobyPk(String rowId)
 {
     lot = lotdb.selectByPk(rowId);
     return(lot);
 }
示例#22
0
        public void CreateNewLottoOrganization(string name)
        {
            Lotto newOrganization = new Lotto(name);

            DataHelper.LottoOrganization = newOrganization;
        }