Ejemplo n.º 1
0
        /// <summary>
        /// 计算注数和金额
        /// </summary>
        void calculate()
        {
            tListLabel.Clear();
            tList.Clear();
            List <bool> dwd = new List <bool>();;

            foreach (var item in ChoiceTabPage.Controls)
            {
                var lc = item as LotteryChoiceNoControl;
                dwd.Add(lc.ChoiceList.Count != 0);
                if (lc != null && lc.ChoiceList.Count > 0)
                {
                    tList.Add(lc.ChoiceList);
                    tListLabel.Add(lc.Choicelbl);
                }
                else
                {
                    if (ChoiceTabPage.Text != "定位胆")
                    {
                        lblTotal.Text = lblTotalTxt;
                        txtBetNo.Text = "";
                        return;
                    }
                }
            }
            if (tList.Count == 0)
            {
                lblTotal.Text = lblTotalTxt;
                txtBetNo.Text = "";
                return;
            }
            var bet = 0;

            switch (ChoiceTabPage.Parent.Tag + ChoiceTabPage.Text)
            {
            case "前三直选复式":
            case "前二直选复式":
                bet = BetCalculateTool.CalculateNoRepeatBet(tList);
                break;

            case "前三直选单式":
                break;

            case "前三组选复式":
                bet = MyTool.CalculateCombination(3, tList[0].Count);
                break;

            case "前三组选单式":
                break;

            case "前三组选胆拖":
                bet = getDT(3);;
                break;

            case "前二组选复式":
                bet = MyTool.CalculateCombination(2, tList[0].Count);
                break;

            case "前二组选胆拖":
                bet = getDT(2);;
                break;

            case "不定位":
            case "定位胆":
            case "趣味定_单双":
            case "趣味猜_中位":
                bet = BetCalculateTool.CalculateN(tList);
                break;

            case "胆拖任选二中二":
                bet = getDT(2);
                break;

            case "胆拖任选三中三":
                bet = getDT(3);
                break;

            case "胆拖任选四中四":
                bet = getDT(4);
                break;

            case "胆拖任选五中五":
                bet = getDT(5);
                break;

            case "胆拖任选六中五":
                bet = getDT(6);
                break;

            case "胆拖任选七中五":
                bet = getDT(7);
                break;

            case "胆拖任选八中五":
                bet = getDT(8);
                break;

            case "任选一中一":
                bet = MyTool.CalculateCombination(1, tList[0].Count);
                break;

            case "任选二中二":
                bet = MyTool.CalculateCombination(2, tList[0].Count);
                break;

            case "任选三中三":
                bet = MyTool.CalculateCombination(3, tList[0].Count);
                break;

            case "任选四中四":
                bet = MyTool.CalculateCombination(4, tList[0].Count);
                break;

            case "任选五中五":
                bet = MyTool.CalculateCombination(5, tList[0].Count);
                break;

            case "任选六中五":
                bet = MyTool.CalculateCombination(6, tList[0].Count);
                break;

            case "任选七中五":
                bet = MyTool.CalculateCombination(7, tList[0].Count);
                break;

            case "任选八中五":
                bet = MyTool.CalculateCombination(8, tList[0].Count);
                break;
            }
            lblTotal.Text = BetCalculateTool.GetTotalMoney(bet, (int)nudBS.Value, cboDW.SelectedIndex);
            lblTotal.Tag  = bet + " " + ChoiceTabPage.Parent.Tag + ChoiceTabPage.Text;
            //在文本框显示号码
            var betNo = "";

            if (bet > 0)
            {
                if (ChoiceTabPage.Text != "定位胆")
                {
                    for (int i = 0; i < tList.Count; i++)
                    {
                        foreach (var item in tList[i].OrderBy(n => n))
                        {
                            betNo += item + " ";
                        }
                        if (betNo.Length > 0)
                        {
                            betNo = betNo.Remove(betNo.Length - 1);
                        }
                        betNo += "|";
                    }
                    betNo = betNo.Remove(betNo.Length - 1);
                }
                else
                {
                    var j = 0;
                    for (int i = 0; i < dwd.Count; i++)
                    {
                        if (!dwd[i])
                        {
                            betNo += "|";
                            j++;
                            continue;
                        }
                        foreach (var item in tList[i - j].OrderBy(n => n))
                        {
                            betNo += item + " ";
                        }
                        if (betNo.Length > 0)
                        {
                            betNo = betNo.Remove(betNo.Length - 1);
                        }
                        betNo += "|";
                    }
                    betNo = betNo.Remove(betNo.Length - 1);
                }
            }
            txtBetNo.Text = betNo;
        }
Ejemplo n.º 2
0
        /// <summary>
        /// 刷新注数
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnCalculate_Click(object sender, EventArgs e)
        {
            LotteryInptuNoControl tb = null;

            foreach (var item in ChoiceTabPage.Controls)
            {
                if (item.GetType() == typeof(LotteryInptuNoControl))
                {
                    tb = (LotteryInptuNoControl)item;
                    break;
                }
            }
            if (tb != null)
            {
                var betStr = tb.GetBetNo();
                var bet    = betStr == "" ? 0 : betStr.Split('|').Length;
                lblTotal.Tag  = bet + " " + ChoiceTabPage.Parent.Tag + ChoiceTabPage.Text;
                lblTotal.Text = BetCalculateTool.GetTotalMoney(bet, (int)nudBS.Value, cboDW.SelectedIndex);
                MessageBox.Show("自动剔除不符合规范号码");
            }
            else
            {
                calculate();
            }
            #region  注
            if (lblTotal.Tag == null)
            {
                return;
            }
            var sp = lblTotal.Tag.ToString().Split(' ');
            if (sp[0] == "0")
            {
                return;
            }
            var     lp = LotteryOpenTool_11x5.LpList().FirstOrDefault(n => n.LotteryPlayName == sp[1]);
            BetInfo b  = new BetInfo
            {
                BetPlayTypeCode = lp.BetPlayTypeCode,
                BetTimes        = Convert.ToInt32(nudBS.Value),
                BetUnit         = Convert.ToInt32(sp[0]),
                BetMoney        = Convert.ToDecimal(lblTotal.Text.Substring(lblTotal.Text.IndexOf("¥") + 1, lblTotal.Text.IndexOf("元") - lblTotal.Text.IndexOf("¥") - 1)),
                AccountId       = account.Id,
                CreateTime      = EntitiesTool.GetDateTimeNow(),
                //LotteryOpenId = nextOpen.Id,
                ResultType       = (int)Enum_ResultType.Wait,
                GetBackPercent   = account.AgentPercent11X5,
                IsGetBackPercent = cboFandian.SelectedIndex != 0,
            };
            if (sp[1].Contains("趣味定_"))
            {
                StringBuilder sb = new StringBuilder();
                foreach (var item in txtBetNo.Text.Split(' '))
                {
                    sb.Append(' ' + item[0].ToString());
                }
                b.BetNum = sb.ToString().Trim();
            }
            else
            {
                b.BetNum = txtBetNo.Text;
            }

            b.MaxBackMoney = (b.IsGetBackPercent?AgentCalculateTool.GetAgentBackMoney_11x5(lp.PayBack, account.AgentPercent11X5):lp.PayBack) * (b.BetMoney / b.BetUnit / 2); //根据是否要返点产生中奖金额
            if (string.IsNullOrEmpty(b.BetNum))
            {
                return;
            }
            wBetList.Add(b);
            #endregion
            var row = dgvwBet.Rows[dgvwBet.Rows.Add()];
            row.Cells[0].Value = sp[1];
            row.Cells[1].Value = b.BetNum;
            row.Cells[2].Value = b.BetUnit;
            row.Cells[3].Value = b.BetTimes;
            row.Cells[4].Value = b.BetMoney;
            row.Cells[5].Value = "X";
        }