コード例 #1
0
ファイル: fmsscMainWin.cs プロジェクト: git-martin/ssc
        private void BettingSln(object currentIssue)
        {
            for (int i = 0; i < currentBetModels.Count; i++)
            {
                var model = currentBetModels[i];
                try
                {
                    model.CurrentIssueStr = currentIssue.ToString();
                    string token = model.CurrentToken;
                    UpdateInfo(string.Format("正在投注{0}账号【{1}】的方案【{2}】...", model.BelongsStr, model.LoginName,
                                             model.BettingNumStr));
                    if (model.Belongs == GloableConstants.AccountBelongs.Jiang)
                    {
                        JiangComController.BettingYiXing(ref model, token);
                    }
                    if (model.Belongs == GloableConstants.AccountBelongs.Qcw)
                    {
                        QcwComController.BettingYiXing(ref model, token);
                    }
                    UpdateInfo(string.Format("{0}账号【{1}】的方案投注完成,结果:{2}.", model.BelongsStr, model.LoginName, model.IsBettingSuccMsg));
                }
                catch (Exception ex)
                {
                    if (!model.IsBettingSucc && model.ResponseCode != 0)
                    {
                        model.IsBettingSucc = false;
                        model.MyMessage     = ex.Message;
                    }
                }
                finally
                {
                    bettedModels.Insert(0, model);
                    //显示投注历史
                    this.dgProcessed.BeginInvoke(new MethodInvoker(delegate()
                    {
                        this.dgProcessed.AutoGenerateColumns = false;
                        this.dgProcessed.DataSource          =
                            new BindingList <BettingSolutinModel>(bettedModels.GetRange(0, bettedModels.Count));
                    }));
                }
            }
            //end
            UpdateInfo("投注完毕!请注意核查网数据,\r\n\r\n如何下方有显示投注失败的,请手动去网站补单!");

            this.btnCreateSln.BeginInvoke(new MethodInvoker(delegate()
            {
                this.btnCreateSln.Enabled = true;
            }));

            this.btnBet.BeginInvoke(new MethodInvoker(delegate()
            {
                this.btnBet.Enabled = true;
            }));
        }
コード例 #2
0
ファイル: fmsscMainWin.cs プロジェクト: git-martin/ssc
        private void CreateSln(object slnInex)
        {
            int selectedSolutionIndex = (int)slnInex;

            this.dgSolution.BeginInvoke(new MethodInvoker(delegate()
            {
                this.dgSolution.AutoGenerateColumns = false;
                this.dgSolution.Rows.Clear();
                this.dgSolution.DataSource = null;
            }));

            // btnCreateSln.inv
            int jiangAccountCount = 1;
            int qcwAccountCount   = 1;

            //如果是方案2,也就是趣彩网复选,A:01234,B:023,C:14  大奖网:56789,那么趣彩网得2 - 3个账号,防止账号过多,此时大奖网只要1 - 2个账号
            if (selectedSolutionIndex == 1)
            {
                Random rndTmp = new Random(DateTime.Now.Millisecond);
                jiangAccountCount = rndTmp.Next(1, 3);
                qcwAccountCount   = 3;
            }
            else if (selectedSolutionIndex == 0)
            {
                Random rndTmp = new Random(DateTime.Now.Millisecond);
                jiangAccountCount = rndTmp.Next(1, 4);
                System.Threading.Thread.Sleep(100);
                rndTmp          = new Random(DateTime.Now.Millisecond);
                qcwAccountCount = rndTmp.Next(1, 4);
            }

            Random rnd = new Random(DateTime.Now.Millisecond);
            List <AccountResponse> Jaccounts = new List <AccountResponse>();
            List <AccountResponse> Qaccounts = new List <AccountResponse>();

            for (int i = 0; i < jiangAccountCount; i++)
            {
                if (GloableParams.JiangAccountFromFile == null || GloableParams.JiangAccountFromFile.Count == 0)
                {
                    break;
                }
                int index  = rnd.Next(0, GloableParams.JiangAccountFromFile.Count);
                var acctmp = GloableParams.JiangAccountFromFile[index];
                try
                {
                    UpdateInfo(string.Format("正在登录并查询{0}账号【{1}】信息....", acctmp.ComeFromStr, acctmp.LoginName));
                    JiangComController.Login(ref acctmp);
                    if (acctmp.status == true)
                    {
                        if (acctmp.RedBagBalance < 2 * (GloableParams.DefaultJiangPersent / 100))
                        {
                            i--;
                            acctmp.HasError     = true;
                            acctmp.ErrorMessage = "红包额度过低";
                            GloableParams.JiangErrorAccountFromFile.Remove(
                                GloableParams.JiangErrorAccountFromFile.FirstOrDefault(
                                    a => a.LoginName == acctmp.LoginName));
                            GloableParams.JiangErrorAccountFromFile.Add(acctmp);
                        }
                        else if (acctmp.MyTotoalMoeny < (2 - 2 * (GloableParams.DefaultJiangPersent / 100)))
                        {
                            i--;
                            acctmp.HasError     = true;
                            acctmp.ErrorMessage = "账户额度过低";
                            GloableParams.JiangErrorAccountFromFile.Remove(
                                GloableParams.JiangErrorAccountFromFile.FirstOrDefault(
                                    a => a.LoginName == acctmp.LoginName));
                            GloableParams.JiangErrorAccountFromFile.Add(acctmp);
                        }
                        else
                        {
                            Jaccounts.Add(acctmp);
                        }
                    }
                    else
                    {
                        i--;
                        acctmp.HasError     = true;
                        acctmp.ErrorMessage = string.IsNullOrEmpty(acctmp.ErrorMessage)
                            ? acctmp.message
                            : acctmp.ErrorMessage;
                        GloableParams.JiangErrorAccountFromFile.Remove(
                            GloableParams.JiangErrorAccountFromFile.FirstOrDefault(
                                a => a.LoginName == acctmp.LoginName));
                        GloableParams.JiangErrorAccountFromFile.Add(acctmp);
                    }
                }
                catch (Exception ex)
                {
                    UpdateInfo(string.Format("{0}账号【{1}】 查询出错:{2}", acctmp.ComeFromStr, acctmp.LoginName, ex.Message));
                    i--;
                    acctmp.HasError     = true;
                    acctmp.ErrorMessage = ex.Message;
                    GloableParams.JiangErrorAccountFromFile.Remove(
                        GloableParams.JiangErrorAccountFromFile.FirstOrDefault(
                            a => a.LoginName == acctmp.LoginName));
                    GloableParams.JiangErrorAccountFromFile.Add(acctmp);
                }
                finally
                {
                    //GloableParams.JiangAccountFromFile.Remove(
                    //    GloableParams.JiangAccountFromFile.FirstOrDefault(
                    //        a => a.LoginName == acctmp.LoginName));
                }
            }
            ///
            for (int i = 0; i < qcwAccountCount; i++)
            {
                if (GloableParams.QcwAccountFromFile == null || GloableParams.QcwAccountFromFile.Count == 0)
                {
                    break;
                }
                int index  = rnd.Next(0, GloableParams.QcwAccountFromFile.Count);
                var acctmp = GloableParams.QcwAccountFromFile[index];
                try
                {
                    UpdateInfo(string.Format("正在登录并查询{0}账号【{1}】信息....", acctmp.ComeFromStr, acctmp.LoginName));
                    QcwComController.Login(ref acctmp);
                    if (acctmp.status == true)
                    {
                        if (acctmp.RedBagBalance < 2 * (GloableParams.DefaultQcwPersent / 100))
                        {
                            i--;
                            acctmp.HasError     = true;
                            acctmp.ErrorMessage = "红包额度过低";
                            GloableParams.QcwErrorAccountFromFile.Remove(
                                GloableParams.QcwErrorAccountFromFile.FirstOrDefault(
                                    a => a.LoginName == acctmp.LoginName));
                            GloableParams.QcwErrorAccountFromFile.Add(acctmp);
                        }
                        else if (acctmp.MyTotoalMoeny < (2 - 2 * (GloableParams.DefaultQcwPersent / 100)))
                        {
                            i--;
                            acctmp.HasError     = true;
                            acctmp.ErrorMessage = "账户额度过低";
                            GloableParams.QcwErrorAccountFromFile.Remove(
                                GloableParams.QcwErrorAccountFromFile.FirstOrDefault(
                                    a => a.LoginName == acctmp.LoginName));
                            GloableParams.QcwErrorAccountFromFile.Add(acctmp);
                        }
                        else
                        {
                            Qaccounts.Add(acctmp);
                        }
                    }
                    else
                    {
                        i--;
                        acctmp.HasError     = true;
                        acctmp.ErrorMessage = acctmp.ErrorMessage = string.IsNullOrEmpty(acctmp.ErrorMessage)
                            ? acctmp.message
                            : acctmp.ErrorMessage;
                        GloableParams.QcwErrorAccountFromFile.Remove(
                            GloableParams.QcwErrorAccountFromFile.FirstOrDefault(
                                a => a.LoginName == acctmp.LoginName));
                        GloableParams.QcwErrorAccountFromFile.Add(acctmp);
                    }
                }
                catch (Exception ex)
                {
                    UpdateInfo(string.Format("{0}账号【{1}】 查询出错:{2}", acctmp.ComeFromStr, acctmp.LoginName, ex.Message));
                    i--;
                    acctmp.HasError     = true;
                    acctmp.ErrorMessage = ex.Message;
                    GloableParams.QcwErrorAccountFromFile.Remove(
                        GloableParams.QcwErrorAccountFromFile.FirstOrDefault(
                            a => a.LoginName == acctmp.LoginName));
                    GloableParams.QcwErrorAccountFromFile.Add(acctmp);
                }
                finally
                {
                    //GloableParams.QcwAccountFromFile.Remove(
                    //    GloableParams.QcwAccountFromFile.FirstOrDefault(
                    //        a => a.LoginName == acctmp.LoginName));
                }
            }
            //end
            UpdateInfo("方案生成完毕!请注意将方案投注时候所有数据不会变更,\r\n倍数,倍数,倍数,不变!\r\n变的只有当前期号");
            //生成方案并绑定
            List <BettingSolutinModel> betModels = new List <BettingSolutinModel>();

            if (selectedSolutionIndex == 1 && Qaccounts.Count > 1)
            {
                betModels = BettingSolutionController2.BuildingBetModels(ref Jaccounts, ref Qaccounts);
            }
            else
            {
                betModels = BettingSolutionController1.BuildingBetModels(ref Jaccounts, ref Qaccounts);
            }
            //betModels = BettingSolutionController0Test.BuildingBetModels(ref Jaccounts, ref Qaccounts);
            currentBetModels = betModels;
            this.dgSolution.BeginInvoke(new MethodInvoker(delegate()
            {
                this.dgSolution.AutoGenerateColumns = false;
                this.dgSolution.DataSource          = new BindingList <BettingSolutinModel>(betModels.GetRange(0, betModels.Count));
            }));
            //显示不合格账号
            List <AccountResponse> newListTmp = new List <AccountResponse>();

            newListTmp.AddRange(GloableParams.QcwErrorAccountFromFile);
            newListTmp.AddRange(GloableParams.JiangErrorAccountFromFile);
            this.dgBadAccount.BeginInvoke(new MethodInvoker(delegate()
            {
                this.dgBadAccount.AutoGenerateColumns = false;
                this.dgBadAccount.DataSource          = new BindingList <AccountResponse>(newListTmp.GetRange(0, newListTmp.Count));
            }));
            //更新account list
            this.lbJiang.BeginInvoke(new MethodInvoker(delegate()
            {
                this.lbJiang.DataSource = null;
                this.lbJiang.Items.Clear();
                this.lbJiang.DataSource    = GloableParams.JiangAccountFromFile;
                this.lbJiang.DisplayMember = "LoginName";
                this.lbJiang.ValueMember   = "Password";
            }));
            this.lbQcw.BeginInvoke(new MethodInvoker(delegate()
            {
                this.lbQcw.DataSource = null;
                this.lbQcw.Items.Clear();
                this.lbQcw.DataSource    = GloableParams.QcwAccountFromFile;
                this.lbQcw.DisplayMember = "LoginName";
                this.lbQcw.ValueMember   = "Password";
            }));

            this.btnCreateSln.BeginInvoke(new MethodInvoker(delegate()
            {
                this.btnCreateSln.Enabled = true;
            }));

            this.btnBet.BeginInvoke(new MethodInvoker(delegate()
            {
                this.btnBet.Enabled = true;
            }));
            //
        }