Пример #1
0
    private void GetID()
    {
        LotteryID = Shove._Convert.StrToInt(tbLotteryID.Value, -1);
        PlayTypeID = Shove._Convert.StrToInt(tbPlayTypeID.Value, -1);
        UserID = Shove._Convert.StrToInt(tbUserID.Value, -1);

        SLS.Lottery lottery = new SLS.Lottery();

        if (!lottery.ValidID(LotteryID))
        {
            PF.GoError(ErrorNumber.Unknow, "参数错误,系统异常。", this.GetType().FullName);

            return;
        }

        if (!lottery[LotteryID].CheckPlayType(PlayTypeID))
        {
            PF.GoError(ErrorNumber.Unknow, "参数错误,系统异常。", this.GetType().FullName);

            return;
        }

        LotteryName = lottery[LotteryID].name;
        PlayTypeName = lottery.GetPlayTypeName(PlayTypeID);

        Name = new Users(1)[1, UserID].Name;
    }
    private void GetID()
    {
        LotteryID  = Shove._Convert.StrToInt(tbLotteryID.Value, -1);
        PlayTypeID = Shove._Convert.StrToInt(tbPlayTypeID.Value, -1);
        UserID     = Shove._Convert.StrToInt(tbUserID.Value, -1);

        SLS.Lottery lottery = new SLS.Lottery();

        if (!lottery.ValidID(LotteryID))
        {
            PF.GoError(ErrorNumber.Unknow, "参数错误,系统异常。", this.GetType().FullName);

            return;
        }

        if (!lottery[LotteryID].CheckPlayType(PlayTypeID))
        {
            PF.GoError(ErrorNumber.Unknow, "参数错误,系统异常。", this.GetType().FullName);

            return;
        }

        LotteryName  = lottery[LotteryID].name;
        PlayTypeName = lottery.GetPlayTypeName(PlayTypeID);

        Name = new Users(1)[1, UserID].Name;
    }
Пример #3
0
    public string AnalyseScheme(string Content, string LotteryID, int PlayTypeID)
    {
        Content = FmtContent(Content);

        string Result = new SLS.Lottery()[Shove._Convert.StrToInt(LotteryID, 0)].AnalyseScheme(Content, PlayTypeID);

        return(Result.Trim());
    }
Пример #4
0
    protected void btnGO_Click(object sender, System.EventArgs e)
    {
        tbWinNumber.Text = Shove._Convert.ToDBC(tbWinNumber.Text.Trim().Replace(" ", " ")).Trim();

        if (!new SLS.Lottery()[int.Parse(ddlLottery.SelectedValue)].AnalyseWinNumber(tbWinNumber.Text))
        {
            Shove._Web.JavaScript.Alert(this.Page, "开奖号码不正确!");

            return;
        }

        double[] WinMoneyList = new double[g.Rows.Count * 2];

        for (int i = 0; i < g.Rows.Count; i++)
        {
            WinMoneyList[i * 2]     = Shove._Convert.StrToDouble(((TextBox)g.Rows[i].Cells[1].FindControl("tbMoney")).Text, 0);
            WinMoneyList[i * 2 + 1] = Shove._Convert.StrToDouble(((TextBox)g.Rows[i].Cells[2].FindControl("tbMoneyNoWithTax")).Text, 0);

            if (WinMoneyList[i * 2] < 0)
            {
                Shove._Web.JavaScript.Alert(this.Page, "第 " + (i + 1).ToString() + " 项奖金输入错误!");

                return;
            }
        }

        DAL.Tables.T_Schemes T_Schemes = new DAL.Tables.T_Schemes();

        DataTable dt = T_Schemes.Open("", "IsuseID = " + ddlIsuse.SelectedValue + " and isOpened = 1", "");

        if (dt == null)
        {
            PF.GoError(ErrorNumber.DataReadWrite, "数据库繁忙,请重试", this.GetType().BaseType.FullName);

            return;
        }

        for (int i = 0; i < dt.Rows.Count; i++)
        {
            string LotteryNumber = dt.Rows[i]["LotteryNumber"].ToString();

            string Description       = "";
            double WinMoneyNoWithTax = 0;

            double WinMoney = new SLS.Lottery()[int.Parse(ddlLottery.SelectedValue)].ComputeWin(LotteryNumber, tbWinNumber.Text.Trim(), ref Description, ref WinMoneyNoWithTax, int.Parse(dt.Rows[i]["PlayTypeID"].ToString()), WinMoneyList);

            int Multiple = Shove._Convert.StrToInt(dt.Rows[i]["Multiple"].ToString(), 1);

            T_Schemes.WinDescription.Value = Description;
            T_Schemes.Update("[ID] = " + dt.Rows[i]["ID"].ToString());
        }

        //tbWinNumber.Text = "";

        Shove._Web.JavaScript.Alert(this.Page, "重构中奖描述成功。");
    }
Пример #5
0
    protected void Page_Load(object sender, System.EventArgs e)
    {
        if (!this.IsPostBack)
        {
            SLS.Lottery lottery = new SLS.Lottery();

            int LotteryID = Shove._Convert.StrToInt(Shove._Web.Utility.GetRequest("id"), -1);

            if (!lottery.ValidID(LotteryID))
            {
                return;
            }

            tbLotteryID.Value = LotteryID.ToString();
            strLotteryID      = LotteryID.ToString();

            strIsuse = "";
            try
            {
                strIsuse = Shove._Web.Utility.GetRequest("Isuse");
            }
            catch
            { }
            tbIsuse.Value = strIsuse;

            int PlayType = Shove._Convert.StrToInt(Shove._Web.Utility.GetRequest("PlayType"), -1);
            if (PlayType < 0)
            {
                return;
            }

            bool PlayTypeRight = false;

            strLotteryName = lottery[LotteryID].name;
            PlayTypeRight  = lottery[LotteryID].CheckPlayType(PlayType);

            if (!PlayTypeRight)
            {
                return;
            }

            tbPlayType.Value = PlayType.ToString();
            strPlayType      = PlayType.ToString();

            tbSchemeFileName.Value = "null";
            tbLotteryNumber.Value  = "null";
            strSchemeFileName      = "null";
            strLotteryNumber       = "null";
        }
    }
Пример #6
0
    protected void Page_Load(object sender, System.EventArgs e)
    {
        if (!this.IsPostBack)
        {
            SLS.Lottery lottery = new SLS.Lottery();

            int LotteryID = Shove._Convert.StrToInt(Shove._Web.Utility.GetRequest("id"), -1);

            if (!lottery.ValidID(LotteryID))
            {
                return;
            }

            tbLotteryID.Value = LotteryID.ToString();
            strLotteryID = LotteryID.ToString();

            strIsuse = "";
            try
            {
                strIsuse = Shove._Web.Utility.GetRequest("Isuse");
            }
            catch
            { }
            tbIsuse.Value = strIsuse;

            int PlayType = Shove._Convert.StrToInt(Shove._Web.Utility.GetRequest("PlayType"), -1);
            if (PlayType < 0)
                return;

            bool PlayTypeRight = false;

            strLotteryName = lottery[LotteryID].name;
            PlayTypeRight = lottery[LotteryID].CheckPlayType(PlayType);

            if (!PlayTypeRight)
                return;

            tbPlayType.Value = PlayType.ToString();
            strPlayType = PlayType.ToString();

            tbSchemeFileName.Value = "null";
            tbLotteryNumber.Value = "null";
            strSchemeFileName = "null";
            strLotteryNumber = "null";
        }
    }
Пример #7
0
    public string SplitScheme(string LotteryNumber, int LotteryID)
    {
        SLS.Lottery slsLottery = new SLS.Lottery();
        string      Number     = "";

        string[] t_lotterys = slsLottery[LotteryID].ToSingle(LotteryNumber, ref Number, LotteryID * 100 + 1);

        if ((t_lotterys == null) || (t_lotterys.Length < 1))
        {
            return("");
        }

        LotteryNumber = "";
        foreach (string s in t_lotterys)
        {
            LotteryNumber += s + ",";
        }

        return(LotteryNumber + t_lotterys.Length.ToString());
    }
Пример #8
0
    private void BindDataForPlayType()
    {
        if (ddlLottery.Items.Count < 1)
        {
            return;
        }

        ddlPlayType.Items.Clear();
        ddlPlayType.Items.Add(new ListItem("全部玩法", "-1"));

        if (ddlLottery.SelectedValue == "-1")
        {
            return;
        }

        SLS.Lottery.PlayType[] PlayTypes = new SLS.Lottery()[int.Parse(ddlLottery.SelectedValue)].GetPlayTypeList();

        foreach (SLS.Lottery.PlayType PlayType in PlayTypes)
        {
            ddlPlayType.Items.Add(new ListItem(PlayType.Name, PlayType.ID.ToString()));
        }
    }
Пример #9
0
    protected void btnOkoooDownload_txt_Click(object sender, EventArgs e)
    {
        DataTable dt = new DAL.Views.V_Isuses().Open("", "[ID] = " + Shove._Web.Utility.FilteSqlInfusion(ddlIsuse.SelectedValue), "");

        if ((dt == null) || (dt.Rows.Count < 1))
        {
            PF.GoError(ErrorNumber.DataReadWrite, "数据库繁忙,请重试", this.Page.GetType().BaseType.FullName);

            return;
        }

        string FileName = dt.Rows[0]["Code"].ToString() + dt.Rows[0]["Name"].ToString() + ".txt";

        dt = new DAL.Views.V_SchemeSchedules().Open("", "IsuseID = " + Shove._Web.Utility.FilteSqlInfusion(ddlIsuse.SelectedValue) + " and Schedule >= 100 and QuashStatus = 0 and Buyed = 0", "[Money] desc");

        if (dt == null)
        {
            PF.GoError(ErrorNumber.DataReadWrite, "数据库繁忙,请重试", this.Page.GetType().BaseType.FullName);

            return;
        }

        if (dt.Rows.Count < 1)
        {
            Shove._Web.JavaScript.Alert(this.Page, "没有数据。");

            return;
        }

        HttpResponse response;

        response = Page.Response;
        response.AppendHeader("Content-Disposition", "attachment;filename=" + FileName);
        Response.ContentType = "application/ms-txt";
        response.ContentEncoding = System.Text.Encoding.GetEncoding("utf-8");

        string CacheKey = "JCZC_Scheme_Bind";

        DataTable dtMatch = Shove._Web.Cache.GetCacheAsDataTable(CacheKey);

        if (dtMatch == null)
        {
            dtMatch = new DAL.Tables.T_Match().Open("ID, MatchNumber, StopSellingTime", "", "");

            if (dtMatch == null)
            {
                return;
            }

            if (dtMatch.Rows.Count < 1)
            {
                return;
            }

            Shove._Web.Cache.SetCache(CacheKey, dtMatch, 3600);
        }

        foreach (DataRow dr in dt.Rows)
        {
            string LotteryNumber = dr["LotteryNumber"].ToString();
            int PlayTypeID = Shove._Convert.StrToInt(dr["PlayTypeID"].ToString(), 0);

            ArrayList al = new ArrayList();

            string[] strs = LotteryNumber.Split('\n');
            string[] strNumbers = null;

            string CanonicalNumber = "";

            if (strs == null)
                return;
            if (strs.Length == 0)
                return;

            for (int i = 0; i < strs.Length; i++)
            {
                if (string.IsNullOrEmpty(strs[i]))
                {
                    continue;
                }

                strNumbers = new SLS.Lottery()[Shove._Convert.StrToInt(PlayTypeID.ToString().Substring(0, PlayTypeID.ToString().Length - 2), 72)].ToSingle(strs[i], ref CanonicalNumber, PlayTypeID);

                if (strNumbers == null)
                {
                    continue;
                }

                for (int j = 0; j < strNumbers.Length; j++)
                {
                    al.Add(strNumbers[j]);
                }
            }

            string[] LotteryNumbers = new string[al.Count];

            StringBuilder sbLotteryNumbers = new StringBuilder();

            for (int i = 0; i < al.Count; i++)
            {
                if (i == al.Count)
                {
                    sbLotteryNumbers.Append(al[i].ToString());
                }
                else
                {
                    sbLotteryNumbers.Append(al[i].ToString() + "\n");
                }

                LotteryNumbers[i] = al[i].ToString();
            }

            int Multiple = 0;
            string Number = "";
            string BuyWays = "";

            foreach (string str in LotteryNumbers)
            {
                if (string.IsNullOrEmpty(str))
                {
                    continue;
                }

                if (str.Split(';').Length < 3)
                {
                    continue;
                }

                try
                {
                    Multiple = Shove._Convert.StrToInt(str.Split(';')[2].Substring(1, str.Split(';')[2].Length - 2).Substring(2), 1);
                }
                catch
                { }

                Number = str.Split(';')[1].Substring(1, str.Split(';')[1].Length - 2);
                string[] Numbers = Number.Split('|');


                if (Numbers.Length == 1)
                {
                    BuyWays = "单关";
                }
                else
                {
                    BuyWays = Numbers.Length.ToString() + "串1";
                }

                long MatchID = 0;

                response.Write(dr["SchemeNumber"].ToString() + "," + PlayTypeName(PlayTypeID) + ",T,");

                for (int i = 0; i < Numbers.Length; i++)
                {
                    if (Numbers[i].IndexOf("(") < 0)
                    {
                        continue;
                    }

                    MatchID = Shove._Convert.StrToLong(Numbers[i].Substring(0, Numbers[i].IndexOf("(")), 1);

                    DataRow[] drMatch = dtMatch.Select("ID=" + MatchID.ToString());

                    if (drMatch.Length < 1)
                    {
                        continue;
                    }

                    response.Write("(" + GetMatchNumber(drMatch[0]["MatchNumber"].ToString()) + ">" + Getesult(PlayTypeID, Numbers[i].Substring(Numbers[i].IndexOf("(") + 1, Numbers[i].IndexOf(")") - Numbers[i].IndexOf("(") - 1)) + ")");

                }

                response.Write("," + BuyWays + "," + Multiple + "," + (2 * Multiple).ToString() + "\r\n");
            }
        }

        response.End();
    }
Пример #10
0
    /// <summary>
    /// 购买彩票
    /// </summary>
    /// <param name="_User"></param>
    private void Buy(Users _User)
    {
        if (_User == null)
        {
            Shove._Web.JavaScript.Alert(this.Page, "请您先登录,然后再进行购买!");

            return;
        }

        string HidIsuseID = Shove._Web.Utility.GetRequest("HidIsuseID");        //期号ID
        string HidIsuseEndTime = Shove._Web.Utility.GetRequest("HidIsuseEndTime");      //过期时间
        string playType = Shove._Web.Utility.GetRequest("tbPlayTypeID");                //玩法ID        
        string HidLotteryID = Shove._Web.Utility.GetRequest("HidLotteryID");                        //彩票ID
        string tb_LotteryNumber = Shove._Web.Utility.FilteSqlInfusion(Request["tb_LotteryNumber"]);     //彩票号
        string tb_hide_SumMoney = Shove._Web.Utility.GetRequest("HidPrice");                //总金额

        string tb_Share = "1";                    //份数
        string tb_BuyShare = "1";              //买多少份
        string tb_OpenUserList = "";          //招股对象
        string tb_Title = "";                        //方案名
        string tb_Description = "幸运投注";                //描述
        string tbAutoStopAtWinMoney = "0";
        string tbSecrecyLevel = "0";                      //保密级别        
        string tb_hide_SumNum = "1";                    //总份数
        string tb_Multiple = "1";                          //倍数
        string tb_hide_AssureMoney = "0";          //保底金额
        string tb_SchemeBonusScale = "4";          //佣金特殊值
        string tb_SchemeBonusScalec = "4";

        int Price = 2;

        if ((playType == "3903") || (playType == "3904"))
        {
            Price = 3;
        }
        else
        {
            Price = 2;
        }
        // 结束

        if (tb_Multiple == "")
        {
            tb_Multiple = "1";
        }

        double SumMoney = 0;
        int Share = 0;
        int BuyShare = 0;
        double AssureMoney = 0;
        int Multiple = 0;
        int SumNum = 0;
        short SecrecyLevel = 0;
        int PlayTypeID = 0;
        int LotteryID = 0;
        long IsuseID = 0;
        double AutoStopAtWinMoney = 0;
        double SchemeBonusScale = 0;
        double SchemeBonusScalec = 0;

        try
        {
            SumMoney = double.Parse(tb_hide_SumMoney);
            Share = int.Parse(tb_Share);
            BuyShare = int.Parse(tb_BuyShare);
            AssureMoney = double.Parse(tb_hide_AssureMoney);
            Multiple = int.Parse(tb_Multiple);
            SumNum = int.Parse(tb_hide_SumNum);
            SecrecyLevel = short.Parse(tbSecrecyLevel);
            PlayTypeID = int.Parse(playType);
            LotteryID = int.Parse(HidLotteryID);
            IsuseID = long.Parse(HidIsuseID);
            AutoStopAtWinMoney = double.Parse(tbAutoStopAtWinMoney);
            SchemeBonusScale = double.Parse(tb_SchemeBonusScale);
            SchemeBonusScalec = double.Parse(tb_SchemeBonusScalec);
        }
        catch
        {
            Shove._Web.JavaScript.Alert(this.Page, "输入有错误,请仔细检查。");

            return;
        }

        if ((SumMoney <= 0) || (SumNum < 1))
        {
            Shove._Web.JavaScript.Alert(this.Page, "输入有错误,请仔细检查。");

            return;
        }

        if (AssureMoney < 0)
        {
            Shove._Web.JavaScript.Alert(this.Page, "输入有错误,请仔细检查。");

            return;
        }

        if (Share < 1)
        {
            Shove._Web.JavaScript.Alert(this.Page, "输入有错误,请仔细检查。");

            return;
        }

        if ((BuyShare == Share) && (AssureMoney == 0))
        {
            Share = 1;
            BuyShare = 1;
        }

        if ((SumMoney / Share) < 1)
        {
            Shove._Web.JavaScript.Alert(this.Page, "每份金额最低不能少于 1 元。");

            return;
        }

        double BuyMoney = BuyShare * (SumMoney / Share) + AssureMoney;

        

        if (BuyMoney > PF.SchemeMaxBettingMoney)
        {
            Shove._Web.JavaScript.Alert(this.Page, "投注金额不能大于" + PF.SchemeMaxBettingMoney.ToString() + ",谢谢。");

            return;
        }

        if (Multiple > 999)
        {
            Shove._Web.JavaScript.Alert(this.Page, "投注倍数不能大于 999 倍,谢谢。");

            return;
        }
        //佣金比例的计算

        if (!(SchemeBonusScale >= 0 || SchemeBonusScale <= 10))
        {
            Shove._Web.JavaScript.Alert(this.Page, "佣金比例只能在0~10之间");

            return;
        }

        if (SchemeBonusScale.ToString().IndexOf("-") > -1 || SchemeBonusScale.ToString().IndexOf(".") > -1)
        {
            Shove._Web.JavaScript.Alert(this.Page, "佣金比例输入有误");

            return;
        }
        if (!(SchemeBonusScalec >= 0 || SchemeBonusScalec <= 10))
        {
            Shove._Web.JavaScript.Alert(this.Page, "佣金比例只能在0~10之间");

            return;
        }

        if (SchemeBonusScalec.ToString().IndexOf("-") > -1 || SchemeBonusScalec.ToString().IndexOf(".") > -1)
        {
            Shove._Web.JavaScript.Alert(this.Page, "佣金比例输入有误");

            return;
        }

        SchemeBonusScale = SchemeBonusScale / 100;
        SchemeBonusScalec = SchemeBonusScalec / 100;

        string LotteryNumber = tb_LotteryNumber;

        if (LotteryNumber[LotteryNumber.Length - 1] == '\n')
        {
            LotteryNumber = LotteryNumber.Substring(0, LotteryNumber.Length - 1);
        }

        #region 对彩票号码进行分析,判断注数

        SLS.Lottery slsLottery = new SLS.Lottery();
        string[] t_lotterys = SplitLotteryNumber(LotteryNumber);

        if ((t_lotterys == null) || (t_lotterys.Length < 1))
        {
            Shove._Web.JavaScript.Alert(this.Page, "选号发生异常,请重新选择号码投注,谢谢。(-694)");

            return;
        }

        int ValidNum = 0;

        foreach (string str in t_lotterys)
        {
            string Number = slsLottery[LotteryID].AnalyseScheme(str, PlayTypeID);

            if (string.IsNullOrEmpty(Number))
            {
                continue;
            }

            string[] str_s = Number.Split('|');

            if (str_s == null || str_s.Length < 1)
            {
                continue;
            }

            ValidNum += Shove._Convert.StrToInt(str_s[str_s.Length - 1], 0);
        }

        if (ValidNum != SumNum)
        {
            Shove._Web.JavaScript.Alert(this.Page, "选号发生异常,请重新选择号码投注,谢谢。");

            return;
        }

        #endregion


        if (DateTime.Now >= Shove._Convert.StrToDateTime(HidIsuseEndTime.Replace("/", "-"), DateTime.Now.AddDays(-1).ToString()))
        {
            Shove._Web.JavaScript.Alert(this.Page, "本期投注已截止,谢谢。");

            return;
        }

        if (Price * SumNum * Multiple != SumMoney)
        {
            Shove._Web.JavaScript.Alert(this.Page, "输入有错误,请仔细检查。");

            return;
        }

        string ReturnDescription = "";

        long SchemeID = _User.InitiateScheme(IsuseID, PlayTypeID, tb_Title.Trim() == "" ? "(无标题)" : tb_Title.Trim(), tb_Description.Trim(), LotteryNumber, "", Multiple, SumMoney, AssureMoney, Share, BuyShare, tb_OpenUserList.Trim(), short.Parse(SecrecyLevel.ToString()), SchemeBonusScale, ref ReturnDescription);

        if (SchemeID < 0)
        {
            PF.GoError(ErrorNumber.Unknow, ReturnDescription, this.GetType().FullName + "(-755)");

            return;
        }

        Shove._Web.Cache.ClearCache("Home_Room_CoBuy_BindDataForType" + IsuseID.ToString());
        Shove._Web.Cache.ClearCache("Home_Room_SchemeAll_BindData" + IsuseID.ToString());

        if (SumMoney > 50 && Share > 1)
        {
            Shove._Web.Cache.ClearCache("Home_Room_JoinAllBuy_BindData");
        }

        Response.Redirect("../Home/Room/UserBuySuccess.aspx?LotteryID=" + LotteryID.ToString() + "&&Money=" + BuyMoney.ToString() + "&SchemeID=" + SchemeID.ToString() + "");

        return;

    }
Пример #11
0
    //对返回的开奖号码,进行程序自动派奖
    private void BonusQuery(string TransMessage)
    {
        System.Xml.XmlDocument XmlDoc = new XmlDocument();
        XmlDoc.Load(new StringReader(TransMessage));

        System.Xml.XmlNodeList nodes = XmlDoc.GetElementsByTagName("*");

        string WinNumber = "";
        string Issue = "";
        string LotteryName = "";

        if (nodes == null)
        {
            return;
        }

        for (int i = 0; i < nodes.Count; i++)
        {
            if (nodes[i].Name.ToUpper() == "BONUSQUERYRESULT")
            {
                WinNumber = nodes[i].Attributes["bonusNumber"].Value.Replace(",", "");
            }

            if (nodes[i].Name.ToUpper() == "ISSUE")
            {
                Issue = nodes[i].Attributes["number"].Value;
                LotteryName = nodes[i].Attributes["gameName"].Value;
            }
        }

        int LotteryID = GetLotteryID(LotteryName);

        if (LotteryID < 0)
        {
            return;
        }

        DataTable dtIssue = new DAL.Tables.T_Isuses().Open("top 1 *", "LotteryID = " + LotteryID.ToString() + " and [Name] = '" + Shove._Web.Utility.FilteSqlInfusion(Issue) + "' and isOpened = 0 and EndTime < GetDate()", "");

        if (dtIssue == null)
        {
            new Log("ElectronTicket\\HPCQ").Write("恒朋-重庆电子票网关自动开奖错误,彩种:" + LotteryName + ",期号:" + Issue);

            return;
        }

        if (dtIssue.Rows.Count < 1)
        {
            return;
        }

        // 准备开奖,开奖之前,对出票不完整的方案进行处理(按系统的设定:当作已出票,或者撤单处理)
        //int ReturnValue = 0;
        //string ReturnDescription = "";

        //DAL.Procedures.P_PrintOutNotFullHandle(LotteryID, "请电询", ref ReturnValue, ref ReturnDescription);


        DataTable dtWinMoneyList = new DAL.Tables.T_WinTypes().Open("DefaultMoney, DefaultMoneyNoWithTax", "LotteryID = " + LotteryID.ToString(), "[Order]");

        if (dtWinMoneyList == null)
        {
            new Log("ElectronTicket\\HPCQ").Write("恒朋-重庆电子票网关自动开奖错误,彩种:" + LotteryName + ",期号:" + Issue);

            return;
        }

        double[] WinMoneyList = new double[dtWinMoneyList.Rows.Count * 2];

        for (int i = 0; i < dtWinMoneyList.Rows.Count; i++)
        {
            WinMoneyList[i * 2] = Shove._Convert.StrToDouble(dtWinMoneyList.Rows[i][0].ToString(), 0);
            WinMoneyList[i * 2 + 1] = Shove._Convert.StrToDouble(dtWinMoneyList.Rows[i][1].ToString(), 0);
        }

        DataTable dtScheme = new DAL.Tables.T_Schemes().Open("", "IsuseID = " + dtIssue.Rows[0]["ID"].ToString() + " and isOpened = 0", "");

        if (dtScheme == null)
        {
            new Log("ElectronTicket\\HPCQ").Write("恒朋-重庆电子票网关自动开奖错误,彩种:" + LotteryName + ",期号:" + Issue);

            return;
        }

        if (dtScheme.Rows.Count > 0)
        {
            for (int i = 0; i < dtScheme.Rows.Count; i++)
            {
                string LotteryNumber = dtScheme.Rows[i]["LotteryNumber"].ToString();
                string Description = "";
                double WinMoneyNoWithTax = 0;

                double WinMoney = new SLS.Lottery()[LotteryID].ComputeWin(LotteryNumber, WinNumber, ref Description, ref WinMoneyNoWithTax, int.Parse(dtScheme.Rows[i]["PlayTypeID"].ToString()), WinMoneyList);

                Shove.Database.MSSQL.ExecuteNonQuery("update T_Schemes set PreWinMoney = @p1, PreWinMoneyNoWithTax = @p2, EditWinMoney = @p3, EditWinMoneyNoWithTax = @p4, WinDescription = @p5 where [ID] = " + dtScheme.Rows[i]["ID"].ToString(),
                        new Shove.Database.MSSQL.Parameter("p1", SqlDbType.Money, 0, ParameterDirection.Input, WinMoney * Shove._Convert.StrToInt(dtScheme.Rows[i]["Multiple"].ToString(), 1)),
                        new Shove.Database.MSSQL.Parameter("p2", SqlDbType.Money, 0, ParameterDirection.Input, WinMoneyNoWithTax * Shove._Convert.StrToInt(dtScheme.Rows[i]["Multiple"].ToString(), 1)),
                        new Shove.Database.MSSQL.Parameter("p3", SqlDbType.Money, 0, ParameterDirection.Input, WinMoney * Shove._Convert.StrToInt(dtScheme.Rows[i]["Multiple"].ToString(), 1)),
                        new Shove.Database.MSSQL.Parameter("p4", SqlDbType.Money, 0, ParameterDirection.Input, WinMoneyNoWithTax * Shove._Convert.StrToInt(dtScheme.Rows[i]["Multiple"].ToString(), 1)),
                        new Shove.Database.MSSQL.Parameter("p5", SqlDbType.VarChar, 0, ParameterDirection.Input, Description));

            }
        }

        //int SchemeCount = 0, QuashCount = 0, WinCount = 0, WinNoBuyCount = 0;
        //  总方案数,处理时撤单数,中奖数,中奖但未成功数

        //ReturnValue = 0;
        //ReturnDescription = "";

        DataSet ds = null;

        //DAL.Procedures.P_Win(ref ds,
        //     long.Parse(dtIssue.Rows[0]["ID"].ToString()),
        //     WinNumber,
        //     "暂无",
        //     1,
        //     true,
        //     ref SchemeCount, ref QuashCount, ref WinCount, ref WinNoBuyCount,
        //     ref ReturnValue, ref ReturnDescription);

        //if ((ds == null) || (ReturnDescription != ""))
        //{
        //    PF.GoError(ErrorNumber.DataReadWrite, ReturnDescription, this.GetType().BaseType.FullName);

        //    return;
        //}

        PF.SendWinNotification(ds);
    }
Пример #12
0
    public string GenerateLuckLotteryNumber(int LotteryID, string Type, string Name)
    {
        string Key = "Home_Room_Buy_GenerateLuckLotteryNumber" + LotteryID.ToString();

        Type = Shove._Web.Utility.FilteSqlInfusion(Type);
        Name = Shove._Web.Utility.FilteSqlInfusion(Name);

        if (Type == "3")
        {
            try
            {
                DateTime time = Convert.ToDateTime(Name);
                Name = time.ToString("yyyy-MM-dd");

                if (time > DateTime.Now)
                {
                    return "出生日期不能超过当前日期!";
                }
            }
            catch
            {
                return "日期格式不正确!";
            }
        }

        DataTable dt = Shove._Web.Cache.GetCacheAsDataTable(Key);

        if (dt == null || dt.Rows.Count == 0)
        {
            dt = new DAL.Tables.T_LuckNumber().Open("", "datediff(d,getdate(),DateTime)=0 and LotteryID=" + LotteryID.ToString() + "", "");

            Shove._Web.Cache.SetCache(Key, dt, 3600);
        }

        string LotteryNumber = "";

        DataRow[] dr = dt.Select("Type=" + Type + " and Name='" + Name + "'");

        if (dr != null && dr.Length > 0)
        {
            LotteryNumber = dr[0]["LotteryNumber"].ToString();
        }
        else
        {
            LotteryNumber = new SLS.Lottery()[LotteryID].BuildNumber(5, 2, 1);

            DAL.Tables.T_LuckNumber ln = new DAL.Tables.T_LuckNumber();

            ln.LotteryID.Value = LotteryID;
            ln.LotteryNumber.Value = LotteryNumber;
            ln.Name.Value = Name;
            ln.Type.Value = Type;

            ln.Insert();
            ln.Delete("datediff(d,DateTime,getdate())>0");

            Shove._Web.Cache.ClearCache(Key);
        }

        return LotteryNumber + "|" + FormatLuckLotteryNumber(LotteryID, LotteryNumber);
    }
Пример #13
0
    protected void btnOK_Click(object sender, System.EventArgs e)
    {
        int    IsuseCount = Shove._Convert.StrToInt(HidIsuseCount.Value, -1);
        int    LotteryID  = Shove._Convert.StrToInt(HidLotteryID.Value, -1);
        short  Type       = Shove._Convert.StrToShort(HidType.Value, -1);
        int    Multiple   = Shove._Convert.StrToInt(HidMultiple.Value, -1);
        int    Nums       = Shove._Convert.StrToInt(HidNums.Value, -1);
        short  BetType    = Shove._Convert.StrToShort(HidBetType.Value, -1);
        double Money      = Shove._Convert.StrToDouble(HidMoney.Value, -1);
        string Title      = Shove._Web.Utility.GetRequest("tbTitle1");
        int    PlayTypeID = Shove._Convert.StrToInt(HidPlayTypeID.Value, -1);

        if (string.IsNullOrEmpty(Title))
        {
            Title = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
        }

        if (IsuseCount < 0 || LotteryID < 0 || Type < 0 || Multiple < 0 || Nums < 0 || BetType < 0 || Money < 0 || PlayTypeID < 0)
        {
            Shove._Web.JavaScript.Alert(this.Page, "投注信息有误!");

            return;
        }

        if (_User.Balance < Money)
        {
            Shove._Web.JavaScript.Alert(this.Page, "您的余额不足,请充值!");

            return;
        }

        int Price = 2;

        if (PlayTypeID == 3903)
        {
            Price = 3;
        }

        if (IsuseCount * Multiple * Nums * Price != Money)
        {
            Shove._Web.JavaScript.Alert(this.Page, "投注总金额与投注倍数、注数、期数不相符!");

            return;
        }

        int Result = -1;

        DateTime EndTime = DateTime.Now;

        switch (Type)
        {
        case 1:
        {
            EndTime = EndTime.AddMonths(1);
        } break;

        case 2:
        {
            EndTime = EndTime.AddMonths(3);
        } break;

        case 3:
        {
            EndTime = EndTime.AddMonths(6);
        } break;

        case 4:
        {
            EndTime = EndTime.AddYears(1);
        } break;
        }

        string ChaseXML = "";

        if (BetType == 1)
        {
            if (Nums != Shove._Convert.StrToInt(Shove._Web.Utility.GetRequest("selectMultiple"), 0))
            {
                Shove._Web.JavaScript.Alert(this.Page, "投注注数出现异常!");

                return;
            }

            if (Multiple != 1)
            {
                Shove._Web.JavaScript.Alert(this.Page, "投注倍数出现异常!");

                return;
            }

            HidLotteryNumber.Value = "";
            string[] lotteryNumber;
            ChaseXML = "<ChaseDetails>";

            Lottery l = new Lottery();

            if (LotteryID == 5)
            {
                lotteryNumber = l[5].BuildNumber(6, 1, Nums * IsuseCount).Split(new String[] { "\n" }, StringSplitOptions.None);
            }
            else if (LotteryID == 39)
            {
                lotteryNumber = l[39].BuildNumber(5, 2, Nums * IsuseCount).Split(new String[] { "\n" }, StringSplitOptions.None);
            }
            else
            {
                lotteryNumber = l[LotteryID].BuildNumber(Nums * IsuseCount).Split(new String[] { "\n" }, StringSplitOptions.None);
            }

            if (lotteryNumber.Length != Nums * IsuseCount)
            {
                Shove._Web.JavaScript.Alert(this.Page, "随机生成号码时出现异常!");

                return;
            }

            int    i             = 1;
            int    j             = 0;
            string LotteryNumber = "";
            foreach (string s in lotteryNumber)
            {
                LotteryNumber += s + "\n";

                if (i % Nums == 0)
                {
                    ChaseXML += "<Chase ChaseLotteryNumber=\"" + LotteryNumber + "\"/>";
                    j++;
                    LotteryNumber = "";
                }

                i++;
            }

            if (j != IsuseCount)
            {
                Shove._Web.JavaScript.Alert(this.Page, "随机生成号码时出现异常!");

                return;
            }

            ChaseXML += "</ChaseDetails>";
        }
        else
        {
            if (string.IsNullOrEmpty(HidLotteryNumber.Value))
            {
                Shove._Web.JavaScript.Alert(this.Page, "发起追号套餐有异常!");

                return;
            }

            if (Multiple != Shove._Convert.StrToInt(Shove._Web.Utility.GetRequest("selectMultiple"), 0))
            {
                Shove._Web.JavaScript.Alert(this.Page, "投注倍数出现异常!");

                return;
            }

            SLS.Lottery slsLottery = new SLS.Lottery();
            string[]    t_lotterys = SplitLotteryNumber(HidLotteryNumber.Value);

            if ((t_lotterys == null) || (t_lotterys.Length < 1))
            {
                Shove._Web.JavaScript.Alert(this.Page, "选号发生异常,请重新选择号码投注,谢谢。");

                return;
            }

            int ValidNum = 0;

            foreach (string str in t_lotterys)
            {
                string Number = slsLottery[LotteryID].AnalyseScheme(str, PlayTypeID);

                if (string.IsNullOrEmpty(Number))
                {
                    continue;
                }

                string[] str_s = Number.Split('|');

                if (str_s == null || str_s.Length < 1)
                {
                    continue;
                }

                ValidNum += Shove._Convert.StrToInt(str_s[str_s.Length - 1], 0);
            }

            if (ValidNum != Nums)
            {
                Shove._Web.JavaScript.Alert(this.Page, "选号发生异常,请重新选择号码投注,谢谢。");

                return;
            }
        }

        string Description = "";

        Result = _User.InitiateCustomChase(LotteryID, PlayTypeID, Price, Type, EndTime, IsuseCount, Multiple, Nums, BetType, HidLotteryNumber.Value, 1, 0, Money, Title, ChaseXML, ref Description);

        if (Result < 0)
        {
            Shove._Web.JavaScript.Alert(this.Page, Description);

            return;
        }

        Shove._Web.Cache.ClearCache("LotteryPackage_BindUsers");
        Shove._Web.Cache.ClearCache(_Site.ID.ToString() + "AccountFreezeDetail_" + _User.ID.ToString());
        Shove._Web.Cache.ClearCache("Home_Room_ViewChaseCombo_BindData" + _User.ID.ToString());

        Shove._Web.JavaScript.Alert(this.Page, "定制追号套餐成功!", "LotteryPackage.aspx");
    }
Пример #14
0
    private void BindBet()
    {
        long BuyID = Shove._Convert.StrToLong(Shove._Web.Utility.GetRequest("BuyID"), 0);

        string FileName = Request.Cookies["ASP.NET_SessionId"].Value;

        string LotteryNumber = "";

        DataTable dt = null;

        int Multiple = 0;
        double SumMoney = 0;
        long IsuseID = 0;
        int Count = 0;
        int LotID = 0;
        int PlayID = 0;
        int Share = 1;
        int BuyShare = 1;
        double AssureMoney = 0;
        short SecrecyLevel = 0;

        if (BuyID > 0)
        {
            dt = new DAL.Tables.T_AlipayBuyTemp().Open("", "ID=" + BuyID.ToString(), "");

            if (dt == null || dt.Rows.Count == 0)
            {
                return;
            }

            hidBuyID.Value = BuyID.ToString();

            DataRow dr = dt.Rows[0];

            string HidIsuseID = dr["IsuseID"].ToString();
            string playType = dr["PlayTypeID"].ToString();
            string tb_Share = dr["Share"].ToString();
            string tb_BuyShare = dr["BuyShare"].ToString();
            string tb_AssureShare = dr["AssureShare"].ToString();
            string tb_OpenUserList = dr["OpenUsers"].ToString();
            string tb_Title = dr["Title"].ToString();
            string tb_Description = dr["Description"].ToString();
            string tbSecrecyLevel = dr["SecrecyLevel"].ToString();
            string tb_LotteryNumber = dr["LotteryNumber"].ToString();
            string tb_hide_SumMoney = dr["SumMoney"].ToString();
            string tb_hide_AssureMoney = dr["AssureMoney"].ToString();
            string HidLotteryID = dr["LotteryID"].ToString();
            string tb_Multiple = dr["Multiple"].ToString();

            if (tb_Multiple == "")
            {
                tb_Multiple = "1";
            }

            try
            {
                Share = int.Parse(tb_Share);
                BuyShare = int.Parse(tb_BuyShare);
                AssureMoney = double.Parse(tb_hide_AssureMoney);
                Multiple = int.Parse(tb_Multiple);
                SecrecyLevel = short.Parse(tbSecrecyLevel);
                PlayID = int.Parse(playType);
                LotID = int.Parse(HidLotteryID);
                IsuseID = long.Parse(HidIsuseID);
            }
            catch { }

            if ((BuyShare == Share) && (AssureMoney == 0))
            {
                Share = 1;
                BuyShare = 1;
            }

            double BuyMoney = BuyShare * (SumMoney / Share) + AssureMoney;

             LotteryNumber = tb_LotteryNumber;

            if (!string.IsNullOrEmpty(LotteryNumber) && LotteryNumber[LotteryNumber.Length - 1] == '\n')
            {
                LotteryNumber = LotteryNumber.Substring(0, LotteryNumber.Length - 1);
            }

            hidLotteryNumber.Value = LotteryNumber;
        }
        else
        {
            try
            {
                LotteryNumber = File.ReadAllText(System.AppDomain.CurrentDomain.BaseDirectory + "Temp\\" + FileName + ".txt");
            }
            catch { }
        }

        if (string.IsNullOrEmpty(LotteryNumber))
        {
            Shove._Web.JavaScript.Alert(this.Page, "传递的参数错误,请重新发起操作!");

            return;
        }

        dt = new DAL.Tables.T_PassRate().Open("MatchID, MatchNumber, StopSellTime", "", "");

        if (dt == null)
        {
            PF.GoError(ErrorNumber.DataReadWrite, "数据库繁忙,请重试", this.GetType().BaseType.FullName);

            return;
        }

        if (dt.Rows.Count < 1)
        {
            return;
        }

        hidMatchID.Value = "";

        foreach (DataRow dr in dt.Rows)
        {
            hidMatchID.Value += dr["MatchID"].ToString() + ",";
        }

        if (hidMatchID.Value.EndsWith(","))
        {
            hidMatchID.Value = hidMatchID.Value.Substring(0, hidMatchID.Value.Length - 1);
        }

        StringBuilder sb = new StringBuilder();

        sb.Append("<table width=\"100%\" border=\"0\" align=\"center\" cellpadding=\"2\" cellspacing=\"1\" class=\"BgBlue\">");
        sb.Append("<tr align=\"center\" bgcolor=\"#FFFFFF\" class=\"BlueLightBg WhiteWords\">");
        sb.Append("<td width=\"8%\"><strong>序号</strong></td>");
        sb.Append("<td><strong>过关场次</strong></td>");
        sb.Append("<td width=\"10%\"><strong>过关方式</strong></td>");
        sb.Append("<td width=\"10%\"><strong>注数</strong></td>");
        sb.Append("<td width=\"10%\"><strong>投注金额(元)</strong></td></tr>");

        string[] LotteryNumbers = LotteryNumber.Replace("\r","").Split('\n');
        string Number = "";
        int No = 0;
        string BuyWays = "";

        StringBuilder sbMatchIDs = new StringBuilder();

        PlayID = Shove._Convert.StrToInt(LotteryNumbers[0].Split(';')[0], 7201);
        LotID = Shove._Convert.StrToInt(PlayID.ToString().Substring(0, 2), 72);

        DateTime EndTime = DateTime.Now;

        if (BuyID > 0)
        {
            foreach (string str in LotteryNumbers)
            {
                if (string.IsNullOrEmpty(str))
                {
                    continue;
                }

                try
                {
                    Multiple = int.Parse(str.Split(';')[2].Substring(1, str.Split(';')[2].Length - 2).Substring(2));
                }
                catch
                {
                    Multiple = Shove._Convert.StrToInt(str.Split(';')[2].Substring(1, str.Split(';')[2].IndexOf(',') - 1).Substring(2), 1);
                }

                if (No > 10)
                {
                    continue;
                }

                sb.Append("<tr align=\"center\" class=\"" + ((No % 2 == 0) ? "BlueWord WhiteBg" : "BlueLightBg2 BlueWord") + "\">");
                sb.Append("<td>" + No.ToString() + "</td>");

                Number = str.Split(';')[1].Substring(1, str.Split(';')[1].Length - 2);
                string[] Numbers = Number.Split('|');

                if (Numbers.Length < 2)
                {
                    continue;
                }

                sb.Append("<td height=\"20\">");

                BuyWays = PF.GetPassWay(str);

                long MatchID = 0;

                for (int i = 0; i < Numbers.Length; i++)
                {
                    if (Numbers[i].IndexOf("(") < 0)
                    {
                        continue;
                    }

                    MatchID = Shove._Convert.StrToLong(Numbers[i].Substring(0, Numbers[i].IndexOf("(")), 1);

                    DataRow[] dr = dt.Select("MatchID=" + MatchID.ToString());

                    if (dr.Length < 1)
                    {
                        continue;
                    }

                    sbMatchIDs.Append(Numbers[i].Substring(0, Numbers[i].IndexOf("(")) + ",");

                    sb.Append(dr[0]["MatchNumber"].ToString() + "->" + PF.Getesult(PlayID.ToString(), Numbers[i].Substring(Numbers[i].IndexOf("(") + 1, Numbers[i].IndexOf(")") - Numbers[i].IndexOf("(") - 1)) + ";");
                }

                int ValidNum = 0;

                SLS.Lottery slsLottery = new SLS.Lottery();
                string temp_Number = slsLottery[LotID].AnalyseScheme(str, PlayID);

                if (string.IsNullOrEmpty(temp_Number))
                {
                    continue;
                }

                string[] str_s = temp_Number.Split('|');

                if (str_s == null || str_s.Length < 1)
                {
                    continue;
                }

                ValidNum += Shove._Convert.StrToInt(str_s[str_s.Length - 1], 0);

                sb.Append("</td>");
                sb.Append("<td height=\"20\">" + BuyWays + "</td>");
                sb.Append("<td>" + ValidNum.ToString() + "</td>");
                sb.Append("<td>" + (2 * Multiple * ValidNum).ToString() + "</td></tr>");

                SumMoney += 2 * Multiple * ValidNum;
                Count += ValidNum;
            }

            sb.Append("</table>");
            labLotteryNumber.Text = sb.ToString();
        }
        else
        {
            foreach (string str in LotteryNumbers)
            {
                if (string.IsNullOrEmpty(str))
                {
                    continue;
                }

                No++;
                Count++;

                if (str.Split(';').Length < 3)
                {
                    continue;
                }

                try
                {
                    Multiple = Shove._Convert.StrToInt(str.Split(';')[2].Substring(1, str.Split(';')[2].Length - 2).Substring(2), 1);
                }
                catch
                { }

                SumMoney += 2 * Multiple;

                if (No > 10)
                {
                    continue;
                }

                sb.Append("<tr align=\"center\" class=\"" + ((No % 2 == 0) ? "BlueWord WhiteBg" : "BlueLightBg2 BlueWord") + "\">");
                sb.Append("<td>" + No.ToString() + "</td>");

                Number = str.Split(';')[1].Substring(1, str.Split(';')[1].Length - 2);
                string[] Numbers = Number.Split('|');

                if (Numbers.Length < 2)
                {
                    continue;
                }

                sb.Append("<td height=\"20\">");

                BuyWays = Numbers.Length.ToString() + "串1";

                long MatchID = 0;

                for (int i = 0; i < Numbers.Length; i++)
                {
                    if (Numbers[i].IndexOf("(") < 0)
                    {
                        continue;
                    }

                    MatchID = Shove._Convert.StrToLong(Numbers[i].Substring(0, Numbers[i].IndexOf("(")), 1);

                    DataRow[] dr = dt.Select("MatchID=" + MatchID.ToString());

                    if (dr.Length < 1)
                    {
                        continue;
                    }

                    sbMatchIDs.Append(Numbers[i].Substring(0, Numbers[i].IndexOf("(")) + ",");

                    sb.Append(dr[0]["MatchNumber"].ToString() + "->" + PF.Getesult(PlayID.ToString(), Numbers[i].Substring(Numbers[i].IndexOf("(") + 1, Numbers[i].IndexOf(")") - Numbers[i].IndexOf("(") - 1)) + ";");
                }

                sb.Append("</td>");
                sb.Append("<td height=\"20\">" + BuyWays + "</td>");
                sb.Append("<td>1</td>");
                sb.Append("<td>" + (2 * Multiple).ToString() + "</td></tr>");
            }

            sb.Append("</table>");
            labLotteryNumber.Text = sb.ToString();
        }

        labShare.Text = Share.ToString();
        labBuyShare.Text = BuyShare.ToString();
        labAssureMoney.Text = AssureMoney.ToString();

        string MatchIDs = sbMatchIDs.ToString();

        if (MatchIDs.EndsWith(","))
        {
            MatchIDs = MatchIDs.Substring(0, MatchIDs.Length - 1);
        }

        DataRow[] drTime = dt.Select("MatchID in (" + MatchIDs + ")", "StopSellTime");

        if (drTime.Length > 0)
        {
            EndTime = Shove._Convert.StrToDateTime(drTime[0]["StopSellTime"].ToString(), DateTime.Now.AddHours(1).ToString());
        }

        labEndTime.Text = EndTime.ToString("yyyy-MM-dd HH:mm:ss");
        HidIsuseEndTime.Value = EndTime.ToString();

        labMultiple.Text = Multiple.ToString();
        labSchemeMoney.Text = SumMoney.ToString();
        labNum.Text = Count.ToString();

        dt = new DAL.Tables.T_Isuses().Open("ID", "LotteryID= " + LotID.ToString(), "EndTime desc");

        if (dt == null)
        {
            PF.GoError(ErrorNumber.DataReadWrite, "数据库繁忙,请重试", this.GetType().BaseType.FullName);

            return;
        }

        if (dt.Rows.Count < 1)
        {
            PF.GoError(ErrorNumber.NoIsuse, "请添加期号", this.GetType().BaseType.FullName);

            return;
        }

        IsuseID = Shove._Convert.StrToLong(dt.Rows[0]["ID"].ToString(), 0);

        hidSchemeMoney.Value = SumMoney.ToString();
        hidMultiple.Value = Multiple.ToString();
        hidlotid.Value = LotID.ToString();
        hidplayid.Value = PlayID.ToString();
        hidSumNum.Value = Count.ToString();
        hidisuseid.Value = IsuseID.ToString();
    }
Пример #15
0
    protected void btnOK_Click(object sender, EventArgs e)
    {
        if (_User == null)
        {
            Shove._Web.JavaScript.Alert(this.Page, "您还没有登录,请登录后再进行操作!");

            return;
        }

        double SumMoney     = 0;
        int    Multiple     = 0;
        short  SecrecyLevel = 0;
        int    PlayTypeID   = 0;
        int    LotteryID    = 0;
        long   IsuseID      = 0;
        int    SumNum       = 0;

        int    Share       = 1;
        int    BuyShare    = 1;
        double AssureMoney = 0;

        try
        {
            SumMoney   = double.Parse(hidSchemeMoney.Value);
            Multiple   = int.Parse(hidMultiple.Value);
            PlayTypeID = int.Parse(hidplayid.Value);
            LotteryID  = int.Parse(hidlotid.Value);
            IsuseID    = long.Parse(hidisuseid.Value);
            SumNum     = int.Parse(hidSumNum.Value);

            Share       = int.Parse(labShare.Text);
            BuyShare    = int.Parse(labBuyShare.Text);
            AssureMoney = double.Parse(labAssureMoney.Text);
        }
        catch
        {
            Shove._Web.JavaScript.Alert(this.Page, "输入有错误,请仔细检查。");

            return;
        }

        if (SumMoney <= 0)
        {
            Shove._Web.JavaScript.Alert(this.Page, "输入有错误,请仔细检查。");

            return;
        }

        if (SumMoney > _User.Balance)
        {
            Shove._Web.JavaScript.Alert(this.Page, "您的余额不足,请充值。");

            return;
        }

        if (SumMoney > PF.SchemeMaxBettingMoney)
        {
            Shove._Web.JavaScript.Alert(this.Page, "投注金额不能大于" + PF.SchemeMaxBettingMoney.ToString() + ",谢谢。");

            return;
        }

        if (Multiple > 999)
        {
            Shove._Web.JavaScript.Alert(this.Page, "投注倍数不能大于 999 倍,谢谢。");

            return;
        }

        string LotteryNumber = "";
        string FileName      = "";

        if (Shove._Convert.StrToLong(hidBuyID.Value, 0) < 1)
        {
            FileName = System.AppDomain.CurrentDomain.BaseDirectory + "Temp\\" + Request.Cookies["ASP.NET_SessionId"].Value + ".txt";

            LotteryNumber = File.ReadAllText(FileName);

            #region 对彩票号码进行分析,判断注数

            SLS.Lottery slsLottery = new SLS.Lottery();
            string[]    t_lotterys = SplitLotteryNumber(LotteryNumber);

            if ((t_lotterys == null) || (t_lotterys.Length < 1))
            {
                Shove._Web.JavaScript.Alert(this.Page, "选号发生异常,请重新选择号码投注,谢谢。(-694)");

                return;
            }

            int ValidNum = 0;

            foreach (string str in t_lotterys)
            {
                if (string.IsNullOrEmpty(str))
                {
                    continue;
                }

                string Number = slsLottery[LotteryID].AnalyseScheme(str, PlayTypeID);

                if (string.IsNullOrEmpty(Number))
                {
                    continue;
                }

                string[] str_s = Number.Split('|');

                if (str_s == null || str_s.Length < 1)
                {
                    continue;
                }

                ValidNum += Shove._Convert.StrToInt(str_s[str_s.Length - 1], 0);
            }

            if (ValidNum != SumNum)
            {
                Shove._Web.JavaScript.Alert(this.Page, "选号发生异常,请重新选择号码投注,谢谢。");

                return;
            }

            #endregion
        }
        else
        {
            LotteryNumber = hidLotteryNumber.Value;
        }

        if (DateTime.Now >= Shove._Convert.StrToDateTime(HidIsuseEndTime.Value.Replace("/", "-"), DateTime.Now.AddDays(-1).ToString()))
        {
            Shove._Web.JavaScript.Alert(this.Page, "本期投注已截止,谢谢。");

            return;
        }

        double Price = 2.0;

        if (Price * SumNum * Multiple != SumMoney)
        {
            Shove._Web.JavaScript.Alert(this.Page, "输入有错误,请仔细检查。");

            return;
        }

        string ReturnDescription = "";

        long SchemeID = _User.InitiateScheme(IsuseID, PlayTypeID, "(无标题)", "", LotteryNumber, "", Multiple, SumMoney, AssureMoney, Share, BuyShare, "", SecrecyLevel, 0.04, ref ReturnDescription);

        if (SchemeID < 0)
        {
            PF.GoError(ErrorNumber.Unknow, ReturnDescription, this.GetType().FullName + "(-347)");

            return;
        }

        File.WriteAllText(System.AppDomain.CurrentDomain.BaseDirectory + "SchemeInfo\\" + SchemeID.ToString() + ".txt", LotteryNumber + "$" + hidMatchID.Value);

        if (File.Exists(FileName))
        {
            try
            {
                File.Delete(FileName);
            }
            catch { }
        }

        Response.Redirect("../Home/Room/UserBuySuccess.aspx?LotteryID=" + LotteryID.ToString() + "&&Money=" + SumMoney.ToString() + "&SchemeID=" + SchemeID.ToString() + "");

        return;
    }
Пример #16
0
    private void BindBet()
    {
        long BuyID = Shove._Convert.StrToLong(Shove._Web.Utility.GetRequest("BuyID"), 0);

        string FileName = Request.Cookies["ASP.NET_SessionId"].Value;

        string LotteryNumber = "";

        DataTable dt = null;

        int    Multiple     = 0;
        double SumMoney     = 0;
        long   IsuseID      = 0;
        int    Count        = 0;
        int    LotID        = 0;
        int    PlayID       = 0;
        int    Share        = 1;
        int    BuyShare     = 1;
        double AssureMoney  = 0;
        short  SecrecyLevel = 0;

        if (BuyID > 0)
        {
            dt = new DAL.Tables.T_AlipayBuyTemp().Open("", "ID=" + BuyID.ToString(), "");

            if (dt == null || dt.Rows.Count == 0)
            {
                return;
            }

            hidBuyID.Value = BuyID.ToString();

            DataRow dr = dt.Rows[0];

            string HidIsuseID          = dr["IsuseID"].ToString();
            string playType            = dr["PlayTypeID"].ToString();
            string tb_Share            = dr["Share"].ToString();
            string tb_BuyShare         = dr["BuyShare"].ToString();
            string tb_AssureShare      = dr["AssureShare"].ToString();
            string tb_OpenUserList     = dr["OpenUsers"].ToString();
            string tb_Title            = dr["Title"].ToString();
            string tb_Description      = dr["Description"].ToString();
            string tbSecrecyLevel      = dr["SecrecyLevel"].ToString();
            string tb_LotteryNumber    = dr["LotteryNumber"].ToString();
            string tb_hide_SumMoney    = dr["SumMoney"].ToString();
            string tb_hide_AssureMoney = dr["AssureMoney"].ToString();
            string HidLotteryID        = dr["LotteryID"].ToString();
            string tb_Multiple         = dr["Multiple"].ToString();

            if (tb_Multiple == "")
            {
                tb_Multiple = "1";
            }

            try
            {
                Share        = int.Parse(tb_Share);
                BuyShare     = int.Parse(tb_BuyShare);
                AssureMoney  = double.Parse(tb_hide_AssureMoney);
                Multiple     = int.Parse(tb_Multiple);
                SecrecyLevel = short.Parse(tbSecrecyLevel);
                PlayID       = int.Parse(playType);
                LotID        = int.Parse(HidLotteryID);
                IsuseID      = long.Parse(HidIsuseID);
            }
            catch { }

            if ((BuyShare == Share) && (AssureMoney == 0))
            {
                Share    = 1;
                BuyShare = 1;
            }

            double BuyMoney = BuyShare * (SumMoney / Share) + AssureMoney;

            LotteryNumber = tb_LotteryNumber;

            if (!string.IsNullOrEmpty(LotteryNumber) && LotteryNumber[LotteryNumber.Length - 1] == '\n')
            {
                LotteryNumber = LotteryNumber.Substring(0, LotteryNumber.Length - 1);
            }

            hidLotteryNumber.Value = LotteryNumber;
        }
        else
        {
            try
            {
                LotteryNumber = File.ReadAllText(System.AppDomain.CurrentDomain.BaseDirectory + "Temp\\" + FileName + ".txt");
            }
            catch { }
        }

        if (string.IsNullOrEmpty(LotteryNumber))
        {
            Shove._Web.JavaScript.Alert(this.Page, "传递的参数错误,请重新发起操作!");

            return;
        }

        dt = new DAL.Tables.T_PassRate().Open("MatchID, MatchNumber, StopSellTime", "", "");

        if (dt == null)
        {
            PF.GoError(ErrorNumber.DataReadWrite, "数据库繁忙,请重试", this.GetType().BaseType.FullName);

            return;
        }

        if (dt.Rows.Count < 1)
        {
            return;
        }

        hidMatchID.Value = "";

        foreach (DataRow dr in dt.Rows)
        {
            hidMatchID.Value += dr["MatchID"].ToString() + ",";
        }

        if (hidMatchID.Value.EndsWith(","))
        {
            hidMatchID.Value = hidMatchID.Value.Substring(0, hidMatchID.Value.Length - 1);
        }

        StringBuilder sb = new StringBuilder();

        sb.Append("<table width=\"100%\" border=\"0\" align=\"center\" cellpadding=\"2\" cellspacing=\"1\" class=\"BgBlue\">");
        sb.Append("<tr align=\"center\" bgcolor=\"#FFFFFF\" class=\"BlueLightBg WhiteWords\">");
        sb.Append("<td width=\"8%\"><strong>序号</strong></td>");
        sb.Append("<td><strong>过关场次</strong></td>");
        sb.Append("<td width=\"10%\"><strong>过关方式</strong></td>");
        sb.Append("<td width=\"10%\"><strong>注数</strong></td>");
        sb.Append("<td width=\"10%\"><strong>投注金额(元)</strong></td></tr>");

        string[] LotteryNumbers = LotteryNumber.Replace("\r", "").Split('\n');
        string   Number         = "";
        int      No             = 0;
        string   BuyWays        = "";

        StringBuilder sbMatchIDs = new StringBuilder();

        PlayID = Shove._Convert.StrToInt(LotteryNumbers[0].Split(';')[0], 7201);
        LotID  = Shove._Convert.StrToInt(PlayID.ToString().Substring(0, 2), 72);

        DateTime EndTime = DateTime.Now;

        if (BuyID > 0)
        {
            foreach (string str in LotteryNumbers)
            {
                if (string.IsNullOrEmpty(str))
                {
                    continue;
                }

                try
                {
                    Multiple = int.Parse(str.Split(';')[2].Substring(1, str.Split(';')[2].Length - 2).Substring(2));
                }
                catch
                {
                    Multiple = Shove._Convert.StrToInt(str.Split(';')[2].Substring(1, str.Split(';')[2].IndexOf(',') - 1).Substring(2), 1);
                }

                if (No > 10)
                {
                    continue;
                }

                sb.Append("<tr align=\"center\" class=\"" + ((No % 2 == 0) ? "BlueWord WhiteBg" : "BlueLightBg2 BlueWord") + "\">");
                sb.Append("<td>" + No.ToString() + "</td>");

                Number = str.Split(';')[1].Substring(1, str.Split(';')[1].Length - 2);
                string[] Numbers = Number.Split('|');

                if (Numbers.Length < 2)
                {
                    continue;
                }

                sb.Append("<td height=\"20\">");

                BuyWays = PF.GetPassWay(str);

                long MatchID = 0;

                for (int i = 0; i < Numbers.Length; i++)
                {
                    if (Numbers[i].IndexOf("(") < 0)
                    {
                        continue;
                    }

                    MatchID = Shove._Convert.StrToLong(Numbers[i].Substring(0, Numbers[i].IndexOf("(")), 1);

                    DataRow[] dr = dt.Select("MatchID=" + MatchID.ToString());

                    if (dr.Length < 1)
                    {
                        continue;
                    }

                    sbMatchIDs.Append(Numbers[i].Substring(0, Numbers[i].IndexOf("(")) + ",");

                    sb.Append(dr[0]["MatchNumber"].ToString() + "->" + PF.Getesult(PlayID.ToString(), Numbers[i].Substring(Numbers[i].IndexOf("(") + 1, Numbers[i].IndexOf(")") - Numbers[i].IndexOf("(") - 1)) + ";");
                }

                int ValidNum = 0;

                SLS.Lottery slsLottery  = new SLS.Lottery();
                string      temp_Number = slsLottery[LotID].AnalyseScheme(str, PlayID);

                if (string.IsNullOrEmpty(temp_Number))
                {
                    continue;
                }

                string[] str_s = temp_Number.Split('|');

                if (str_s == null || str_s.Length < 1)
                {
                    continue;
                }

                ValidNum += Shove._Convert.StrToInt(str_s[str_s.Length - 1], 0);

                sb.Append("</td>");
                sb.Append("<td height=\"20\">" + BuyWays + "</td>");
                sb.Append("<td>" + ValidNum.ToString() + "</td>");
                sb.Append("<td>" + (2 * Multiple * ValidNum).ToString() + "</td></tr>");

                SumMoney += 2 * Multiple * ValidNum;
                Count    += ValidNum;
            }

            sb.Append("</table>");
            labLotteryNumber.Text = sb.ToString();
        }
        else
        {
            foreach (string str in LotteryNumbers)
            {
                if (string.IsNullOrEmpty(str))
                {
                    continue;
                }

                No++;
                Count++;

                if (str.Split(';').Length < 3)
                {
                    continue;
                }

                try
                {
                    Multiple = Shove._Convert.StrToInt(str.Split(';')[2].Substring(1, str.Split(';')[2].Length - 2).Substring(2), 1);
                }
                catch
                { }

                SumMoney += 2 * Multiple;

                if (No > 10)
                {
                    continue;
                }

                sb.Append("<tr align=\"center\" class=\"" + ((No % 2 == 0) ? "BlueWord WhiteBg" : "BlueLightBg2 BlueWord") + "\">");
                sb.Append("<td>" + No.ToString() + "</td>");

                Number = str.Split(';')[1].Substring(1, str.Split(';')[1].Length - 2);
                string[] Numbers = Number.Split('|');

                if (Numbers.Length < 2)
                {
                    continue;
                }

                sb.Append("<td height=\"20\">");

                BuyWays = Numbers.Length.ToString() + "串1";

                long MatchID = 0;

                for (int i = 0; i < Numbers.Length; i++)
                {
                    if (Numbers[i].IndexOf("(") < 0)
                    {
                        continue;
                    }

                    MatchID = Shove._Convert.StrToLong(Numbers[i].Substring(0, Numbers[i].IndexOf("(")), 1);

                    DataRow[] dr = dt.Select("MatchID=" + MatchID.ToString());

                    if (dr.Length < 1)
                    {
                        continue;
                    }

                    sbMatchIDs.Append(Numbers[i].Substring(0, Numbers[i].IndexOf("(")) + ",");

                    sb.Append(dr[0]["MatchNumber"].ToString() + "->" + PF.Getesult(PlayID.ToString(), Numbers[i].Substring(Numbers[i].IndexOf("(") + 1, Numbers[i].IndexOf(")") - Numbers[i].IndexOf("(") - 1)) + ";");
                }

                sb.Append("</td>");
                sb.Append("<td height=\"20\">" + BuyWays + "</td>");
                sb.Append("<td>1</td>");
                sb.Append("<td>" + (2 * Multiple).ToString() + "</td></tr>");
            }

            sb.Append("</table>");
            labLotteryNumber.Text = sb.ToString();
        }

        labShare.Text       = Share.ToString();
        labBuyShare.Text    = BuyShare.ToString();
        labAssureMoney.Text = AssureMoney.ToString();

        string MatchIDs = sbMatchIDs.ToString();

        if (MatchIDs.EndsWith(","))
        {
            MatchIDs = MatchIDs.Substring(0, MatchIDs.Length - 1);
        }

        DataRow[] drTime = dt.Select("MatchID in (" + MatchIDs + ")", "StopSellTime");

        if (drTime.Length > 0)
        {
            EndTime = Shove._Convert.StrToDateTime(drTime[0]["StopSellTime"].ToString(), DateTime.Now.AddHours(1).ToString());
        }

        labEndTime.Text       = EndTime.ToString("yyyy-MM-dd HH:mm:ss");
        HidIsuseEndTime.Value = EndTime.ToString();

        labMultiple.Text    = Multiple.ToString();
        labSchemeMoney.Text = SumMoney.ToString();
        labNum.Text         = Count.ToString();

        dt = new DAL.Tables.T_Isuses().Open("ID", "LotteryID= " + LotID.ToString(), "EndTime desc");

        if (dt == null)
        {
            PF.GoError(ErrorNumber.DataReadWrite, "数据库繁忙,请重试", this.GetType().BaseType.FullName);

            return;
        }

        if (dt.Rows.Count < 1)
        {
            PF.GoError(ErrorNumber.NoIsuse, "请添加期号", this.GetType().BaseType.FullName);

            return;
        }

        IsuseID = Shove._Convert.StrToLong(dt.Rows[0]["ID"].ToString(), 0);

        hidSchemeMoney.Value = SumMoney.ToString();
        hidMultiple.Value    = Multiple.ToString();
        hidlotid.Value       = LotID.ToString();
        hidplayid.Value      = PlayID.ToString();
        hidSumNum.Value      = Count.ToString();
        hidisuseid.Value     = IsuseID.ToString();
    }
Пример #17
0
    protected void btnOK_Click(object sender, EventArgs e)
    {
        if (_User == null)
        {
            Shove._Web.JavaScript.Alert(this.Page, "您还没有登录,请登录后再进行操作!");

            return;
        }

        double SumMoney     = 0;
        int    Multiple     = 0;
        short  SecrecyLevel = 0;
        int    PlayTypeID   = 0;
        int    LotteryID    = 0;
        long   IsuseID      = 0;
        int    SumNum       = 0;

        try
        {
            SumMoney   = double.Parse(hidSchemeMoney.Value);
            Multiple   = int.Parse(hidMultiple.Value);
            PlayTypeID = int.Parse(hidplayid.Value);
            LotteryID  = int.Parse(hidlotid.Value);
            PlayTypeID = int.Parse(hidplayid.Value);
            IsuseID    = long.Parse(hidisuseid.Value);
            SumNum     = int.Parse(hidSumNum.Value);
        }
        catch
        {
            Shove._Web.JavaScript.Alert(this.Page, "输入有错误,请仔细检查。");

            return;
        }

        if (SumMoney <= 0)
        {
            Shove._Web.JavaScript.Alert(this.Page, "输入有错误,请仔细检查。");

            return;
        }

        if (SumMoney > _User.Balance)
        {
            Shove._Web.JavaScript.Alert(this.Page, "您的余额不足,请充值。");

            return;
        }

        if (SumMoney > PF.SchemeMaxBettingMoney)
        {
            Shove._Web.JavaScript.Alert(this.Page, "投注金额不能大于" + PF.SchemeMaxBettingMoney.ToString() + ",谢谢。");

            return;
        }

        if (Multiple > 999)
        {
            Shove._Web.JavaScript.Alert(this.Page, "投注倍数不能大于 999 倍,谢谢。");

            return;
        }

        string LotteryNumber = hidcodes.Value.Replace("&nbsp;", " ");

        #region 对彩票号码进行分析,判断注数

        SLS.Lottery slsLottery = new SLS.Lottery();
        string[]    t_lotterys = SplitLotteryNumber(LotteryNumber);

        if ((t_lotterys == null) || (t_lotterys.Length < 1))
        {
            Shove._Web.JavaScript.Alert(this.Page, "选号发生异常,请重新选择号码投注,谢谢。(-694)");

            return;
        }

        int ValidNum = 0;

        foreach (string str in t_lotterys)
        {
            string Number = slsLottery[LotteryID].AnalyseScheme(str, PlayTypeID);

            if (string.IsNullOrEmpty(Number))
            {
                continue;
            }

            string[] str_s = Number.Split('|');

            if (str_s == null || str_s.Length < 1)
            {
                continue;
            }

            ValidNum += Shove._Convert.StrToInt(str_s[str_s.Length - 1], 0);
        }

        if (ValidNum != SumNum)
        {
            Shove._Web.JavaScript.Alert(this.Page, "选号发生异常,请重新选择号码投注,谢谢。");

            return;
        }

        #endregion

        if (DateTime.Now >= Shove._Convert.StrToDateTime(HidIsuseEndTime.Value.Replace("/", "-"), DateTime.Now.AddDays(-1).ToString()))
        {
            Shove._Web.JavaScript.Alert(this.Page, "本期投注已截止,谢谢。");

            return;
        }

        double Price = 2.0;

        if (PlayTypeID == 3903 || PlayTypeID == 3904)
        {
            Price = 3.0;
        }

        if (Price * SumNum * Multiple != SumMoney)
        {
            Shove._Web.JavaScript.Alert(this.Page, "输入有错误,请仔细检查。");

            return;
        }

        string ReturnDescription = "";

        long SchemeID = _User.InitiateScheme(IsuseID, PlayTypeID, "(无标题)", "", LotteryNumber, "", Multiple, SumMoney, 0, 1, 1, "", SecrecyLevel, 0.04, ref ReturnDescription);

        if (SchemeID < 0)
        {
            PF.GoError(ErrorNumber.Unknow, ReturnDescription, this.GetType().FullName + "(-347)");

            return;
        }

        Response.Redirect("Home/Room/UserBuySuccess.aspx?LotteryID=" + LotteryID.ToString() + "&&Money=" + SumMoney.ToString() + "&SchemeID=" + SchemeID.ToString() + "");

        return;
    }
Пример #18
0
    public static DataTable GetZCDCBuyContent(string BuyNum, long SchemeID, ref string vote)
    {
        string lotteryNumber = Shove._Convert.ToHtmlCode(BuyNum);

        string BuyContent = "";

        bool IsGetScheme = new SLS.Lottery()[SLS.Lottery.ZCDC.sID].GetSchemeSplit(lotteryNumber, ref BuyContent, ref vote);

        string PlayType = lotteryNumber.Split(';')[0].ToString();

        string[] Team = BuyContent.Split('|');

        DataTable dtnew = new DataTable();
        DataColumn newDC;

        newDC = new DataColumn("No", System.Type.GetType("System.Int32"));
        dtnew.Columns.Add(newDC);

        newDC = new DataColumn("LeagueTypeName", System.Type.GetType("System.String"));
        dtnew.Columns.Add(newDC);

        newDC = new DataColumn("HostTeam", System.Type.GetType("System.String"));
        dtnew.Columns.Add(newDC);

        newDC = new DataColumn("QuestTeam", System.Type.GetType("System.String"));
        dtnew.Columns.Add(newDC);

        newDC = new DataColumn("Content", System.Type.GetType("System.String"));
        dtnew.Columns.Add(newDC);

        newDC = new DataColumn("MarkersColor", System.Type.GetType("System.String"));
        dtnew.Columns.Add(newDC);

        newDC = new DataColumn("sp", System.Type.GetType("System.String"));
        dtnew.Columns.Add(newDC);

        newDC = new DataColumn("LotteryResult", System.Type.GetType("System.String"));
        dtnew.Columns.Add(newDC);

        newDC = new DataColumn("GamesResult", System.Type.GetType("System.String"));
        dtnew.Columns.Add(newDC);

        newDC = new DataColumn("HalftimeResult", System.Type.GetType("System.String"));
        dtnew.Columns.Add(newDC);

        for (int i = 0; i < Team.Length; i++)
        {
            DataTable dtp = GetTeamInfo(Team[i].Split('(')[0], SchemeID);

            if (dtp == null)
            {
                return null;
            }

            string TeamResult = Team[i].Split('(')[1].Substring(0, Team[i].Split('(')[1].Length - 1);

            string LotteryResult = "";
            string GamesResult = "";
            string HalftimeResult = "";
            string LetBall = "";
            string sp = "";
            if (PlayType == SLS.Lottery.ZCDC.PlayType_SPF.ToString())
            {
                TeamResult = TeamResult.Replace("0", "负").Replace("1", "平").Replace("3", "胜");

                if (dtp.Rows[0]["SPFResult"] != null)
                {
                    LotteryResult = dtp.Rows[0]["SPFResult"].ToString();
                    LotteryResult = LotteryResult.Replace("0", "负").Replace("1", "平").Replace("3", "胜");
                }

                if (dtp.Rows[0]["SPF_SP"] != null)
                {
                    sp = dtp.Rows[0]["SPF_SP"].ToString();
                }
            }

            if (PlayType == SLS.Lottery.ZCDC.PlayType_ZJQ.ToString())
            {
                TeamResult = TeamResult.Replace("7", "7+");

                if (dtp.Rows[0]["ZJQResult"] != null)
                {
                    LotteryResult = dtp.Rows[0]["ZJQResult"].ToString();
                    LotteryResult = LotteryResult.Replace("7", "7+");
                }

                if (dtp.Rows[0]["ZJQ_SP"] != null)
                {
                    sp = dtp.Rows[0]["ZJQ_SP"].ToString();
                }
            }

            if (PlayType == SLS.Lottery.ZCDC.PlayType_SXDS.ToString())
            {
                TeamResult = TeamResult.Replace("1", "上-单").Replace("2", "上-双").Replace("3", "下-单").Replace("4", "下-双");

                if (dtp.Rows[0]["SXDSResult"] != null)
                {
                    LotteryResult = dtp.Rows[0]["SXDSResult"].ToString();
                    LotteryResult = LotteryResult.Replace("1", "上-单").Replace("2", "上-双").Replace("3", "下-单").Replace("4", "下-双");
                }

                if (dtp.Rows[0]["SXDS_SP"] != null)
                {
                    sp = dtp.Rows[0]["SXDS_SP"].ToString();
                }
            }

            string SaleTeam = "";
            string SaleTeamResult = "";

            if (PlayType == SLS.Lottery.ZCDC.PlayType_ZQBF.ToString())
            {
                string[] Teams = TeamResult.Split(',');

                for (int j = 0; j < Teams.Length; j++)
                {
                    if (Teams[j].Length > 1)
                    {
                        SaleTeam += Teams[j].Replace("25", "负其他").Replace("24", "2:4").Replace("23", "1:4").Replace("22", "0:4").Replace("21", "2:3").Replace("20", "1:3").Replace("19", "0:3").Replace("18", "1:2").Replace("17", "0:2").Replace("16", "0:1").Replace("15", "平其他").Replace("14", "3:3").Replace("13", "2:2").Replace("12", "1:1").Replace("11", "0:0").Replace("10", "胜其他");
                    }
                    else
                    {
                        SaleTeam += Teams[j].Replace("1", "1:0").Replace("2", "2:0").Replace("3", "2:1").Replace("4", "3:0").Replace("5", "3:1").Replace("6", "3:2").Replace("7", "4:0").Replace("8", "4:1").Replace("9", "4:2");

                    }

                    SaleTeam += ",";
                }

                TeamResult = SaleTeam.Substring(0, SaleTeam.Length - 1);

                if (dtp.Rows[0]["ZQBFResult"] != null)
                {
                    string[] TeamsResult = dtp.Rows[0]["ZQBFResult"].ToString().Split(',');

                    for (int j = 0; j < TeamsResult.Length; j++)
                    {

                        if (TeamsResult[j].Length > 1)
                        {
                            SaleTeamResult += TeamsResult[j].Replace("25", "负其他").Replace("24", "2:4").Replace("23", "1:4").Replace("22", "0:4").Replace("21", "2:3").Replace("20", "1:3").Replace("19", "0:3").Replace("18", "1:2").Replace("17", "0:2").Replace("16", "0:1").Replace("15", "平其他").Replace("14", "3:3").Replace("13", "2:2").Replace("12", "1:1").Replace("11", "0:0").Replace("10", "胜其他");
                        }
                        else
                        {
                            SaleTeamResult += TeamsResult[j].Replace("1", "1:0").Replace("2", "2:0").Replace("3", "2:1").Replace("4", "3:0").Replace("5", "3:1").Replace("6", "3:2").Replace("7", "4:0").Replace("8", "4:1").Replace("9", "4:2");

                        }

                        SaleTeamResult += ",";
                    }

                    LotteryResult = SaleTeamResult.Substring(0, SaleTeamResult.Length - 1);
                }


                if (dtp.Rows[0]["ZQBF_SP"] != null)
                {
                    sp = dtp.Rows[0]["ZQBF_SP"].ToString();
                }

            }

            if (PlayType == SLS.Lottery.ZCDC.PlayType_BQCSPF.ToString())
            {
                TeamResult = TeamResult.Replace("1", "胜-胜").Replace("2", "胜-平").Replace("3", "胜-负").Replace("4", "平-胜").Replace("5", "平-平").Replace("6", "平-负").Replace("7", "负-胜").Replace("8", "负-平 ").Replace("9", "负-负");

                if (dtp.Rows[0]["BQCSPFResult"] != null)
                {
                    LotteryResult = dtp.Rows[0]["BQCSPFResult"].ToString();
                    LotteryResult = LotteryResult.Replace("1", "胜-胜").Replace("2", "胜-平").Replace("3", "胜-负").Replace("4", "平-胜").Replace("5", "平-平").Replace("6", "平-负").Replace("7", "负-胜").Replace("8", "负-平 ").Replace("9", "负-负");
                }

                if (dtp.Rows[0]["BQCSPF_SP"] != null)
                {
                    sp = dtp.Rows[0]["BQCSPF_SP"].ToString();
                }
            }

            if (LotteryResult == "*")
            {
                LotteryResult = "延时";
                sp = "1";
            }

            if (dtp.Rows[0]["Result"] != null)
            {
                GamesResult = dtp.Rows[0]["Result"].ToString();
            }

            if (dtp.Rows[0]["HalftimeResult"] != null)
            {
                HalftimeResult = dtp.Rows[0]["HalftimeResult"].ToString();
            }

            if (dtp.Rows[0]["LetBall"] != null)
            {
                LetBall = dtp.Rows[0]["LetBall"].ToString();
            }

            if (LetBall == "0")
            {
                LetBall = "";
            }
            else
            {
                LetBall = "[" + LetBall + "]";
            }

            DataRow dr1 = dtnew.NewRow();
            dr1[0] = dtp.Rows[0]["No"].ToString();
            dr1[1] = dtp.Rows[0]["LeagueTypeName"].ToString();
            dr1[2] = dtp.Rows[0]["HostTeam"].ToString() + LetBall;
            dr1[3] = dtp.Rows[0]["QuestTeam"].ToString();
            dr1[4] = TeamResult;
            dr1[5] = dtp.Rows[0]["MarkersColor"].ToString();
            dr1[6] = sp;
            dr1[7] = LotteryResult;
            dr1[8] = GamesResult;
            dr1[9] = HalftimeResult;
            dtnew.Rows.Add(dr1);
        }

        return dtnew;
    }
Пример #19
0
    //获取开奖号码
    public static DataTable GetDataTable(DataTable dt, int Type2)
    {
        DataColumn newDC0 = new DataColumn("Order", System.Type.GetType("System.String"));
        DataColumn newDC1 = new DataColumn("LotteryID", System.Type.GetType("System.String"));
        DataColumn newDC2 = new DataColumn("LotteryName", System.Type.GetType("System.String"));
        DataColumn newDC3 = new DataColumn("IsuseName", System.Type.GetType("System.String"));
        DataColumn newDC4 = new DataColumn("WinLotteryNumber", System.Type.GetType("System.String"));
        DataColumn newDC5 = new DataColumn("LotteryTypeID", System.Type.GetType("System.String"));
        DataColumn newDC6 = new DataColumn("LotteryType2", System.Type.GetType("System.String"));
        DataColumn newDC7 = new DataColumn("LotteryType2Name", System.Type.GetType("System.String"));

        DataTable dtType2 = new DataTable();
        dtType2.Columns.Add(newDC0);
        dtType2.Columns.Add(newDC1);
        dtType2.Columns.Add(newDC2);
        dtType2.Columns.Add(newDC3);
        dtType2.Columns.Add(newDC4);
        dtType2.Columns.Add(newDC5);
        dtType2.Columns.Add(newDC6);
        dtType2.Columns.Add(newDC7);

        DataRow[] Rows;

        if (Type2 == 3)
        {
            Rows = dt.Select("LotteryType2 = " + Type2 + "and LotteryID <> " + SLS.Lottery.ZCDC.ID.ToString(), "EndTime desc");
        }
        else
        {
            Rows = dt.Select("LotteryType2 = " + Type2, "EndTime desc");
        }

        foreach (DataRow dr in Rows)
        {
            DataRow dr1 = dtType2.NewRow();
            dr1[0] = dr[0].ToString();
            dr1[1] = dr[1].ToString();
            dr1[2] = dr[2].ToString();
            dr1[3] = dr[3].ToString();
            dr1[4] = new SLS.Lottery()[int.Parse(dr[1].ToString())].ShowNumber(dr[4].ToString());
            dr1[5] = dr[5].ToString();
            dr1[6] = dr[6].ToString();
            dr1[7] = dr[7].ToString();

            dtType2.Rows.Add(dr1);
        }

        return dtType2;
    }
Пример #20
0
    protected void btn_ok_Click(object sender, EventArgs e)
    {
        DataTable dt = new DAL.Views.V_ElectronTicketAgentSchemesElectronTickets().Open("LotteryID, IsuseID, PlayTypeID, Ticket, SchemeNumber, WinLotteryNumber, DateTime, Money, Multiple", "Identifiers='" + tbTicket.Text.Trim() + "'", "");

        if (dt == null)
        {
            Shove._Web.JavaScript.Alert(this.Page, "数据库读写错误!");

            return;
        }

        if (dt.Rows.Count < 1)
        {
            Shove._Web.JavaScript.Alert(this.Page, "没有找到此票标识!");

            return;
        }

        DataTable dtWinList = new DAL.Tables.T_WinTypes().Open("","LotteryID=" + dt.Rows[0]["LotteryID"].ToString(),"");

        if ((dtWinList == null) || (dtWinList.Rows.Count < 1))
        {
            Shove._Web.JavaScript.Alert(this.Page, "数据库读写错误!");

            return;
        }

        double[] WinMoneyList = new double[dtWinList.Rows.Count * 2];

        for (int i = 0; i < dtWinList.Rows.Count; i++)
        {
            WinMoneyList[i * 2] = Shove._Convert.StrToDouble(dtWinList.Rows[i]["defaultMoney"].ToString(), 0);
            WinMoneyList[i * 2 + 1] = Shove._Convert.StrToDouble(dtWinList.Rows[i]["DefaultMoneyNoWithTax"].ToString(), 0);

            if (WinMoneyList[i * 2] < 0)
            {
                Shove._Web.JavaScript.Alert(this.Page, "数据库读写错误!");

                return;
            }

            if (WinMoneyList[i * 2] < WinMoneyList[i * 2 + 1])
            {
                Shove._Web.JavaScript.Alert(this.Page, "数据库读写错误!");

                return;
            }
        }

        string t_LotteryNumber = dt.Rows[0]["Ticket"].ToString();
        string LotteryNumber = "";

        int LotteryID = Shove._Convert.StrToInt(dt.Rows[0]["LotteryID"].ToString(), 0);
        int PlayTypeID = Shove._Convert.StrToInt(dt.Rows[0]["PlayTypeID"].ToString(), 0);
        string WinLotteryNumber = dt.Rows[0]["WinLotteryNumber"].ToString();

        try
        {
            new SLS.Lottery()[LotteryID].HPSH_ToElectronicTicket(PlayTypeID, t_LotteryNumber, ref LotteryNumber, ref PlayTypeID);
        }
        catch
        {
        }

        string Description = "";
        double WinMoneyNoWithTax = 0;
        double WinMoney = 0;

        try
        {
            WinMoney = new SLS.Lottery()[LotteryID].ComputeWin(LotteryNumber, WinLotteryNumber, ref Description, ref WinMoneyNoWithTax, PlayTypeID, WinMoneyList);
        }
        catch
        {
        }

        lbDescription.Text = "";

        if (!string.IsNullOrEmpty(Description.Trim()))
        {
            lbDescription.Text = Description;
        }

        lbSchemeNumber.Text = dt.Rows[0]["SchemeNumber"].ToString();
        lbDateTime.Text = dt.Rows[0]["DateTime"].ToString();
        lbAmount.Text = dt.Rows[0]["Money"].ToString();
        lbMultiple.Text = dt.Rows[0]["Multiple"].ToString();

        if (WinMoney > 0)
        {
            lbWinMoney.Text = WinMoney.ToString();
        }
        else
        {
            lbWinMoney.Text = "<color='red'>" + WinMoney + "</color>";
        }
    }
Пример #21
0
    protected void btnOK_Click(object sender, EventArgs e)
    {
        if (_User == null)
        {
            Shove._Web.JavaScript.Alert(this.Page, "您还没有登录,请登录后再进行操作!");

            return;
        }

        double SumMoney = 0;
        int Multiple = 0;
        short SecrecyLevel = 0;
        int PlayTypeID = 0;
        int LotteryID = 0;
        long IsuseID = 0;
        int SumNum = 0;

        int Share = 1;
        int BuyShare = 1;
        double AssureMoney = 0;

        try
        {
            SumMoney = double.Parse(hidSchemeMoney.Value);
            Multiple = int.Parse(hidMultiple.Value);
            PlayTypeID = int.Parse(hidplayid.Value);
            LotteryID = int.Parse(hidlotid.Value);
            IsuseID = long.Parse(hidisuseid.Value);
            SumNum = int.Parse(hidSumNum.Value);

            Share = int.Parse(labShare.Text);
            BuyShare = int.Parse(labBuyShare.Text);
            AssureMoney = double.Parse(labAssureMoney.Text);
        }
        catch
        {
            Shove._Web.JavaScript.Alert(this.Page, "输入有错误,请仔细检查。");

            return;
        }

        if (SumMoney <= 0)
        {
            Shove._Web.JavaScript.Alert(this.Page, "输入有错误,请仔细检查。");

            return;
        }

        if (SumMoney > _User.Balance)
        {
            Shove._Web.JavaScript.Alert(this.Page, "您的余额不足,请充值。");

            return;
        }

        if (SumMoney > PF.SchemeMaxBettingMoney)
        {
            Shove._Web.JavaScript.Alert(this.Page, "投注金额不能大于" + PF.SchemeMaxBettingMoney.ToString() + ",谢谢。");

            return;
        }

        if (Multiple > 999)
        {
            Shove._Web.JavaScript.Alert(this.Page, "投注倍数不能大于 999 倍,谢谢。");

            return;
        }

         string LotteryNumber = "";
         string FileName = "";

         if (Shove._Convert.StrToLong(hidBuyID.Value, 0) < 1)
         {
             FileName = System.AppDomain.CurrentDomain.BaseDirectory + "Temp\\" + Request.Cookies["ASP.NET_SessionId"].Value + ".txt";

             LotteryNumber = File.ReadAllText(FileName);

             #region 对彩票号码进行分析,判断注数

             SLS.Lottery slsLottery = new SLS.Lottery();
             string[] t_lotterys = SplitLotteryNumber(LotteryNumber);

             if ((t_lotterys == null) || (t_lotterys.Length < 1))
             {
                 Shove._Web.JavaScript.Alert(this.Page, "选号发生异常,请重新选择号码投注,谢谢。(-694)");

                 return;
             }

             int ValidNum = 0;

             foreach (string str in t_lotterys)
             {
                 if (string.IsNullOrEmpty(str))
                 {
                     continue;
                 }

                 string Number = slsLottery[LotteryID].AnalyseScheme(str, PlayTypeID);

                 if (string.IsNullOrEmpty(Number))
                 {
                     continue;
                 }

                 string[] str_s = Number.Split('|');

                 if (str_s == null || str_s.Length < 1)
                 {
                     continue;
                 }

                 ValidNum += Shove._Convert.StrToInt(str_s[str_s.Length - 1], 0);
             }

             if (ValidNum != SumNum)
             {
                 Shove._Web.JavaScript.Alert(this.Page, "选号发生异常,请重新选择号码投注,谢谢。");

                 return;
             }

             #endregion
         }
         else
         {
             LotteryNumber = hidLotteryNumber.Value;
         }

        if (DateTime.Now >= Shove._Convert.StrToDateTime(HidIsuseEndTime.Value.Replace("/", "-"), DateTime.Now.AddDays(-1).ToString()))
        {
            Shove._Web.JavaScript.Alert(this.Page, "本期投注已截止,谢谢。");

            return;
        }

        double Price = 2.0;

        if (Price * SumNum * Multiple != SumMoney)
        {
            Shove._Web.JavaScript.Alert(this.Page, "输入有错误,请仔细检查。");

            return;
        }

        string ReturnDescription = "";

        long SchemeID = _User.InitiateScheme(IsuseID, PlayTypeID, "(无标题)", "", LotteryNumber, "", Multiple, SumMoney, AssureMoney, Share, BuyShare, "", SecrecyLevel, 0.04, ref ReturnDescription);

        if (SchemeID < 0)
        {
            PF.GoError(ErrorNumber.Unknow, ReturnDescription, this.GetType().FullName + "(-347)");

            return;
        }

        File.WriteAllText(System.AppDomain.CurrentDomain.BaseDirectory + "SchemeInfo\\" + SchemeID.ToString() + ".txt", LotteryNumber + "$" + hidMatchID.Value);

        if (File.Exists(FileName))
        {
            try
            {
                File.Delete(FileName);
            }
            catch { }
        }

        Response.Redirect("../Home/Room/UserBuySuccess.aspx?LotteryID=" + LotteryID.ToString() + "&&Money=" + SumMoney.ToString() + "&SchemeID=" + SchemeID.ToString() + "");

        return;
    }
Пример #22
0
    /// <summary>
    /// 购买彩票
    /// </summary>
    /// <param name="_User"></param>
    private void Buy(Users _User)
    {
        string HidIsuseID          = Shove._Web.Utility.GetRequest("HidIsuseID");
        string HidIsuseEndTime     = Shove._Web.Utility.GetRequest("HidIsuseEndTime");
        string playType            = Shove._Web.Utility.GetRequest("playType");
        string CoBuy               = Shove._Web.Utility.GetRequest("CoBuy");
        string tb_Share            = Shove._Web.Utility.GetRequest("tb_Share");
        string tb_BuyShare         = Shove._Web.Utility.GetRequest("tb_BuyShare");
        string tb_AssureShare      = Shove._Web.Utility.GetRequest("tb_AssureShare");
        string tb_OpenUserList     = "";
        string tb_Title            = Shove._Web.Utility.GetRequest("tb_Title");
        string tb_Description      = Shove._Web.Utility.GetRequest("tb_Description");
        string tbSecrecyLevel      = Shove._Web.Utility.GetRequest("SecrecyLevel");
        string tb_LotteryNumber    = Shove._Web.Utility.FilteSqlInfusion(Request["tb_LotteryNumber"]);
        string tb_hide_SumMoney    = Shove._Web.Utility.GetRequest("tb_hide_SumMoney");
        string tb_hide_AssureMoney = Shove._Web.Utility.GetRequest("tb_hide_AssureMoney");
        string tb_hide_SumNum      = Shove._Web.Utility.GetRequest("tb_hide_SumNum");
        string HidLotteryID        = Shove._Web.Utility.GetRequest("HidLotteryID");
        string tb_Multiple         = Shove._Web.Utility.GetRequest("tb_Multiple");
        string tb_SchemeBonusScale = Shove._Web.Utility.GetRequest("tb_SchemeBonusScale");
        string playTypeID          = Shove._Web.Utility.GetRequest("tbPlayTypeID");
        string tb_SumMoney         = Shove._Web.Utility.GetRequest("tb_SchemeMoney");
        string bet = Shove._Web.Utility.GetRequest("bet");

        int Price = 2;

        if (tb_Multiple == "")
        {
            tb_Multiple = "1";
        }

        double SumMoney         = 0;
        int    Share            = 0;
        int    BuyShare         = 0;
        double AssureMoney      = 0;
        int    Multiple         = 0;
        int    SumNum           = 0;
        short  SecrecyLevel     = 0;
        int    PlayTypeID       = 0;
        int    LotteryID        = 0;
        long   IsuseID          = 0;
        double SchemeBonusScale = 0;

        if (string.IsNullOrEmpty(tb_Share))
        {
            tb_Share = Shove._Web.Utility.GetRequest("tb_MinSchemeMoney");
        }

        try
        {
            SumMoney         = double.Parse(tb_hide_SumMoney);
            Share            = int.Parse(tb_Share);
            BuyShare         = int.Parse(tb_BuyShare);
            AssureMoney      = double.Parse(tb_hide_AssureMoney);
            Multiple         = int.Parse(tb_Multiple);
            SumNum           = int.Parse(tb_hide_SumNum);
            SecrecyLevel     = short.Parse(tbSecrecyLevel);
            PlayTypeID       = int.Parse(playTypeID);
            LotteryID        = int.Parse(HidLotteryID);
            IsuseID          = long.Parse(HidIsuseID);
            SchemeBonusScale = double.Parse(tb_SchemeBonusScale);
        }
        catch
        {
            Shove._Web.JavaScript.Alert(this.Page, "输入有错误,请仔细检查。");

            return;
        }

        if (playTypeID != playType)
        {
            if (bet != "Bet01")
            {
                SumMoney = Shove._Convert.StrToDouble(Shove._Web.Utility.GetRequest("tb_MinSchemeMoney"), 0);
            }
            else
            {
                SumMoney = double.Parse(tb_SumMoney);
            }
        }

        if ((SumMoney <= 0) || (SumNum < 1 && playTypeID == playType))
        {
            Shove._Web.JavaScript.Alert(this.Page, "输入有错误,请仔细检查。");

            return;
        }

        if (AssureMoney < 0)
        {
            Shove._Web.JavaScript.Alert(this.Page, "输入有错误,请仔细检查。");

            return;
        }

        if (Share < 1)
        {
            Shove._Web.JavaScript.Alert(this.Page, "输入有错误,请仔细检查。");

            return;
        }

        if ((BuyShare == Share) && (AssureMoney == 0))
        {
            Share    = 1;
            BuyShare = 1;
        }

        if ((SumMoney / Share) < 1)
        {
            Shove._Web.JavaScript.Alert(this.Page, "每份金额最低不能少于 1 元。");

            return;
        }

        double BuyMoney = BuyShare * (SumMoney / Share) + AssureMoney;

        if (BuyMoney > _User.Balance)
        {
            SaveDataForAliBuy();

            return;
        }

        if (BuyMoney > PF.SchemeMaxBettingMoney)
        {
            Shove._Web.JavaScript.Alert(this.Page, "投注金额不能大于" + PF.SchemeMaxBettingMoney.ToString() + ",谢谢。");

            return;
        }

        if (Multiple > 999)
        {
            Shove._Web.JavaScript.Alert(this.Page, "投注倍数不能大于 999 倍,谢谢。");

            return;
        }
        //佣金比例的计算

        if (!(SchemeBonusScale >= 0 || SchemeBonusScale <= 10))
        {
            Shove._Web.JavaScript.Alert(this.Page, "佣金比例只能在0~10之间");

            return;
        }

        if (SchemeBonusScale.ToString().IndexOf("-") > -1 || SchemeBonusScale.ToString().IndexOf(".") > -1)
        {
            Shove._Web.JavaScript.Alert(this.Page, "佣金比例输入有误");

            return;
        }

        SchemeBonusScale = SchemeBonusScale / 100;

        string LotteryNumber = tb_LotteryNumber;

        if (playTypeID == playType)
        {
            if (LotteryNumber[LotteryNumber.Length - 1] == '\n')
            {
                LotteryNumber = LotteryNumber.Substring(0, LotteryNumber.Length - 1);
            }

            #region 对彩票号码进行分析,判断注数

            SLS.Lottery slsLottery = new SLS.Lottery();
            string[]    t_lotterys = SplitLotteryNumber(LotteryNumber);

            if ((t_lotterys == null) || (t_lotterys.Length < 1))
            {
                Shove._Web.JavaScript.Alert(this.Page, "选号发生异常,请重新选择号码投注,谢谢。(-694)");

                return;
            }

            int ValidNum = 0;

            foreach (string str in t_lotterys)
            {
                string Number = slsLottery[LotteryID].AnalyseScheme(str, PlayTypeID);

                if (string.IsNullOrEmpty(Number))
                {
                    continue;
                }

                string[] str_s = Number.Split('|');

                if (str_s == null || str_s.Length < 1)
                {
                    continue;
                }

                ValidNum += Shove._Convert.StrToInt(str_s[str_s.Length - 1], 0);
            }

            if (ValidNum != SumNum)
            {
                Shove._Web.JavaScript.Alert(this.Page, "选号发生异常,请重新选择号码投注,谢谢。");

                return;
            }

            #endregion
        }
        else
        {
            LotteryNumber = "";
        }

        string ReturnDescription = "";

        if (DateTime.Now >= Shove._Convert.StrToDateTime(HidIsuseEndTime.Replace("/", "-"), DateTime.Now.AddDays(-1).ToString()))
        {
            Shove._Web.JavaScript.Alert(this.Page, "本期投注已截止,谢谢。");

            return;
        }

        if (playType == playTypeID && Price * SumNum * Multiple != SumMoney)
        {
            Shove._Web.JavaScript.Alert(this.Page, "输入有错误,请仔细检查。");

            return;
        }

        long SchemeID = _User.InitiateScheme(IsuseID, PlayTypeID, tb_Title.Trim() == "" ? "(无标题)" : tb_Title.Trim(), tb_Description.Trim(), LotteryNumber, "", Multiple, SumMoney, AssureMoney, Share, BuyShare, tb_OpenUserList.Trim(), short.Parse(SecrecyLevel.ToString()), SchemeBonusScale, ref ReturnDescription);
        if (SchemeID < 0)
        {
            PF.GoError(ErrorNumber.Unknow, ReturnDescription, this.GetType().FullName + "(-755)");

            return;
        }

        if (playType != playTypeID)
        {
            double MinMoney = 0;
            double MaxMoney = 0;

            if (bet == "Bet01")
            {
                MinMoney = SumMoney;
                MaxMoney = SumMoney;
            }
            else
            {
                MinMoney = Shove._Convert.StrToDouble(Shove._Web.Utility.GetRequest("tb_MinSchemeMoney"), 0);
                MaxMoney = Shove._Convert.StrToDouble(Shove._Web.Utility.GetRequest("tb_MaxSchemeMoney"), 0);
            }

            if (MaxMoney < MinMoney)
            {
                Shove._Web.JavaScript.Alert(this.Page, "您输入的最大方案金额不能小于最小方案金额!");

                return;
            }

            if (MaxMoney > MinMoney * 1.4)
            {
                Shove._Web.JavaScript.Alert(this.Page, "您输入的最大方案金额大于最小方案金额的 1.4 倍!");

                return;
            }

            DAL.Tables.T_PrepareBet t_PrepareBet = new DAL.Tables.T_PrepareBet();

            t_PrepareBet.SchemeID.Value = SchemeID;
            t_PrepareBet.MinMoney.Value = MinMoney;
            t_PrepareBet.MaxMoney.Value = MaxMoney;
            t_PrepareBet.Insert();
        }

        Shove._Web.Cache.ClearCache("Home_Room_CoBuy_BindDataForType" + IsuseID.ToString());
        Shove._Web.Cache.ClearCache("Home_Room_SchemeAll_BindData" + IsuseID.ToString());

        if (SumMoney > 50 && Share > 1)
        {
            Shove._Web.Cache.ClearCache("Home_Room_JoinAllBuy_BindData");
        }

        Response.Redirect("../Home/Room/UserBuySuccess.aspx?LotteryID=" + LotteryID.ToString() + "&&Money=" + BuyMoney.ToString() + "&SchemeID=" + SchemeID.ToString() + "");

        return;
    }
Пример #23
0
 public static DataTable GetDataTable(DataTable dt, int Type2)
 {
     DataRow[] rowArray;
     DataColumn column = new DataColumn("Order", Type.GetType("System.String"));
     DataColumn column2 = new DataColumn("LotteryID", Type.GetType("System.String"));
     DataColumn column3 = new DataColumn("LotteryName", Type.GetType("System.String"));
     DataColumn column4 = new DataColumn("IsuseName", Type.GetType("System.String"));
     DataColumn column5 = new DataColumn("WinLotteryNumber", Type.GetType("System.String"));
     DataColumn column6 = new DataColumn("LotteryTypeID", Type.GetType("System.String"));
     DataColumn column7 = new DataColumn("LotteryType2", Type.GetType("System.String"));
     DataColumn column8 = new DataColumn("LotteryType2Name", Type.GetType("System.String"));
     DataTable table = new DataTable();
     table.Columns.Add(column);
     table.Columns.Add(column2);
     table.Columns.Add(column3);
     table.Columns.Add(column4);
     table.Columns.Add(column5);
     table.Columns.Add(column6);
     table.Columns.Add(column7);
     table.Columns.Add(column8);
     if (Type2 == 3)
     {
         object[] objArray = new object[] { "LotteryType2 = ", Type2, "and LotteryID <> ", 0x2d.ToString() };
         rowArray = dt.Select(string.Concat(objArray), "EndTime desc");
     }
     else
     {
         rowArray = dt.Select("LotteryType2 = " + Type2, "EndTime desc");
     }
     foreach (DataRow row in rowArray)
     {
         DataRow row2 = table.NewRow();
         row2[0] = row[0].ToString();
         row2[1] = row[1].ToString();
         row2[2] = row[2].ToString();
         row2[3] = row[3].ToString();
         row2[4] = new SLS.Lottery()[int.Parse(row[1].ToString())].ShowNumber(row[4].ToString());
         row2[5] = row[5].ToString();
         row2[6] = row[6].ToString();
         row2[7] = row[7].ToString();
         table.Rows.Add(row2);
     }
     return table;
 }
Пример #24
0
    protected void btn_ok_Click(object sender, EventArgs e)
    {
        DataTable dt = new DAL.Views.V_ElectronTicketAgentSchemesElectronTickets().Open("LotteryID, IsuseID, PlayTypeID, Ticket, SchemeNumber, WinLotteryNumber, DateTime, Money, Multiple", "Identifiers='" + tbTicket.Text.Trim() + "'", "");

        if (dt == null)
        {
            Shove._Web.JavaScript.Alert(this.Page, "数据库读写错误!");

            return;
        }

        if (dt.Rows.Count < 1)
        {
            Shove._Web.JavaScript.Alert(this.Page, "没有找到此票标识!");

            return;
        }

        DataTable dtWinList = new DAL.Tables.T_WinTypes().Open("", "LotteryID=" + dt.Rows[0]["LotteryID"].ToString(), "");

        if ((dtWinList == null) || (dtWinList.Rows.Count < 1))
        {
            Shove._Web.JavaScript.Alert(this.Page, "数据库读写错误!");

            return;
        }

        double[] WinMoneyList = new double[dtWinList.Rows.Count * 2];

        for (int i = 0; i < dtWinList.Rows.Count; i++)
        {
            WinMoneyList[i * 2]     = Shove._Convert.StrToDouble(dtWinList.Rows[i]["defaultMoney"].ToString(), 0);
            WinMoneyList[i * 2 + 1] = Shove._Convert.StrToDouble(dtWinList.Rows[i]["DefaultMoneyNoWithTax"].ToString(), 0);

            if (WinMoneyList[i * 2] < 0)
            {
                Shove._Web.JavaScript.Alert(this.Page, "数据库读写错误!");

                return;
            }

            if (WinMoneyList[i * 2] < WinMoneyList[i * 2 + 1])
            {
                Shove._Web.JavaScript.Alert(this.Page, "数据库读写错误!");

                return;
            }
        }

        string t_LotteryNumber = dt.Rows[0]["Ticket"].ToString();
        string LotteryNumber   = "";

        int    LotteryID        = Shove._Convert.StrToInt(dt.Rows[0]["LotteryID"].ToString(), 0);
        int    PlayTypeID       = Shove._Convert.StrToInt(dt.Rows[0]["PlayTypeID"].ToString(), 0);
        string WinLotteryNumber = dt.Rows[0]["WinLotteryNumber"].ToString();

        try
        {
            new SLS.Lottery()[LotteryID].HPSH_ToElectronicTicket(PlayTypeID, t_LotteryNumber, ref LotteryNumber, ref PlayTypeID);
        }
        catch
        {
        }

        string Description       = "";
        double WinMoneyNoWithTax = 0;
        double WinMoney          = 0;

        try
        {
            WinMoney = new SLS.Lottery()[LotteryID].ComputeWin(LotteryNumber, WinLotteryNumber, ref Description, ref WinMoneyNoWithTax, PlayTypeID, WinMoneyList);
        }
        catch
        {
        }

        lbDescription.Text = "";

        if (!string.IsNullOrEmpty(Description.Trim()))
        {
            lbDescription.Text = Description;
        }

        lbSchemeNumber.Text = dt.Rows[0]["SchemeNumber"].ToString();
        lbDateTime.Text     = dt.Rows[0]["DateTime"].ToString();
        lbAmount.Text       = dt.Rows[0]["Money"].ToString();
        lbMultiple.Text     = dt.Rows[0]["Multiple"].ToString();

        if (WinMoney > 0)
        {
            lbWinMoney.Text = WinMoney.ToString();
        }
        else
        {
            lbWinMoney.Text = "<color='red'>" + WinMoney + "</color>";
        }
    }
Пример #25
0
    protected void btnGO_Step1_Click(object sender, EventArgs e)
    {
        btnGO_Step1.AlertText = "";

        if (ddlLottery.SelectedValue == SLS.Lottery.ZCDC.sID)
        {
            Shove._Web.JavaScript.Alert(this.Page, "足彩单场不支持分步开奖。");

            return;
        }

        tbWinNumber.Text = Shove._Convert.ToDBC(tbWinNumber.Text.Trim().Replace(" ", " ")).Trim();

        if (!new SLS.Lottery()[int.Parse(ddlLottery.SelectedValue)].AnalyseWinNumber(tbWinNumber.Text))
        {
            Shove._Web.JavaScript.Alert(this.Page, "开奖号码不正确!");

            return;
        }

        SystemOptions so = new SystemOptions();
        bool          isCompareWinMoneyNoWithFax = so["isCompareWinMoneyNoWithFax"].ToBoolean(true);

        string WinListXML = "<WinLists>";

        double[] WinMoneyList = new double[g.Rows.Count * 2];

        for (int i = 0; i < g.Rows.Count; i++)
        {
            WinMoneyList[i * 2]     = Shove._Convert.StrToDouble(((TextBox)g.Rows[i].Cells[1].FindControl("tbMoney")).Text, 0);
            WinMoneyList[i * 2 + 1] = Shove._Convert.StrToDouble(((TextBox)g.Rows[i].Cells[2].FindControl("tbMoneyNoWithTax")).Text, 0);

            if (WinMoneyList[i * 2] < 0)
            {
                Shove._Web.JavaScript.Alert(this.Page, "第 " + (i + 1).ToString() + " 项奖金输入错误!");

                return;
            }

            if (WinMoneyList[i * 2] < WinMoneyList[i * 2 + 1])
            {
                if (isCompareWinMoneyNoWithFax)
                {
                    Shove._Web.JavaScript.Alert(this.Page, "第 " + (i + 1).ToString() + " 项税后奖金输入错误(不能大于税前奖金)!");

                    return;
                }
            }

            WinListXML += "<WinList defaultMoney=\"" + WinMoneyList[i * 2].ToString() + "\" DefaultMoneyNoWithTax=\"" + WinMoneyList[i * 2 + 1].ToString() + "\"/>";
        }

        WinListXML += "</WinLists>";

        DataTable dtIsuseBonuses = new DAL.Tables.T_IsuseBonuses().Open("", "IsuseID = " + Shove._Web.Utility.FilteSqlInfusion(ddlIsuse.SelectedValue), "");

        if (dtIsuseBonuses == null)
        {
            PF.GoError(ErrorNumber.DataReadWrite, "数据库繁忙,请重试", this.GetType().BaseType.FullName);

            return;
        }

        if (dtIsuseBonuses.Rows.Count < 1)
        {
            int    ReturnValue       = -1;
            string ReturnDescription = "";


            int Result = DAL.Procedures.P_IsuseBonusesAdd(Shove._Convert.StrToLong(ddlIsuse.SelectedValue, 0), _User.ID, WinListXML, ref ReturnValue, ref ReturnDescription);

            if (Result < 0)
            {
                PF.GoError(ErrorNumber.DataReadWrite, "数据库繁忙,请重试", this.GetType().BaseType.FullName);

                return;
            }

            if (ReturnValue < 0)
            {
                Shove._Web.JavaScript.Alert(this.Page, ReturnDescription);

                return;
            }

            Shove._Web.JavaScript.Alert(this.Page, "请下一位管理员继续开奖!");

            return;
        }

        if (dtIsuseBonuses.Rows[0]["UserID"].ToString() == _User.ID.ToString())
        {
            Shove._Web.JavaScript.Alert(this.Page, "请下一位管理员继续开奖!");

            return;
        }

        for (int i = 0; i < dtIsuseBonuses.Rows.Count; i++)
        {
            if ((WinMoneyList[i * 2] != Shove._Convert.StrToDouble(dtIsuseBonuses.Rows[i]["defaultMoney"].ToString(), 0)) || (WinMoneyList[i * 2 + 1] != Shove._Convert.StrToDouble(dtIsuseBonuses.Rows[i]["DefaultMoneyNoWithTax"].ToString(), 0)))
            {
                DAL.Tables.T_IsuseBonuses T_IsuseBonuses = new DAL.Tables.T_IsuseBonuses();
                T_IsuseBonuses.Delete("IsuseID = " + ddlIsuse.SelectedValue);

                Shove._Web.JavaScript.Alert(this.Page, "两次奖项输入不一致,请联系上一次开奖操作员!");

                return;
            }
        }

        DataTable dt = new DAL.Tables.T_Schemes().Open("* ", "IsuseID = " + Shove._Web.Utility.FilteSqlInfusion(ddlIsuse.SelectedValue) + " and isOpened = 0 and Buyed = 1", "[ID]");

        if (dt == null)
        {
            PF.GoError(ErrorNumber.DataReadWrite, "数据库繁忙,请重试", this.GetType().BaseType.FullName);

            return;
        }

        StringBuilder sb = new StringBuilder();

        string NoWinSchemeID = "";

        for (int i = 0; i < dt.Rows.Count; i++)
        {
            string LotteryNumber     = dt.Rows[i]["LotteryNumber"].ToString();
            string Description       = "";
            double WinMoneyNoWithTax = 0;
            double WinMoney          = 0;

            try
            {
                WinMoney = new SLS.Lottery()[int.Parse(ddlLottery.SelectedValue)].ComputeWin(LotteryNumber, tbWinNumber.Text.Trim(), ref Description, ref WinMoneyNoWithTax, int.Parse(dt.Rows[i]["PlayTypeID"].ToString()), WinMoneyList);
            }
            catch
            {
                WinMoney = 0;

                new Log("System").Write("方案 ID:" + dt.Rows[i]["ID"].ToString() + " 算奖出现错误!");
            }

            if (WinMoney == 0)
            {
                NoWinSchemeID += dt.Rows[i]["ID"].ToString() + ",";

                continue;
            }

            sb.Append("update T_Schemes set EditWinMoney = ").Append(WinMoney * Shove._Convert.StrToInt(dt.Rows[i]["Multiple"].ToString(), 1))
            .Append(", EditWinMoneyNoWithTax = ").Append(WinMoneyNoWithTax * Shove._Convert.StrToInt(dt.Rows[i]["Multiple"].ToString(), 1))
            .Append(", WinDescription = '").Append(Description).Append("'")
            .Append(" where [ID] = ").AppendLine(dt.Rows[i]["ID"].ToString());
        }

        Shove.Database.MSSQL.ExecuteNonQuery(sb.ToString(), new Shove.Database.MSSQL.Parameter[0]);

        if (NoWinSchemeID.EndsWith(","))
        {
            NoWinSchemeID = NoWinSchemeID.Substring(0, NoWinSchemeID.Length - 1);
        }

        if (!string.IsNullOrEmpty(NoWinSchemeID))
        {
            StringBuilder sb1 = new StringBuilder();

            sb1.Append("update T_Schemes set EditWinMoney = 0")
            .Append(", EditWinMoneyNoWithTax = 0, isOpened = 1 , OpenOperatorID=" + _User.ID.ToString())
            .Append(", WinDescription = ''")
            .Append(" where [ID] in (" + NoWinSchemeID + ")");

            Shove.Database.MSSQL.ExecuteNonQuery(sb1.ToString(), new Shove.Database.MSSQL.Parameter[0]);
        }

        dt = new DAL.Tables.T_Schemes().Open("top 1 * ", "IsuseID = " + Shove._Web.Utility.FilteSqlInfusion(ddlIsuse.SelectedValue) + " and isOpened = 0 and Buyed = 1 and WinDescription is null", "[ID]");

        if (dt == null)
        {
            PF.GoError(ErrorNumber.DataReadWrite, "数据库繁忙,请重试", this.GetType().BaseType.FullName);

            return;
        }

        Step1IsOpen = (dt.Rows.Count > 0);

        btnGO_Step1.Enabled = Step1IsOpen;
        btnGO_Step2.Enabled = (!Step1IsOpen);
        btnGO_Step3.Enabled = ((!Step1IsOpen) && (!Step2IsOpen));

        string Message = "请再次执行第一步";

        if (!Step1IsOpen)
        {
            Message = "开奖步骤一已经完成,请执行第二步.";
        }

        Shove._Web.JavaScript.Alert(this.Page, Message);
    }
Пример #26
0
    // 接收奖期通知
    private void IsuseNotice(string TransMessage)
    {
        System.Xml.XmlDocument XmlDoc = new XmlDocument();

        try
        {
            XmlDoc.Load(new StringReader(TransMessage));
        }
        catch { }

        DAL.Tables.T_Isuses t_Isuses = new DAL.Tables.T_Isuses();

        string Body = TransMessage.Substring(TransMessage.IndexOf("<elements"), TransMessage.LastIndexOf("</elements>") - TransMessage.IndexOf("<elements")) + "</elements>";

        DataSet ds = new DataSet();

        ds.ReadXml(new StringReader(Body));

        if (ds == null)
        {
            return;
        }

        if (ds.Tables.Count == 0)
        {
            return;
        }

        DataTable dt = ds.Tables[0];

        if (dt.Rows.Count < 1)
        {
            return;
        }

        string MessageID = "";

        for (int i = 0; i < dt.Rows.Count; i++)
        {
            DataRow dr = dt.Rows[i];

            string LotteryName = dr["lotteryid"].ToString();
            int    LotteryID   = GetLotteryID(LotteryName);
            string IsuseName   = GetIsusesNameToCaiyou(LotteryID.ToString(), dr["issue"].ToString());
            string Status      = dr["status"].ToString();
            string StartTime   = dr["starttime"].ToString();
            string EndTime     = dr["endtime"].ToString();
            string WinNumber   = "";

            if (Shove._Convert.StrToInt(Status, 0) > 1)
            {
                try
                {
                    WinNumber = GetWinNumber(LotteryID, dr["bonuscode"].ToString());
                }
                catch { }
            }

            if ((LotteryID < 0) || (String.IsNullOrEmpty(IsuseName)))
            {
                continue;
            }

            if (t_Isuses.GetCount("LotteryID = " + LotteryID.ToString() + " and [Name] = '" + Shove._Web.Utility.FilteSqlInfusion(IsuseName) + "' and year(StartTime) = YEAR(GETDATE())") < 1)
            {
                DateTime _StartTime = DateTime.Now;
                DateTime _EndTime   = DateTime.Now;

                try
                {
                    _StartTime = DateTime.Parse(StartTime);
                    _EndTime   = DateTime.Parse(EndTime);
                }
                catch
                {
                    continue;
                }

                long   IsuseID           = -1;
                string ReturnDescription = "";

                if (DAL.Procedures.P_IsuseAdd(LotteryID, IsuseName, _StartTime, _EndTime, "", ref IsuseID, ref ReturnDescription) < 0)
                {
                    continue;
                }

                if (IsuseID < 0)
                {
                    continue;
                }
            }

            DataTable dtIsuse = t_Isuses.Open("ID, State, WinLotteryNumber", "LotteryID = " + LotteryID.ToString() + " and [Name] = '" + Shove._Web.Utility.FilteSqlInfusion(IsuseName) + "' and year(StartTime) = YEAR(GETDATE())", "");

            if ((dtIsuse == null) || (dtIsuse.Rows.Count < 1))
            {
                continue;
            }

            if (Status == "1")
            {
                int    ReturnValue      = 0;
                string ReturnDescprtion = "";

                if (DAL.Procedures.P_ElectronTicketAgentSchemeQuash(Shove._Convert.StrToLong(dtIsuse.Rows[0]["ID"].ToString(), 0), ref ReturnValue, ref ReturnDescprtion) < 0)
                {
                    new Log("ElectronTicket\\ZCW").Write("电子票方案撤单错误_P_ElectronTicketAgentSchemeQuash");

                    continue;
                }
            }

            bool isHasUpdate = false;

            if (dtIsuse.Rows[0]["State"].ToString() != Status)
            {
                isHasUpdate = true;
            }

            if (isHasUpdate)
            {
                int    ReturnValue      = 0;
                string ReturnDescprtion = "";

                if (DAL.Procedures.P_IsuseUpdate(LotteryID, Shove._Web.Utility.FilteSqlInfusion(IsuseName), Shove._Convert.StrToShort(Status, 0), Shove._Convert.StrToDateTime(StartTime, DateTime.Now.ToString()), Shove._Convert.StrToDateTime(EndTime, DateTime.Now.ToString()), DateTime.Now, WinNumber, ref ReturnValue, ref ReturnDescprtion) < 0)
                {
                    new Log("ElectronTicket\\ZCW").Write("电子票撤销追号错误P_IsuseEdit。");
                }

                if (ReturnValue < 0)
                {
                    new Log("ElectronTicket\\ZCW").Write(ReturnDescprtion);
                }
            }

            if (!String.IsNullOrEmpty(WinNumber) && (dtIsuse.Rows[0]["WinLotteryNumber"].ToString() != WinNumber))
            {
                DataTable dtWinTypes = new DAL.Tables.T_WinTypes().Open("", "LotteryID =" + LotteryID.ToString(), "");

                double[] WinMoneyList = new double[dtWinTypes.Rows.Count * 2];

                for (int k = 0; k < dtWinTypes.Rows.Count; k++)
                {
                    if (Shove._Convert.StrToDouble(dtWinTypes.Rows[k]["DefaultMoney"].ToString(), 1) < 1)
                    {
                        MessageID = GetFromXPath(TransMessage, "message/header/messengerid");
                        ReNotice(MessageID, "13008");

                        return;
                    }

                    WinMoneyList[k * 2]     = Shove._Convert.StrToDouble(dtWinTypes.Rows[k]["DefaultMoney"].ToString(), 1);
                    WinMoneyList[k * 2 + 1] = Shove._Convert.StrToDouble(dtWinTypes.Rows[k]["DefaultMoneyNoWithTax"].ToString(), 1);
                }

                #region 开奖第一步

                DataTable dtWin = null;

                dtWin = new DAL.Tables.T_Schemes().Open("LotteryNumber,PlayTypeID,Multiple,ID", "isOpened = 0 and IsuseID = " + dtIsuse.Rows[0]["ID"].ToString(), "[ID]");

                if (dtWin == null)
                {
                    return;
                }

                for (int y = 0; y < dtWin.Rows.Count; y++)
                {
                    string LotteryNumber = "";

                    try
                    {
                        LotteryNumber = dtWin.Rows[y]["LotteryNumber"].ToString();
                    }
                    catch
                    { }

                    string Description       = "";
                    double WinMoneyNoWithTax = 0;

                    try
                    {
                        double WinMoney = new SLS.Lottery()[LotteryID].ComputeWin(LotteryNumber, WinNumber, ref Description, ref WinMoneyNoWithTax, int.Parse(dtWin.Rows[y]["PlayTypeID"].ToString()), WinMoneyList);

                        Shove.Database.MSSQL.ExecuteNonQuery("update T_Schemes set PreWinMoney = @p1, PreWinMoneyNoWithTax = @p2, EditWinMoney = @p3, EditWinMoneyNoWithTax = @p4, WinDescription = @p5 where [ID] = " + dtWin.Rows[y]["ID"].ToString(),
                                                             new Shove.Database.MSSQL.Parameter("p1", SqlDbType.Money, 0, ParameterDirection.Input, WinMoney * Shove._Convert.StrToInt(dtWin.Rows[y]["Multiple"].ToString(), 1)),
                                                             new Shove.Database.MSSQL.Parameter("p2", SqlDbType.Money, 0, ParameterDirection.Input, WinMoneyNoWithTax * Shove._Convert.StrToInt(dtWin.Rows[y]["Multiple"].ToString(), 1)),
                                                             new Shove.Database.MSSQL.Parameter("p3", SqlDbType.Money, 0, ParameterDirection.Input, WinMoney * Shove._Convert.StrToInt(dtWin.Rows[y]["Multiple"].ToString(), 1)),
                                                             new Shove.Database.MSSQL.Parameter("p4", SqlDbType.Money, 0, ParameterDirection.Input, WinMoneyNoWithTax * Shove._Convert.StrToInt(dtWin.Rows[y]["Multiple"].ToString(), 1)),
                                                             new Shove.Database.MSSQL.Parameter("p5", SqlDbType.VarChar, 0, ParameterDirection.Input, Description));
                    }
                    catch
                    {
                        continue;
                    }
                }

                #endregion

                #region 开奖第二步

                string OpenAffiche = new OpenAfficheTemplates()[LotteryID];

                int  SchemeCount, QuashCount, WinCount, WinNoBuyCount;
                bool isEndOpen = false;

                int    ReturnValue       = 0;
                string ReturnDescription = "";

                while (!isEndOpen)
                {
                    SchemeCount   = 0;
                    QuashCount    = 0;
                    WinCount      = 0;
                    WinNoBuyCount = 0;
                    //  总方案数,处理时撤单数,中奖数,中奖但未成功数

                    ReturnValue       = 0;
                    ReturnDescription = "";
                    DataSet dsWin = null;

                    DAL.Procedures.P_Win(ref dsWin,
                                         Shove._Convert.StrToLong(dtIsuse.Rows[0]["ID"].ToString(), 0),
                                         WinNumber,
                                         OpenAffiche,
                                         1,
                                         true,
                                         ref SchemeCount, ref QuashCount, ref WinCount, ref WinNoBuyCount,
                                         ref isEndOpen,
                                         ref ReturnValue, ref ReturnDescription);
                }

                #endregion
            }
        }

        MessageID = GetFromXPath(TransMessage, "message/header/messengerid");
        ReNotice(MessageID, "13008");
    }
Пример #27
0
    protected void btnGO_Step1_Click(object sender, EventArgs e)
    {
        btnGO_Step1.AlertText = "";

        if (ddlLottery.SelectedValue == SLS.Lottery.ZCDC.sID)
        {
            Shove._Web.JavaScript.Alert(this.Page, "足彩单场不支持分步开奖。");

            return;
        }

        tbWinNumber.Text = Shove._Convert.ToDBC(tbWinNumber.Text.Trim().Replace(" ", " ")).Trim();

        if (!new SLS.Lottery()[int.Parse(ddlLottery.SelectedValue)].AnalyseWinNumber(tbWinNumber.Text))
        {
            Shove._Web.JavaScript.Alert(this.Page, "开奖号码不正确!");

            return;
        }

        SystemOptions so = new SystemOptions();
        bool isCompareWinMoneyNoWithFax = so["isCompareWinMoneyNoWithFax"].ToBoolean(true);

        string WinListXML = "<WinLists>";

        double[] WinMoneyList = new double[g.Rows.Count * 2];

        for (int i = 0; i < g.Rows.Count; i++)
        {
            WinMoneyList[i * 2] = Shove._Convert.StrToDouble(((TextBox)g.Rows[i].Cells[1].FindControl("tbMoney")).Text, 0);
            WinMoneyList[i * 2 + 1] = Shove._Convert.StrToDouble(((TextBox)g.Rows[i].Cells[2].FindControl("tbMoneyNoWithTax")).Text, 0);

            if (WinMoneyList[i * 2] < 0)
            {
                Shove._Web.JavaScript.Alert(this.Page, "第 " + (i + 1).ToString() + " 项奖金输入错误!");

                return;
            }

            if (WinMoneyList[i * 2] < WinMoneyList[i * 2 + 1])
            {
                if (isCompareWinMoneyNoWithFax)
                {
                    Shove._Web.JavaScript.Alert(this.Page, "第 " + (i + 1).ToString() + " 项税后奖金输入错误(不能大于税前奖金)!");

                    return;
                }
            }

            WinListXML += "<WinList defaultMoney=\"" + WinMoneyList[i * 2].ToString() + "\" DefaultMoneyNoWithTax=\"" + WinMoneyList[i * 2 + 1].ToString() + "\"/>";
        }

        WinListXML += "</WinLists>";

        DataTable dtIsuseBonuses = new DAL.Tables.T_IsuseBonuses().Open("", "IsuseID = " + Shove._Web.Utility.FilteSqlInfusion(ddlIsuse.SelectedValue), "");

        if (dtIsuseBonuses == null)
        {
            PF.GoError(ErrorNumber.DataReadWrite, "数据库繁忙,请重试", this.GetType().BaseType.FullName);

            return;
        }

        if (dtIsuseBonuses.Rows.Count < 1)
        {
            int ReturnValue = -1;
            string ReturnDescription = "";


            int Result = DAL.Procedures.P_IsuseBonusesAdd(Shove._Convert.StrToLong(ddlIsuse.SelectedValue, 0), _User.ID, WinListXML, ref ReturnValue, ref ReturnDescription);

            if (Result < 0)
            {
                PF.GoError(ErrorNumber.DataReadWrite, "数据库繁忙,请重试", this.GetType().BaseType.FullName);

                return;
            }

            if (ReturnValue < 0)
            {
                Shove._Web.JavaScript.Alert(this.Page, ReturnDescription);

                return;
            }

            Shove._Web.JavaScript.Alert(this.Page, "请下一位管理员继续开奖!");

            return;
        }

        if (dtIsuseBonuses.Rows[0]["UserID"].ToString() == _User.ID.ToString())
        {
            Shove._Web.JavaScript.Alert(this.Page, "请下一位管理员继续开奖!");

            return;
        }

        for (int i = 0; i < dtIsuseBonuses.Rows.Count; i++)
        {
            if ((WinMoneyList[i * 2] != Shove._Convert.StrToDouble(dtIsuseBonuses.Rows[i]["defaultMoney"].ToString(), 0)) || (WinMoneyList[i * 2 + 1] != Shove._Convert.StrToDouble(dtIsuseBonuses.Rows[i]["DefaultMoneyNoWithTax"].ToString(), 0)))
            {
                DAL.Tables.T_IsuseBonuses T_IsuseBonuses = new DAL.Tables.T_IsuseBonuses();
                T_IsuseBonuses.Delete("IsuseID = " + ddlIsuse.SelectedValue);

                Shove._Web.JavaScript.Alert(this.Page, "两次奖项输入不一致,请联系上一次开奖操作员!");

                return;
            }
        }

        DataTable dt = new DAL.Tables.T_Schemes().Open("* ", "IsuseID = " + Shove._Web.Utility.FilteSqlInfusion(ddlIsuse.SelectedValue) + " and isOpened = 0 and Buyed = 1", "[ID]");

        if (dt == null)
        {
            PF.GoError(ErrorNumber.DataReadWrite, "数据库繁忙,请重试", this.GetType().BaseType.FullName);

            return;
        }

        StringBuilder sb = new StringBuilder();

        string NoWinSchemeID = "";

        for (int i = 0; i < dt.Rows.Count; i++)
        {
            string LotteryNumber = dt.Rows[i]["LotteryNumber"].ToString();
            string Description = "";
            double WinMoneyNoWithTax = 0;


            double WinMoney = 0;

            try
            {
                WinMoney = new SLS.Lottery()[int.Parse(ddlLottery.SelectedValue)].ComputeWin(LotteryNumber, tbWinNumber.Text.Trim(), ref Description, ref WinMoneyNoWithTax, int.Parse(dt.Rows[i]["PlayTypeID"].ToString()), WinMoneyList);
            }
            catch
            {
                WinMoney = 0;

                new Log("System").Write("方案 ID:" + dt.Rows[i]["ID"].ToString() + " 算奖出现错误!");
            }

            if (WinMoney == 0)
            {
                NoWinSchemeID += dt.Rows[i]["ID"].ToString()  + ",";

                continue;
            }

            sb.Append("update T_Schemes set EditWinMoney = ").Append(WinMoney * Shove._Convert.StrToInt(dt.Rows[i]["Multiple"].ToString(), 1))
                .Append(", EditWinMoneyNoWithTax = ").Append(WinMoneyNoWithTax * Shove._Convert.StrToInt(dt.Rows[i]["Multiple"].ToString(), 1))
                .Append(", WinDescription = '").Append(Description).Append("'")
                .Append(" where [ID] = ").AppendLine(dt.Rows[i]["ID"].ToString());
        }

        Shove.Database.MSSQL.ExecuteNonQuery(sb.ToString(), new Shove.Database.MSSQL.Parameter[0]);

        if (NoWinSchemeID.EndsWith(","))
        {
            NoWinSchemeID = NoWinSchemeID.Substring(0, NoWinSchemeID.Length - 1);
        }

        if (!string.IsNullOrEmpty(NoWinSchemeID))
        {
            StringBuilder sb1 = new StringBuilder();

            sb1.Append("update T_Schemes set EditWinMoney = 0")
                .Append(", EditWinMoneyNoWithTax = 0, isOpened = 1 , OpenOperatorID=" + _User.ID.ToString())
                .Append(", WinDescription = ''")
                .Append(" where [ID] in (" + NoWinSchemeID + ")");

            Shove.Database.MSSQL.ExecuteNonQuery(sb1.ToString(), new Shove.Database.MSSQL.Parameter[0]);
        }

        dt = new DAL.Tables.T_Schemes().Open("top 1 * ", "IsuseID = " + Shove._Web.Utility.FilteSqlInfusion(ddlIsuse.SelectedValue) + " and isOpened = 0 and Buyed = 1 and WinDescription is null", "[ID]");

        if (dt == null)
        {
            PF.GoError(ErrorNumber.DataReadWrite, "数据库繁忙,请重试", this.GetType().BaseType.FullName);

            return;
        }

        Step1IsOpen = (dt.Rows.Count > 0);

        btnGO_Step1.Enabled = Step1IsOpen;
        btnGO_Step2.Enabled = (!Step1IsOpen);
        btnGO_Step3.Enabled = ((!Step1IsOpen) && (!Step2IsOpen));

        string Message = "请再次执行第一步";

        if (!Step1IsOpen)
        {
            Message = "开奖步骤一已经完成,请执行第二步.";
        }

        Shove._Web.JavaScript.Alert(this.Page, Message);
    }
Пример #28
0
    private void BindDataForPlayType()
    {
        if (ddlLottery.Items.Count < 1)
        {
            return;
        }

        ddlPlayType.Items.Clear();
        ddlPlayType.Items.Add(new ListItem("全部玩法", "-1"));

        if (ddlLottery.SelectedValue == "-1")
        {
            return;
        }

        SLS.Lottery.PlayType[] PlayTypes = new SLS.Lottery()[int.Parse(ddlLottery.SelectedValue)].GetPlayTypeList();

        foreach (SLS.Lottery.PlayType PlayType in PlayTypes)
        {
            ddlPlayType.Items.Add(new ListItem(PlayType.Name, PlayType.ID.ToString()));
        }
    }
Пример #29
0
    public string AnalyseScheme(string Content, string LotteryID, int PlayTypeID)
    {
        string Result = new SLS.Lottery()[Shove._Convert.StrToInt(LotteryID, 0)].AnalyseScheme(Content, PlayTypeID);

        return Result.Trim();
    }
Пример #30
0
    private void BindData()
    {
        long SchemeID = Shove._Convert.StrToLong(Shove._Web.Utility.GetRequest("id"), -1);

        if (SchemeID < 0)
        {
            PF.GoError(ErrorNumber.Unknow, "参数错误", this.GetType().FullName);

            return;
        }

        DataTable dt = new DAL.Tables.T_Schemes().Open("InitiateUserID,LotteryNumber, PlayTypeID", "SiteID = " + _Site.ID.ToString() + " and [ID] = " + SchemeID.ToString(), "");

        if (dt == null)
        {
            PF.GoError(ErrorNumber.DataReadWrite, "数据库繁忙,请重试", this.GetType().FullName);

            return;
        }

        if (dt.Rows.Count < 1)
        {
            PF.GoError(ErrorNumber.Unknow, "参数错误", this.GetType().FullName);

            return;
        }

        long InitiateUserID = Shove._Convert.StrToLong(dt.Rows[0]["InitiateUserID"].ToString(), -1);

        //既不是发起人,也不在招股对象之内
        if (_User != null && !_User.isCanViewSchemeContent(SchemeID))
        {
            PF.GoError(ErrorNumber.Unknow, "对不起,您不在此方案的招股对象之内。", this.GetType().FullName);

            return;
        }

        string LotteryNumber = dt.Rows[0]["LotteryNumber"].ToString();

        if (Shove._Convert.StrToInt(dt.Rows[0]["PlayTypeID"].ToString(), -1) > 7200 && Shove._Convert.StrToInt(dt.Rows[0]["PlayTypeID"].ToString(), -1) < 7300)
        {
            string CacheKey = "JCZC_Scheme_Bind";

            DataTable dtMatch = Shove._Web.Cache.GetCacheAsDataTable(CacheKey);

            if (dtMatch == null)
            {
                dtMatch = new DAL.Tables.T_Match().Open("ID, MatchNumber, StopSellingTime", "", "");

                if (dtMatch == null)
                {
                    return;
                }

                if (dtMatch.Rows.Count < 1)
                {
                    return;
                }

                Shove._Web.Cache.SetCache(CacheKey, dtMatch, 3600);
            }

            string CanonicalNumber = "";
            int    PlayTypeID      = Shove._Convert.StrToInt(dt.Rows[0]["PlayTypeID"].ToString(), 7201);

            ArrayList al = new ArrayList();

            string[] strs = LotteryNumber.Split('\n');

            if (strs == null)
            {
                return;
            }
            if (strs.Length == 0)
            {
                return;
            }

            string CacheKeyNumbers = "Home_Web_DownloadSchemeFile_" + SchemeID.ToString();

            string[] LotteryNumbers = Shove._Web.Cache.GetCacheAsString(CacheKeyNumbers, "").Split('\n');
            string[] strNumbers     = null;

            if (LotteryNumbers.Length < 2)
            {
                for (int i = 0; i < strs.Length; i++)
                {
                    if (string.IsNullOrEmpty(strs[i]))
                    {
                        continue;
                    }

                    strNumbers = new SLS.Lottery()[Shove._Convert.StrToInt(PlayTypeID.ToString().Substring(0, PlayTypeID.ToString().Length - 2), 72)].ToSingle(strs[i], ref CanonicalNumber, PlayTypeID);

                    if (strNumbers == null)
                    {
                        continue;
                    }

                    for (int j = 0; j < strNumbers.Length; j++)
                    {
                        al.Add(strNumbers[j]);
                    }
                }

                LotteryNumbers = new string[al.Count];

                StringBuilder sbLotteryNumbers = new StringBuilder();

                for (int i = 0; i < al.Count; i++)
                {
                    if (i == al.Count)
                    {
                        sbLotteryNumbers.Append(al[i].ToString());
                    }
                    else
                    {
                        sbLotteryNumbers.Append(al[i].ToString() + "\n");
                    }

                    LotteryNumbers[i] = al[i].ToString();
                }

                Shove._Web.Cache.SetCache(CacheKeyNumbers, sbLotteryNumbers.ToString(), 3600);
            }

            StringBuilder sb = new StringBuilder();

            sb.Append("<table width=\"60%\" border=\"0\" align=\"center\" cellpadding=\"2\" cellspacing=\"1\" class=\"BgBlue\">");
            sb.Append("<tr align=\"center\" bgcolor=\"#FFFFFF\" class=\"BlueLightBg WhiteWords\">");
            sb.Append("<td width=\"8%\"><strong>序号</strong></td>");
            sb.Append("<td><strong>过关场次</strong></td>");
            sb.Append("<td width=\"10%\"><strong>过关方式</strong></td>");
            sb.Append("<td width=\"10%\"><strong>注数</strong></td>");
            sb.Append("<td width=\"10%\"><strong>投注金额(元)</strong></td></tr>");

            string Number  = "";
            int    No      = 0;
            string BuyWays = "";

            int Multiple = 0;

            int LotID  = 0;
            int PlayID = 0;

            PlayID = Shove._Convert.StrToInt(LotteryNumbers[0].Split(';')[0], 7201);
            LotID  = Shove._Convert.StrToInt(PlayID.ToString().Substring(0, 2), 72);

            DateTime EndTime = DateTime.Now;

            int pageindex = 1;
            if (!string.IsNullOrEmpty(Shove._Web.Utility.GetRequest("p")))
            {
                pageindex = Shove._Convert.StrToInt(Shove._Web.Utility.GetRequest("p").ToString(), 1);
            }

            int perPageRowCount = 30;

            if (pageindex < 1)
            {
                pageindex = 1;
            }

            foreach (string str in LotteryNumbers)
            {
                if (string.IsNullOrEmpty(str))
                {
                    continue;
                }

                No++;

                if (str.Split(';').Length < 3)
                {
                    continue;
                }

                try
                {
                    Multiple = Shove._Convert.StrToInt(str.Split(';')[2].Substring(1, str.Split(';')[2].Length - 2).Substring(2), 1);
                }
                catch
                { }

                if ((No < (pageindex - 1) * perPageRowCount) || No > (pageindex) * perPageRowCount)
                {
                    continue;
                }

                sb.Append("<tr align=\"center\" class=\"" + ((No % 2 == 0) ? "BlueWord WhiteBg" : "BlueLightBg2 BlueWord") + "\">");
                sb.Append("<td>" + No.ToString() + "</td>");

                Number = str.Split(';')[1].Substring(1, str.Split(';')[1].Length - 2);
                string[] Numbers = Number.Split('|');

                //if (Numbers.Length < 2)
                //{
                //    continue;
                //}

                sb.Append("<td height=\"20\">");

                if (Numbers.Length == 1)
                {
                    BuyWays = "单关";
                }
                else
                {
                    BuyWays = Numbers.Length.ToString() + "串1";
                }

                long MatchID = 0;

                for (int i = 0; i < Numbers.Length; i++)
                {
                    if (Numbers[i].IndexOf("(") < 0)
                    {
                        continue;
                    }

                    MatchID = Shove._Convert.StrToLong(Numbers[i].Substring(0, Numbers[i].IndexOf("(")), 1);

                    DataRow[] dr = dtMatch.Select("ID=" + MatchID.ToString());

                    if (dr.Length < 1)
                    {
                        continue;
                    }

                    sb.Append(dr[0]["MatchNumber"].ToString() + "->" + PF.Getesult(PlayID.ToString(), Numbers[i].Substring(Numbers[i].IndexOf("(") + 1, Numbers[i].IndexOf(")") - Numbers[i].IndexOf("(") - 1)) + ";");
                }

                sb.Append("</td>");
                sb.Append("<td height=\"20\">" + BuyWays + "</td>");
                sb.Append("<td>1</td>");
                sb.Append("<td>" + (2 * Multiple).ToString() + "</td></tr>");
            }

            sb.Append("</table>");
            labLotteryNumber.Text = sb.ToString();

            StringBuilder sbpage = new StringBuilder();

            int rowCount  = No;
            int pageCount = rowCount % perPageRowCount == 0 ? rowCount / perPageRowCount : rowCount / perPageRowCount + 1;

            if (SchemeID < 0)
            {
                sbpage.Append("<div id=\"Pagination\" class=\"yahoo\" style=\"width: auto;\"><span id=\"first\"><a href=\"DownloadSchemeFile.aspx\">首页</a></span>");

                if (pageindex == 1)
                {
                    sbpage.Append("<span class=\"disabled\">« 上一页</span>");
                }
                else
                {
                    sbpage.Append("<span><a href=\"DownloadSchemeFile.aspx?p=" + (pageindex - 1).ToString() + "\">« 上一页</a></span>");
                }

                for (int i = 0; i < pageCount; i++)
                {
                    if (i == pageindex - 1)
                    {
                        sbpage.Append("<span class=\"current\">" + (i + 1).ToString() + "</span>");

                        continue;
                    }

                    if ((i < pageindex + 4 || i < 9) && (i > pageindex - 6 || i > pageCount - 10))
                    {
                        sbpage.Append("<a href=\"DownloadSchemeFile.aspx?p=" + (i + 1).ToString() + "\">" + (i + 1).ToString() + "</a>");
                    }
                }

                if (pageindex == pageCount)
                {
                    sbpage.Append("<span class=\"disabled\">下一页 »</span>");
                }
                else
                {
                    sbpage.Append("<span><a href=\"DownloadSchemeFile.aspx?p=" + (pageindex + 1).ToString() + "\">下一页 »</a></span>");
                }

                sbpage.Append("<span id=\"last\" value=\"" + pageCount.ToString() + "\"><a href=\"DownloadSchemeFile.aspx?p=" + (pageCount).ToString() + "\">尾页</a></span><span class=\"jilu\">共" + pageCount.ToString() + "页," + No.ToString() + "条记录</span></div>");
            }
            else
            {
                sbpage.Append("<div id=\"Pagination\" class=\"yahoo\" style=\"width: auto;\"><span id=\"first\"><a href=\"DownloadSchemeFile.aspx?id=" + SchemeID.ToString() + "\">首页</a></span>");

                if (pageindex == 1)
                {
                    sbpage.Append("<span class=\"disabled\">« 上一页</span>");
                }
                else
                {
                    sbpage.Append("<span><a href=\"DownloadSchemeFile.aspx?id=" + SchemeID.ToString() + "&p=" + (pageindex - 1).ToString() + "\">« 上一页</a></span>");
                }

                for (int i = 0; i < pageCount; i++)
                {
                    if (i == pageindex - 1)
                    {
                        sbpage.Append("<span class=\"current\">" + (i + 1).ToString() + "</span>");

                        continue;
                    }

                    if ((i < pageindex + 4 || i < 9) && (i > pageindex - 6 || i > pageCount - 10))
                    {
                        sbpage.Append("<a href=\"DownloadSchemeFile.aspx?id=" + SchemeID.ToString() + "&p=" + (i + 1).ToString() + "\">" + (i + 1).ToString() + "</a>");
                    }
                }

                if (pageindex == pageCount)
                {
                    sbpage.Append("<span class=\"disabled\">下一页 »</span>");
                }
                else
                {
                    sbpage.Append("<span><a href=\"DownloadSchemeFile.aspx?id=" + SchemeID.ToString() + "&p=" + (pageindex + 1).ToString() + "\">下一页 »</a></span>");
                }

                sbpage.Append("<span id=\"last\" value=\"" + pageCount.ToString() + "\"><a href=\"DownloadSchemeFile.aspx?id=" + SchemeID.ToString() + "&p=" + (pageCount).ToString() + "\">尾页</a></span><span class=\"jilu\">共" + pageCount.ToString() + "页," + No.ToString() + "条记录</span></div>");
            }

            labLotteryNumber.Text += sbpage.ToString();
        }
        else
        {
            LotteryNumber = PF.GetScriptResTable(LotteryNumber);

            if (LotteryNumber.IndexOf("table") < 0)
            {
                LotteryNumber = Shove._Convert.ToHtmlCode(LotteryNumber);
            }

            labLotteryNumber.Text = (LotteryNumber == "") ? "未找到相关数据。" : (LotteryNumber + "&nbsp;");
        }
    }
Пример #31
0
    public string AnalyseScheme(string Content, int LotteryID)
    {
        string Result = new SLS.Lottery()[LotteryID].AnalyseScheme(Content, LotteryID * 100 + 1);

        return(Result.Trim());
    }
Пример #32
0
    private void Bind(long SchemeID)
    {
        string LotteryNumber = "";
        string[] LotteryNumbers = null;

        string CacheKey = "JCZC_Scheme_Bind";

        DataTable dtMatch = Shove._Web.Cache.GetCacheAsDataTable(CacheKey);

        if (SchemeID < 0)
        {
            string FileName = Request.Cookies["ASP.NET_SessionId"].Value;

            try
            {
                LotteryNumber = File.ReadAllText(System.AppDomain.CurrentDomain.BaseDirectory + "Temp\\" + FileName + ".txt");
            }
            catch { }

            if (string.IsNullOrEmpty(LotteryNumber))
            {
                Shove._Web.JavaScript.Alert(this.Page, "传递的参数错误,请重新发起操作!");

                return;
            }

            LotteryNumbers = LotteryNumber.Replace("\r", "").Split('\n');

            if (dtMatch == null)
            {
                dtMatch = new DAL.Tables.T_PassRate().Open("MatchID, MatchNumber, StopSellTime", "", "");
            }
        }

        if (string.IsNullOrEmpty(LotteryNumber))
        {
            string SchemeInfo = "";

            try
            {
                SchemeInfo = File.ReadAllText(System.AppDomain.CurrentDomain.BaseDirectory + "SchemeInfo\\" + SchemeID.ToString() + ".txt");
            }
            catch { }

            if (string.IsNullOrEmpty(SchemeInfo))
            {
                DataTable dt = new DAL.Tables.T_Schemes().Open("", "ID=" + SchemeID.ToString(), "");

                if (dt == null)
                {
                    Shove._Web.JavaScript.Alert(this.Page, "传递的参数错误,请重新发起操作!");

                    return;
                }

                if (dt.Rows.Count < 1)
                {
                    Shove._Web.JavaScript.Alert(this.Page, "传递的参数错误,请重新发起操作!");

                    return;
                }

                LotteryNumber = dt.Rows[0]["LotteryNumber"].ToString();

                ArrayList al = new ArrayList();

                string[] strs = LotteryNumber.Split('\n');

                if (strs == null)
                    return;
                if (strs.Length == 0)
                    return;

                string CanonicalNumber = "";
                int PlayTypeID = Shove._Convert.StrToInt(dt.Rows[0]["PlayTypeID"].ToString(), 7201);

                string CacheKeyNumbers = "Home_Web_DownloadSchemeFile_" + SchemeID.ToString();

                LotteryNumbers = Shove._Web.Cache.GetCacheAsString(CacheKeyNumbers, "").Split('\n');
                string[] strNumbers = null;

                if (LotteryNumbers.Length < 2)
                {
                    for (int i = 0; i < strs.Length; i++)
                    {
                        if (string.IsNullOrEmpty(strs[i]))
                        {
                            continue;
                        }

                        strNumbers = new SLS.Lottery()[Shove._Convert.StrToInt(PlayTypeID.ToString().Substring(0, PlayTypeID.ToString().Length - 2), 72)].ToSingle(strs[i], ref CanonicalNumber, PlayTypeID);

                        if (strNumbers == null)
                        {
                            continue;
                        }

                        for (int j = 0; j < strNumbers.Length; j++)
                        {
                            al.Add(strNumbers[j]);
                        }
                    }

                    LotteryNumbers = new string[al.Count];

                    StringBuilder sbLotteryNumbers = new StringBuilder();

                    for (int i = 0; i < al.Count; i++)
                    {
                        if (i == al.Count)
                        {
                            sbLotteryNumbers.Append(al[i].ToString());
                        }
                        else
                        {
                            sbLotteryNumbers.Append(al[i].ToString() + "\n");
                        }

                        LotteryNumbers[i] = al[i].ToString();
                    }

                    Shove._Web.Cache.SetCache(CacheKeyNumbers, sbLotteryNumbers.ToString(), 3600);
                }

                if (dtMatch == null)
                {
                    dtMatch = new DAL.Tables.T_Match().Open("ID as MatchID, MatchNumber, StopSellingTime as StopSellTime", "", "");
                }
            }
            else
            {
                LotteryNumber = SchemeInfo.Substring(0, SchemeInfo.LastIndexOf('$') - 1);

                LotteryNumbers = LotteryNumber.Replace("\r", "").Split('\n');

                if (dtMatch == null)
                {
                    dtMatch = new DAL.Tables.T_PassRate().Open("MatchID, MatchNumber, StopSellTime", "MatchID in (" + SchemeInfo.Substring(SchemeInfo.LastIndexOf('$')) + ")", "");
                }
            }
        }

        if (dtMatch == null)
        {
            Shove._Web.JavaScript.Alert(this.Page, "传递的参数错误,请重新发起操作!");

            return;
        }

        if (dtMatch.Rows.Count < 1)
        {
            return;
        }

        Shove._Web.Cache.SetCache(CacheKey, dtMatch, 3600);

        StringBuilder sb = new StringBuilder();

        sb.Append("<table width=\"60%\" border=\"0\" align=\"center\" cellpadding=\"2\" cellspacing=\"1\" class=\"BgBlue\">");
        sb.Append("<tr align=\"center\" bgcolor=\"#FFFFFF\" class=\"BlueLightBg WhiteWords\">");
        sb.Append("<td width=\"8%\"><strong>序号</strong></td>");
        sb.Append("<td><strong>过关场次</strong></td>");
        sb.Append("<td width=\"10%\"><strong>过关方式</strong></td>");
        sb.Append("<td width=\"10%\"><strong>注数</strong></td>");
        sb.Append("<td width=\"10%\"><strong>投注金额(元)</strong></td></tr>");

        string Number = "";
        int No = 0;
        string BuyWays = "";

        int Multiple = 0;

        int LotID = 0;
        int PlayID = 0;

        PlayID = Shove._Convert.StrToInt(LotteryNumbers[0].Split(';')[0], 7201);
        LotID = Shove._Convert.StrToInt(PlayID.ToString().Substring(0, 2), 72);

        DateTime EndTime = DateTime.Now;

        int pageindex = 1;
        if (!string.IsNullOrEmpty(Shove._Web.Utility.GetRequest("p")))
        {
            pageindex = Shove._Convert.StrToInt(Shove._Web.Utility.GetRequest("p").ToString(), 1);
        }

        int perPageRowCount = 30;

        if (pageindex < 1)
        {
            pageindex = 1;
        }

        foreach (string str in LotteryNumbers)
        {
            if (string.IsNullOrEmpty(str))
            {
                continue;
            }

            No++;

            if (str.Split(';').Length < 3)
            {
                continue;
            }

            try
            {
                Multiple = Shove._Convert.StrToInt(str.Split(';')[2].Substring(1, str.Split(';')[2].Length - 2).Substring(2), 1);
            }
            catch
            { }

            if ((No < (pageindex - 1) * perPageRowCount) || No > (pageindex) * perPageRowCount)
            {
                continue;
            }

            sb.Append("<tr align=\"center\" class=\"" + ((No % 2 == 0) ? "BlueWord WhiteBg" : "BlueLightBg2 BlueWord") + "\">");
            sb.Append("<td>" + No.ToString() + "</td>");

            Number = str.Split(';')[1].Substring(1, str.Split(';')[1].Length - 2);
            string[] Numbers = Number.Split('|');

            if (Numbers.Length < 2)
            {
                continue;
            }

            sb.Append("<td height=\"20\">");

            BuyWays = Numbers.Length.ToString() + "串1";

            long MatchID = 0;

            for (int i = 0; i < Numbers.Length; i++)
            {
                if (Numbers[i].IndexOf("(") < 0)
                {
                    continue;
                }

                MatchID = Shove._Convert.StrToLong(Numbers[i].Substring(0, Numbers[i].IndexOf("(")), 1);

                DataRow[] dr = dtMatch.Select("MatchID=" + MatchID.ToString());

                if (dr.Length < 1)
                {
                    continue;
                }

                sb.Append(dr[0]["MatchNumber"].ToString() + "->" + PF.Getesult(PlayID.ToString(), Numbers[i].Substring(Numbers[i].IndexOf("(") + 1, Numbers[i].IndexOf(")") - Numbers[i].IndexOf("(") - 1)) + ";");
            }

            sb.Append("</td>");
            sb.Append("<td height=\"20\">" + BuyWays + "</td>");
            sb.Append("<td>1</td>");
            sb.Append("<td>" + (2 * Multiple).ToString() + "</td></tr>");
        }

        sb.Append("</table>");
        labLotteryNumber.Text = sb.ToString();

        StringBuilder sbpage = new StringBuilder();

        int rowCount = No;
        int pageCount = rowCount % perPageRowCount == 0 ? rowCount / perPageRowCount : rowCount / perPageRowCount + 1;

        if (SchemeID < 0)
        {
            sbpage.Append("<div id=\"Pagination\" class=\"yahoo\" style=\"width: auto;\"><span id=\"first\"><a href=\"Scheme.aspx\">首页</a></span>");

            if (pageindex == 1)
            {
                sbpage.Append("<span class=\"disabled\">« 上一页</span>");
            }
            else
            {
                sbpage.Append("<span><a href=\"Scheme.aspx?p=" + (pageindex - 1).ToString() + "\">« 上一页</a></span>");
            }

            for (int i = 0; i < pageCount; i++)
            {
                if (i == pageindex - 1)
                {
                    sbpage.Append("<span class=\"current\">" + (i + 1).ToString() + "</span>");

                    continue;
                }

                if ((i < pageindex + 4 || i < 9) && (i > pageindex - 6 || i > pageCount - 10))
                {
                    sbpage.Append("<a href=\"Scheme.aspx?p=" + (i + 1).ToString() + "\">" + (i + 1).ToString() + "</a>");
                }
            }

            if (pageindex == pageCount)
            {
                sbpage.Append("<span class=\"disabled\">下一页 »</span>");
            }
            else
            {
                sbpage.Append("<span><a href=\"Scheme.aspx?p=" + (pageindex + 1).ToString() + "\">下一页 »</a></span>");
            }

            sbpage.Append("<span id=\"last\" value=\"" + pageCount.ToString() + "\"><a href=\"Scheme.aspx?p=" + (pageCount).ToString() + "\">尾页</a></span><span class=\"jilu\">共" + pageCount.ToString() + "页," + No.ToString() + "条记录</span></div>");
        }
        else
        {
            sbpage.Append("<div id=\"Pagination\" class=\"yahoo\" style=\"width: auto;\"><span id=\"first\"><a href=\"Scheme.aspx?id="+ SchemeID.ToString() +"\">首页</a></span>");

            if (pageindex == 1)
            {
                sbpage.Append("<span class=\"disabled\">« 上一页</span>");
            }
            else
            {
                sbpage.Append("<span><a href=\"Scheme.aspx?id=" + SchemeID.ToString() + "&p=" + (pageindex - 1).ToString() + "\">« 上一页</a></span>");
            }

            for (int i = 0; i < pageCount; i++)
            {
                if (i == pageindex - 1)
                {
                    sbpage.Append("<span class=\"current\">" + (i + 1).ToString() + "</span>");

                    continue;
                }

                if ((i < pageindex + 4 || i < 9) && (i > pageindex - 6 || i > pageCount - 10))
                {
                    sbpage.Append("<a href=\"Scheme.aspx?id=" + SchemeID.ToString() + "&p=" + (i + 1).ToString() + "\">" + (i + 1).ToString() + "</a>");
                }
            }

            if (pageindex == pageCount)
            {
                sbpage.Append("<span class=\"disabled\">下一页 »</span>");
            }
            else
            {
                sbpage.Append("<span><a href=\"Scheme.aspx?id=" + SchemeID.ToString() + "&p=" + (pageindex + 1).ToString() + "\">下一页 »</a></span>");
            }

            sbpage.Append("<span id=\"last\" value=\"" + pageCount.ToString() + "\"><a href=\"Scheme.aspx?id=" + SchemeID.ToString() + "&p=" + (pageCount).ToString() + "\">尾页</a></span><span class=\"jilu\">共" + pageCount.ToString() + "页," + No.ToString() + "条记录</span></div>");
        }

        labLotteryNumber.Text += sbpage.ToString();
    }
Пример #33
0
    private string GetLotteryNumber(int LotteryID, int PlayTypeID, string BettingNumber, ref int Num)   // Num 返回注数
    {
        Num = 0;

        if (String.IsNullOrEmpty(BettingNumber))
        {
            return("");
        }

        SLS.Lottery.LotteryBase lb = new SLS.Lottery()[LotteryID];

        if (lb == null)
        {
            return("");
        }

        string t_Number = lb.AnalyseScheme(BettingNumber, PlayTypeID);

        if (String.IsNullOrEmpty(t_Number))
        {
            return("");
        }

        string[] t_Numbers = t_Number.Split('\n');

        if ((t_Numbers == null) || (t_Numbers.Length < 1))
        {
            return("");
        }

        string Result = "";

        foreach (string str in t_Numbers)
        {
            string t_str = str.Trim();

            if (String.IsNullOrEmpty(t_str))
            {
                continue;
            }

            string[] t_strs = t_str.Split('|');

            if ((t_strs == null) || (t_strs.Length != 2))
            {
                continue;
            }

            int t_Num = Shove._Convert.StrToInt(t_strs[1], -1);

            if (String.IsNullOrEmpty(t_strs[0]) || (t_Num < 1))
            {
                continue;
            }

            Result += t_strs[0] + "\n";
            Num    += t_Num;
        }

        if (Result.EndsWith("\n"))
        {
            Result = Result.Substring(0, Result.Length - 1);
        }

        return(Result);
    }
Пример #34
0
    protected void btnfileUp_Click(object sender, System.EventArgs e)
    {
        string UploadFileName = btnfile.Value;

        if (String.IsNullOrEmpty(UploadFileName))
        {
            Shove._Web.JavaScript.Alert(this.Page, "请先选择一个文件再上传。");

            return;
        }

        if (!UploadFileName.Trim().ToLower().EndsWith(".txt"))
        {
            Shove._Web.JavaScript.Alert(this.Page, "只能上传 .txt 文本类型的文件。");

            return;
        }

        tbSchemeFileName.Value = "null";
        tbLotteryNumber.Value = "null";
        strSchemeFileName = "null";
        strLotteryNumber = "null";

        strPlayTypeName = new SLS.Lottery().GetPlayTypeName(int.Parse(tbPlayType.Value));
        strLotteryName = new SLS.Lottery()[int.Parse(tbLotteryID.Value)].name;

        string NewFileName = "";

        if (Shove._IO.File.UploadFile(this.Page, btnfile, "/Temp/", ref NewFileName, "text") != 0)
        {
            Shove._Web.JavaScript.Alert(this.Page, "方案上传失败。");

            return;
        }

        string FileName = this.Server.MapPath("/Temp/" + NewFileName);

        string Content = Shove._Convert.ToDBC(System.IO.File.ReadAllText(FileName, System.Text.Encoding.Default)).Trim();

        if (Content == "")
        {
            System.IO.File.Delete(FileName);
            Shove._Web.JavaScript.Alert(this.Page, "方案文件没有任何内容,请重新选择。");

            return;
        }

        tbSchemeFileName.Value = NewFileName;
        strSchemeFileName = NewFileName;

        //分析
        int LotteryID = Shove._Convert.StrToInt(tbLotteryID.Value, -1);
        if (!new SLS.Lottery().ValidID(LotteryID))
        {
            System.IO.File.Delete(FileName);

            tbSchemeFileName.Value = "null";
            strSchemeFileName = "null";

            Shove._Web.JavaScript.Alert(this.Page, "方案上传失败。");

            return;
        }

        int PlayType = int.Parse(tbPlayType.Value);
        if (LotteryID == 61)
        {
            Content = FmtContent(Content);
        }

        tbLotteryNumber.Value = new SLS.Lottery()[LotteryID].AnalyseScheme(Content, PlayType);

        strLotteryNumber = tbLotteryNumber.Value.Trim();

        string[] Schemes = strLotteryNumber.Split(new String[] { "\n" }, StringSplitOptions.None);
        strLotteryNumber = "";

        foreach (string s in Schemes)
        {
            if (s.Split('|').Length > 2)
            {
                strLotteryNumber += s.Substring(0, s.LastIndexOf("|")).Trim();
            }
            else
            {
                strLotteryNumber += s.Split('|')[0];
            }
        }
        if (strLotteryNumber == "")
        {
            System.IO.File.Delete(FileName);

            tbLotteryNumber.Value = "null";
            strLotteryNumber = "null";
            tbSchemeFileName.Value = "null";
            strSchemeFileName = "null";

            Shove._Web.JavaScript.Alert(this.Page, "从方案文件中没有提取到符合书写规则的投注内容。");
        }
        else
        {
            System.IO.File.Delete(FileName);

            if (strLotteryNumber.Replace(" ", "").Replace("\n", "") != Content.Replace(" ", "").Replace("\n", "").Replace("\r", "").Replace("\r\n", ""))
            {
                Shove._Web.JavaScript.Alert(this.Page, "过滤掉了您上传方案中不符合格式的投注方案,请核对!");
            }

            //Shove._Web.JavaScript.Alert(this.Page, "方案上传成功。(注:系统只从方案中提取遵循书写规则的投注内容,如果系统提取的结果与您方案文件不一致,请检查方案文件是否完全遵循了书写规则)");
        }
    }
Пример #35
0
    public string GenerateLuckLotteryNumber(int LotteryID, string Type, string Name, string lotteryName)
    {
        if (string.IsNullOrEmpty(lotteryName))
        {
            lotteryName = "cjdlt";
        }
        string Key = "Home_Room_Buy_GenerateLuckLotteryNumber" + LotteryID.ToString();

        Type = Shove._Web.Utility.FilteSqlInfusion(Type);
        Name = Shove._Web.Utility.FilteSqlInfusion(Name);

        if (Type == "3")
        {
            try
            {
                DateTime time = Convert.ToDateTime(Name);
                Name = time.ToString("yyyy-MM-dd");

                if (time > DateTime.Now)
                {
                    return "出生日期不能超过当前日期!";
                }
            }
            catch
            {
                return "日期格式不正确!";
            }
        }

        DataTable dt = Shove._Web.Cache.GetCacheAsDataTable(Key);

        if (dt == null || dt.Rows.Count == 0)
        {
            dt = new DAL.Tables.T_LuckNumber().Open("", "datediff(d,getdate(),DateTime)=0 and LotteryID=" + LotteryID.ToString() + "", "");

            Shove._Web.Cache.SetCache(Key, dt, 3600);
        }

        string LotteryNumber = "";

        DataRow[] dr = dt.Select("Type=" + Type + " and Name='" + Name + "'");

        if (dr != null && dr.Length > 0)
        {
            LotteryNumber = dr[0]["LotteryNumber"].ToString();
        }
        else
        {           

            string num = "";
            switch (lotteryName)
            {
                case "cjdlt":
                    num = new SLS.Lottery()[LotteryID].BuildNumber(5, 2, 1);
                    break;
                case "pl3":
                    num = new SLS.Lottery()[LotteryID].BuildNumber(1);
                    break;
                case "ssq":
                    num = new SLS.Lottery()[LotteryID].BuildNumber(6, 1, 1);
                    break;
                case "3d":
                    num = new SLS.Lottery()[LotteryID].BuildNumber(1);
                    break;
                case "qlc":
                    num = new SLS.Lottery()[LotteryID].BuildNumber(1);
                    break;
                case "pl5":
                    num = new SLS.Lottery()[LotteryID].BuildNumber(1);
                    break;
                case "qxc":
                    num = new SLS.Lottery()[LotteryID].BuildNumber(1);
                    break;
                case "22x5":
                    num = new SLS.Lottery()[LotteryID].BuildNumber(1);
                    break;
                case "31x7":
                    num = new SLS.Lottery()[LotteryID].BuildNumber(1);
                    break;
            }

            LotteryNumber = num;

            DAL.Tables.T_LuckNumber ln = new DAL.Tables.T_LuckNumber();

            ln.LotteryID.Value = LotteryID;
            ln.LotteryNumber.Value = LotteryNumber;
            ln.Name.Value = Name;
            ln.Type.Value = Type;

            ln.Insert();
            ln.Delete("datediff(d,DateTime,getdate())>0");

            Shove._Web.Cache.ClearCache(Key);
        }

        string LuckLottery = "";

        switch (lotteryName)
        {
            case "cjdlt":
                LuckLottery = FormatLuckLotteryNumber_cjdlt(LotteryID, LotteryNumber);
                break;
            case "pl3":
                LuckLottery = FormatLuckLotteryNumber_PL3(LotteryID, LotteryNumber);
                break;
            case "ssq":
                LuckLottery = FormatLuckLotteryNumber_SSQ(LotteryID, LotteryNumber);
                break;
            case "3d":
                LuckLottery = FormatLuckLotteryNumber_3D(LotteryNumber);
                break;
            case "qlc":
                LuckLottery = FormatLuckLotteryNumber_QLC(LotteryNumber);
                break;
            case "pl5":
                LuckLottery = FormatLuckLotteryNumber_PL5(LotteryNumber);
                break;
            case "qxc":
                LuckLottery = FormatLuckLotteryNumber_QXC(LotteryID, LotteryNumber);
                break;
            case "22x5":
                LuckLottery = FormatLuckLotteryNumber_22x5(LotteryNumber);
                break;
            case "31x7":
                LuckLottery = FormatLuckLotteryNumber_31X7(LotteryID, LotteryNumber);
                break;
        }


        return LotteryNumber + "|" + LuckLottery;
    }
Пример #36
0
    protected void btnOkoooDownload_txt_Click(object sender, EventArgs e)
    {
        DataTable dt = new DAL.Views.V_Isuses().Open("", "[ID] = " + Shove._Web.Utility.FilteSqlInfusion(ddlIsuse.SelectedValue), "");

        if ((dt == null) || (dt.Rows.Count < 1))
        {
            PF.GoError(ErrorNumber.DataReadWrite, "数据库繁忙,请重试", this.Page.GetType().BaseType.FullName);

            return;
        }

        string FileName = dt.Rows[0]["Code"].ToString() + dt.Rows[0]["Name"].ToString() + ".txt";

        dt = new DAL.Views.V_SchemeSchedules().Open("", "IsuseID = " + Shove._Web.Utility.FilteSqlInfusion(ddlIsuse.SelectedValue) + " and Schedule >= 100 and QuashStatus = 0 and Buyed = 0", "[Money] desc");

        if (dt == null)
        {
            PF.GoError(ErrorNumber.DataReadWrite, "数据库繁忙,请重试", this.Page.GetType().BaseType.FullName);

            return;
        }

        if (dt.Rows.Count < 1)
        {
            Shove._Web.JavaScript.Alert(this.Page, "没有数据。");

            return;
        }

        HttpResponse response;

        response = Page.Response;
        response.AppendHeader("Content-Disposition", "attachment;filename=" + FileName);
        Response.ContentType     = "application/ms-txt";
        response.ContentEncoding = System.Text.Encoding.GetEncoding("utf-8");

        string CacheKey = "JCZC_Scheme_Bind";

        DataTable dtMatch = Shove._Web.Cache.GetCacheAsDataTable(CacheKey);

        if (dtMatch == null)
        {
            dtMatch = new DAL.Tables.T_Match().Open("ID, MatchNumber, StopSellingTime", "", "");

            if (dtMatch == null)
            {
                return;
            }

            if (dtMatch.Rows.Count < 1)
            {
                return;
            }

            Shove._Web.Cache.SetCache(CacheKey, dtMatch, 3600);
        }

        foreach (DataRow dr in dt.Rows)
        {
            string LotteryNumber = dr["LotteryNumber"].ToString();
            int    PlayTypeID    = Shove._Convert.StrToInt(dr["PlayTypeID"].ToString(), 0);

            ArrayList al = new ArrayList();

            string[] strs       = LotteryNumber.Split('\n');
            string[] strNumbers = null;

            string CanonicalNumber = "";

            if (strs == null)
            {
                return;
            }
            if (strs.Length == 0)
            {
                return;
            }

            for (int i = 0; i < strs.Length; i++)
            {
                if (string.IsNullOrEmpty(strs[i]))
                {
                    continue;
                }

                strNumbers = new SLS.Lottery()[Shove._Convert.StrToInt(PlayTypeID.ToString().Substring(0, PlayTypeID.ToString().Length - 2), 72)].ToSingle(strs[i], ref CanonicalNumber, PlayTypeID);

                if (strNumbers == null)
                {
                    continue;
                }

                for (int j = 0; j < strNumbers.Length; j++)
                {
                    al.Add(strNumbers[j]);
                }
            }

            string[] LotteryNumbers = new string[al.Count];

            StringBuilder sbLotteryNumbers = new StringBuilder();

            for (int i = 0; i < al.Count; i++)
            {
                if (i == al.Count)
                {
                    sbLotteryNumbers.Append(al[i].ToString());
                }
                else
                {
                    sbLotteryNumbers.Append(al[i].ToString() + "\n");
                }

                LotteryNumbers[i] = al[i].ToString();
            }

            int    Multiple = 0;
            string Number   = "";
            string BuyWays  = "";

            foreach (string str in LotteryNumbers)
            {
                if (string.IsNullOrEmpty(str))
                {
                    continue;
                }

                if (str.Split(';').Length < 3)
                {
                    continue;
                }

                try
                {
                    Multiple = Shove._Convert.StrToInt(str.Split(';')[2].Substring(1, str.Split(';')[2].Length - 2).Substring(2), 1);
                }
                catch
                { }

                Number = str.Split(';')[1].Substring(1, str.Split(';')[1].Length - 2);
                string[] Numbers = Number.Split('|');


                if (Numbers.Length == 1)
                {
                    BuyWays = "单关";
                }
                else
                {
                    BuyWays = Numbers.Length.ToString() + "串1";
                }

                long MatchID = 0;

                response.Write(dr["SchemeNumber"].ToString() + "," + PlayTypeName(PlayTypeID) + ",T,");

                for (int i = 0; i < Numbers.Length; i++)
                {
                    if (Numbers[i].IndexOf("(") < 0)
                    {
                        continue;
                    }

                    MatchID = Shove._Convert.StrToLong(Numbers[i].Substring(0, Numbers[i].IndexOf("(")), 1);

                    DataRow[] drMatch = dtMatch.Select("ID=" + MatchID.ToString());

                    if (drMatch.Length < 1)
                    {
                        continue;
                    }

                    response.Write("(" + GetMatchNumber(drMatch[0]["MatchNumber"].ToString()) + ">" + Getesult(PlayTypeID, Numbers[i].Substring(Numbers[i].IndexOf("(") + 1, Numbers[i].IndexOf(")") - Numbers[i].IndexOf("(") - 1)) + ")");
                }

                response.Write("," + BuyWays + "," + Multiple + "," + (2 * Multiple).ToString() + "\r\n");
            }
        }

        response.End();
    }
Пример #37
0
    private void BindData()
    {
        long SchemeID = Shove._Convert.StrToLong(Shove._Web.Utility.GetRequest("id"), -1);

        if (SchemeID < 0)
        {
            PF.GoError(ErrorNumber.Unknow, "参数错误", this.GetType().FullName);

            return;
        }

        DataTable dt = new DAL.Tables.T_Schemes().Open("InitiateUserID,LotteryNumber, PlayTypeID", "SiteID = " + _Site.ID.ToString() + " and [ID] = " + SchemeID.ToString(), "");
      
        if (dt == null)
        {
            PF.GoError(ErrorNumber.DataReadWrite, "数据库繁忙,请重试", this.GetType().FullName);

            return;
        }

        if (dt.Rows.Count < 1)
        {
            PF.GoError(ErrorNumber.Unknow, "参数错误", this.GetType().FullName);

            return;
        }

        long InitiateUserID = Shove._Convert.StrToLong(dt.Rows[0]["InitiateUserID"].ToString(), -1);

        //既不是发起人,也不在招股对象之内
        if (_User != null && !_User.isCanViewSchemeContent(SchemeID))
        {
            PF.GoError(ErrorNumber.Unknow, "对不起,您不在此方案的招股对象之内。", this.GetType().FullName);

            return;
        }

        string LotteryNumber = dt.Rows[0]["LotteryNumber"].ToString();

        if (Shove._Convert.StrToInt(dt.Rows[0]["PlayTypeID"].ToString(), -1) > 7200 && Shove._Convert.StrToInt(dt.Rows[0]["PlayTypeID"].ToString(), -1) < 7300)
        {
            string CacheKey = "JCZC_Scheme_Bind";

            DataTable dtMatch = Shove._Web.Cache.GetCacheAsDataTable(CacheKey);

            if (dtMatch == null)
            {
                dtMatch = new DAL.Tables.T_Match().Open("ID, MatchNumber, StopSellingTime", "", "");

                if(dtMatch == null)
                {
                    return;
                }

                if (dtMatch.Rows.Count < 1)
                {
                    return;
                }

                Shove._Web.Cache.SetCache(CacheKey, dtMatch, 3600);
            }

            string CanonicalNumber = "";
            int PlayTypeID = Shove._Convert.StrToInt(dt.Rows[0]["PlayTypeID"].ToString(), 7201);

            ArrayList al = new ArrayList();

            string[] strs = LotteryNumber.Split('\n');

            if (strs == null)
                return;
            if (strs.Length == 0)
                return;

            string CacheKeyNumbers = "Home_Web_DownloadSchemeFile_" + SchemeID.ToString();

            string[] LotteryNumbers = Shove._Web.Cache.GetCacheAsString(CacheKeyNumbers, "").Split('\n');
            string[] strNumbers = null;

            if (LotteryNumbers.Length < 2)
            {
                for (int i = 0; i < strs.Length; i++)
                {
                    if (string.IsNullOrEmpty(strs[i]))
                    {
                        continue;
                    }

                    strNumbers = new SLS.Lottery()[Shove._Convert.StrToInt(PlayTypeID.ToString().Substring(0, PlayTypeID.ToString().Length - 2), 72)].ToSingle(strs[i], ref CanonicalNumber, PlayTypeID);

                    if (strNumbers == null)
                    {
                        continue;
                    }

                    for (int j = 0; j < strNumbers.Length; j++)
                    {
                        al.Add(strNumbers[j]);
                    }
                }

                LotteryNumbers = new string[al.Count];

                StringBuilder sbLotteryNumbers = new StringBuilder();

                for (int i = 0; i < al.Count; i++)
                {
                    if (i == al.Count)
                    {
                        sbLotteryNumbers.Append(al[i].ToString());
                    }
                    else
                    {
                        sbLotteryNumbers.Append(al[i].ToString() + "\n");
                    }

                    LotteryNumbers[i] = al[i].ToString();
                }

                Shove._Web.Cache.SetCache(CacheKeyNumbers, sbLotteryNumbers.ToString(), 3600);
            }

            StringBuilder sb = new StringBuilder();

            sb.Append("<table width=\"60%\" border=\"0\" align=\"center\" cellpadding=\"2\" cellspacing=\"1\" class=\"BgBlue\">");
            sb.Append("<tr align=\"center\" bgcolor=\"#FFFFFF\" class=\"BlueLightBg WhiteWords\">");
            sb.Append("<td width=\"8%\"><strong>序号</strong></td>");
            sb.Append("<td><strong>过关场次</strong></td>");
            sb.Append("<td width=\"10%\"><strong>过关方式</strong></td>");
            sb.Append("<td width=\"10%\"><strong>注数</strong></td>");
            sb.Append("<td width=\"10%\"><strong>投注金额(元)</strong></td></tr>");

            string Number = "";
            int No = 0;
            string BuyWays = "";

            int Multiple = 0;

            int LotID = 0;
            int PlayID = 0;

            PlayID = Shove._Convert.StrToInt(LotteryNumbers[0].Split(';')[0], 7201);
            LotID = Shove._Convert.StrToInt(PlayID.ToString().Substring(0, 2), 72);

            DateTime EndTime = DateTime.Now;

            int pageindex = 1;
            if (!string.IsNullOrEmpty(Shove._Web.Utility.GetRequest("p")))
            {
                pageindex = Shove._Convert.StrToInt(Shove._Web.Utility.GetRequest("p").ToString(), 1);
            }

            int perPageRowCount = 30;

            if (pageindex < 1)
            {
                pageindex = 1;
            }

            foreach (string str in LotteryNumbers)
            {
                if (string.IsNullOrEmpty(str))
                {
                    continue;
                }

                No++;

                if (str.Split(';').Length < 3)
                {
                    continue;
                }

                try
                {
                    Multiple = Shove._Convert.StrToInt(str.Split(';')[2].Substring(1, str.Split(';')[2].Length - 2).Substring(2), 1);
                }
                catch
                { }

                if ((No < (pageindex - 1) * perPageRowCount) || No > (pageindex) * perPageRowCount)
                {
                    continue;
                }

                sb.Append("<tr align=\"center\" class=\"" + ((No % 2 == 0) ? "BlueWord WhiteBg" : "BlueLightBg2 BlueWord") + "\">");
                sb.Append("<td>" + No.ToString() + "</td>");

                Number = str.Split(';')[1].Substring(1, str.Split(';')[1].Length - 2);
                string[] Numbers = Number.Split('|');

                //if (Numbers.Length < 2)
                //{
                //    continue;
                //}

                sb.Append("<td height=\"20\">");

                if (Numbers.Length == 1)
                {
                    BuyWays = "单关";
                }
                else
                {
                    BuyWays = Numbers.Length.ToString() + "串1";
                }

                long MatchID = 0;

                for (int i = 0; i < Numbers.Length; i++)
                {
                    if (Numbers[i].IndexOf("(") < 0)
                    {
                        continue;
                    }

                    MatchID = Shove._Convert.StrToLong(Numbers[i].Substring(0, Numbers[i].IndexOf("(")), 1);

                    DataRow[] dr = dtMatch.Select("ID=" + MatchID.ToString());

                    if (dr.Length < 1)
                    {
                        continue;
                    }

                    sb.Append(dr[0]["MatchNumber"].ToString() + "->" + PF.Getesult(PlayID.ToString(), Numbers[i].Substring(Numbers[i].IndexOf("(") + 1, Numbers[i].IndexOf(")") - Numbers[i].IndexOf("(") - 1)) + ";");
                }

                sb.Append("</td>");
                sb.Append("<td height=\"20\">" + BuyWays + "</td>");
                sb.Append("<td>1</td>");
                sb.Append("<td>" + (2 * Multiple).ToString() + "</td></tr>");
            }

            sb.Append("</table>");
            labLotteryNumber.Text = sb.ToString();

            StringBuilder sbpage = new StringBuilder();

            int rowCount = No;
            int pageCount = rowCount % perPageRowCount == 0 ? rowCount / perPageRowCount : rowCount / perPageRowCount + 1;

            if (SchemeID < 0)
            {
                sbpage.Append("<div id=\"Pagination\" class=\"yahoo\" style=\"width: auto;\"><span id=\"first\"><a href=\"DownloadSchemeFile.aspx\">首页</a></span>");

                if (pageindex == 1)
                {
                    sbpage.Append("<span class=\"disabled\">« 上一页</span>");
                }
                else
                {
                    sbpage.Append("<span><a href=\"DownloadSchemeFile.aspx?p=" + (pageindex - 1).ToString() + "\">« 上一页</a></span>");
                }

                for (int i = 0; i < pageCount; i++)
                {
                    if (i == pageindex - 1)
                    {
                        sbpage.Append("<span class=\"current\">" + (i + 1).ToString() + "</span>");

                        continue;
                    }

                    if ((i < pageindex + 4 || i < 9) && (i > pageindex - 6 || i > pageCount - 10))
                    {
                        sbpage.Append("<a href=\"DownloadSchemeFile.aspx?p=" + (i + 1).ToString() + "\">" + (i + 1).ToString() + "</a>");
                    }
                }

                if (pageindex == pageCount)
                {
                    sbpage.Append("<span class=\"disabled\">下一页 »</span>");
                }
                else
                {
                    sbpage.Append("<span><a href=\"DownloadSchemeFile.aspx?p=" + (pageindex + 1).ToString() + "\">下一页 »</a></span>");
                }

                sbpage.Append("<span id=\"last\" value=\"" + pageCount.ToString() + "\"><a href=\"DownloadSchemeFile.aspx?p=" + (pageCount).ToString() + "\">尾页</a></span><span class=\"jilu\">共" + pageCount.ToString() + "页," + No.ToString() + "条记录</span></div>");
            }
            else
            {
                sbpage.Append("<div id=\"Pagination\" class=\"yahoo\" style=\"width: auto;\"><span id=\"first\"><a href=\"DownloadSchemeFile.aspx?id=" + SchemeID.ToString() + "\">首页</a></span>");

                if (pageindex == 1)
                {
                    sbpage.Append("<span class=\"disabled\">« 上一页</span>");
                }
                else
                {
                    sbpage.Append("<span><a href=\"DownloadSchemeFile.aspx?id=" + SchemeID.ToString() + "&p=" + (pageindex - 1).ToString() + "\">« 上一页</a></span>");
                }

                for (int i = 0; i < pageCount; i++)
                {
                    if (i == pageindex - 1)
                    {
                        sbpage.Append("<span class=\"current\">" + (i + 1).ToString() + "</span>");

                        continue;
                    }

                    if ((i < pageindex + 4 || i < 9) && (i > pageindex - 6 || i > pageCount - 10))
                    {
                        sbpage.Append("<a href=\"DownloadSchemeFile.aspx?id=" + SchemeID.ToString() + "&p=" + (i + 1).ToString() + "\">" + (i + 1).ToString() + "</a>");
                    }
                }

                if (pageindex == pageCount)
                {
                    sbpage.Append("<span class=\"disabled\">下一页 »</span>");
                }
                else
                {
                    sbpage.Append("<span><a href=\"DownloadSchemeFile.aspx?id=" + SchemeID.ToString() + "&p=" + (pageindex + 1).ToString() + "\">下一页 »</a></span>");
                }

                sbpage.Append("<span id=\"last\" value=\"" + pageCount.ToString() + "\"><a href=\"DownloadSchemeFile.aspx?id=" + SchemeID.ToString() + "&p=" + (pageCount).ToString() + "\">尾页</a></span><span class=\"jilu\">共" + pageCount.ToString() + "页," + No.ToString() + "条记录</span></div>");
            }

            labLotteryNumber.Text += sbpage.ToString();

        }
        else
        {
            LotteryNumber = PF.GetScriptResTable(LotteryNumber);

            if (LotteryNumber.IndexOf("table") < 0)
            {
                LotteryNumber = Shove._Convert.ToHtmlCode(LotteryNumber);
            }

            labLotteryNumber.Text = (LotteryNumber == "") ? "未找到相关数据。" : (LotteryNumber + "&nbsp;");
        }
    }
Пример #38
0
    /// <summary>
    /// 购买彩票
    /// </summary>
    /// <param name="_User"></param>
    private void Buy(Users _User)
    {
        string HidIsuseID           = Shove._Web.Utility.GetRequest("HidIsuseID");
        string HidIsuseEndTime      = Shove._Web.Utility.GetRequest("HidIsuseEndTime");
        string playType             = Shove._Web.Utility.GetRequest("tbPlayTypeID");
        string Chase                = Shove._Web.Utility.GetRequest("Chase");
        string CoBuy                = Shove._Web.Utility.GetRequest("CoBuy");
        string tb_Share             = Shove._Web.Utility.GetRequest("tb_Share");
        string tb_BuyShare          = Shove._Web.Utility.GetRequest("tb_BuyShare");
        string tb_AssureShare       = Shove._Web.Utility.GetRequest("tb_AssureShare");
        string tb_OpenUserList      = "";
        string tb_Title             = Shove._Web.Utility.GetRequest("tb_Title");
        string tb_Description       = Shove._Web.Utility.GetRequest("tb_Description");
        string tbAutoStopAtWinMoney = Shove._Web.Utility.GetRequest("tbAutoStopAtWinMoney");
        string tbSecrecyLevel       = Shove._Web.Utility.GetRequest("SecrecyLevel");
        string tb_LotteryNumber     = Shove._Web.Utility.FilteSqlInfusion(Request["tb_LotteryNumber"]);
        string tb_hide_SumMoney     = Shove._Web.Utility.GetRequest("tb_hide_SumMoney");
        string tb_hide_AssureMoney  = Shove._Web.Utility.GetRequest("tb_hide_AssureMoney");
        string tb_hide_SumNum       = Shove._Web.Utility.GetRequest("tb_hide_SumNum");
        string HidIsuseCount        = Shove._Web.Utility.GetRequest("HidIsuseCount");
        string HidLotteryID         = Shove._Web.Utility.GetRequest("HidLotteryID");
        string HidIsAlipay          = Shove._Web.Utility.GetRequest("HidIsAlipay");
        string tb_Multiple          = Shove._Web.Utility.GetRequest("tb_Multiple");
        string HidIsuseName         = Shove._Web.Utility.GetRequest("HidIsuseName");
        string tbPlayTypeName       = Shove._Web.Utility.GetRequest("tbPlayTypeName");
        string ChaseBuyedMoney      = Shove._Web.Utility.GetRequest("tb_hide_ChaseBuyedMoney");
        string tb_SchemeBonusScale  = Shove._Web.Utility.GetRequest("tb_SchemeBonusScale");
        string tb_SchemeBonusScalec = Shove._Web.Utility.GetRequest("tb_SchemeBonusScalec");

        int Price = 2;

        if (tb_Multiple == "")
        {
            tb_Multiple = "1";
        }

        double SumMoney           = 0;
        int    Share              = 0;
        int    BuyShare           = 0;
        double AssureMoney        = 0;
        int    Multiple           = 0;
        int    SumNum             = 0;
        short  SecrecyLevel       = 0;
        int    PlayTypeID         = 0;
        int    LotteryID          = 0;
        long   IsuseID            = 0;
        double AutoStopAtWinMoney = 0;
        double SchemeBonusScale   = 0;
        double SchemeBonusScalec  = 0;

        try
        {
            SumMoney           = double.Parse(tb_hide_SumMoney);
            Share              = int.Parse(tb_Share);
            BuyShare           = int.Parse(tb_BuyShare);
            AssureMoney        = double.Parse(tb_hide_AssureMoney);
            Multiple           = int.Parse(tb_Multiple);
            SumNum             = int.Parse(tb_hide_SumNum);
            SecrecyLevel       = short.Parse(tbSecrecyLevel);
            PlayTypeID         = int.Parse(playType);
            LotteryID          = int.Parse(HidLotteryID);
            IsuseID            = long.Parse(HidIsuseID);
            AutoStopAtWinMoney = double.Parse(tbAutoStopAtWinMoney);
            SchemeBonusScale   = double.Parse(tb_SchemeBonusScale);
            SchemeBonusScalec  = double.Parse(tb_SchemeBonusScalec);
        }
        catch
        {
            Shove._Web.JavaScript.Alert(this.Page, "输入有错误,请仔细检查。");

            return;
        }

        if ((SumMoney <= 0) || (SumNum < 1))
        {
            Shove._Web.JavaScript.Alert(this.Page, "输入有错误,请仔细检查。");

            return;
        }

        if (AssureMoney < 0)
        {
            Shove._Web.JavaScript.Alert(this.Page, "输入有错误,请仔细检查。");

            return;
        }

        if (Share < 1)
        {
            Shove._Web.JavaScript.Alert(this.Page, "输入有错误,请仔细检查。");

            return;
        }

        if ((BuyShare == Share) && (AssureMoney == 0))
        {
            Share    = 1;
            BuyShare = 1;
        }

        if ((SumMoney / Share) < 1)
        {
            Shove._Web.JavaScript.Alert(this.Page, "每份金额最低不能少于 1 元。");

            return;
        }

        double BuyMoney = BuyShare * (SumMoney / Share) + AssureMoney;

        if (Chase != "")
        {
            BuyMoney = double.Parse(ChaseBuyedMoney);
        }
        //DateTime dtBefore = new DateTime(2009, 10, 16, 0, 0, 0, 0);
        //if (!_User.isMobileValided && !_User.isEmailValided && _User.RegisterTime >= dtBefore)
        //{
        //    script = "<script>Valid();</script>";

        //    return;
        //}

        if (BuyMoney > _User.Balance)
        {
            SaveDataForAliBuy();

            return;
        }

        if (BuyMoney > PF.SchemeMaxBettingMoney)
        {
            Shove._Web.JavaScript.Alert(this.Page, "投注金额不能大于" + PF.SchemeMaxBettingMoney.ToString() + ",谢谢。");

            return;
        }

        if (Multiple > 999)
        {
            Shove._Web.JavaScript.Alert(this.Page, "投注倍数不能大于 999 倍,谢谢。");

            return;
        }
        //佣金比例的计算

        if (!(SchemeBonusScale >= 0 || SchemeBonusScale <= 10))
        {
            Shove._Web.JavaScript.Alert(this.Page, "佣金比例只能在0~10之间");

            return;
        }

        if (SchemeBonusScale.ToString().IndexOf("-") > -1 || SchemeBonusScale.ToString().IndexOf(".") > -1)
        {
            Shove._Web.JavaScript.Alert(this.Page, "佣金比例输入有误");

            return;
        }
        if (!(SchemeBonusScalec >= 0 || SchemeBonusScalec <= 10))
        {
            Shove._Web.JavaScript.Alert(this.Page, "佣金比例只能在0~10之间");

            return;
        }

        if (SchemeBonusScalec.ToString().IndexOf("-") > -1 || SchemeBonusScalec.ToString().IndexOf(".") > -1)
        {
            Shove._Web.JavaScript.Alert(this.Page, "佣金比例输入有误");

            return;
        }

        SchemeBonusScale  = SchemeBonusScale / 100;
        SchemeBonusScalec = SchemeBonusScalec / 100;

        string LotteryNumber = tb_LotteryNumber;

        if (LotteryNumber[LotteryNumber.Length - 1] == '\n')
        {
            LotteryNumber = LotteryNumber.Substring(0, LotteryNumber.Length - 1);
        }

        #region 对彩票号码进行分析,判断注数

        SLS.Lottery slsLottery = new SLS.Lottery();
        string[]    t_lotterys = SplitLotteryNumber(LotteryNumber);

        if ((t_lotterys == null) || (t_lotterys.Length < 1))
        {
            Shove._Web.JavaScript.Alert(this.Page, "选号发生异常,请重新选择号码投注,谢谢。(-694)");

            return;
        }

        int ValidNum = 0;

        foreach (string str in t_lotterys)
        {
            string Number = slsLottery[LotteryID].AnalyseScheme(str, PlayTypeID);

            if (string.IsNullOrEmpty(Number))
            {
                continue;
            }

            string[] str_s = Number.Split('|');

            if (str_s == null || str_s.Length < 1)
            {
                continue;
            }

            ValidNum += Shove._Convert.StrToInt(str_s[str_s.Length - 1], 0);
        }

        if (ValidNum != SumNum)
        {
            Shove._Web.JavaScript.Alert(this.Page, "选号发生异常,请重新选择号码投注,谢谢。");

            return;
        }

        #endregion

        StringBuilder ChaseXML          = new StringBuilder();
        int           RpTodayDataCount  = 0;
        string        AdditionasXml     = "";
        string        ReturnDescription = "";

        //追号
        if (Chase == "1")
        {
            foreach (string key in Request.Form.AllKeys)
            {
                if (key.IndexOf("check") > -1)
                {
                    int row = Shove._Convert.StrToInt(key.Replace("check", ""), -1);
                    if (row > 0)
                    {
                        RpTodayDataCount++;
                        int money = Shove._Convert.StrToInt(Request.Form["tb_hide_SumNum"], -1) * Price * Shove._Convert.StrToInt(Request.Form["times" + row.ToString()], -1);
                        ChaseXML.Append(Request.Form[key]).Append(",")
                        .Append(Request.Form["times" + row.ToString()]).Append(",")
                        .Append(money.ToString()).Append(";");
                    }
                }
            }

            if (ChaseXML.Length > 0)
            {
                ChaseXML.Remove(ChaseXML.Length - 1, 1);
            }

            if (LotteryNumber[LotteryNumber.Length - 1] == '\n')
            {
                LotteryNumber = LotteryNumber.Substring(0, LotteryNumber.Length - 1);
            }

            try
            {
                SumMoney = double.Parse(tb_hide_SumMoney);
            }
            catch
            {
                Shove._Web.JavaScript.Alert(this.Page, "输入有错误,请仔细检查。(-1325)");

                return;
            }

            if (SumMoney < 2)
            {
                Shove._Web.JavaScript.Alert(this.Page, "输入有错误,请仔细检查。(-1332)");

                return;
            }

            string[] XML = ChaseXML.ToString().Split(';');
            int      CompetitionCount = XML.Length;

            string[] Xmlparams = new string[CompetitionCount * 6];

            string   str_EndTime = DAL.Functions.F_GetIsuseSystemEndTime(long.Parse(XML[0].Split(',')[0]), PlayTypeID).ToString();
            DateTime EndTime     = DateTime.Parse(str_EndTime);

            if (DateTime.Now >= EndTime)
            {
                Shove._Web.JavaScript.Alert(this.Page, "您选择的追号期号中包含已截止的期,请重新选择。");

                return;
            }

            //构建格式:期号,玩法类别,方案,倍数,金额,方案保密级别
            for (int i = 0; i < CompetitionCount; i++)
            {
                Xmlparams[i * 6]     = XML[i].Split(',')[0];    //期号
                Xmlparams[i * 6 + 1] = PlayTypeID.ToString();   //玩法类别
                Xmlparams[i * 6 + 2] = LotteryNumber;           //方案
                Xmlparams[i * 6 + 3] = XML[i].Split(',')[1];    //倍数
                Xmlparams[i * 6 + 4] = XML[i].Split(',')[2];    //金额
                Xmlparams[i * 6 + 5] = SecrecyLevel.ToString();

                if (Shove._Convert.StrToDouble(Xmlparams[i * 6 + 3], 0) * SumMoney != Shove._Convert.StrToDouble(Xmlparams[i * 6 + 4], 1))
                {
                    Shove._Web.JavaScript.Alert(this.Page, "输入有错误,请仔细检查。");

                    return;
                }

                if (Shove._Convert.StrToDouble(Xmlparams[i * 6 + 3], 0) < Multiple)
                {
                    Shove._Web.JavaScript.Alert(this.Page, "追号倍数有错误,请仔细检查!");

                    return;
                }

                if (double.Parse(Xmlparams[i * 6 + 3]) * SumNum * Price != double.Parse(Xmlparams[i * 6 + 4]))
                {
                    Shove._Web.JavaScript.Alert(this.Page, "追号金额有错误,请仔细检查!可能原因:浏览器不兼容,建议使用IE 7.0");

                    return;
                }
            }

            AdditionasXml = PF.BuildIsuseAdditionasXmlForChase(Xmlparams);

            if (AdditionasXml == "")
            {
                Shove._Web.JavaScript.Alert(this.Page, "追号发生错误。");

                return;
            }

            if (_User.InitiateChaseTask(tb_Title.Trim(), tb_Description.Trim(), LotteryID, AutoStopAtWinMoney, AdditionasXml, LotteryNumber, SchemeBonusScalec, ref ReturnDescription) < 0)
            {
                PF.GoError(ErrorNumber.Unknow, ReturnDescription, this.GetType().FullName + "(-754)");

                return;
            }

            Shove._Web.Cache.ClearCache("Home_Room_CoBuy_BindDataForType" + IsuseID.ToString());
            Shove._Web.Cache.ClearCache("Home_Room_SchemeAll_BindData" + IsuseID.ToString());
            Shove._Web.Cache.ClearCache(_Site.ID.ToString() + "AccountFreezeDetail_" + _User.ID.ToString());

            Response.Redirect("../Home/Room/UserBuySuccess.aspx?LotteryID=" + LotteryID.ToString() + "&Type=2&Money=" + BuyMoney.ToString() + "");

            return;
        }
        else
        {
            if (DateTime.Now >= Shove._Convert.StrToDateTime(HidIsuseEndTime.Replace("/", "-"), DateTime.Now.AddDays(-1).ToString()))
            {
                Shove._Web.JavaScript.Alert(this.Page, "本期投注已截止,谢谢。");

                return;
            }

            if (Price * SumNum * Multiple != SumMoney)
            {
                Shove._Web.JavaScript.Alert(this.Page, "输入有错误,请仔细检查。");

                return;
            }

            long SchemeID = _User.InitiateScheme(IsuseID, PlayTypeID, tb_Title.Trim() == "" ? "(无标题)" : tb_Title.Trim(), tb_Description.Trim(), LotteryNumber, "", Multiple, SumMoney, AssureMoney, Share, BuyShare, tb_OpenUserList.Trim(), short.Parse(SecrecyLevel.ToString()), SchemeBonusScale, ref ReturnDescription);
            if (SchemeID < 0)
            {
                PF.GoError(ErrorNumber.Unknow, ReturnDescription, this.GetType().FullName + "(-755)");

                return;
            }

            Shove._Web.Cache.ClearCache("Home_Room_CoBuy_BindDataForType" + IsuseID.ToString());
            Shove._Web.Cache.ClearCache("Home_Room_SchemeAll_BindData" + IsuseID.ToString());

            if (SumMoney > 50 && Share > 1)
            {
                Shove._Web.Cache.ClearCache("Home_Room_JoinAllBuy_BindData");
            }

            Response.Redirect("../Home/Room/UserBuySuccess.aspx?LotteryID=" + LotteryID.ToString() + "&&Money=" + BuyMoney.ToString() + "&SchemeID=" + SchemeID.ToString() + "");

            return;
        }
    }
Пример #39
0
    private string GetLotteryNumber(int LotteryID, int PlayTypeID, string BettingNumber, ref int Num)   // Num 返回注数
    {
        Num = 0;

        if (String.IsNullOrEmpty(BettingNumber))
        {
            return "";
        }

        SLS.Lottery.LotteryBase lb = new SLS.Lottery()[LotteryID];

        if (lb == null)
        {
            return "";
        }

        string t_Number = lb.AnalyseScheme(BettingNumber, PlayTypeID);

        if (String.IsNullOrEmpty(t_Number))
        {
            return "";
        }

        string[] t_Numbers = t_Number.Split('\n');

        if ((t_Numbers == null) || (t_Numbers.Length < 1))
        {
            return "";
        }

        string Result = "";

        foreach (string str in t_Numbers)
        {
            string t_str = str.Trim();

            if (String.IsNullOrEmpty(t_str))
            {
                continue;
            }

            string[] t_strs = t_str.Split('|');

            if ((t_strs == null) || (t_strs.Length != 2))
            {
                continue;
            }

            int t_Num = Shove._Convert.StrToInt(t_strs[1], -1);

            if (String.IsNullOrEmpty(t_strs[0]) || (t_Num < 1))
            {
                continue;
            }

            Result += t_strs[0] + "\n";
            Num += t_Num;
        }

        if (Result.EndsWith("\n"))
        {
            Result = Result.Substring(0, Result.Length - 1);
        }

        return Result;
    }
Пример #40
0
    protected void btnOK_Click(object sender, System.EventArgs e)
    {
        int IsuseCount = Shove._Convert.StrToInt(HidIsuseCount.Value, -1);
        int LotteryID = Shove._Convert.StrToInt(HidLotteryID.Value, -1);
        short Type = Shove._Convert.StrToShort(HidType.Value, -1);
        int Multiple = Shove._Convert.StrToInt(HidMultiple.Value, -1);
        int Nums = Shove._Convert.StrToInt(HidNums.Value, -1);
        short BetType = Shove._Convert.StrToShort(HidBetType.Value, -1);
        double Money = Shove._Convert.StrToDouble(HidMoney.Value, -1);
        string Title = Shove._Web.Utility.GetRequest("tbTitle1");
        int PlayTypeID = Shove._Convert.StrToInt(HidPlayTypeID.Value, -1);
      
        if (string.IsNullOrEmpty(Title))
        {
            Title = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
        }

        if (IsuseCount < 0 || LotteryID < 0 || Type < 0 || Multiple < 0 || Nums < 0 || BetType < 0 || Money < 0 || PlayTypeID < 0)
        {
            Shove._Web.JavaScript.Alert(this.Page, "投注信息有误!");

            return;
        }

        if (_User.Balance < Money)
        {
            Shove._Web.JavaScript.Alert(this.Page, "您的余额不足,请充值!");

            return;
        }

        int Price = 2;
        if (PlayTypeID == 3903)
        {
            Price = 3;
        }

        if (IsuseCount * Multiple * Nums * Price != Money)
        {
            Shove._Web.JavaScript.Alert(this.Page, "投注总金额与投注倍数、注数、期数不相符!");

            return;
        }

        int Result = -1;

        DateTime EndTime = DateTime.Now;

        switch (Type)
        {
            case 1:
                {
                    EndTime = EndTime.AddMonths(1);
                } break;

            case 2:
                {
                    EndTime = EndTime.AddMonths(3);
                } break;

            case 3:
                {
                    EndTime = EndTime.AddMonths(6);
                } break;

            case 4:
                {
                    EndTime = EndTime.AddYears(1);
                } break;
        }

        string ChaseXML = "";

        if (BetType == 1)
        {
            if (Nums != Shove._Convert.StrToInt(Shove._Web.Utility.GetRequest("selectMultiple"), 0))
            {
                Shove._Web.JavaScript.Alert(this.Page, "投注注数出现异常!");

                return;
            }

            if (Multiple != 1)
            {
                Shove._Web.JavaScript.Alert(this.Page, "投注倍数出现异常!");

                return;
            }

            HidLotteryNumber.Value = "";
            string[] lotteryNumber;
            ChaseXML = "<ChaseDetails>";

            Lottery l = new Lottery();

            if (LotteryID == 5)
            {
                lotteryNumber = l[5].BuildNumber(6, 1, Nums*IsuseCount).Split(new String[] { "\n" }, StringSplitOptions.None);
            }
            else if (LotteryID == 39)
            {
                lotteryNumber = l[39].BuildNumber(5, 2, Nums * IsuseCount).Split(new String[] { "\n" }, StringSplitOptions.None);
            }
            else
            {
                lotteryNumber = l[LotteryID].BuildNumber(Nums * IsuseCount).Split(new String[] { "\n" }, StringSplitOptions.None);
            }

            if (lotteryNumber.Length != Nums * IsuseCount)
            {
                Shove._Web.JavaScript.Alert(this.Page, "随机生成号码时出现异常!");

                return;
            }

            int i = 1;
            int j = 0;
            string LotteryNumber = "";
            foreach (string s in lotteryNumber)
            {
                LotteryNumber += s + "\n";

                if (i % Nums == 0)
                {
                    ChaseXML += "<Chase ChaseLotteryNumber=\"" + LotteryNumber + "\"/>";
                    j++;
                    LotteryNumber = "";
                }

                i++;
            }

            if (j != IsuseCount)
            {
                Shove._Web.JavaScript.Alert(this.Page, "随机生成号码时出现异常!");

                return;
            }

            ChaseXML += "</ChaseDetails>";
        }
        else
        {
            if (string.IsNullOrEmpty(HidLotteryNumber.Value))
            {
                Shove._Web.JavaScript.Alert(this.Page, "发起追号套餐有异常!");

                return;
            }

            if (Multiple != Shove._Convert.StrToInt(Shove._Web.Utility.GetRequest("selectMultiple"), 0))
            {
                Shove._Web.JavaScript.Alert(this.Page, "投注倍数出现异常!");

                return;
            }

            SLS.Lottery slsLottery = new SLS.Lottery();
            string[] t_lotterys = SplitLotteryNumber(HidLotteryNumber.Value);

            if ((t_lotterys == null) || (t_lotterys.Length < 1))
            {
                Shove._Web.JavaScript.Alert(this.Page, "选号发生异常,请重新选择号码投注,谢谢。");

                return;
            }

            int ValidNum = 0;

            foreach (string str in t_lotterys)
            {
                string Number = slsLottery[LotteryID].AnalyseScheme(str, PlayTypeID);

                if (string.IsNullOrEmpty(Number))
                {
                    continue;
                }

                string[] str_s = Number.Split('|');

                if (str_s == null || str_s.Length < 1)
                {
                    continue;
                }

                ValidNum += Shove._Convert.StrToInt(str_s[str_s.Length - 1], 0);
            }

            if (ValidNum != Nums)
            {
                Shove._Web.JavaScript.Alert(this.Page, "选号发生异常,请重新选择号码投注,谢谢。");

                return;
            }
        }

        string Description = "";

        Result = _User.InitiateCustomChase(LotteryID,PlayTypeID,Price, Type, EndTime, IsuseCount, Multiple, Nums, BetType, HidLotteryNumber.Value, 1, 0, Money, Title, ChaseXML, ref Description);

        if (Result < 0)
        {
            Shove._Web.JavaScript.Alert(this.Page, Description);

            return;
        }

        Shove._Web.Cache.ClearCache("LotteryPackage_BindUsers");
        Shove._Web.Cache.ClearCache(_Site.ID.ToString() + "AccountFreezeDetail_" + _User.ID.ToString());
        Shove._Web.Cache.ClearCache("Home_Room_ViewChaseCombo_BindData" + _User.ID.ToString());

        Shove._Web.JavaScript.Alert(this.Page, "定制追号套餐成功!", "LotteryPackage.aspx");
    }
Пример #41
0
    // 接收奖期通知
    private void IsuseNotice(string TransMessage)
    {
        System.Xml.XmlDocument XmlDoc     = new XmlDocument();
        System.Xml.XmlNodeList nodes      = null;
        System.Xml.XmlNodeList nodesIssue = null;

        try
        {
            XmlDoc.Load(new StringReader(TransMessage));

            nodes      = XmlDoc.GetElementsByTagName("*");
            nodesIssue = XmlDoc.GetElementsByTagName("issue");
        }
        catch { }

        if (nodes == null)
        {
            this.Response.End();

            return;
        }

        DAL.Tables.T_Isuses t_Isuses = new DAL.Tables.T_Isuses();

        for (int i = 0; i < nodes.Count; i++)
        {
            if (!(nodes[i].Name.ToUpper() == "BODY" && nodes[i].FirstChild.Name.ToUpper() == "ISSUENOTIFY"))
            {
                continue;
            }

            for (int j = 0; j < nodesIssue.Count; j++)
            {
                string IsuseName   = nodesIssue[j].Attributes["number"].Value;
                string LotteryName = nodesIssue[j].Attributes["gameName"].Value;
                string Status      = nodesIssue[j].Attributes["status"].Value;
                string StartTime   = nodesIssue[j].Attributes["startTime"].Value;
                string EndTime     = nodesIssue[j].Attributes["stopTime"].Value;
                int    LotteryID   = GetLotteryID(LotteryName);
                string WinNumber   = "";

                try
                {
                    WinNumber = GetWinNumber(LotteryID, nodesIssue[j].Attributes["bonusCode"].Value);
                }
                catch { }

                if ((LotteryID < 0) || (String.IsNullOrEmpty(IsuseName)))
                {
                    continue;
                }

                if (t_Isuses.GetCount("LotteryID = " + LotteryID.ToString() + " and [Name] = '" + Shove._Web.Utility.FilteSqlInfusion(IsuseName) + "'") < 1)
                {
                    DateTime _StartTime = DateTime.Now;
                    DateTime _EndTime   = DateTime.Now;

                    try
                    {
                        _StartTime = DateTime.Parse(StartTime);
                        _EndTime   = DateTime.Parse(EndTime);
                    }
                    catch
                    {
                        continue;
                    }

                    long   IsuseID           = -1;
                    string ReturnDescription = "";

                    if (DAL.Procedures.P_IsuseAdd(LotteryID, IsuseName, _StartTime, _EndTime, "", ref IsuseID, ref ReturnDescription) < 0)
                    {
                        continue;
                    }

                    if (IsuseID < 0)
                    {
                        continue;
                    }
                }

                DataTable dtIsuse = t_Isuses.Open("ID, State, WinLotteryNumber", "LotteryID = " + LotteryID.ToString() + " and [Name] = '" + Shove._Web.Utility.FilteSqlInfusion(IsuseName) + "' and LotteryID  in (select id from T_Lotteries where PrintOutType = 104)", "");

                if ((dtIsuse == null) || (dtIsuse.Rows.Count < 1))
                {
                    continue;
                }

                if (Status == "4")
                {
                    int    ReturnValue      = 0;
                    string ReturnDescprtion = "";

                    if (DAL.Procedures.P_ElectronTicketAgentSchemeQuash(Shove._Convert.StrToLong(dtIsuse.Rows[0]["ID"].ToString(), 0), ref ReturnValue, ref ReturnDescprtion) < 0)
                    {
                        new Log("ElectronTicket\\HPSH").Write("电子票方案撤单错误_P_ElectronTicketAgentSchemeQuash");

                        continue;
                    }
                }

                bool isHasUpdate = false;

                if (dtIsuse.Rows[0]["State"].ToString() != Status)
                {
                    isHasUpdate = true;
                }

                if (!String.IsNullOrEmpty(WinNumber) && (dtIsuse.Rows[0]["WinLotteryNumber"].ToString() != WinNumber))
                {
                    if (LotteryID == SLS.Lottery.SHSSL.ID)
                    {
                        DataTable dtWinTypes = new DAL.Tables.T_WinTypes().Open("", "LotteryID =" + LotteryID.ToString(), "");

                        double[] WinMoneyList = new double[dtWinTypes.Rows.Count * 2];

                        for (int k = 0; k < dtWinTypes.Rows.Count; k++)
                        {
                            WinMoneyList[k * 2]     = Shove._Convert.StrToDouble(dtWinTypes.Rows[k]["DefaultMoney"].ToString(), 1);
                            WinMoneyList[k * 2 + 1] = Shove._Convert.StrToDouble(dtWinTypes.Rows[k]["DefaultMoneyNoWithTax"].ToString(), 1);
                        }

                        DataTable dtChaseTaskDetails = new DAL.Tables.T_ChaseTaskDetails().Open("", "IsuseID=" + dtIsuse.Rows[0]["ID"].ToString() + " and SchemeID IS NOT NULL", "");

                        for (int k = 0; k < dtChaseTaskDetails.Rows.Count; k++)
                        {
                            string LotteryNumber     = dtChaseTaskDetails.Rows[k]["LotteryNumber"].ToString();
                            string Description       = "";
                            double WinMoneyNoWithTax = 0;

                            double WinMoney = new SLS.Lottery()[LotteryID].ComputeWin(LotteryNumber, WinNumber, ref Description, ref WinMoneyNoWithTax, int.Parse(dtChaseTaskDetails.Rows[k]["PlayTypeID"].ToString()), WinMoneyList);

                            if (WinMoney < 1)
                            {
                                continue;
                            }

                            int    ReturnValue      = 0;
                            string ReturnDescprtion = "";

                            if (DAL.Procedures.P_ChaseTaskStopWhenWin(Shove._Convert.StrToLong(dtChaseTaskDetails.Rows[k]["SiteID"].ToString(), 1), Shove._Convert.StrToLong(dtChaseTaskDetails.Rows[k]["SchemeID"].ToString(), 0), WinMoney, ref ReturnValue, ref ReturnDescprtion) < 0)
                            {
                                new Log("ElectronTicket\\HPSH").Write("电子票撤销追号错误_P_ChaseTaskStopWhenWin。");
                            }
                        }
                    }
                }

                if (isHasUpdate)
                {
                    int    ReturnValue      = 0;
                    string ReturnDescprtion = "";

                    if (DAL.Procedures.P_IsuseUpdate(LotteryID, Shove._Web.Utility.FilteSqlInfusion(IsuseName), Shove._Convert.StrToShort(Status, 1), Shove._Convert.StrToDateTime(StartTime, DateTime.Now.ToString()), Shove._Convert.StrToDateTime(EndTime, DateTime.Now.ToString()), DateTime.Now, WinNumber, ref ReturnValue, ref ReturnDescprtion) < 0)
                    {
                        new Log("ElectronTicket\\HPSH").Write("电子票撤销追号错误P_IsuseEdit。");
                    }

                    if (ReturnValue < 0)
                    {
                        new Log("ElectronTicket\\HPSH").Write(ReturnDescprtion);
                    }
                }
            }
        }

        string MessageID = nodes[0].Attributes["id"].Value;

        ReNotice(MessageID, "501");
    }
Пример #42
0
    private void Bind(long SchemeID)
    {
        string LotteryNumber = "";

        string[] LotteryNumbers = null;

        string CacheKey = "JCZC_Scheme_Bind";

        DataTable dtMatch = Shove._Web.Cache.GetCacheAsDataTable(CacheKey);

        if (SchemeID < 0)
        {
            string FileName = Request.Cookies["ASP.NET_SessionId"].Value;

            try
            {
                LotteryNumber = File.ReadAllText(System.AppDomain.CurrentDomain.BaseDirectory + "Temp\\" + FileName + ".txt");
            }
            catch { }

            if (string.IsNullOrEmpty(LotteryNumber))
            {
                Shove._Web.JavaScript.Alert(this.Page, "传递的参数错误,请重新发起操作!");

                return;
            }

            LotteryNumbers = LotteryNumber.Replace("\r", "").Split('\n');

            if (dtMatch == null)
            {
                dtMatch = new DAL.Tables.T_PassRate().Open("MatchID, MatchNumber, StopSellTime", "", "");
            }
        }

        if (string.IsNullOrEmpty(LotteryNumber))
        {
            string SchemeInfo = "";

            try
            {
                SchemeInfo = File.ReadAllText(System.AppDomain.CurrentDomain.BaseDirectory + "SchemeInfo\\" + SchemeID.ToString() + ".txt");
            }
            catch { }

            if (string.IsNullOrEmpty(SchemeInfo))
            {
                DataTable dt = new DAL.Tables.T_Schemes().Open("", "ID=" + SchemeID.ToString(), "");

                if (dt == null)
                {
                    Shove._Web.JavaScript.Alert(this.Page, "传递的参数错误,请重新发起操作!");

                    return;
                }

                if (dt.Rows.Count < 1)
                {
                    Shove._Web.JavaScript.Alert(this.Page, "传递的参数错误,请重新发起操作!");

                    return;
                }

                LotteryNumber = dt.Rows[0]["LotteryNumber"].ToString();

                ArrayList al = new ArrayList();

                string[] strs = LotteryNumber.Split('\n');

                if (strs == null)
                {
                    return;
                }
                if (strs.Length == 0)
                {
                    return;
                }

                string CanonicalNumber = "";
                int    PlayTypeID      = Shove._Convert.StrToInt(dt.Rows[0]["PlayTypeID"].ToString(), 7201);

                string CacheKeyNumbers = "Home_Web_DownloadSchemeFile_" + SchemeID.ToString();

                LotteryNumbers = Shove._Web.Cache.GetCacheAsString(CacheKeyNumbers, "").Split('\n');
                string[] strNumbers = null;

                if (LotteryNumbers.Length < 2)
                {
                    for (int i = 0; i < strs.Length; i++)
                    {
                        if (string.IsNullOrEmpty(strs[i]))
                        {
                            continue;
                        }

                        strNumbers = new SLS.Lottery()[Shove._Convert.StrToInt(PlayTypeID.ToString().Substring(0, PlayTypeID.ToString().Length - 2), 72)].ToSingle(strs[i], ref CanonicalNumber, PlayTypeID);

                        if (strNumbers == null)
                        {
                            continue;
                        }

                        for (int j = 0; j < strNumbers.Length; j++)
                        {
                            al.Add(strNumbers[j]);
                        }
                    }

                    LotteryNumbers = new string[al.Count];

                    StringBuilder sbLotteryNumbers = new StringBuilder();

                    for (int i = 0; i < al.Count; i++)
                    {
                        if (i == al.Count)
                        {
                            sbLotteryNumbers.Append(al[i].ToString());
                        }
                        else
                        {
                            sbLotteryNumbers.Append(al[i].ToString() + "\n");
                        }

                        LotteryNumbers[i] = al[i].ToString();
                    }

                    Shove._Web.Cache.SetCache(CacheKeyNumbers, sbLotteryNumbers.ToString(), 3600);
                }

                if (dtMatch == null)
                {
                    dtMatch = new DAL.Tables.T_Match().Open("ID as MatchID, MatchNumber, StopSellingTime as StopSellTime", "", "");
                }
            }
            else
            {
                LotteryNumber = SchemeInfo.Substring(0, SchemeInfo.LastIndexOf('$') - 1);

                LotteryNumbers = LotteryNumber.Replace("\r", "").Split('\n');

                if (dtMatch == null)
                {
                    dtMatch = new DAL.Tables.T_PassRate().Open("MatchID, MatchNumber, StopSellTime", "MatchID in (" + SchemeInfo.Substring(SchemeInfo.LastIndexOf('$')) + ")", "");
                }
            }
        }

        if (dtMatch == null)
        {
            Shove._Web.JavaScript.Alert(this.Page, "传递的参数错误,请重新发起操作!");

            return;
        }

        if (dtMatch.Rows.Count < 1)
        {
            return;
        }

        Shove._Web.Cache.SetCache(CacheKey, dtMatch, 3600);

        StringBuilder sb = new StringBuilder();

        sb.Append("<table width=\"60%\" border=\"0\" align=\"center\" cellpadding=\"2\" cellspacing=\"1\" class=\"BgBlue\">");
        sb.Append("<tr align=\"center\" bgcolor=\"#FFFFFF\" class=\"BlueLightBg WhiteWords\">");
        sb.Append("<td width=\"8%\"><strong>序号</strong></td>");
        sb.Append("<td><strong>过关场次</strong></td>");
        sb.Append("<td width=\"10%\"><strong>过关方式</strong></td>");
        sb.Append("<td width=\"10%\"><strong>注数</strong></td>");
        sb.Append("<td width=\"10%\"><strong>投注金额(元)</strong></td></tr>");

        string Number  = "";
        int    No      = 0;
        string BuyWays = "";

        int Multiple = 0;

        int LotID  = 0;
        int PlayID = 0;

        PlayID = Shove._Convert.StrToInt(LotteryNumbers[0].Split(';')[0], 7201);
        LotID  = Shove._Convert.StrToInt(PlayID.ToString().Substring(0, 2), 72);

        DateTime EndTime = DateTime.Now;

        int pageindex = 1;

        if (!string.IsNullOrEmpty(Shove._Web.Utility.GetRequest("p")))
        {
            pageindex = Shove._Convert.StrToInt(Shove._Web.Utility.GetRequest("p").ToString(), 1);
        }

        int perPageRowCount = 30;

        if (pageindex < 1)
        {
            pageindex = 1;
        }

        foreach (string str in LotteryNumbers)
        {
            if (string.IsNullOrEmpty(str))
            {
                continue;
            }

            No++;

            if (str.Split(';').Length < 3)
            {
                continue;
            }

            try
            {
                Multiple = Shove._Convert.StrToInt(str.Split(';')[2].Substring(1, str.Split(';')[2].Length - 2).Substring(2), 1);
            }
            catch
            { }

            if ((No < (pageindex - 1) * perPageRowCount) || No > (pageindex) * perPageRowCount)
            {
                continue;
            }

            sb.Append("<tr align=\"center\" class=\"" + ((No % 2 == 0) ? "BlueWord WhiteBg" : "BlueLightBg2 BlueWord") + "\">");
            sb.Append("<td>" + No.ToString() + "</td>");

            Number = str.Split(';')[1].Substring(1, str.Split(';')[1].Length - 2);
            string[] Numbers = Number.Split('|');

            if (Numbers.Length < 2)
            {
                continue;
            }

            sb.Append("<td height=\"20\">");

            BuyWays = Numbers.Length.ToString() + "串1";

            long MatchID = 0;

            for (int i = 0; i < Numbers.Length; i++)
            {
                if (Numbers[i].IndexOf("(") < 0)
                {
                    continue;
                }

                MatchID = Shove._Convert.StrToLong(Numbers[i].Substring(0, Numbers[i].IndexOf("(")), 1);

                DataRow[] dr = dtMatch.Select("MatchID=" + MatchID.ToString());

                if (dr.Length < 1)
                {
                    continue;
                }

                sb.Append(dr[0]["MatchNumber"].ToString() + "->" + PF.Getesult(PlayID.ToString(), Numbers[i].Substring(Numbers[i].IndexOf("(") + 1, Numbers[i].IndexOf(")") - Numbers[i].IndexOf("(") - 1)) + ";");
            }

            sb.Append("</td>");
            sb.Append("<td height=\"20\">" + BuyWays + "</td>");
            sb.Append("<td>1</td>");
            sb.Append("<td>" + (2 * Multiple).ToString() + "</td></tr>");
        }

        sb.Append("</table>");
        labLotteryNumber.Text = sb.ToString();

        StringBuilder sbpage = new StringBuilder();

        int rowCount  = No;
        int pageCount = rowCount % perPageRowCount == 0 ? rowCount / perPageRowCount : rowCount / perPageRowCount + 1;

        if (SchemeID < 0)
        {
            sbpage.Append("<div id=\"Pagination\" class=\"yahoo\" style=\"width: auto;\"><span id=\"first\"><a href=\"Scheme.aspx\">首页</a></span>");

            if (pageindex == 1)
            {
                sbpage.Append("<span class=\"disabled\">« 上一页</span>");
            }
            else
            {
                sbpage.Append("<span><a href=\"Scheme.aspx?p=" + (pageindex - 1).ToString() + "\">« 上一页</a></span>");
            }

            for (int i = 0; i < pageCount; i++)
            {
                if (i == pageindex - 1)
                {
                    sbpage.Append("<span class=\"current\">" + (i + 1).ToString() + "</span>");

                    continue;
                }

                if ((i < pageindex + 4 || i < 9) && (i > pageindex - 6 || i > pageCount - 10))
                {
                    sbpage.Append("<a href=\"Scheme.aspx?p=" + (i + 1).ToString() + "\">" + (i + 1).ToString() + "</a>");
                }
            }

            if (pageindex == pageCount)
            {
                sbpage.Append("<span class=\"disabled\">下一页 »</span>");
            }
            else
            {
                sbpage.Append("<span><a href=\"Scheme.aspx?p=" + (pageindex + 1).ToString() + "\">下一页 »</a></span>");
            }

            sbpage.Append("<span id=\"last\" value=\"" + pageCount.ToString() + "\"><a href=\"Scheme.aspx?p=" + (pageCount).ToString() + "\">尾页</a></span><span class=\"jilu\">共" + pageCount.ToString() + "页," + No.ToString() + "条记录</span></div>");
        }
        else
        {
            sbpage.Append("<div id=\"Pagination\" class=\"yahoo\" style=\"width: auto;\"><span id=\"first\"><a href=\"Scheme.aspx?id=" + SchemeID.ToString() + "\">首页</a></span>");

            if (pageindex == 1)
            {
                sbpage.Append("<span class=\"disabled\">« 上一页</span>");
            }
            else
            {
                sbpage.Append("<span><a href=\"Scheme.aspx?id=" + SchemeID.ToString() + "&p=" + (pageindex - 1).ToString() + "\">« 上一页</a></span>");
            }

            for (int i = 0; i < pageCount; i++)
            {
                if (i == pageindex - 1)
                {
                    sbpage.Append("<span class=\"current\">" + (i + 1).ToString() + "</span>");

                    continue;
                }

                if ((i < pageindex + 4 || i < 9) && (i > pageindex - 6 || i > pageCount - 10))
                {
                    sbpage.Append("<a href=\"Scheme.aspx?id=" + SchemeID.ToString() + "&p=" + (i + 1).ToString() + "\">" + (i + 1).ToString() + "</a>");
                }
            }

            if (pageindex == pageCount)
            {
                sbpage.Append("<span class=\"disabled\">下一页 »</span>");
            }
            else
            {
                sbpage.Append("<span><a href=\"Scheme.aspx?id=" + SchemeID.ToString() + "&p=" + (pageindex + 1).ToString() + "\">下一页 »</a></span>");
            }

            sbpage.Append("<span id=\"last\" value=\"" + pageCount.ToString() + "\"><a href=\"Scheme.aspx?id=" + SchemeID.ToString() + "&p=" + (pageCount).ToString() + "\">尾页</a></span><span class=\"jilu\">共" + pageCount.ToString() + "页," + No.ToString() + "条记录</span></div>");
        }

        labLotteryNumber.Text += sbpage.ToString();
    }
Пример #43
0
    // 接收奖期通知
    private void IsuseNotice(string TransMessage)
    {
        System.Xml.XmlDocument XmlDoc = new XmlDocument();

        try
        {
            XmlDoc.Load(new StringReader(TransMessage));
        }
        catch { }

        DAL.Tables.T_Isuses t_Isuses = new DAL.Tables.T_Isuses();

        string Body = TransMessage.Substring(TransMessage.IndexOf("<elements"), TransMessage.LastIndexOf("</elements>") - TransMessage.IndexOf("<elements")) + "</elements>";

        DataSet ds = new DataSet();

        ds.ReadXml(new StringReader(Body));

        if (ds == null)
        {
            return;
        }

        if (ds.Tables.Count == 0)
        {
            return;
        }

        DataTable dt = ds.Tables[0];

        if (dt.Rows.Count < 1)
        {
            return;
        }

        string MessageID = "";

        for (int i = 0; i < dt.Rows.Count; i++)
        {
            DataRow dr = dt.Rows[i];

            string LotteryName = dr["lotteryid"].ToString();
            int LotteryID = GetLotteryID(LotteryName);
            string IsuseName = GetIsusesNameToCaiyou(LotteryID.ToString(), dr["issue"].ToString());
            string Status = dr["status"].ToString();
            string StartTime = dr["starttime"].ToString();
            string EndTime = dr["endtime"].ToString();
            string WinNumber = "";

            if (Shove._Convert.StrToInt(Status, 0) > 1)
            {
                try
                {
                    WinNumber = GetWinNumber(LotteryID, dr["bonuscode"].ToString());
                }
                catch { }
            }

            if ((LotteryID < 0) || (String.IsNullOrEmpty(IsuseName)))
            {
                continue;
            }

            if (t_Isuses.GetCount("LotteryID = " + LotteryID.ToString() + " and [Name] = '" + Shove._Web.Utility.FilteSqlInfusion(IsuseName) + "' and year(StartTime) = YEAR(GETDATE())") < 1)
            {
                DateTime _StartTime = DateTime.Now;
                DateTime _EndTime = DateTime.Now;

                try
                {
                    _StartTime = DateTime.Parse(StartTime);
                    _EndTime = DateTime.Parse(EndTime);
                }
                catch
                {
                    continue;
                }

                long IsuseID = -1;
                string ReturnDescription = "";

                if (DAL.Procedures.P_IsuseAdd(LotteryID, IsuseName, _StartTime, _EndTime, "", ref IsuseID, ref ReturnDescription) < 0)
                {
                    continue;
                }

                if (IsuseID < 0)
                {
                    continue;
                }
            }

            DataTable dtIsuse = t_Isuses.Open("ID, State, WinLotteryNumber", "LotteryID = " + LotteryID.ToString() + " and [Name] = '" + Shove._Web.Utility.FilteSqlInfusion(IsuseName) + "' and year(StartTime) = YEAR(GETDATE())", "");

            if ((dtIsuse == null) || (dtIsuse.Rows.Count < 1))
            {
                continue;
            }

            if (Status == "1")
            {
                int ReturnValue = 0;
                string ReturnDescprtion = "";

                if (DAL.Procedures.P_ElectronTicketAgentSchemeQuash(Shove._Convert.StrToLong(dtIsuse.Rows[0]["ID"].ToString(), 0), ref ReturnValue, ref ReturnDescprtion) < 0)
                {
                    new Log("ElectronTicket\\ZCW").Write("电子票方案撤单错误_P_ElectronTicketAgentSchemeQuash");

                    continue;
                }
            }

            bool isHasUpdate = false;

            if (dtIsuse.Rows[0]["State"].ToString() != Status)
            {
                isHasUpdate = true;
            }

            if (isHasUpdate)
            {
                int ReturnValue = 0;
                string ReturnDescprtion = "";

                if (DAL.Procedures.P_IsuseUpdate(LotteryID, Shove._Web.Utility.FilteSqlInfusion(IsuseName), Shove._Convert.StrToShort(Status, 0), Shove._Convert.StrToDateTime(StartTime, DateTime.Now.ToString()), Shove._Convert.StrToDateTime(EndTime, DateTime.Now.ToString()), DateTime.Now, WinNumber, ref ReturnValue, ref ReturnDescprtion) < 0)
                {
                    new Log("ElectronTicket\\ZCW").Write("电子票撤销追号错误P_IsuseEdit。");
                }

                if (ReturnValue < 0)
                {
                    new Log("ElectronTicket\\ZCW").Write(ReturnDescprtion);
                }
            }

            if (!String.IsNullOrEmpty(WinNumber) && (dtIsuse.Rows[0]["WinLotteryNumber"].ToString() != WinNumber))
            {
                DataTable dtWinTypes = new DAL.Tables.T_WinTypes().Open("", "LotteryID =" + LotteryID.ToString(), "");

                double[] WinMoneyList = new double[dtWinTypes.Rows.Count * 2];

                for (int k = 0; k < dtWinTypes.Rows.Count; k++)
                {
                    if (Shove._Convert.StrToDouble(dtWinTypes.Rows[k]["DefaultMoney"].ToString(), 1) < 1)
                    {
                        MessageID = GetFromXPath(TransMessage, "message/header/messengerid");
                        ReNotice(MessageID, "13008");

                        return;
                    }

                    WinMoneyList[k * 2] = Shove._Convert.StrToDouble(dtWinTypes.Rows[k]["DefaultMoney"].ToString(), 1);
                    WinMoneyList[k * 2 + 1] = Shove._Convert.StrToDouble(dtWinTypes.Rows[k]["DefaultMoneyNoWithTax"].ToString(), 1);
                }

                #region 开奖第一步

                DataTable dtWin = null;

                dtWin = new DAL.Tables.T_Schemes().Open("LotteryNumber,PlayTypeID,Multiple,ID", "isOpened = 0 and IsuseID = " + dtIsuse.Rows[0]["ID"].ToString(), "[ID]");

                if (dtWin == null)
                {
                    return;
                }

                for (int y = 0; y < dtWin.Rows.Count; y++)
                {
                    string LotteryNumber = "";

                    try
                    {
                        LotteryNumber = dtWin.Rows[y]["LotteryNumber"].ToString();
                    }
                    catch
                    { }

                    string Description = "";
                    double WinMoneyNoWithTax = 0;

                    try
                    {

                        double WinMoney = new SLS.Lottery()[LotteryID].ComputeWin(LotteryNumber, WinNumber, ref Description, ref WinMoneyNoWithTax, int.Parse(dtWin.Rows[y]["PlayTypeID"].ToString()), WinMoneyList);

                        Shove.Database.MSSQL.ExecuteNonQuery("update T_Schemes set PreWinMoney = @p1, PreWinMoneyNoWithTax = @p2, EditWinMoney = @p3, EditWinMoneyNoWithTax = @p4, WinDescription = @p5 where [ID] = " + dtWin.Rows[y]["ID"].ToString(),
                            new Shove.Database.MSSQL.Parameter("p1", SqlDbType.Money, 0, ParameterDirection.Input, WinMoney * Shove._Convert.StrToInt(dtWin.Rows[y]["Multiple"].ToString(), 1)),
                            new Shove.Database.MSSQL.Parameter("p2", SqlDbType.Money, 0, ParameterDirection.Input, WinMoneyNoWithTax * Shove._Convert.StrToInt(dtWin.Rows[y]["Multiple"].ToString(), 1)),
                            new Shove.Database.MSSQL.Parameter("p3", SqlDbType.Money, 0, ParameterDirection.Input, WinMoney * Shove._Convert.StrToInt(dtWin.Rows[y]["Multiple"].ToString(), 1)),
                            new Shove.Database.MSSQL.Parameter("p4", SqlDbType.Money, 0, ParameterDirection.Input, WinMoneyNoWithTax * Shove._Convert.StrToInt(dtWin.Rows[y]["Multiple"].ToString(), 1)),
                            new Shove.Database.MSSQL.Parameter("p5", SqlDbType.VarChar, 0, ParameterDirection.Input, Description));
                    }
                    catch
                    {
                        continue;
                    }
                }

                #endregion

                #region 开奖第二步

                string OpenAffiche = new OpenAfficheTemplates()[LotteryID];

                int SchemeCount, QuashCount, WinCount, WinNoBuyCount;
                bool isEndOpen = false;

                int ReturnValue = 0;
                string ReturnDescription = "";

                while (!isEndOpen)
                {
                    SchemeCount = 0;
                    QuashCount = 0;
                    WinCount = 0;
                    WinNoBuyCount = 0;
                    //  总方案数,处理时撤单数,中奖数,中奖但未成功数

                    ReturnValue = 0;
                    ReturnDescription = "";
                    DataSet dsWin = null;

                    DAL.Procedures.P_Win(ref dsWin,
                         Shove._Convert.StrToLong(dtIsuse.Rows[0]["ID"].ToString(), 0),
                         WinNumber,
                         OpenAffiche,
                         1,
                         true,
                         ref SchemeCount, ref QuashCount, ref WinCount, ref WinNoBuyCount,
                         ref isEndOpen,
                         ref ReturnValue, ref ReturnDescription);
                }

                #endregion
            }

        }

        MessageID = GetFromXPath(TransMessage, "message/header/messengerid");
        ReNotice(MessageID, "13008");
    }
Пример #44
0
    // 接收开奖通知
    private void IsuseOpenNotice(string Transmessage)
    {
        System.Xml.XmlDocument XmlDoc         = new XmlDocument();
        System.Xml.XmlNodeList nodes          = null;
        System.Xml.XmlNodeList nodesBonusItem = null;
        System.Xml.XmlNodeList nodesIssue     = null;

        try
        {
            XmlDoc.Load(new StringReader(Transmessage));

            nodes          = XmlDoc.GetElementsByTagName("*");
            nodesBonusItem = XmlDoc.GetElementsByTagName("bonusItem");
            nodesIssue     = XmlDoc.GetElementsByTagName("issue");
        }
        catch { }

        if (nodes == null)
        {
            return;
        }

        string BonusNumber = "";

        for (int j = 0; j < nodes.Count; j++)
        {
            if (!(nodes[j].Name.ToUpper() == "BODY" && nodes[j].FirstChild.Name.ToUpper() == "BONUSNOTIFY"))
            {
                continue;
            }

            BonusNumber = nodes[j].FirstChild.Attributes["bonusNumber"].InnerText;
        }

        if (nodesIssue == null)
        {
            this.Response.End();

            return;
        }

        string MessageID   = nodes[0].Attributes["id"].Value;
        string number      = nodesIssue[0].Attributes["number"].Value;
        string LotteryName = nodesIssue[0].Attributes["gameName"].Value;

        int LotteryID = GetLotteryID(LotteryName);

        string WinNumber = GetWinNumber(LotteryID, BonusNumber);

        DataTable dtIsuse = new DAL.Tables.T_Isuses().Open("", " [Name] = '" + Shove._Web.Utility.FilteSqlInfusion(number) + "' and LotteryID = " + LotteryID.ToString() + " and IsOpened = 0 and LotteryID  in (select id from T_Lotteries where PrintOutType = 104)", "");

        if ((dtIsuse == null) || (dtIsuse.Rows.Count < 1))
        {
            this.Response.End();

            return;
        }

        string IsuseID = dtIsuse.Rows[0]["ID"].ToString();

        DAL.Tables.T_Isuses T_Isuses = new DAL.Tables.T_Isuses();

        T_Isuses.WinLotteryNumber.Value = WinNumber;
        T_Isuses.OpenOperatorID.Value   = 1;
        T_Isuses.Update(" ID = " + IsuseID);

        int    ReturnValue       = 0;
        string ReturnDescription = "";

        DataTable dtWinTypesSSL = new DAL.Tables.T_WinTypes().Open("", " LotteryID =" + LotteryID.ToString(), "");

        if ((dtWinTypesSSL != null) && dtWinTypesSSL.Rows.Count > 0)
        {
            double[] WinMoneyList = new double[dtWinTypesSSL.Rows.Count * 2];

            double DefaultMoney          = 0;
            double DefaultMoneyNoWithTax = 0;

            for (int i = 0; i < dtWinTypesSSL.Rows.Count; i++)
            {
                DefaultMoney          = Shove._Convert.StrToDouble(dtWinTypesSSL.Rows[i]["DefaultMoney"].ToString(), 0);
                DefaultMoneyNoWithTax = Shove._Convert.StrToDouble(dtWinTypesSSL.Rows[i]["DefaultMoneyNoWithTax"].ToString(), 0);

                WinMoneyList[i * 2]     = DefaultMoney == 0 ? 1 : DefaultMoneyNoWithTax;
                WinMoneyList[i * 2 + 1] = DefaultMoneyNoWithTax == 0 ? 1 : DefaultMoneyNoWithTax;
            }

            DataTable dtSchemesWithTaskDetails = new DAL.Tables.T_Schemes().Open("", "IsuseID = " + IsuseID + " and WinMoney = 0  and Buyed = 1 and isnull(Identifiers, '') = ''", "");

            string LotteryNumber       = "";
            SLS.Lottery.LotteryBase lb = new SLS.Lottery()[LotteryID];

            string Description       = "";
            double WinMoneyNoWithTax = 0;

            for (int i = 0; i < dtSchemesWithTaskDetails.Rows.Count; i++)
            {
                LotteryNumber     = dtSchemesWithTaskDetails.Rows[i]["LotteryNumber"].ToString();
                Description       = "";
                WinMoneyNoWithTax = 0;

                double WinMoney = lb.ComputeWin(LotteryNumber, WinNumber.Trim(), ref Description, ref WinMoneyNoWithTax, int.Parse(dtSchemesWithTaskDetails.Rows[i]["PlayTypeID"].ToString()), WinMoneyList);

                if (WinMoney > 0)
                {
                    Shove.Database.MSSQL.ExecuteNonQuery("update T_Schemes set PreWinMoney = @p1, PreWinMoneyNoWithTax = @p2, WinMoney = @p3, WinMoneyNoWithTax = @p4, WinDescription = @p5 where [ID] = " + dtSchemesWithTaskDetails.Rows[i]["ID"].ToString(),
                                                         new Shove.Database.MSSQL.Parameter("p1", SqlDbType.Money, 0, ParameterDirection.Input, WinMoney * Shove._Convert.StrToInt(dtSchemesWithTaskDetails.Rows[i]["Multiple"].ToString(), 1)),
                                                         new Shove.Database.MSSQL.Parameter("p2", SqlDbType.Money, 0, ParameterDirection.Input, WinMoneyNoWithTax * Shove._Convert.StrToInt(dtSchemesWithTaskDetails.Rows[i]["Multiple"].ToString(), 1)),
                                                         new Shove.Database.MSSQL.Parameter("p3", SqlDbType.Money, 0, ParameterDirection.Input, WinMoney * Shove._Convert.StrToInt(dtSchemesWithTaskDetails.Rows[i]["Multiple"].ToString(), 1)),
                                                         new Shove.Database.MSSQL.Parameter("p4", SqlDbType.Money, 0, ParameterDirection.Input, WinMoneyNoWithTax * Shove._Convert.StrToInt(dtSchemesWithTaskDetails.Rows[i]["Multiple"].ToString(), 1)),
                                                         new Shove.Database.MSSQL.Parameter("p5", SqlDbType.VarChar, 0, ParameterDirection.Input, Description));

                    continue;
                }
            }
        }

        string BonusXML      = "<Schemes>";
        string AgentBonusXML = "<Schemes>";

        if ((nodesBonusItem != null) && (nodesBonusItem.Count > 0))
        {
            string  bonusItemXML = Transmessage.Substring(Transmessage.IndexOf("<bonusNotify"), Transmessage.LastIndexOf("</body>") - Transmessage.IndexOf("<bonusNotify"));
            DataSet dsXML        = new DataSet();

            try
            {
                dsXML.ReadXml(new StringReader(bonusItemXML));
            }
            catch (Exception e)
            {
                new Log("ElectronTicket\\HPSD").Write("电子票开奖,第 " + number + " 期解析开奖数据错误:" + e.Message);

                this.Response.End();

                return;
            }

            if ((dsXML == null) || (dsXML.Tables.Count < 3))
            {
                new Log("ElectronTicket\\HPSD").Write("电子票开奖,第 " + number + " 期开奖数据格式不符合要求。");

                this.Response.End();

                return;
            }

            DataTable dtTickets = dsXML.Tables[2];
            DataTable dtSchemes = MSSQL.Select("SELECT SchemeID, 0 AS AgentID, SchemesMultiple as Multiple, Identifiers FROM V_SchemesSendToCenter WHERE (IsuseID = " + IsuseID + ")");

            if (dtSchemes == null)
            {
                new Log("ElectronTicket\\HPSD").Write("电子票开奖,第 " + number + " 期,读取本地方案错误。");

                this.Response.End();

                return;
            }

            try
            {
                var query1 = from NewDtTickets in dtTickets.AsEnumerable()
                             join NewdtScheme in dtSchemes.AsEnumerable()
                             on NewDtTickets.Field <string>("ticketID") equals NewdtScheme.Field <string>("Identifiers")
                             select new
                {
                    ID         = NewdtScheme.Field <long>("SchemeID"),
                    AgentID    = 0,          //NewdtScheme.Field<long>("AgentID"),
                    Multiple   = NewdtScheme.Field <int>("Multiple"),
                    Bonus      = Shove._Convert.StrToDouble(NewDtTickets.Field <string>("money"), 0),
                    BonusLevel = NewDtTickets.Field <string>("bonusLevel"),
                };

                var query2 = from NewDt in query1.AsQueryable()
                             group NewDt by new { NewDt.ID, NewDt.BonusLevel, NewDt.AgentID, NewDt.Multiple } into gg
                    select new
                {
                    ID         = gg.Key.ID,
                    AgentID    = gg.Key.AgentID,
                    Multiple   = gg.Key.Multiple,
                    Bonus      = gg.Sum(NewDt => NewDt.Bonus),
                    BonusLevel = GetWinDescription(LotteryID, gg.Key.BonusLevel)
                };

                var query3 = from NewDt in query2.AsQueryable()
                             group NewDt by new { NewDt.ID, NewDt.Multiple, NewDt.AgentID } into t_dtSchemes
                    select new
                {
                    SchemeID   = t_dtSchemes.Key.ID,
                    AgentID    = t_dtSchemes.Key.AgentID,
                    Multiple   = t_dtSchemes.Key.Multiple,
                    Bonus      = t_dtSchemes.Sum(NewDt => NewDt.Bonus),
                    BonusLevel = "中奖金额:" + t_dtSchemes.Sum(NewDt => NewDt.Bonus).ToString() + ((t_dtSchemes.Key.Multiple != 1) ? "(" + t_dtSchemes.Key.Multiple.ToString() + "倍)" : "")
                };

                foreach (var Scheme in query3)
                {
                    if (Scheme.AgentID == 0)
                    {
                        BonusXML += "<Scheme SchemeID=\"" + Scheme.SchemeID.ToString() + "\" WinMoney=\"" + Scheme.Bonus.ToString() + "\" WinDescription=\"" + Scheme.BonusLevel + "\" />";
                    }
                    else
                    {
                        AgentBonusXML += "<Scheme SchemeID=\"" + Scheme.SchemeID.ToString() + "\" WinMoney=\"" + Scheme.Bonus.ToString() + "\" WinDescription=\"" + Scheme.BonusLevel + "\" />";
                    }
                }
            }
            catch (Exception e)
            {
                new Log("ElectronTicket\\HPSD").Write("电子票开奖,第 " + number + " 期详细中奖数据解析错误:" + e.Message);

                this.Response.End();

                return;
            }
        }

        BonusXML      += "</Schemes>";
        AgentBonusXML += "</Schemes>";

        dtIsuse = new DAL.Tables.T_Isuses().Open("", "[ID] = " + IsuseID + " and IsOpened = 0", "");

        if ((dtIsuse == null) || (dtIsuse.Rows.Count < 1))
        {
            this.Response.End();

            return;
        }

        DataSet ds     = null;
        int     Times  = 0;
        int     Result = -1;

        while ((Result < 0) && (Times < 5))
        {
            ReturnValue       = 0;
            ReturnDescription = "";

            Result = DAL.Procedures.P_ElectronTicketWin(ref ds, Shove._Convert.StrToLong(IsuseID, 0), BonusXML, AgentBonusXML, ref ReturnValue, ref ReturnDescription);

            if (Result < 0)
            {
                new Log("ElectronTicket\\HPSD").Write("电子票第 " + (Times + 1).ToString() + " 次派奖出现错误(IsuseOpenNotice) 期号为: " + number + ",彩种为: " + LotteryID.ToString());
                Times++;

                if (Times < 5)
                {
                    System.Threading.Thread.Sleep(10000);
                }

                continue;
            }
        }

        if (ReturnValue < 0)
        {
            new Log("ElectronTicket\\HPSD").Write("电子票派奖出现错误(IsuseOpenNotice) 期号为: " + number + ",彩种为: " + LotteryID.ToString() + ",错误:" + ReturnDescription);

            this.Response.End();

            return;
        }

        DataTable dtWinTypes = new DAL.Tables.T_WinTypes().Open("", " LotteryID =" + LotteryID.ToString(), "");

        if ((dtWinTypes != null) && dtWinTypes.Rows.Count > 0)
        {
            double[] WinMoneyList = new double[dtWinTypes.Rows.Count * 2];

            double DefaultMoney          = 0;
            double DefaultMoneyNoWithTax = 0;

            for (int i = 0; i < dtWinTypes.Rows.Count; i++)
            {
                DefaultMoney          = Shove._Convert.StrToDouble(dtWinTypes.Rows[i]["DefaultMoney"].ToString(), 0);
                DefaultMoneyNoWithTax = Shove._Convert.StrToDouble(dtWinTypes.Rows[i]["DefaultMoneyNoWithTax"].ToString(), 0);

                WinMoneyList[i * 2]     = DefaultMoney == 0 ? 1 : DefaultMoneyNoWithTax;
                WinMoneyList[i * 2 + 1] = DefaultMoneyNoWithTax == 0 ? 1 : DefaultMoneyNoWithTax;
            }

            DataTable dtSchemesWithTaskDetails = new DAL.Views.V_Schemes().Open("LotteryNumber, PlayTypeID, SiteID, ID, Multiple", " IsuseID = " + IsuseID + " and WinMoney = 0  and Buyed = 0", "");

            string LotteryNumber       = "";
            SLS.Lottery.LotteryBase lb = new SLS.Lottery()[LotteryID];

            string Description       = "";
            double WinMoneyNoWithTax = 0;

            for (int i = 0; i < dtSchemesWithTaskDetails.Rows.Count; i++)
            {
                LotteryNumber     = dtSchemesWithTaskDetails.Rows[i]["LotteryNumber"].ToString();
                Description       = "";
                WinMoneyNoWithTax = 0;

                double WinMoney = lb.ComputeWin(LotteryNumber, WinNumber.Trim(), ref Description, ref WinMoneyNoWithTax, int.Parse(dtSchemesWithTaskDetails.Rows[i]["PlayTypeID"].ToString()), WinMoneyList);

                if (WinMoney > 0)
                {
                    if (DAL.Procedures.P_ChaseTaskStopWhenWin(Shove._Convert.StrToLong(dtSchemesWithTaskDetails.Rows[i]["SiteID"].ToString(), 0), Shove._Convert.StrToLong(dtSchemesWithTaskDetails.Rows[i]["ID"].ToString(), 0), WinMoney, ref ReturnValue, ref ReturnDescription) < 0)
                    {
                        new Log("ElectronTicket\\HPSD").Write("执行电子票--判断是否停止追号的时候出现错误");
                    }

                    continue;
                }
            }
        }

        PF.SendWinNotification(ds);

        MessageID = nodes[0].Attributes["id"].Value;
        ReNotice(MessageID, "508");
    }
Пример #45
0
    public string GenerateLuckLotteryNumber(int LotteryID, string Type, string Name)
    {
        string Key = "Home_Room_Buy_GenerateLuckLotteryNumber" + LotteryID.ToString();

        Type = Shove._Web.Utility.FilteSqlInfusion(Type);
        Name = Shove._Web.Utility.FilteSqlInfusion(Name);

        if (Type == "3")
        {
            try
            {
                DateTime time = Convert.ToDateTime(Name);
                Name = time.ToString("yyyy-MM-dd");

                if (time > DateTime.Now)
                {
                    return("出生日期不能超过当前日期!");
                }
            }
            catch
            {
                return("日期格式不正确!");
            }
        }

        DataTable dt = Shove._Web.Cache.GetCacheAsDataTable(Key);

        if (dt == null || dt.Rows.Count == 0)
        {
            dt = new DAL.Tables.T_LuckNumber().Open("", "datediff(d,getdate(),DateTime)=0 and LotteryID=" + LotteryID.ToString() + "", "");

            Shove._Web.Cache.SetCache(Key, dt, 3600);
        }

        string LotteryNumber = "";

        DataRow[] dr = dt.Select("Type=" + Type + " and Name='" + Name + "'");

        if (dr != null && dr.Length > 0)
        {
            LotteryNumber = dr[0]["LotteryNumber"].ToString();
        }
        else
        {
            LotteryNumber = new SLS.Lottery()[LotteryID].BuildNumber(1);

            DAL.Tables.T_LuckNumber ln = new DAL.Tables.T_LuckNumber();

            ln.LotteryID.Value     = LotteryID;
            ln.LotteryNumber.Value = LotteryNumber;
            ln.Name.Value          = Name;
            ln.Type.Value          = Type;

            ln.Insert();
            ln.Delete("datediff(d,DateTime,getdate())>0");

            Shove._Web.Cache.ClearCache(Key);
        }

        return(LotteryNumber + "|" + FormatLuckLotteryNumber(LotteryNumber));
    }
Пример #46
0
    //对返回的开奖号码,进行程序自动派奖
    private void BonusQuery(string TransMessage)
    {
        System.Xml.XmlDocument XmlDoc = new XmlDocument();
        XmlDoc.Load(new StringReader(TransMessage));

        System.Xml.XmlNodeList nodes = XmlDoc.GetElementsByTagName("*");

        string WinNumber   = "";
        string Issue       = "";
        string LotteryName = "";

        if (nodes == null)
        {
            return;
        }

        for (int i = 0; i < nodes.Count; i++)
        {
            if (nodes[i].Name.ToUpper() == "BONUSQUERYRESULT")
            {
                WinNumber = nodes[i].Attributes["bonusNumber"].Value.Replace(",", "");
            }

            if (nodes[i].Name.ToUpper() == "ISSUE")
            {
                Issue       = nodes[i].Attributes["number"].Value;
                LotteryName = nodes[i].Attributes["gameName"].Value;
            }
        }

        int LotteryID = GetLotteryID(LotteryName);

        if (LotteryID < 0)
        {
            return;
        }

        DataTable dtIssue = new DAL.Tables.T_Isuses().Open("top 1 *", "LotteryID = " + LotteryID.ToString() + " and [Name] = '" + Shove._Web.Utility.FilteSqlInfusion(Issue) + "' and isOpened = 0 and EndTime < GetDate()", "");

        if (dtIssue == null)
        {
            new Log("ElectronTicket\\HPCQ").Write("恒朋-重庆电子票网关自动开奖错误,彩种:" + LotteryName + ",期号:" + Issue);

            return;
        }

        if (dtIssue.Rows.Count < 1)
        {
            return;
        }

        // 准备开奖,开奖之前,对出票不完整的方案进行处理(按系统的设定:当作已出票,或者撤单处理)
        //int ReturnValue = 0;
        //string ReturnDescription = "";

        //DAL.Procedures.P_PrintOutNotFullHandle(LotteryID, "请电询", ref ReturnValue, ref ReturnDescription);


        DataTable dtWinMoneyList = new DAL.Tables.T_WinTypes().Open("DefaultMoney, DefaultMoneyNoWithTax", "LotteryID = " + LotteryID.ToString(), "[Order]");

        if (dtWinMoneyList == null)
        {
            new Log("ElectronTicket\\HPCQ").Write("恒朋-重庆电子票网关自动开奖错误,彩种:" + LotteryName + ",期号:" + Issue);

            return;
        }

        double[] WinMoneyList = new double[dtWinMoneyList.Rows.Count * 2];

        for (int i = 0; i < dtWinMoneyList.Rows.Count; i++)
        {
            WinMoneyList[i * 2]     = Shove._Convert.StrToDouble(dtWinMoneyList.Rows[i][0].ToString(), 0);
            WinMoneyList[i * 2 + 1] = Shove._Convert.StrToDouble(dtWinMoneyList.Rows[i][1].ToString(), 0);
        }

        DataTable dtScheme = new DAL.Tables.T_Schemes().Open("", "IsuseID = " + dtIssue.Rows[0]["ID"].ToString() + " and isOpened = 0", "");

        if (dtScheme == null)
        {
            new Log("ElectronTicket\\HPCQ").Write("恒朋-重庆电子票网关自动开奖错误,彩种:" + LotteryName + ",期号:" + Issue);

            return;
        }

        if (dtScheme.Rows.Count > 0)
        {
            for (int i = 0; i < dtScheme.Rows.Count; i++)
            {
                string LotteryNumber     = dtScheme.Rows[i]["LotteryNumber"].ToString();
                string Description       = "";
                double WinMoneyNoWithTax = 0;

                double WinMoney = new SLS.Lottery()[LotteryID].ComputeWin(LotteryNumber, WinNumber, ref Description, ref WinMoneyNoWithTax, int.Parse(dtScheme.Rows[i]["PlayTypeID"].ToString()), WinMoneyList);

                Shove.Database.MSSQL.ExecuteNonQuery("update T_Schemes set PreWinMoney = @p1, PreWinMoneyNoWithTax = @p2, EditWinMoney = @p3, EditWinMoneyNoWithTax = @p4, WinDescription = @p5 where [ID] = " + dtScheme.Rows[i]["ID"].ToString(),
                                                     new Shove.Database.MSSQL.Parameter("p1", SqlDbType.Money, 0, ParameterDirection.Input, WinMoney * Shove._Convert.StrToInt(dtScheme.Rows[i]["Multiple"].ToString(), 1)),
                                                     new Shove.Database.MSSQL.Parameter("p2", SqlDbType.Money, 0, ParameterDirection.Input, WinMoneyNoWithTax * Shove._Convert.StrToInt(dtScheme.Rows[i]["Multiple"].ToString(), 1)),
                                                     new Shove.Database.MSSQL.Parameter("p3", SqlDbType.Money, 0, ParameterDirection.Input, WinMoney * Shove._Convert.StrToInt(dtScheme.Rows[i]["Multiple"].ToString(), 1)),
                                                     new Shove.Database.MSSQL.Parameter("p4", SqlDbType.Money, 0, ParameterDirection.Input, WinMoneyNoWithTax * Shove._Convert.StrToInt(dtScheme.Rows[i]["Multiple"].ToString(), 1)),
                                                     new Shove.Database.MSSQL.Parameter("p5", SqlDbType.VarChar, 0, ParameterDirection.Input, Description));
            }
        }

        //int SchemeCount = 0, QuashCount = 0, WinCount = 0, WinNoBuyCount = 0;
        //  总方案数,处理时撤单数,中奖数,中奖但未成功数

        //ReturnValue = 0;
        //ReturnDescription = "";

        DataSet ds = null;

        //DAL.Procedures.P_Win(ref ds,
        //     long.Parse(dtIssue.Rows[0]["ID"].ToString()),
        //     WinNumber,
        //     "暂无",
        //     1,
        //     true,
        //     ref SchemeCount, ref QuashCount, ref WinCount, ref WinNoBuyCount,
        //     ref ReturnValue, ref ReturnDescription);

        //if ((ds == null) || (ReturnDescription != ""))
        //{
        //    PF.GoError(ErrorNumber.DataReadWrite, ReturnDescription, this.GetType().BaseType.FullName);

        //    return;
        //}

        PF.SendWinNotification(ds);
    }
Пример #47
0
    /// <summary>
    /// 充值成功后,绑定数据
    /// </summary>
    /// <param name="BuyID"></param>
    private void BindDataForAliBuy(long BuyID)
    {
        DataTable dt = new DAL.Tables.T_AlipayBuyTemp().Open("", "ID=" + BuyID.ToString(), "");

        if (dt == null || dt.Rows.Count == 0)
        {
            return;
        }

        DataRow dr = dt.Rows[0];

        string HidIsuseID           = dr["IsuseID"].ToString();
        string playType             = dr["PlayTypeID"].ToString();
        bool   IsChase              = Shove._Convert.StrToBool(dr["IsChase"].ToString(), false);
        bool   IsCoBuy              = Shove._Convert.StrToBool(dr["IsCoBuy"].ToString(), false);
        string tb_Share             = dr["Share"].ToString();
        string tb_BuyShare          = dr["BuyShare"].ToString();
        string tb_AssureShare       = dr["AssureShare"].ToString();
        string tb_OpenUserList      = dr["OpenUsers"].ToString();
        string tb_Title             = dr["Title"].ToString();
        string tb_Description       = dr["Description"].ToString();
        string tbAutoStopAtWinMoney = dr["StopwhenwinMoney"].ToString();
        string tbSecrecyLevel       = dr["SecrecyLevel"].ToString();
        string tb_LotteryNumber     = dr["LotteryNumber"].ToString();
        string tb_hide_SumMoney     = dr["SumMoney"].ToString();
        string tb_hide_AssureMoney  = dr["AssureMoney"].ToString();
        string HidLotteryID         = dr["LotteryID"].ToString();
        string tb_Multiple          = dr["Multiple"].ToString();
        string AdditionasXml        = dr["AdditionasXml"].ToString();

        if (tb_Multiple == "")
        {
            tb_Multiple = "1";
        }

        double SumMoney           = 0;
        int    Share              = 0;
        int    BuyShare           = 0;
        double AssureMoney        = 0;
        int    Multiple           = 0;
        short  SecrecyLevel       = 0;
        int    PlayTypeID         = 0;
        int    LotteryID          = 0;
        long   IsuseID            = 0;
        double AutoStopAtWinMoney = 0;

        try
        {
            SumMoney           = double.Parse(tb_hide_SumMoney);
            Share              = int.Parse(tb_Share);
            BuyShare           = int.Parse(tb_BuyShare);
            AssureMoney        = double.Parse(tb_hide_AssureMoney);
            Multiple           = int.Parse(tb_Multiple);
            SecrecyLevel       = short.Parse(tbSecrecyLevel);
            PlayTypeID         = int.Parse(playType);
            LotteryID          = int.Parse(HidLotteryID);
            IsuseID            = long.Parse(HidIsuseID);
            AutoStopAtWinMoney = double.Parse(tbAutoStopAtWinMoney);
        }
        catch { }

        if ((BuyShare == Share) && (AssureMoney == 0))
        {
            Share    = 1;
            BuyShare = 1;
        }

        double BuyMoney = BuyShare * (SumMoney / Share) + AssureMoney;

        if (IsChase)
        {
            BuyMoney = double.Parse(tb_hide_SumMoney);
        }

        string LotteryNumber = tb_LotteryNumber;

        if (LotteryNumber[LotteryNumber.Length - 1] == '\n')
        {
            LotteryNumber = LotteryNumber.Substring(0, LotteryNumber.Length - 1);
        }

        StringBuilder sb = new StringBuilder();

        sb.AppendLine("<script type='text/javascript' defer='defer'>");

        sb.Append("$Id('playType").Append(PlayTypeID.ToString()).AppendLine("').checked = true;");
        sb.AppendLine("clickPlayType('" + PlayTypeID.ToString() + "');");
        sb.AppendLine("function BindDataForFromAli(){");

        //追号
        if (IsChase)
        {
            XmlDocument xml = new XmlDocument();
            xml.LoadXml(AdditionasXml);
            XmlNodeList xnl = xml.ChildNodes[0].ChildNodes;

            foreach (XmlNode xn in xnl)
            {
                sb.Append("$Id('times").Append(xn.Attributes["IsuseID"].Value).Append("').value = '").Append(xn.Attributes["Multiple"].Value).AppendLine("';");
                sb.Append("$Id('money").Append(xn.Attributes["IsuseID"].Value).Append("').value = '").Append(xn.Attributes["Money"].Value).AppendLine("';");
                sb.Append("$Id('check").Append(xn.Attributes["IsuseID"].Value).AppendLine("').checked = true;");
                sb.Append("$Id('times").Append(xn.Attributes["IsuseID"].Value).AppendLine("').disabled = '';");
            }
        }

        LotteryNumber = LotteryNumber.Replace("\r", "");
        int    LotteryNum = 0;
        string Number     = "";

        foreach (string lotteryNumber in LotteryNumber.Split('\n'))
        {
            LotteryNum += new SLS.Lottery()[LotteryID].ToSingle(lotteryNumber, ref Number, PlayTypeID).Length;
            sb.AppendLine("var option = document.createElement('option');");
            sb.AppendLine("$Id('list_LotteryNumber').options.add(option);");
            sb.Append("option.innerText = '").Append(lotteryNumber).AppendLine("';");
            sb.Append("option.value = '").Append(lotteryNumber).AppendLine("';");
        }

        if (IsChase)
        {
            sb.AppendLine("$Id('Chase').checked = true;");
            sb.AppendLine("oncbInitiateTypeClick($Id('Chase'));");
        }

        if (IsCoBuy)
        {
            sb.AppendLine("$Id('CoBuy').checked = true;");
            sb.AppendLine("oncbInitiateTypeClick($Id('CoBuy'));");
        }

        sb.Append("$Id('tb_LotteryNumber').value = '").Append(tb_LotteryNumber.Replace("\r", "\\r").Replace("\n", "\\n")).AppendLine("';");
        sb.Append("$Id('tb_Share').value = '").Append(tb_Share).AppendLine("';");
        sb.Append("$Id('tb_BuyShare').value = '").Append(tb_BuyShare).AppendLine("';");
        sb.Append("$Id('tb_AssureShare').value = '").Append(tb_AssureShare).AppendLine("';");
        sb.Append("$Id('tb_OpenUserList').value = '").Append(tb_OpenUserList).AppendLine("';");
        sb.Append("$Id('tb_Title').value = '").Append(tb_Title).AppendLine("';");
        sb.Append("$Id('tb_Description').value = '").Append(tb_Description.Replace("\r", "\\r").Replace("\n", "\\n")).AppendLine("';");
        sb.Append("$Id('tbAutoStopAtWinMoney').value = '").Append(tbAutoStopAtWinMoney).AppendLine("';");
        sb.Append("$Id('SecrecyLevel").Append(SecrecyLevel.ToString()).AppendLine("').checked = true;");
        sb.Append("$Id('tb_hide_SumMoney').value = '").Append(tb_hide_SumMoney).AppendLine("';");
        sb.Append("$Id('tb_hide_AssureMoney').value = '").Append(AssureMoney.ToString("N0")).AppendLine("';");
        sb.Append("$Id('tb_Multiple').value = '").Append(Multiple.ToString()).AppendLine("';");
        sb.Append("$Id('lab_AssureMoney').innerText = '").Append(AssureMoney.ToString("N0")).AppendLine("';");
        sb.Append("$Id('lab_SumMoney').innerText = '").Append(SumMoney.ToString("N0")).AppendLine("';");
        sb.Append("$Id('LbSumMoney').innerText = '").Append(SumMoney.ToString("N0")).AppendLine("';");
        sb.Append("$Id('lab_Num').innerText = '").Append(LotteryNum.ToString()).AppendLine("';");
        sb.AppendLine("CalcResult();");
        sb.AppendLine("}");
        sb.AppendLine("</script>");

        script = sb.ToString();
    }
Пример #48
0
    protected void btnOK_Click(object sender, EventArgs e)
    {
        if (_User == null)
        {
            Shove._Web.JavaScript.Alert(this.Page, "您还没有登录,请登录后再进行操作!");

            return;
        }

        double SumMoney = 0;
        int Multiple = 0;
        short SecrecyLevel = 0;
        int PlayTypeID = 0;
        int LotteryID = 0;
        long IsuseID = 0;
        int SumNum = 0;

        try
        {
            SumMoney = double.Parse(hidSchemeMoney.Value);
            Multiple = int.Parse(hidMultiple.Value);
            PlayTypeID = int.Parse(hidplayid.Value);
            LotteryID = int.Parse(hidlotid.Value);
            PlayTypeID = int.Parse(hidplayid.Value);
            IsuseID = long.Parse(hidisuseid.Value);
            SumNum = int.Parse(hidSumNum.Value);
        }
        catch
        {
            Shove._Web.JavaScript.Alert(this.Page, "输入有错误,请仔细检查。");

            return;
        }

        if (SumMoney <= 0)
        {
            Shove._Web.JavaScript.Alert(this.Page, "输入有错误,请仔细检查。");

            return;
        }

        if (SumMoney > _User.Balance)
        {
            Shove._Web.JavaScript.Alert(this.Page, "您的余额不足,请充值。");

            return;
        }

        if (SumMoney > PF.SchemeMaxBettingMoney)
        {
            Shove._Web.JavaScript.Alert(this.Page, "投注金额不能大于" + PF.SchemeMaxBettingMoney.ToString() + ",谢谢。");

            return;
        }

        if (Multiple > 999)
        {
            Shove._Web.JavaScript.Alert(this.Page, "投注倍数不能大于 999 倍,谢谢。");

            return;
        }

        string LotteryNumber = hidcodes.Value.Replace("&nbsp;", " ");

        #region 对彩票号码进行分析,判断注数

        SLS.Lottery slsLottery = new SLS.Lottery();
        string[] t_lotterys = SplitLotteryNumber(LotteryNumber);

        if ((t_lotterys == null) || (t_lotterys.Length < 1))
        {
            Shove._Web.JavaScript.Alert(this.Page, "选号发生异常,请重新选择号码投注,谢谢。(-694)");

            return;
        }

        int ValidNum = 0;

        foreach (string str in t_lotterys)
        {
            string Number = slsLottery[LotteryID].AnalyseScheme(str, PlayTypeID);

            if (string.IsNullOrEmpty(Number))
            {
                continue;
            }

            string[] str_s = Number.Split('|');

            if (str_s == null || str_s.Length < 1)
            {
                continue;
            }

            ValidNum += Shove._Convert.StrToInt(str_s[str_s.Length - 1], 0);
        }

        if (ValidNum != SumNum)
        {
            Shove._Web.JavaScript.Alert(this.Page, "选号发生异常,请重新选择号码投注,谢谢。");

            return;
        }

        #endregion

        if (DateTime.Now >= Shove._Convert.StrToDateTime(HidIsuseEndTime.Value.Replace("/", "-"), DateTime.Now.AddDays(-1).ToString()))
        {
            Shove._Web.JavaScript.Alert(this.Page, "本期投注已截止,谢谢。");

            return;
        }

        double Price = 2.0;

        if (PlayTypeID == 3903 || PlayTypeID == 3904)
        {
            Price = 3.0;
        }

        if (Price * SumNum * Multiple != SumMoney)
        {
            Shove._Web.JavaScript.Alert(this.Page, "输入有错误,请仔细检查。");

            return;
        }

        string ReturnDescription = "";

        long SchemeID = _User.InitiateScheme(IsuseID, PlayTypeID, "(无标题)", "", LotteryNumber, "", Multiple, SumMoney, 0, 1, 1, "", SecrecyLevel, 0.04, ref ReturnDescription);

        if (SchemeID < 0)
        {
            PF.GoError(ErrorNumber.Unknow, ReturnDescription, this.GetType().FullName + "(-347)");

            return;
        }

        Response.Redirect("Home/Room/UserBuySuccess.aspx?LotteryID=" + LotteryID.ToString() + "&&Money=" + SumMoney.ToString() + "&SchemeID=" + SchemeID.ToString() + "");

        return;
    }
Пример #49
0
    /// <summary>
    /// 购买彩票
    /// </summary>
    /// <param name="_User"></param>
    private void Buy(Users _User)
    {
        string HidIsuseID = Shove._Web.Utility.GetRequest("HidIsuseID");
        string HidIsuseEndTime = Shove._Web.Utility.GetRequest("HidIsuseEndTime");
        string playType = Shove._Web.Utility.GetRequest("playType");
        string CoBuy = Shove._Web.Utility.GetRequest("CoBuy");
        string tb_Share = Shove._Web.Utility.GetRequest("tb_Share");
        string tb_BuyShare = Shove._Web.Utility.GetRequest("tb_BuyShare");
        string tb_AssureShare = Shove._Web.Utility.GetRequest("tb_AssureShare");
        string tb_OpenUserList = "";
        string tb_Title = Shove._Web.Utility.GetRequest("tb_Title");
        string tb_Description = Shove._Web.Utility.GetRequest("tb_Description");
        string tbSecrecyLevel = Shove._Web.Utility.GetRequest("SecrecyLevel");
        string tb_LotteryNumber = Shove._Web.Utility.FilteSqlInfusion(Request["tb_LotteryNumber"]);
        string tb_hide_SumMoney = Shove._Web.Utility.GetRequest("tb_hide_SumMoney");
        string tb_hide_AssureMoney = Shove._Web.Utility.GetRequest("tb_hide_AssureMoney");
        string tb_hide_SumNum = Shove._Web.Utility.GetRequest("tb_hide_SumNum");
        string HidLotteryID = Shove._Web.Utility.GetRequest("HidLotteryID");
        string tb_Multiple = Shove._Web.Utility.GetRequest("tb_Multiple");
        string tb_SchemeBonusScale = Shove._Web.Utility.GetRequest("tb_SchemeBonusScale");
        string playTypeID = Shove._Web.Utility.GetRequest("tbPlayTypeID");
        string tb_SumMoney = Shove._Web.Utility.GetRequest("tb_SchemeMoney");
        string bet = Shove._Web.Utility.GetRequest("bet");

        int Price = 2;

        if (tb_Multiple == "")
        {
            tb_Multiple = "1";
        }

        double SumMoney = 0;
        int Share = 0;
        int BuyShare = 0;
        double AssureMoney = 0;
        int Multiple = 0;
        int SumNum = 0;
        short SecrecyLevel = 0;
        int PlayTypeID = 0;
        int LotteryID = 0;
        long IsuseID = 0;
        double SchemeBonusScale = 0;

        if (string.IsNullOrEmpty(tb_Share))
        {
            tb_Share = Shove._Web.Utility.GetRequest("tb_MinSchemeMoney");
        }

        try
        {
            SumMoney = double.Parse(tb_hide_SumMoney);
            Share = int.Parse(tb_Share);
            BuyShare = int.Parse(tb_BuyShare);
            AssureMoney = double.Parse(tb_hide_AssureMoney);
            Multiple = int.Parse(tb_Multiple);
            SumNum = int.Parse(tb_hide_SumNum);
            SecrecyLevel = short.Parse(tbSecrecyLevel);
            PlayTypeID = int.Parse(playTypeID);
            LotteryID = int.Parse(HidLotteryID);
            IsuseID = long.Parse(HidIsuseID);
            SchemeBonusScale = double.Parse(tb_SchemeBonusScale);
        }
        catch
        {
            Shove._Web.JavaScript.Alert(this.Page, "输入有错误,请仔细检查。");

            return;
        }

        if (playTypeID != playType)
        {
            if (bet != "Bet01")
            {
                SumMoney = Shove._Convert.StrToDouble(Shove._Web.Utility.GetRequest("tb_MinSchemeMoney"), 0);
            }
            else
            {
                SumMoney = double.Parse(tb_SumMoney);
            }
        }

        if ((SumMoney <= 0) || (SumNum < 1 && playTypeID == playType))
        {
            Shove._Web.JavaScript.Alert(this.Page, "输入有错误,请仔细检查。");

            return;
        }

        if (AssureMoney < 0)
        {
            Shove._Web.JavaScript.Alert(this.Page, "输入有错误,请仔细检查。");

            return;
        }

        if (Share < 1)
        {
            Shove._Web.JavaScript.Alert(this.Page, "输入有错误,请仔细检查。");

            return;
        }

        if ((BuyShare == Share) && (AssureMoney == 0))
        {
            Share = 1;
            BuyShare = 1;
        }

        if ((SumMoney / Share) < 1)
        {
            Shove._Web.JavaScript.Alert(this.Page, "每份金额最低不能少于 1 元。");

            return;
        }

        double BuyMoney = BuyShare * (SumMoney / Share) + AssureMoney;

        if (BuyMoney > _User.Balance)
        {
            SaveDataForAliBuy();

            return;
        }

        if (BuyMoney > PF.SchemeMaxBettingMoney)
        {
            Shove._Web.JavaScript.Alert(this.Page, "投注金额不能大于" + PF.SchemeMaxBettingMoney.ToString() + ",谢谢。");

            return;
        }

        if (Multiple > 999)
        {
            Shove._Web.JavaScript.Alert(this.Page, "投注倍数不能大于 999 倍,谢谢。");

            return;
        }
        //佣金比例的计算

        if (!(SchemeBonusScale >= 0 || SchemeBonusScale <= 10))
        {
            Shove._Web.JavaScript.Alert(this.Page, "佣金比例只能在0~10之间");

            return;
        }

        if (SchemeBonusScale.ToString().IndexOf("-") > -1 || SchemeBonusScale.ToString().IndexOf(".") > -1)
        {
            Shove._Web.JavaScript.Alert(this.Page, "佣金比例输入有误");

            return;
        }

        SchemeBonusScale = SchemeBonusScale / 100;

        string LotteryNumber = tb_LotteryNumber;

        if (playTypeID == playType)
        {
            if (LotteryNumber[LotteryNumber.Length - 1] == '\n')
            {
                LotteryNumber = LotteryNumber.Substring(0, LotteryNumber.Length - 1);
            }

            #region 对彩票号码进行分析,判断注数

            SLS.Lottery slsLottery = new SLS.Lottery();
            string[] t_lotterys = SplitLotteryNumber(LotteryNumber);

            if ((t_lotterys == null) || (t_lotterys.Length < 1))
            {
                Shove._Web.JavaScript.Alert(this.Page, "选号发生异常,请重新选择号码投注,谢谢。(-694)");

                return;
            }

            int ValidNum = 0;

            foreach (string str in t_lotterys)
            {
                string Number = slsLottery[LotteryID].AnalyseScheme(str, PlayTypeID);

                if (string.IsNullOrEmpty(Number))
                {
                    continue;
                }

                string[] str_s = Number.Split('|');

                if (str_s == null || str_s.Length < 1)
                {
                    continue;
                }

                ValidNum += Shove._Convert.StrToInt(str_s[str_s.Length - 1], 0);
            }

            if (ValidNum != SumNum)
            {
                Shove._Web.JavaScript.Alert(this.Page, "选号发生异常,请重新选择号码投注,谢谢。");

                return;
            }

            #endregion
        }
                else
        {
            LotteryNumber = "";
        }

        string ReturnDescription = "";

        if (DateTime.Now >= Shove._Convert.StrToDateTime(HidIsuseEndTime.Replace("/", "-"), DateTime.Now.AddDays(-1).ToString()))
        {
            Shove._Web.JavaScript.Alert(this.Page, "本期投注已截止,谢谢。");

            return;
        }

        if (playType == playTypeID && Price * SumNum * Multiple != SumMoney)
        {
            Shove._Web.JavaScript.Alert(this.Page, "输入有错误,请仔细检查。");

            return;
        }

        long SchemeID = _User.InitiateScheme(IsuseID, PlayTypeID, tb_Title.Trim() == "" ? "(无标题)" : tb_Title.Trim(), tb_Description.Trim(), LotteryNumber, "", Multiple, SumMoney, AssureMoney, Share, BuyShare, tb_OpenUserList.Trim(), short.Parse(SecrecyLevel.ToString()), SchemeBonusScale, ref ReturnDescription);
        if (SchemeID < 0)
        {
            PF.GoError(ErrorNumber.Unknow, ReturnDescription, this.GetType().FullName + "(-755)");

            return;
        }

        if (playType != playTypeID)
        {
            double MinMoney = 0;
            double MaxMoney = 0;

            if (bet == "Bet01")
            {
                MinMoney = SumMoney;
                MaxMoney = SumMoney;
            }
            else
            {
                MinMoney = Shove._Convert.StrToDouble(Shove._Web.Utility.GetRequest("tb_MinSchemeMoney"), 0);
                MaxMoney = Shove._Convert.StrToDouble(Shove._Web.Utility.GetRequest("tb_MaxSchemeMoney"), 0);
            }

            if (MaxMoney < MinMoney)
            {
                Shove._Web.JavaScript.Alert(this.Page, "您输入的最大方案金额不能小于最小方案金额!");

                return;
            }

            if (MaxMoney > MinMoney * 1.4)
            {
                Shove._Web.JavaScript.Alert(this.Page, "您输入的最大方案金额大于最小方案金额的 1.4 倍!");

                return;
            }

            DAL.Tables.T_PrepareBet t_PrepareBet = new DAL.Tables.T_PrepareBet();

            t_PrepareBet.SchemeID.Value = SchemeID;
            t_PrepareBet.MinMoney.Value = MinMoney;
            t_PrepareBet.MaxMoney.Value = MaxMoney;
            t_PrepareBet.Insert();
        }

        Shove._Web.Cache.ClearCache("Home_Room_CoBuy_BindDataForType" + IsuseID.ToString());
        Shove._Web.Cache.ClearCache("Home_Room_SchemeAll_BindData" + IsuseID.ToString());

        if (SumMoney > 50 && Share > 1)
        {
            Shove._Web.Cache.ClearCache("Home_Room_JoinAllBuy_BindData");
        }

        Response.Redirect("../Home/Room/UserBuySuccess.aspx?LotteryID=" + LotteryID.ToString() + "&&Money=" + BuyMoney.ToString() + "&SchemeID=" + SchemeID.ToString() + "");

        return;
    }
Пример #50
0
    public string SplitScheme(string LotteryNumber, int PlayTypeID)
    {
        SLS.Lottery slsLottery = new SLS.Lottery();
        string Number = "";
        string[] t_lotterys = slsLottery[62].ToSingle(LotteryNumber, ref Number, PlayTypeID);

        if ((t_lotterys == null) || (t_lotterys.Length < 1))
        {
            return "";
        }

        LotteryNumber = "";
        foreach (string s in t_lotterys)
        {
            LotteryNumber += s.Replace(" ", "|") + ",";
        }

        return LotteryNumber + t_lotterys.Length.ToString();
    }
Пример #51
0
    protected void btnGO_Step2_Click(object sender, EventArgs e)
    {
        btnGO_Step1.AlertText = "";

        if (ddlLottery.SelectedValue == SLS.Lottery.ZCDC.sID)
        {
            Shove._Web.JavaScript.Alert(this.Page, "足彩单场不支持分步开奖。");

            return;
        }

        tbWinNumber.Text = Shove._Convert.ToDBC(tbWinNumber.Text.Trim().Replace(" ", " ")).Trim();

        if (!new SLS.Lottery()[int.Parse(ddlLottery.SelectedValue)].AnalyseWinNumber(tbWinNumber.Text))
        {
            Shove._Web.JavaScript.Alert(this.Page, "开奖号码不正确!");

            return;
        }

        SystemOptions so = new SystemOptions();
        bool          isCompareWinMoneyNoWithFax = so["isCompareWinMoneyNoWithFax"].ToBoolean(true);

        double[] WinMoneyList = new double[g.Rows.Count * 2];

        for (int i = 0; i < g.Rows.Count; i++)
        {
            WinMoneyList[i * 2]     = Shove._Convert.StrToDouble(((TextBox)g.Rows[i].Cells[1].FindControl("tbMoney")).Text, 0);
            WinMoneyList[i * 2 + 1] = Shove._Convert.StrToDouble(((TextBox)g.Rows[i].Cells[2].FindControl("tbMoneyNoWithTax")).Text, 0);

            if (WinMoneyList[i * 2] < 0)
            {
                Shove._Web.JavaScript.Alert(this.Page, "第 " + (i + 1).ToString() + " 项奖金输入错误!");

                return;
            }

            if (WinMoneyList[i * 2] < WinMoneyList[i * 2 + 1])
            {
                if (isCompareWinMoneyNoWithFax)
                {
                    Shove._Web.JavaScript.Alert(this.Page, "第 " + (i + 1).ToString() + " 项税后奖金输入错误(不能大于税前奖金)!");

                    return;
                }
            }
        }

        if (Shove._Convert.ToTextCode(tbOpenAffiche.Value.Trim()) == "")
        {
            Shove._Web.JavaScript.Alert(this.Page, "请输入开奖公告!");

            return;
        }

        DataTable dt = new DAL.Tables.T_ElectronTicketAgentSchemes().Open("*", "IsuseID = " + Shove._Web.Utility.FilteSqlInfusion(ddlIsuse.SelectedValue) + " and WinMoney is null and state = 1", "[ID]");

        if (dt == null)
        {
            PF.GoError(ErrorNumber.DataReadWrite, "数据库繁忙,请重试", this.GetType().BaseType.FullName);

            return;
        }

        DAL.Tables.T_ElectronTicketAgentSchemes t_ElectronTicketAgentSchemes = new DAL.Tables.T_ElectronTicketAgentSchemes();

        for (int i = 0; i < dt.Rows.Count; i++)
        {
            string LotteryNumber     = dt.Rows[i]["LotteryNumber"].ToString();
            string Description       = "";
            double WinMoneyNoWithTax = 0;

            double WinMoney = new SLS.Lottery()[int.Parse(ddlLottery.SelectedValue)].ComputeWin(LotteryNumber, tbWinNumber.Text.Trim(), ref Description, ref WinMoneyNoWithTax, int.Parse(dt.Rows[i]["PlayTypeID"].ToString()), WinMoneyList);

            t_ElectronTicketAgentSchemes.WinMoney.Value           = WinMoney * Shove._Convert.StrToInt(dt.Rows[i]["Multiple"].ToString(), 1);
            t_ElectronTicketAgentSchemes.WinMoneyWithoutTax.Value = WinMoneyNoWithTax * Shove._Convert.StrToInt(dt.Rows[i]["Multiple"].ToString(), 1);
            t_ElectronTicketAgentSchemes.WinDescription.Value     = Description;

            t_ElectronTicketAgentSchemes.Update("[ID] =" + dt.Rows[i]["ID"].ToString());
        }

        dt = new DAL.Tables.T_ElectronTicketAgentSchemes().Open("top 1 * ", "IsuseID = " + Shove._Web.Utility.FilteSqlInfusion(ddlIsuse.SelectedValue) + " and state = 1 and WinMoney is null", "[ID]");

        if (dt == null)
        {
            PF.GoError(ErrorNumber.DataReadWrite, "数据库繁忙,请重试", this.GetType().BaseType.FullName);

            return;
        }

        Step2IsOpen = (dt.Rows.Count > 0);

        btnGO_Step2.Enabled = Step2IsOpen;
        btnGO_Step3.Enabled = (!Step2IsOpen);

        string Message = "请再次执行第二步";

        if (!Step2IsOpen)
        {
            Message = "开奖步骤二已经完成,请执行第三步.";
        }

        Shove._Web.JavaScript.Alert(this.Page, Message);
    }
Пример #52
0
    // 接收奖期通知
    private void IsuseNotice(string TransMessage)
    {
        System.Xml.XmlDocument XmlDoc = new XmlDocument();
        System.Xml.XmlNodeList nodes = null;
        System.Xml.XmlNodeList nodesIssue = null;

        try
        {
            XmlDoc.Load(new StringReader(TransMessage));

            nodes = XmlDoc.GetElementsByTagName("*");
            nodesIssue = XmlDoc.GetElementsByTagName("issue");
        }
        catch { }

        if (nodes == null)
        {
            this.Response.End();

            return;
        }

        DAL.Tables.T_Isuses t_Isuses = new DAL.Tables.T_Isuses();

        for (int i = 0; i < nodes.Count; i++)
        {
            if (!(nodes[i].Name.ToUpper() == "BODY" && nodes[i].FirstChild.Name.ToUpper() == "ISSUENOTIFY"))
            {
                continue;
            }

            for (int j = 0; j < nodesIssue.Count; j++)
            {
                string IsuseName = nodesIssue[j].Attributes["number"].Value;
                string LotteryName = nodesIssue[j].Attributes["gameName"].Value;
                string Status = nodesIssue[j].Attributes["status"].Value;
                string StartTime = nodesIssue[j].Attributes["startTime"].Value;
                string EndTime = nodesIssue[j].Attributes["stopTime"].Value;
                int LotteryID = GetLotteryID(LotteryName);
                string WinNumber = "";

                try
                {
                    WinNumber = GetWinNumber(LotteryID, nodesIssue[j].Attributes["bonusCode"].Value);
                }
                catch { }

                if ((LotteryID < 0) || (String.IsNullOrEmpty(IsuseName)))
                {
                    continue;
                }

                if (t_Isuses.GetCount("LotteryID = " + LotteryID.ToString() + " and [Name] = '" + Shove._Web.Utility.FilteSqlInfusion(IsuseName) + "'") < 1)
                {
                    DateTime _StartTime = DateTime.Now;
                    DateTime _EndTime = DateTime.Now;

                    try
                    {
                        _StartTime = DateTime.Parse(StartTime);
                        _EndTime = DateTime.Parse(EndTime);
                    }
                    catch
                    {
                        continue;
                    }

                    long IsuseID = -1;
                    string ReturnDescription = "";

                    if (DAL.Procedures.P_IsuseAdd(LotteryID, IsuseName, _StartTime, _EndTime, "", ref IsuseID, ref ReturnDescription) < 0)
                    {
                        continue;
                    }

                    if (IsuseID < 0)
                    {
                        continue;
                    }
                }

                DataTable dtIsuse = t_Isuses.Open("ID, State, WinLotteryNumber", "LotteryID = " + LotteryID.ToString() + " and [Name] = '" + Shove._Web.Utility.FilteSqlInfusion(IsuseName) + "' and LotteryID  in (select id from T_Lotteries where PrintOutType = 103)", "");

                if ((dtIsuse == null) || (dtIsuse.Rows.Count < 1))
                {
                    continue;
                }

                if (Status == "4")
                {
                    int ReturnValue = 0;
                    string ReturnDescprtion = "";

                    if (DAL.Procedures.P_ElectronTicketAgentSchemeQuash(Shove._Convert.StrToLong(dtIsuse.Rows[0]["ID"].ToString(), 0), ref ReturnValue, ref ReturnDescprtion) < 0)
                    {
                        new Log("ElectronTicket\\HPJX").Write("电子票方案撤单错误_P_ElectronTicketAgentSchemeQuash");

                        continue;
                    }
                }

                if (dtIsuse.Rows[0]["State"].ToString() != Status)
                {
                    int ReturnValue = 0;
                    string ReturnDescprtion = "";

                    if (DAL.Procedures.P_IsuseUpdate(LotteryID, IsuseName, Shove._Convert.StrToShort(Status, 0), Shove._Convert.StrToDateTime(StartTime, DateTime.Now.ToString()), Shove._Convert.StrToDateTime(EndTime, DateTime.Now.ToString()), DateTime.Now, WinNumber, ref ReturnValue, ref ReturnDescprtion) < 0)
                    {
                        new Log("ElectronTicket\\HPJX").Write("电子票期号状态更新错误_P_IsuseUpdate");

                        continue;
                    }
                }

                if (!String.IsNullOrEmpty(WinNumber) && (dtIsuse.Rows[0]["WinLotteryNumber"].ToString() != WinNumber))
                {
                    if (LotteryID == SLS.Lottery.JXSSC.ID)
                    {
                        DataTable dtWinTypes = new DAL.Tables.T_WinTypes().Open("", "LotteryID =" + LotteryID.ToString(), "");

                        double[] WinMoneyList = new double[dtWinTypes.Rows.Count * 2];

                        for (int k = 0; k < dtWinTypes.Rows.Count; k++)
                        {
                            WinMoneyList[k * 2] = Shove._Convert.StrToDouble(dtWinTypes.Rows[k]["DefaultMoney"].ToString(), 1);
                            WinMoneyList[k * 2 + 1] = Shove._Convert.StrToDouble(dtWinTypes.Rows[k]["DefaultMoneyNoWithTax"].ToString(), 1);
                        }

                        DataTable dtChaseTaskDetails = new DAL.Tables.T_ChaseTaskDetails().Open("", "IsuseID=" + dtIsuse.Rows[0]["ID"].ToString() + " and SchemeID IS NOT NULL", "");

                        for (int k = 0; k < dtChaseTaskDetails.Rows.Count; k++)
                        {
                            string LotteryNumber = dtChaseTaskDetails.Rows[k]["LotteryNumber"].ToString();

                            string Description = "";
                            double WinMoneyNoWithTax = 0;

                            double WinMoney = new SLS.Lottery()[LotteryID].ComputeWin(LotteryNumber, WinNumber, ref Description, ref WinMoneyNoWithTax, int.Parse(dtChaseTaskDetails.Rows[k]["PlayTypeID"].ToString()), WinMoneyList);

                            if (WinMoney < 1)
                            {
                                continue;
                            }

                            int ReturnValue = 0;
                            string ReturnDescprtion = "";

                            if (DAL.Procedures.P_ChaseTaskStopWhenWin(Shove._Convert.StrToLong(dtChaseTaskDetails.Rows[k]["SiteID"].ToString(), 1), Shove._Convert.StrToLong(dtChaseTaskDetails.Rows[k]["SchemeID"].ToString(), 0), WinMoney, ref ReturnValue, ref ReturnDescprtion) < 0)
                            {
                                new Log("ElectronTicket\\HPJX").Write("电子票撤销追号错误_P_ChaseTaskStopWhenWin。");
                            }
                        }
                    }
                }
            }
        }

        string MessageID = nodes[0].Attributes["id"].Value;
        ReNotice(MessageID, "501");
    }
Пример #53
0
    protected void btnfileUp_Click(object sender, System.EventArgs e)
    {
        string UploadFileName = btnfile.Value;

        if (String.IsNullOrEmpty(UploadFileName))
        {
            Shove._Web.JavaScript.Alert(this.Page, "请先选择一个文件再上传。");

            return;
        }

        if (!UploadFileName.Trim().ToLower().EndsWith(".txt"))
        {
            Shove._Web.JavaScript.Alert(this.Page, "只能上传 .txt 文本类型的文件。");

            return;
        }

        tbSchemeFileName.Value = "null";
        tbLotteryNumber.Value  = "null";
        strSchemeFileName      = "null";
        strLotteryNumber       = "null";

        strPlayTypeName = new SLS.Lottery().GetPlayTypeName(int.Parse(tbPlayType.Value));
        strLotteryName  = new SLS.Lottery()[int.Parse(tbLotteryID.Value)].name;

        string NewFileName = "";

        if (Shove._IO.File.UploadFile(this.Page, btnfile, "../../Temp/", ref NewFileName, "text") != 0)
        {
            Shove._Web.JavaScript.Alert(this.Page, "方案上传失败。");

            return;
        }

        string FileName = this.Server.MapPath("../../Temp/" + NewFileName);

        string Content = Shove._Convert.ToDBC(System.IO.File.ReadAllText(FileName, System.Text.Encoding.Default)).Trim();

        if (Content == "")
        {
            System.IO.File.Delete(FileName);
            Shove._Web.JavaScript.Alert(this.Page, "方案文件没有任何内容,请重新选择。");

            return;
        }

        tbSchemeFileName.Value = NewFileName;
        strSchemeFileName      = NewFileName;

        //分析
        int LotteryID = Shove._Convert.StrToInt(tbLotteryID.Value, -1);

        if (!new SLS.Lottery().ValidID(LotteryID))
        {
            System.IO.File.Delete(FileName);

            tbSchemeFileName.Value = "null";
            strSchemeFileName      = "null";

            Shove._Web.JavaScript.Alert(this.Page, "方案上传失败。");

            return;
        }

        int PlayType = int.Parse(tbPlayType.Value);

        if (LotteryID == 61)
        {
            Content = FmtContent(Content);
        }

        tbLotteryNumber.Value = new SLS.Lottery()[LotteryID].AnalyseScheme(Content, PlayType);

        strLotteryNumber = tbLotteryNumber.Value.Trim();

        string[] Schemes = strLotteryNumber.Split(new String[] { "\n" }, StringSplitOptions.None);
        strLotteryNumber = "";

        foreach (string s in Schemes)
        {
            if (s.Split('|').Length > 2)
            {
                strLotteryNumber += s.Substring(0, s.LastIndexOf("|")).Trim();
            }
            else
            {
                strLotteryNumber += s.Split('|')[0];
            }
        }
        if (strLotteryNumber == "")
        {
            System.IO.File.Delete(FileName);

            tbLotteryNumber.Value  = "null";
            strLotteryNumber       = "null";
            tbSchemeFileName.Value = "null";
            strSchemeFileName      = "null";

            Shove._Web.JavaScript.Alert(this.Page, "从方案文件中没有提取到符合书写规则的投注内容。");
        }
        else
        {
            System.IO.File.Delete(FileName);

            if (strLotteryNumber.Replace(" ", "").Replace("\n", "") != Content.Replace(" ", "").Replace("\n", "").Replace("\r", "").Replace("\r\n", ""))
            {
                Shove._Web.JavaScript.Alert(this.Page, "过滤掉了您上传方案中不符合格式的投注方案,请核对!");
            }

            //Shove._Web.JavaScript.Alert(this.Page, "方案上传成功。(注:系统只从方案中提取遵循书写规则的投注内容,如果系统提取的结果与您方案文件不一致,请检查方案文件是否完全遵循了书写规则)");
        }
    }
Пример #54
0
    // 接收开奖通知
    private void IsuseOpenNotice(string Transmessage)
    {
        System.Xml.XmlDocument XmlDoc = new XmlDocument();
        System.Xml.XmlNodeList nodes = null;
        System.Xml.XmlNodeList nodesBonusItem = null;
        System.Xml.XmlNodeList nodesIssue = null;

        try
        {
            XmlDoc.Load(new StringReader(Transmessage));

            nodes = XmlDoc.GetElementsByTagName("*");
            nodesBonusItem = XmlDoc.GetElementsByTagName("bonusItem");
            nodesIssue = XmlDoc.GetElementsByTagName("issue");
        }
        catch { }

        if (nodes == null)
        {
            return;
        }

        string BonusNumber = "";

        for (int j = 0; j < nodes.Count; j++)
        {
            if (!(nodes[j].Name.ToUpper() == "BODY" && nodes[j].FirstChild.Name.ToUpper() == "BONUSNOTIFY"))
            {
                continue;
            }

            BonusNumber = nodes[j].FirstChild.Attributes["bonusNumber"].InnerText;
        }

        if (nodesIssue == null)
        {
            this.Response.End();

            return;
        }

        string MessageID = nodes[0].Attributes["id"].Value;
        string number = nodesIssue[0].Attributes["number"].Value;
        string LotteryName = nodesIssue[0].Attributes["gameName"].Value;

        int LotteryID = GetLotteryID(LotteryName);

        string WinNumber = GetWinNumber(LotteryID, BonusNumber);

        DataTable dtIsuse = new DAL.Tables.T_Isuses().Open("", " [Name] = '" + Shove._Web.Utility.FilteSqlInfusion(number) + "' and LotteryID = " + LotteryID.ToString() + " and IsOpened = 0 and LotteryID  in (select id from T_Lotteries where PrintOutType = 103)", "");

        if ((dtIsuse == null) || (dtIsuse.Rows.Count < 1))
        {
            this.Response.End();

            return;
        }

        string IsuseID = dtIsuse.Rows[0]["ID"].ToString();

        DAL.Tables.T_Isuses T_Isuses = new DAL.Tables.T_Isuses();

        T_Isuses.WinLotteryNumber.Value = WinNumber;
        T_Isuses.OpenOperatorID.Value = 1;
        T_Isuses.Update(" ID = " + IsuseID);


        DataTable dtWinTypesSSL = new DAL.Tables.T_WinTypes().Open("", " LotteryID =" + LotteryID.ToString(), "");

        if ((dtWinTypesSSL != null) && dtWinTypesSSL.Rows.Count > 0)
        {
            double[] WinMoneyList = new double[dtWinTypesSSL.Rows.Count * 2];

            double DefaultMoney = 0;
            double DefaultMoneyNoWithTax = 0;

            for (int i = 0; i < dtWinTypesSSL.Rows.Count; i++)
            {
                DefaultMoney = Shove._Convert.StrToDouble(dtWinTypesSSL.Rows[i]["DefaultMoney"].ToString(), 0);
                DefaultMoneyNoWithTax = Shove._Convert.StrToDouble(dtWinTypesSSL.Rows[i]["DefaultMoneyNoWithTax"].ToString(), 0);

                WinMoneyList[i * 2] = DefaultMoney == 0 ? 1 : DefaultMoneyNoWithTax;
                WinMoneyList[i * 2 + 1] = DefaultMoneyNoWithTax == 0 ? 1 : DefaultMoneyNoWithTax;
            }

            DataTable dtSchemesWithTaskDetails = new DAL.Tables.T_Schemes().Open("", "IsuseID = " + IsuseID + " and WinMoney = 0  and Buyed = 1 and isnull(Identifiers, '') = ''", "");

            string LotteryNumber = "";
            SLS.Lottery.LotteryBase lb = new SLS.Lottery()[LotteryID];

            string Description = "";
            double WinMoneyNoWithTax = 0;

            for (int i = 0; i < dtSchemesWithTaskDetails.Rows.Count; i++)
            {
                LotteryNumber = dtSchemesWithTaskDetails.Rows[i]["LotteryNumber"].ToString();
                Description = "";
                WinMoneyNoWithTax = 0;

                double WinMoney = lb.ComputeWin(LotteryNumber, WinNumber.Trim(), ref Description, ref WinMoneyNoWithTax, int.Parse(dtSchemesWithTaskDetails.Rows[i]["PlayTypeID"].ToString()), WinMoneyList);

                if (WinMoney > 0)
                {
                    Shove.Database.MSSQL.ExecuteNonQuery("update T_Schemes set PreWinMoney = @p1, PreWinMoneyNoWithTax = @p2, WinMoney = @p3, WinMoneyNoWithTax = @p4, WinDescription = @p5 where [ID] = " + dtSchemesWithTaskDetails.Rows[i]["ID"].ToString(),
                        new Shove.Database.MSSQL.Parameter("p1", SqlDbType.Money, 0, ParameterDirection.Input, WinMoney * Shove._Convert.StrToInt(dtSchemesWithTaskDetails.Rows[i]["Multiple"].ToString(), 1)),
                        new Shove.Database.MSSQL.Parameter("p2", SqlDbType.Money, 0, ParameterDirection.Input, WinMoneyNoWithTax * Shove._Convert.StrToInt(dtSchemesWithTaskDetails.Rows[i]["Multiple"].ToString(), 1)),
                        new Shove.Database.MSSQL.Parameter("p3", SqlDbType.Money, 0, ParameterDirection.Input, WinMoney * Shove._Convert.StrToInt(dtSchemesWithTaskDetails.Rows[i]["Multiple"].ToString(), 1)),
                        new Shove.Database.MSSQL.Parameter("p4", SqlDbType.Money, 0, ParameterDirection.Input, WinMoneyNoWithTax * Shove._Convert.StrToInt(dtSchemesWithTaskDetails.Rows[i]["Multiple"].ToString(), 1)),
                        new Shove.Database.MSSQL.Parameter("p5", SqlDbType.VarChar, 0, ParameterDirection.Input, Description));

                    continue;
                }
            }
        }

        string BonusXML = "<Schemes>";
        string AgentBonusXML = "<Schemes>";

        if ((nodesBonusItem != null) && (nodesBonusItem.Count > 0))
        {
            string bonusItemXML = Transmessage.Substring(Transmessage.IndexOf("<bonusNotify"), Transmessage.LastIndexOf("</body>") - Transmessage.IndexOf("<bonusNotify"));
            DataSet dsXML = new DataSet();

            try
            {
                dsXML.ReadXml(new StringReader(bonusItemXML));
            }
            catch (Exception e)
            {
                new Log("ElectronTicket\\HPJX").Write("电子票开奖,第 " + number + " 期解析开奖数据错误:" + e.Message);

                this.Response.End();

                return;
            }

            if ((dsXML == null) || (dsXML.Tables.Count < 3))
            {
                new Log("ElectronTicket\\HPJX").Write("电子票开奖,第 " + number + " 期开奖数据格式不符合要求。");

                this.Response.End();

                return;
            }

            DataTable dtTickets = dsXML.Tables[2];
            DataTable dtSchemes = MSSQL.Select("SELECT SchemeID, 0 AS AgentID, SchemesMultiple as Multiple, Identifiers FROM V_SchemesSendToCenter WHERE (IsuseID = " + IsuseID + ")");

            if (dtSchemes == null)
            {
                new Log("ElectronTicket\\HPJX").Write("电子票开奖,第 " + number + " 期,读取本地方案错误。");

                this.Response.End();

                return;
            }

            try
            {
                var query1 = from NewDtTickets in dtTickets.AsEnumerable()
                             join NewdtScheme in dtSchemes.AsEnumerable()
                             on NewDtTickets.Field<string>("ticketID") equals NewdtScheme.Field<string>("Identifiers")
                             select new
                             {
                                 ID = NewdtScheme.Field<long>("SchemeID"),
                                 AgentID = 0,//NewdtScheme.Field<long>("AgentID"),
                                 Multiple = NewdtScheme.Field<int>("Multiple"),
                                 Bonus = Shove._Convert.StrToDouble(NewDtTickets.Field<string>("money"), 0),
                                 BonusLevel = NewDtTickets.Field<string>("bonusLevel"),
                                 Size = Shove._Convert.StrToInt(NewDtTickets.Field<string>("size"), 1)
                             };

                var query2 = from NewDt in query1.AsQueryable()
                             group NewDt by new { NewDt.ID, NewDt.BonusLevel, NewDt.AgentID, NewDt.Multiple } into gg
                             select new
                             {
                                 ID = gg.Key.ID,
                                 AgentID = gg.Key.AgentID,
                                 Multiple = gg.Key.Multiple,
                                 Bonus = gg.Sum(NewDt => NewDt.Bonus),
                                 BonusLevel = GetSchemeWinDescription(gg.Key.BonusLevel, LotteryID, (gg.Sum(NewDt => NewDt.Size) / gg.Key.Multiple))
                             };

                var query3 = from NewDt in query2.AsQueryable()
                             group NewDt by new { NewDt.ID, NewDt.Multiple, NewDt.AgentID } into t_dtSchemes
                             select new
                             {
                                 SchemeID = t_dtSchemes.Key.ID,
                                 AgentID = t_dtSchemes.Key.AgentID,
                                 Multiple = t_dtSchemes.Key.Multiple,
                                 Bonus = t_dtSchemes.Sum(NewDt => NewDt.Bonus),
                                 BonusLevel = t_dtSchemes.Merge(NewDt => NewDt.BonusLevel) + ((t_dtSchemes.Key.Multiple != 1) ? "(" + t_dtSchemes.Key.Multiple.ToString() + "倍)" : "")
                             };

                foreach (var Scheme in query3)
                {
                    if (Scheme.AgentID == 0)
                    {
                        BonusXML += "<Scheme SchemeID=\"" + Scheme.SchemeID.ToString() + "\" WinMoney=\"" + Scheme.Bonus.ToString() + "\" WinDescription=\"" + Scheme.BonusLevel + "\" />";
                    }
                    else
                    {
                        AgentBonusXML += "<Scheme SchemeID=\"" + Scheme.SchemeID.ToString() + "\" WinMoney=\"" + Scheme.Bonus.ToString() + "\" WinDescription=\"" + Scheme.BonusLevel + "\" />";
                    }
                }
            }
            catch (Exception e)
            {
                new Log("ElectronTicket\\HPJX").Write("电子票开奖,第 " + number + " 期详细中奖数据解析错误:" + e.Message);

                this.Response.End();

                return;
            }
        }

        BonusXML += "</Schemes>";
        AgentBonusXML += "</Schemes>";

        dtIsuse = new DAL.Tables.T_Isuses().Open("", "[ID] = " + IsuseID + " and IsOpened = 0", "");

        if ((dtIsuse == null) || (dtIsuse.Rows.Count < 1))
        {
            this.Response.End();

            return;
        }

        int ReturnValue = 0;
        string ReturnDescription = "";

        DataSet ds = null;
        int Times = 0;
        int Result = -1;

        while ((Result < 0) && (Times < 5))
        {
            ReturnValue = 0;
            ReturnDescription = "";

            Result = DAL.Procedures.P_ElectronTicketWin(ref ds, Shove._Convert.StrToLong(IsuseID, 0), BonusXML, AgentBonusXML, ref ReturnValue, ref ReturnDescription);

            if (Result < 0)
            {
                new Log("ElectronTicket\\HPJX").Write("电子票第 " + (Times + 1).ToString() + " 次派奖出现错误(IsuseOpenNotice) 期号为: " + number + ",彩种为: " + LotteryID.ToString());
                Times++;

                if (Times < 5)
                {
                    System.Threading.Thread.Sleep(10000);
                }

                continue;
            }
        }

        if (ReturnValue < 0)
        {
            new Log("ElectronTicket\\HPJX").Write("电子票派奖出现错误(IsuseOpenNotice) 期号为: " + number + ",彩种为: " + LotteryID.ToString() + ",错误:" + ReturnDescription);

            this.Response.End();

            return;
        }

        PF.SendWinNotification(ds);

        DataTable dtWinTypes = new DAL.Tables.T_WinTypes().Open("", " LotteryID =" + LotteryID.ToString(), "");

        if ((dtWinTypes != null) && dtWinTypes.Rows.Count > 0)
        {

            double[] WinMoneyList = new double[dtWinTypes.Rows.Count * 2];

            double DefaultMoney = 0;
            double DefaultMoneyNoWithTax = 0;

            for (int i = 0; i < dtWinTypes.Rows.Count; i++)
            {
                DefaultMoney = Shove._Convert.StrToDouble(dtWinTypes.Rows[i]["DefaultMoney"].ToString(), 0);
                DefaultMoneyNoWithTax = Shove._Convert.StrToDouble(dtWinTypes.Rows[i]["DefaultMoneyNoWithTax"].ToString(), 0);

                WinMoneyList[i * 2] = DefaultMoney == 0 ? 1 : DefaultMoneyNoWithTax;
                WinMoneyList[i * 2 + 1] = DefaultMoneyNoWithTax == 0 ? 1 : DefaultMoneyNoWithTax;
            }

            DataTable dtSchemesWithTaskDetails = new DAL.Views.V_Schemes().Open("", "IsuseID = " + IsuseID + " and IsuseName = '" + Shove._Web.Utility.FilteSqlInfusion(number) + "' and LotteryID = " + LotteryID.ToString() + " and WinMoney = 0  and Buyed = 0 and ID in ( select ID from V_ChaseTaskDetails where IsuseName = '" + Shove._Web.Utility.FilteSqlInfusion(number) + "' and LotteryID = " + LotteryID.ToString() + ")", "");

            string LotteryNumber = "";
            SLS.Lottery.LotteryBase lb = new SLS.Lottery()[LotteryID];

            string Description = "";
            double WinMoneyNoWithTax = 0;

            for (int i = 0; i < dtSchemesWithTaskDetails.Rows.Count; i++)
            {
                LotteryNumber = dtSchemesWithTaskDetails.Rows[i]["LotteryNumber"].ToString();
                Description = "";
                WinMoneyNoWithTax = 0;

                double WinMoney = lb.ComputeWin(LotteryNumber, WinNumber.Trim(), ref Description, ref WinMoneyNoWithTax, int.Parse(dtSchemesWithTaskDetails.Rows[i]["PlayTypeID"].ToString()), WinMoneyList);

                if (WinMoney > 0)
                {
                    if (DAL.Procedures.P_ChaseTaskStopWhenWin(Shove._Convert.StrToLong(dtSchemesWithTaskDetails.Rows[i]["SiteID"].ToString(), 0), Shove._Convert.StrToLong(dtSchemesWithTaskDetails.Rows[i]["ID"].ToString(), 0), WinMoney, ref ReturnValue, ref ReturnDescription) < 0)
                    {
                        new Log("ElectronTicket\\HPJX").Write("执行电子票--判断是否停止追号的时候出现错误");
                    }

                    continue;
                }
            }
        }

        MessageID = nodes[0].Attributes["id"].Value;
        ReNotice(MessageID, "508");
    }
Пример #55
0
    protected void btnGO_Step2_Click(object sender, EventArgs e)
    {
        btnGO_Step1.AlertText = "";

        if (ddlLottery.SelectedValue == SLS.Lottery.ZCDC.sID)
        {
            Shove._Web.JavaScript.Alert(this.Page, "足彩单场不支持分步开奖。");

            return;
        }

        tbWinNumber.Text = Shove._Convert.ToDBC(tbWinNumber.Text.Trim().Replace(" ", " ")).Trim();

        if (!new SLS.Lottery()[int.Parse(ddlLottery.SelectedValue)].AnalyseWinNumber(tbWinNumber.Text))
        {
            Shove._Web.JavaScript.Alert(this.Page, "开奖号码不正确!");

            return;
        }

        SystemOptions so = new SystemOptions();
        bool isCompareWinMoneyNoWithFax = so["isCompareWinMoneyNoWithFax"].ToBoolean(true);

        double[] WinMoneyList = new double[g.Rows.Count * 2];

        for (int i = 0; i < g.Rows.Count; i++)
        {
            WinMoneyList[i * 2] = Shove._Convert.StrToDouble(((TextBox)g.Rows[i].Cells[1].FindControl("tbMoney")).Text, 0);
            WinMoneyList[i * 2 + 1] = Shove._Convert.StrToDouble(((TextBox)g.Rows[i].Cells[2].FindControl("tbMoneyNoWithTax")).Text, 0);

            if (WinMoneyList[i * 2] < 0)
            {
                Shove._Web.JavaScript.Alert(this.Page, "第 " + (i + 1).ToString() + " 项奖金输入错误!");

                return;
            }

            if (WinMoneyList[i * 2] < WinMoneyList[i * 2 + 1])
            {
                if (isCompareWinMoneyNoWithFax)
                {
                    Shove._Web.JavaScript.Alert(this.Page, "第 " + (i + 1).ToString() + " 项税后奖金输入错误(不能大于税前奖金)!");

                    return;
                }
            }
        }

        if (Shove._Convert.ToTextCode(tbOpenAffiche.Value.Trim()) == "")
        {
            Shove._Web.JavaScript.Alert(this.Page, "请输入开奖公告!");

            return;
        }

        DataTable dt = new DAL.Tables.T_ElectronTicketAgentSchemes().Open("*", "IsuseID = " + Shove._Web.Utility.FilteSqlInfusion(ddlIsuse.SelectedValue) + " and WinMoney is null and state = 1", "[ID]");

        if (dt == null)
        {
            PF.GoError(ErrorNumber.DataReadWrite, "数据库繁忙,请重试", this.GetType().BaseType.FullName);

            return;
        }

        DAL.Tables.T_ElectronTicketAgentSchemes t_ElectronTicketAgentSchemes = new DAL.Tables.T_ElectronTicketAgentSchemes();

        for (int i = 0; i < dt.Rows.Count; i++)
        {
            string LotteryNumber = dt.Rows[i]["LotteryNumber"].ToString();
            string Description = "";
            double WinMoneyNoWithTax = 0;

            double WinMoney = new SLS.Lottery()[int.Parse(ddlLottery.SelectedValue)].ComputeWin(LotteryNumber, tbWinNumber.Text.Trim(), ref Description, ref WinMoneyNoWithTax, int.Parse(dt.Rows[i]["PlayTypeID"].ToString()), WinMoneyList);

            t_ElectronTicketAgentSchemes.WinMoney.Value = WinMoney * Shove._Convert.StrToInt(dt.Rows[i]["Multiple"].ToString(), 1);
            t_ElectronTicketAgentSchemes.WinMoneyWithoutTax.Value = WinMoneyNoWithTax * Shove._Convert.StrToInt(dt.Rows[i]["Multiple"].ToString(), 1);
            t_ElectronTicketAgentSchemes.WinDescription.Value = Description;

            t_ElectronTicketAgentSchemes.Update("[ID] =" + dt.Rows[i]["ID"].ToString());
        }

        dt = new DAL.Tables.T_ElectronTicketAgentSchemes().Open("top 1 * ", "IsuseID = " + Shove._Web.Utility.FilteSqlInfusion(ddlIsuse.SelectedValue) + " and state = 1 and WinMoney is null", "[ID]");

        if (dt == null)
        {
            PF.GoError(ErrorNumber.DataReadWrite, "数据库繁忙,请重试", this.GetType().BaseType.FullName);

            return;
        }

        Step2IsOpen = (dt.Rows.Count > 0);

        btnGO_Step2.Enabled = Step2IsOpen;
        btnGO_Step3.Enabled = (!Step2IsOpen);

        string Message = "请再次执行第二步";

        if (!Step2IsOpen)
        {
            Message = "开奖步骤二已经完成,请执行第三步.";
        }

        Shove._Web.JavaScript.Alert(this.Page, Message);
    }
Пример #56
0
    /// <summary>
    /// 购买彩票
    /// </summary>
    /// <param name="_User"></param>
    private void Buy(Users _User)
    {
        if (_User == null)
        {
            Shove._Web.JavaScript.Alert(this.Page, "请您先登录,然后再进行购买!");

            return;
        }

        string HidIsuseID       = Shove._Web.Utility.GetRequest("HidIsuseID");                      //期号ID
        string HidIsuseEndTime  = Shove._Web.Utility.GetRequest("HidIsuseEndTime");                 //过期时间
        string playType         = Shove._Web.Utility.GetRequest("tbPlayTypeID");                    //玩法ID
        string HidLotteryID     = Shove._Web.Utility.GetRequest("HidLotteryID");                    //彩票ID
        string tb_LotteryNumber = Shove._Web.Utility.FilteSqlInfusion(Request["tb_LotteryNumber"]); //彩票号
        string tb_hide_SumMoney = Shove._Web.Utility.GetRequest("HidPrice");                        //总金额

        string tb_Share             = "1";                                                          //份数
        string tb_BuyShare          = "1";                                                          //买多少份
        string tb_OpenUserList      = "";                                                           //招股对象
        string tb_Title             = "";                                                           //方案名
        string tb_Description       = "幸运投注";                                                       //描述
        string tbAutoStopAtWinMoney = "0";
        string tbSecrecyLevel       = "0";                                                          //保密级别
        string tb_hide_SumNum       = "1";                                                          //总份数
        string tb_Multiple          = "1";                                                          //倍数
        string tb_hide_AssureMoney  = "0";                                                          //保底金额
        string tb_SchemeBonusScale  = "4";                                                          //佣金特殊值
        string tb_SchemeBonusScalec = "4";

        int Price = 2;

        if ((playType == "3903") || (playType == "3904"))
        {
            Price = 3;
        }
        else
        {
            Price = 2;
        }
        // 结束

        if (tb_Multiple == "")
        {
            tb_Multiple = "1";
        }

        double SumMoney           = 0;
        int    Share              = 0;
        int    BuyShare           = 0;
        double AssureMoney        = 0;
        int    Multiple           = 0;
        int    SumNum             = 0;
        short  SecrecyLevel       = 0;
        int    PlayTypeID         = 0;
        int    LotteryID          = 0;
        long   IsuseID            = 0;
        double AutoStopAtWinMoney = 0;
        double SchemeBonusScale   = 0;
        double SchemeBonusScalec  = 0;

        try
        {
            SumMoney           = double.Parse(tb_hide_SumMoney);
            Share              = int.Parse(tb_Share);
            BuyShare           = int.Parse(tb_BuyShare);
            AssureMoney        = double.Parse(tb_hide_AssureMoney);
            Multiple           = int.Parse(tb_Multiple);
            SumNum             = int.Parse(tb_hide_SumNum);
            SecrecyLevel       = short.Parse(tbSecrecyLevel);
            PlayTypeID         = int.Parse(playType);
            LotteryID          = int.Parse(HidLotteryID);
            IsuseID            = long.Parse(HidIsuseID);
            AutoStopAtWinMoney = double.Parse(tbAutoStopAtWinMoney);
            SchemeBonusScale   = double.Parse(tb_SchemeBonusScale);
            SchemeBonusScalec  = double.Parse(tb_SchemeBonusScalec);
        }
        catch
        {
            Shove._Web.JavaScript.Alert(this.Page, "输入有错误,请仔细检查。");

            return;
        }

        if ((SumMoney <= 0) || (SumNum < 1))
        {
            Shove._Web.JavaScript.Alert(this.Page, "输入有错误,请仔细检查。");

            return;
        }

        if (AssureMoney < 0)
        {
            Shove._Web.JavaScript.Alert(this.Page, "输入有错误,请仔细检查。");

            return;
        }

        if (Share < 1)
        {
            Shove._Web.JavaScript.Alert(this.Page, "输入有错误,请仔细检查。");

            return;
        }

        if ((BuyShare == Share) && (AssureMoney == 0))
        {
            Share    = 1;
            BuyShare = 1;
        }

        if ((SumMoney / Share) < 1)
        {
            Shove._Web.JavaScript.Alert(this.Page, "每份金额最低不能少于 1 元。");

            return;
        }

        double BuyMoney = BuyShare * (SumMoney / Share) + AssureMoney;



        if (BuyMoney > PF.SchemeMaxBettingMoney)
        {
            Shove._Web.JavaScript.Alert(this.Page, "投注金额不能大于" + PF.SchemeMaxBettingMoney.ToString() + ",谢谢。");

            return;
        }

        if (Multiple > 999)
        {
            Shove._Web.JavaScript.Alert(this.Page, "投注倍数不能大于 999 倍,谢谢。");

            return;
        }
        //佣金比例的计算

        if (!(SchemeBonusScale >= 0 || SchemeBonusScale <= 10))
        {
            Shove._Web.JavaScript.Alert(this.Page, "佣金比例只能在0~10之间");

            return;
        }

        if (SchemeBonusScale.ToString().IndexOf("-") > -1 || SchemeBonusScale.ToString().IndexOf(".") > -1)
        {
            Shove._Web.JavaScript.Alert(this.Page, "佣金比例输入有误");

            return;
        }
        if (!(SchemeBonusScalec >= 0 || SchemeBonusScalec <= 10))
        {
            Shove._Web.JavaScript.Alert(this.Page, "佣金比例只能在0~10之间");

            return;
        }

        if (SchemeBonusScalec.ToString().IndexOf("-") > -1 || SchemeBonusScalec.ToString().IndexOf(".") > -1)
        {
            Shove._Web.JavaScript.Alert(this.Page, "佣金比例输入有误");

            return;
        }

        SchemeBonusScale  = SchemeBonusScale / 100;
        SchemeBonusScalec = SchemeBonusScalec / 100;

        string LotteryNumber = tb_LotteryNumber;

        if (LotteryNumber[LotteryNumber.Length - 1] == '\n')
        {
            LotteryNumber = LotteryNumber.Substring(0, LotteryNumber.Length - 1);
        }

        #region 对彩票号码进行分析,判断注数

        SLS.Lottery slsLottery = new SLS.Lottery();
        string[]    t_lotterys = SplitLotteryNumber(LotteryNumber);

        if ((t_lotterys == null) || (t_lotterys.Length < 1))
        {
            Shove._Web.JavaScript.Alert(this.Page, "选号发生异常,请重新选择号码投注,谢谢。(-694)");

            return;
        }

        int ValidNum = 0;

        foreach (string str in t_lotterys)
        {
            string Number = slsLottery[LotteryID].AnalyseScheme(str, PlayTypeID);

            if (string.IsNullOrEmpty(Number))
            {
                continue;
            }

            string[] str_s = Number.Split('|');

            if (str_s == null || str_s.Length < 1)
            {
                continue;
            }

            ValidNum += Shove._Convert.StrToInt(str_s[str_s.Length - 1], 0);
        }

        if (ValidNum != SumNum)
        {
            Shove._Web.JavaScript.Alert(this.Page, "选号发生异常,请重新选择号码投注,谢谢。");

            return;
        }

        #endregion


        if (DateTime.Now >= Shove._Convert.StrToDateTime(HidIsuseEndTime.Replace("/", "-"), DateTime.Now.AddDays(-1).ToString()))
        {
            Shove._Web.JavaScript.Alert(this.Page, "本期投注已截止,谢谢。");

            return;
        }

        if (Price * SumNum * Multiple != SumMoney)
        {
            Shove._Web.JavaScript.Alert(this.Page, "输入有错误,请仔细检查。");

            return;
        }

        string ReturnDescription = "";

        long SchemeID = _User.InitiateScheme(IsuseID, PlayTypeID, tb_Title.Trim() == "" ? "(无标题)" : tb_Title.Trim(), tb_Description.Trim(), LotteryNumber, "", Multiple, SumMoney, AssureMoney, Share, BuyShare, tb_OpenUserList.Trim(), short.Parse(SecrecyLevel.ToString()), SchemeBonusScale, ref ReturnDescription);

        if (SchemeID < 0)
        {
            PF.GoError(ErrorNumber.Unknow, ReturnDescription, this.GetType().FullName + "(-755)");

            return;
        }

        Shove._Web.Cache.ClearCache("Home_Room_CoBuy_BindDataForType" + IsuseID.ToString());
        Shove._Web.Cache.ClearCache("Home_Room_SchemeAll_BindData" + IsuseID.ToString());

        if (SumMoney > 50 && Share > 1)
        {
            Shove._Web.Cache.ClearCache("Home_Room_JoinAllBuy_BindData");
        }

        Response.Redirect("../Home/Room/UserBuySuccess.aspx?LotteryID=" + LotteryID.ToString() + "&&Money=" + BuyMoney.ToString() + "&SchemeID=" + SchemeID.ToString() + "");

        return;
    }
Пример #57
0
    /// <summary>
    /// 购买彩票
    /// </summary>
    /// <param name="_User"></param>
    private void Buy(Users _User)
    {
        string HidIsuseID = Shove._Web.Utility.GetRequest("HidIsuseID");
        string HidIsuseEndTime = Shove._Web.Utility.GetRequest("HidIsuseEndTime");
        string playType = Shove._Web.Utility.GetRequest("tbPlayTypeID");
        string Chase = Shove._Web.Utility.GetRequest("Chase");
        string CoBuy = Shove._Web.Utility.GetRequest("CoBuy");
        string tb_Share = Shove._Web.Utility.GetRequest("tb_Share");
        string tb_BuyShare = Shove._Web.Utility.GetRequest("tb_BuyShare");
        string tb_AssureShare = Shove._Web.Utility.GetRequest("tb_AssureShare");
        string tb_OpenUserList = "";
        string tb_Title = Shove._Web.Utility.GetRequest("tb_Title");
        string tb_Description = Shove._Web.Utility.GetRequest("tb_Description");
        string tbAutoStopAtWinMoney = Shove._Web.Utility.GetRequest("tbAutoStopAtWinMoney");
        string tbSecrecyLevel = Shove._Web.Utility.GetRequest("SecrecyLevel");
        string tb_LotteryNumber = Shove._Web.Utility.FilteSqlInfusion(Request["tb_LotteryNumber"]);
        string tb_hide_SumMoney = Shove._Web.Utility.GetRequest("tb_hide_SumMoney");
        string tb_hide_AssureMoney = Shove._Web.Utility.GetRequest("tb_hide_AssureMoney");
        string tb_hide_SumNum = Shove._Web.Utility.GetRequest("tb_hide_SumNum");
        string HidIsuseCount = Shove._Web.Utility.GetRequest("HidIsuseCount");
        string HidLotteryID = Shove._Web.Utility.GetRequest("HidLotteryID");
        string HidIsAlipay = Shove._Web.Utility.GetRequest("HidIsAlipay");
        string tb_Multiple = Shove._Web.Utility.GetRequest("tb_Multiple");
        string HidIsuseName = Shove._Web.Utility.GetRequest("HidIsuseName");
        string tbPlayTypeName = Shove._Web.Utility.GetRequest("tbPlayTypeName");
        string ChaseBuyedMoney = Shove._Web.Utility.GetRequest("tb_hide_ChaseBuyedMoney");
        string tb_SchemeBonusScale = Shove._Web.Utility.GetRequest("tb_SchemeBonusScale");
        string tb_SchemeBonusScalec = Shove._Web.Utility.GetRequest("tb_SchemeBonusScalec");

        int Price = 2;

        if ((playType == "3903") || (playType == "3904") || (playType == "3908"))
        {
            Price = 3;
        }
        else
        {
            Price = 2;
        }
        // 结束

        if (tb_Multiple == "")
        {
            tb_Multiple = "1";
        }

        double SumMoney = 0;
        int Share = 0;
        int BuyShare = 0;
        double AssureMoney = 0;
        int Multiple = 0;
        int SumNum = 0;
        short SecrecyLevel = 0;
        int PlayTypeID = 0;
        int LotteryID = 0;
        long IsuseID = 0;
        double AutoStopAtWinMoney = 0;
        double SchemeBonusScale = 0;
        double SchemeBonusScalec = 0;

        try
        {
            SumMoney = double.Parse(tb_hide_SumMoney);
            Share = int.Parse(tb_Share);
            BuyShare = int.Parse(tb_BuyShare);
            AssureMoney = double.Parse(tb_hide_AssureMoney);
            Multiple = int.Parse(tb_Multiple);
            SumNum = int.Parse(tb_hide_SumNum);
            SecrecyLevel = short.Parse(tbSecrecyLevel);
            PlayTypeID = int.Parse(playType);
            LotteryID = int.Parse(HidLotteryID);
            IsuseID = long.Parse(HidIsuseID);
            AutoStopAtWinMoney = double.Parse(tbAutoStopAtWinMoney);
            SchemeBonusScale = double.Parse(tb_SchemeBonusScale);
            SchemeBonusScalec = double.Parse(tb_SchemeBonusScalec);
        }
        catch
        {
            Shove._Web.JavaScript.Alert(this.Page, "输入有错误,请仔细检查。");

            return;
        }

        if ((SumMoney <= 0) || (SumNum < 1))
        {
            Shove._Web.JavaScript.Alert(this.Page, "输入有错误,请仔细检查。");

            return;
        }

        if (AssureMoney < 0)
        {
            Shove._Web.JavaScript.Alert(this.Page, "输入有错误,请仔细检查。");

            return;
        }

        if (Share < 1)
        {
            Shove._Web.JavaScript.Alert(this.Page, "输入有错误,请仔细检查。");

            return;
        }

        if ((BuyShare == Share) && (AssureMoney == 0))
        {
            Share = 1;
            BuyShare = 1;
        }

        if ((SumMoney / Share) < 1)
        {
            Shove._Web.JavaScript.Alert(this.Page, "每份金额最低不能少于 1 元。");

            return;
        }

        double BuyMoney = BuyShare * (SumMoney / Share) + AssureMoney;

        if (Chase != "")
        {
            BuyMoney = double.Parse(ChaseBuyedMoney);
        }
   
        if (BuyMoney > _User.Balance)
        {
            SaveDataForAliBuy();

            return;
        }

        if (BuyMoney > PF.SchemeMaxBettingMoney)
        {
            Shove._Web.JavaScript.Alert(this.Page, "投注金额不能大于" + PF.SchemeMaxBettingMoney.ToString() + ",谢谢。");

            return;
        }

        if (Multiple > 999)
        {
            Shove._Web.JavaScript.Alert(this.Page, "投注倍数不能大于 999 倍,谢谢。");

            return;
        }
        //佣金比例的计算

        if (!(SchemeBonusScale >= 0 || SchemeBonusScale <= 10))
        {
            Shove._Web.JavaScript.Alert(this.Page, "佣金比例只能在0~10之间");

            return;
        }

        if (SchemeBonusScale.ToString().IndexOf("-") > -1 || SchemeBonusScale.ToString().IndexOf(".") > -1)
        {
            Shove._Web.JavaScript.Alert(this.Page, "佣金比例输入有误");

            return;
        }
        if (!(SchemeBonusScalec >= 0 || SchemeBonusScalec <= 10))
        {
            Shove._Web.JavaScript.Alert(this.Page, "佣金比例只能在0~10之间");

            return;
        }

        if (SchemeBonusScalec.ToString().IndexOf("-") > -1 || SchemeBonusScalec.ToString().IndexOf(".") > -1)
        {
            Shove._Web.JavaScript.Alert(this.Page, "佣金比例输入有误");

            return;
        }

        SchemeBonusScale = SchemeBonusScale / 100;
        SchemeBonusScalec = SchemeBonusScalec / 100;

        string LotteryNumber = tb_LotteryNumber;

        if (LotteryNumber[LotteryNumber.Length - 1] == '\n')
        {
            LotteryNumber = LotteryNumber.Substring(0, LotteryNumber.Length - 1);
        }

        #region 对彩票号码进行分析,判断注数

        SLS.Lottery slsLottery = new SLS.Lottery();
        string[] t_lotterys = SplitLotteryNumber(LotteryNumber);

        if ((t_lotterys == null) || (t_lotterys.Length < 1))
        {
            Shove._Web.JavaScript.Alert(this.Page, "选号发生异常,请重新选择号码投注,谢谢。(-694)");

            return;
        }

        int ValidNum = 0;

        foreach (string str in t_lotterys)
        {
            string Number = slsLottery[LotteryID].AnalyseScheme(str, PlayTypeID);

            if (string.IsNullOrEmpty(Number))
            {
                continue;
            }

            string[] str_s = Number.Split('|');

            if (str_s == null || str_s.Length < 1)
            {
                continue;
            }

            ValidNum += Shove._Convert.StrToInt(str_s[str_s.Length - 1], 0);
        }

        if (ValidNum != SumNum)
        {
            Shove._Web.JavaScript.Alert(this.Page, "选号发生异常,请重新选择号码投注,谢谢。");

            return;
        }

        #endregion

        StringBuilder ChaseXML = new StringBuilder();
        int RpTodayDataCount = 0;
        string AdditionasXml = "";
        string ReturnDescription = "";

        //追号
        if (Chase == "1")
        {
            foreach (string key in Request.Form.AllKeys)
            {
                if (key.IndexOf("check") > -1)
                {
                    int row = Shove._Convert.StrToInt(key.Replace("check", ""), -1);
                    if (row > 0)
                    {
                        RpTodayDataCount++;
                        int money = Shove._Convert.StrToInt(Request.Form["tb_hide_SumNum"], -1) * Price * Shove._Convert.StrToInt(Request.Form["times" + row.ToString()], -1);
                        ChaseXML.Append(Request.Form[key]).Append(",")
                            .Append(Request.Form["times" + row.ToString()]).Append(",")
                            .Append(money.ToString()).Append(";");
                    }
                }
            }

            if (ChaseXML.Length > 0)
            {
                ChaseXML.Remove(ChaseXML.Length - 1, 1);
            }

            if (LotteryNumber[LotteryNumber.Length - 1] == '\n')
            {
                LotteryNumber = LotteryNumber.Substring(0, LotteryNumber.Length - 1);
            }

            try
            {
                SumMoney = double.Parse(tb_hide_SumMoney);
            }
            catch
            {
                Shove._Web.JavaScript.Alert(this.Page, "输入有错误,请仔细检查。(-1325)");

                return;
            }

            if (SumMoney < 2)
            {
                Shove._Web.JavaScript.Alert(this.Page, "输入有错误,请仔细检查。(-1332)");

                return;
            }

            string[] XML = ChaseXML.ToString().Split(';');
            int CompetitionCount = XML.Length;

            string[] Xmlparams = new string[CompetitionCount * 6];

            string str_EndTime = DAL.Functions.F_GetIsuseSystemEndTime(long.Parse(XML[0].Split(',')[0]), PlayTypeID).ToString();
            DateTime EndTime = DateTime.Parse(str_EndTime);

            if (DateTime.Now >= EndTime)
            {
                Shove._Web.JavaScript.Alert(this.Page, "您选择的追号期号中包含已截止的期,请重新选择。");

                return;
            }

            //构建格式:期号,玩法类别,方案,倍数,金额,方案保密级别
            for (int i = 0; i < CompetitionCount; i++)
            {
                Xmlparams[i * 6] = XML[i].Split(',')[0];        //期号
                Xmlparams[i * 6 + 1] = PlayTypeID.ToString();   //玩法类别
                Xmlparams[i * 6 + 2] = LotteryNumber;           //方案
                Xmlparams[i * 6 + 3] = XML[i].Split(',')[1];    //倍数
                Xmlparams[i * 6 + 4] = XML[i].Split(',')[2];    //金额
                Xmlparams[i * 6 + 5] = SecrecyLevel.ToString();

                if (Shove._Convert.StrToDouble(Xmlparams[i * 6 + 3], 0) * SumMoney != Shove._Convert.StrToDouble(Xmlparams[i * 6 + 4], 1))
                {
                    Shove._Web.JavaScript.Alert(this.Page, "输入有错误,请仔细检查。");

                    return;
                }

                if (Shove._Convert.StrToDouble(Xmlparams[i * 6 + 3], 0) < Multiple)
                {
                    Shove._Web.JavaScript.Alert(this.Page, "追号倍数有错误,请仔细检查!");

                    return;
                }

                if (double.Parse(Xmlparams[i * 6 + 3]) * SumNum * Price != double.Parse(Xmlparams[i * 6 + 4]))
                {
                    Shove._Web.JavaScript.Alert(this.Page, "追号金额有错误,请仔细检查!可能原因:浏览器不兼容,建议使用IE 7.0");

                    return;
                }
            }

            AdditionasXml = PF.BuildIsuseAdditionasXmlForChase(Xmlparams);

            if (AdditionasXml == "")
            {
                Shove._Web.JavaScript.Alert(this.Page, "追号发生错误。");

                return;
            }

            if (_User.InitiateChaseTask(tb_Title.Trim(), tb_Description.Trim(), LotteryID, AutoStopAtWinMoney, AdditionasXml, LotteryNumber, SchemeBonusScalec, ref ReturnDescription) < 0)
            {
                PF.GoError(ErrorNumber.Unknow, ReturnDescription, this.GetType().FullName + "(-754)");

                return;
            }

            Shove._Web.Cache.ClearCache("Home_Room_CoBuy_BindDataForType" + IsuseID.ToString());
            Shove._Web.Cache.ClearCache("Home_Room_SchemeAll_BindData" + IsuseID.ToString());
            Shove._Web.Cache.ClearCache(_Site.ID.ToString() + "AccountFreezeDetail_" + _User.ID.ToString());

            Response.Redirect("../Home/Room/UserBuySuccess.aspx?LotteryID=" + LotteryID.ToString() + "&Type=2&Money=" + BuyMoney.ToString() + "");

            return;
        }
        else
        {
            if (DateTime.Now >= Shove._Convert.StrToDateTime(HidIsuseEndTime.Replace("/", "-"), DateTime.Now.AddDays(-1).ToString()))
            {
                Shove._Web.JavaScript.Alert(this.Page, "本期投注已截止,谢谢。");

                return;
            }

            if (Price * SumNum * Multiple != SumMoney)
            {
                Shove._Web.JavaScript.Alert(this.Page, "输入有错误,请仔细检查。");

                return;
            }

            long SchemeID = _User.InitiateScheme(IsuseID, PlayTypeID, tb_Title.Trim() == "" ? "(无标题)" : tb_Title.Trim(), tb_Description.Trim(), LotteryNumber, "", Multiple, SumMoney, AssureMoney, Share, BuyShare, tb_OpenUserList.Trim(), short.Parse(SecrecyLevel.ToString()), SchemeBonusScale, ref ReturnDescription);
            if (SchemeID < 0)
            {
                PF.GoError(ErrorNumber.Unknow, ReturnDescription, this.GetType().FullName + "(-755)");

                return;
            }

            Shove._Web.Cache.ClearCache("Home_Room_CoBuy_BindDataForType" + IsuseID.ToString());
            Shove._Web.Cache.ClearCache("Home_Room_SchemeAll_BindData" + IsuseID.ToString());

            if (SumMoney > 50 && Share > 1)
            {
                Shove._Web.Cache.ClearCache("Home_Room_JoinAllBuy_BindData");
            }

            Response.Redirect("../Home/Room/UserBuySuccess.aspx?LotteryID=" + LotteryID.ToString() + "&&Money=" + BuyMoney.ToString() + "&SchemeID=" + SchemeID.ToString() + "");

            return;
        }
    }
Пример #58
0
    public string GenerateLuckLotteryNumber(int LotteryID, string Type, string Name, string lotteryName)
    {
        if (string.IsNullOrEmpty(lotteryName))
        {
            lotteryName = "cjdlt";
        }
        string Key = "Home_Room_Buy_GenerateLuckLotteryNumber" + LotteryID.ToString();

        Type = Shove._Web.Utility.FilteSqlInfusion(Type);
        Name = Shove._Web.Utility.FilteSqlInfusion(Name);

        if (Type == "3")
        {
            try
            {
                DateTime time = Convert.ToDateTime(Name);
                Name = time.ToString("yyyy-MM-dd");

                if (time > DateTime.Now)
                {
                    return("出生日期不能超过当前日期!");
                }
            }
            catch
            {
                return("日期格式不正确!");
            }
        }

        DataTable dt = Shove._Web.Cache.GetCacheAsDataTable(Key);

        if (dt == null || dt.Rows.Count == 0)
        {
            dt = new DAL.Tables.T_LuckNumber().Open("", "datediff(d,getdate(),DateTime)=0 and LotteryID=" + LotteryID.ToString() + "", "");

            Shove._Web.Cache.SetCache(Key, dt, 3600);
        }

        string LotteryNumber = "";

        DataRow[] dr = dt.Select("Type=" + Type + " and Name='" + Name + "'");

        if (dr != null && dr.Length > 0)
        {
            LotteryNumber = dr[0]["LotteryNumber"].ToString();
        }
        else
        {
            string num = "";
            switch (lotteryName)
            {
            case "cjdlt":
                num = new SLS.Lottery()[LotteryID].BuildNumber(5, 2, 1);
                break;

            case "pl3":
                num = new SLS.Lottery()[LotteryID].BuildNumber(1);
                break;

            case "ssq":
                num = new SLS.Lottery()[LotteryID].BuildNumber(6, 1, 1);
                break;

            case "3d":
                num = new SLS.Lottery()[LotteryID].BuildNumber(1);
                break;

            case "qlc":
                num = new SLS.Lottery()[LotteryID].BuildNumber(1);
                break;

            case "pl5":
                num = new SLS.Lottery()[LotteryID].BuildNumber(1);
                break;

            case "qxc":
                num = new SLS.Lottery()[LotteryID].BuildNumber(1);
                break;

            case "22x5":
                num = new SLS.Lottery()[LotteryID].BuildNumber(1);
                break;

            case "31x7":
                num = new SLS.Lottery()[LotteryID].BuildNumber(1);
                break;
            }

            LotteryNumber = num;

            DAL.Tables.T_LuckNumber ln = new DAL.Tables.T_LuckNumber();

            ln.LotteryID.Value     = LotteryID;
            ln.LotteryNumber.Value = LotteryNumber;
            ln.Name.Value          = Name;
            ln.Type.Value          = Type;

            ln.Insert();
            ln.Delete("datediff(d,DateTime,getdate())>0");

            Shove._Web.Cache.ClearCache(Key);
        }

        string LuckLottery = "";

        switch (lotteryName)
        {
        case "cjdlt":
            LuckLottery = FormatLuckLotteryNumber_cjdlt(LotteryID, LotteryNumber);
            break;

        case "pl3":
            LuckLottery = FormatLuckLotteryNumber_PL3(LotteryID, LotteryNumber);
            break;

        case "ssq":
            LuckLottery = FormatLuckLotteryNumber_SSQ(LotteryID, LotteryNumber);
            break;

        case "3d":
            LuckLottery = FormatLuckLotteryNumber_3D(LotteryNumber);
            break;

        case "qlc":
            LuckLottery = FormatLuckLotteryNumber_QLC(LotteryNumber);
            break;

        case "pl5":
            LuckLottery = FormatLuckLotteryNumber_PL5(LotteryNumber);
            break;

        case "qxc":
            LuckLottery = FormatLuckLotteryNumber_QXC(LotteryID, LotteryNumber);
            break;

        case "22x5":
            LuckLottery = FormatLuckLotteryNumber_22x5(LotteryNumber);
            break;

        case "31x7":
            LuckLottery = FormatLuckLotteryNumber_31X7(LotteryID, LotteryNumber);
            break;
        }


        return(LotteryNumber + "|" + LuckLottery);
    }
Пример #59
0
    /// <summary>
    /// 充值成功后,绑定数据
    /// </summary>
    /// <param name="BuyID"></param>
    private void BindDataForAliBuy(long BuyID)
    {
        DataTable dt = new DAL.Tables.T_AlipayBuyTemp().Open("", "ID=" + BuyID.ToString(), "");

        if (dt == null || dt.Rows.Count == 0)
        {
            return;
        }

        DataRow dr = dt.Rows[0];

        string HidIsuseID = dr["IsuseID"].ToString();
        string playType = dr["PlayTypeID"].ToString();
        bool IsChase = Shove._Convert.StrToBool(dr["IsChase"].ToString(), false);
        bool IsCoBuy = Shove._Convert.StrToBool(dr["IsCoBuy"].ToString(), false);
        string tb_Share = dr["Share"].ToString();
        string tb_BuyShare = dr["BuyShare"].ToString();
        string tb_AssureShare = dr["AssureShare"].ToString();
        string tb_OpenUserList = dr["OpenUsers"].ToString();
        string tb_Title = dr["Title"].ToString();
        string tb_Description = dr["Description"].ToString();
        string tbAutoStopAtWinMoney = dr["StopwhenwinMoney"].ToString();
        string tbSecrecyLevel = dr["SecrecyLevel"].ToString();
        string tb_LotteryNumber = dr["LotteryNumber"].ToString();
        string tb_hide_SumMoney = dr["SumMoney"].ToString();
        string tb_hide_AssureMoney = dr["AssureMoney"].ToString();
        string HidLotteryID = dr["LotteryID"].ToString();
        string tb_Multiple = dr["Multiple"].ToString();
        string AdditionasXml = dr["AdditionasXml"].ToString();

        if (tb_Multiple == "")
        {
            tb_Multiple = "1";
        }

        double SumMoney = 0;
        int Share = 0;
        int BuyShare = 0;
        double AssureMoney = 0;
        int Multiple = 0;
        short SecrecyLevel = 0;
        int PlayTypeID = 0;
        int LotteryID = 0;
        long IsuseID = 0;
        double AutoStopAtWinMoney = 0;

        try
        {
            SumMoney = double.Parse(tb_hide_SumMoney);
            Share = int.Parse(tb_Share);
            BuyShare = int.Parse(tb_BuyShare);
            AssureMoney = double.Parse(tb_hide_AssureMoney);
            Multiple = int.Parse(tb_Multiple);
            SecrecyLevel = short.Parse(tbSecrecyLevel);
            PlayTypeID = int.Parse(playType);
            LotteryID = int.Parse(HidLotteryID);
            IsuseID = long.Parse(HidIsuseID);
            AutoStopAtWinMoney = double.Parse(tbAutoStopAtWinMoney);
        }
        catch { }

        if ((BuyShare == Share) && (AssureMoney == 0))
        {
            Share = 1;
            BuyShare = 1;
        }

        double BuyMoney = BuyShare * (SumMoney / Share) + AssureMoney;

        if (IsChase)
        {
            BuyMoney = double.Parse(tb_hide_SumMoney);
        }

        string LotteryNumber = tb_LotteryNumber;

        if (LotteryNumber[LotteryNumber.Length - 1] == '\n')
        {
            LotteryNumber = LotteryNumber.Substring(0, LotteryNumber.Length - 1);
        }

        StringBuilder sb = new StringBuilder();

        sb.AppendLine("<script type='text/javascript' defer='defer'>");

        sb.Append("$Id('playType").Append(PlayTypeID.ToString()).AppendLine("').checked = true;");
        sb.AppendLine("clickPlayType('" + PlayTypeID.ToString() + "');");
        sb.AppendLine("function BindDataForFromAli(){");

        //追号
        if (IsChase)
        {
            XmlDocument xml = new XmlDocument();
            xml.LoadXml(AdditionasXml);
            XmlNodeList xnl = xml.ChildNodes[0].ChildNodes;

            foreach (XmlNode xn in xnl)
            {
                sb.Append("$Id('times").Append(xn.Attributes["IsuseID"].Value).Append("').value = '").Append(xn.Attributes["Multiple"].Value).AppendLine("';");
                sb.Append("$Id('money").Append(xn.Attributes["IsuseID"].Value).Append("').value = '").Append(xn.Attributes["Money"].Value).AppendLine("';");
                sb.Append("$Id('check").Append(xn.Attributes["IsuseID"].Value).AppendLine("').checked = true;");
                sb.Append("$Id('times").Append(xn.Attributes["IsuseID"].Value).AppendLine("').disabled = '';");
            }
        }

        LotteryNumber = LotteryNumber.Replace("\r", "");
        int LotteryNum = 0;
        string Number = "";
        foreach (string lotteryNumber in LotteryNumber.Split('\n'))
        {
            LotteryNum += new SLS.Lottery()[LotteryID].ToSingle(lotteryNumber, ref Number, PlayTypeID).Length;
            sb.AppendLine("var option = document.createElement('option');");
            sb.AppendLine("$Id('list_LotteryNumber').options.add(option);");
            sb.Append("option.innerText = '").Append(lotteryNumber).AppendLine("';");
            sb.Append("option.value = '").Append(lotteryNumber).AppendLine("';");
        }

        if (IsChase)
        {
            sb.AppendLine("$Id('Chase').checked = true;");
            sb.AppendLine("oncbInitiateTypeClick($Id('Chase'));");
        }

        if (IsCoBuy)
        {
            sb.AppendLine("$Id('CoBuy').checked = true;");
            sb.AppendLine("oncbInitiateTypeClick($Id('CoBuy'));");
        }

        sb.Append("$Id('tb_LotteryNumber').value = '").Append(tb_LotteryNumber.Replace("\r", "\\r").Replace("\n", "\\n")).AppendLine("';");
        sb.Append("$Id('tb_Share').value = '").Append(tb_Share).AppendLine("';");
        sb.Append("$Id('tb_BuyShare').value = '").Append(tb_BuyShare).AppendLine("';");
        sb.Append("$Id('tb_AssureShare').value = '").Append(tb_AssureShare).AppendLine("';");
        sb.Append("$Id('tb_OpenUserList').value = '").Append(tb_OpenUserList).AppendLine("';");
        sb.Append("$Id('tb_Title').value = '").Append(tb_Title).AppendLine("';");
        sb.Append("$Id('tb_Description').value = '").Append(tb_Description.Replace("\r", "\\r").Replace("\n", "\\n")).AppendLine("';");
        sb.Append("$Id('tbAutoStopAtWinMoney').value = '").Append(tbAutoStopAtWinMoney).AppendLine("';");
        sb.Append("$Id('SecrecyLevel").Append(SecrecyLevel.ToString()).AppendLine("').checked = true;");
        sb.Append("$Id('tb_hide_SumMoney').value = '").Append(tb_hide_SumMoney).AppendLine("';");
        sb.Append("$Id('tb_hide_AssureMoney').value = '").Append(AssureMoney.ToString("N0")).AppendLine("';");
        sb.Append("$Id('tb_Multiple').value = '").Append(Multiple.ToString()).AppendLine("';");
        sb.Append("$Id('lab_AssureMoney').innerText = '").Append(AssureMoney.ToString("N0")).AppendLine("';");
        sb.Append("$Id('lab_SumMoney').innerText = '").Append(SumMoney.ToString("N0")).AppendLine("';");
        sb.Append("$Id('LbSumMoney').innerText = '").Append(SumMoney.ToString("N0")).AppendLine("';");
        sb.Append("$Id('lab_Num').innerText = '").Append(LotteryNum.ToString()).AppendLine("';");
        sb.AppendLine("CalcResult();");
        sb.AppendLine("}");
        sb.AppendLine("</script>");

        script = sb.ToString();
    }
Пример #60
0
    //对开奖号码通知进行处理
    private void ReceiveWinNumberNotice(string TransMessage)
    {
        string elements = TransMessage.Substring(TransMessage.IndexOf("<body"), TransMessage.LastIndexOf("</body>") - TransMessage.IndexOf("<body")) + "</body>";

        DataSet ds = new DataSet();

        ds.ReadXml(new StringReader(elements));

        if (ds == null)
        {
            return;
        }

        if (ds.Tables.Count == 0)
        {
            return;
        }

        if (ds.Tables.Count < 1)
        {
            return;
        }

        DataTable dtLottery = ds.Tables[0];
        DataTable dtIssue   = ds.Tables[1];

        DAL.Tables.T_Isuses t_Isuses = new DAL.Tables.T_Isuses();

        string number      = dtLottery.Rows[0]["issue"].ToString();
        string LotteryName = dtLottery.Rows[0]["lotteryId"].ToString();

        string BonusNumber = dtIssue.Rows[0]["baseCode"].ToString() + " " + dtIssue.Rows[0]["specialCode"].ToString();

        int    LotteryID = GetLotteryID(LotteryName);
        string WinNumber = GetWinNumber(LotteryID, BonusNumber);

        string Body = "";

        DataTable dtIsuse = new DAL.Tables.T_Isuses().Open("", "[Name] = '" + number + "' and LotteryID = " + LotteryID.ToString() + " and IsOpened = 0", "");

        if ((dtIsuse == null) || (dtIsuse.Rows.Count < 1))
        {
            Body = "<body><result>0</result></body>";

            ReNotice("1202", Body);

            return;
        }

        long IsuseID = Shove._Convert.StrToLong(dtIsuse.Rows[0]["ID"].ToString(), 0);

        DAL.Tables.T_Isuses T_Isuses = new DAL.Tables.T_Isuses();

        T_Isuses.WinLotteryNumber.Value = WinNumber;
        T_Isuses.OpenOperatorID.Value   = 1;
        T_Isuses.Update("[ID] = " + IsuseID + " and [Name] = '" + number + "' and LotteryID = " + LotteryID.ToString());


        DAL.Tables.T_IsuseInfo t_IsuseInfo = new DAL.Tables.T_IsuseInfo();

        t_IsuseInfo.TotalSaleMoney.Value       = Shove._Convert.StrToDouble(dtLottery.Rows[0]["totalSaleMoney"].ToString(), -1);
        t_IsuseInfo.PoolOut.Value              = Shove._Convert.StrToDouble(dtLottery.Rows[0]["poolOut"].ToString(), -1);
        t_IsuseInfo.TotalAwardMoney.Value      = Shove._Convert.StrToDouble(dtLottery.Rows[0]["totalAwardMoney"].ToString(), -1);
        t_IsuseInfo.TotalSaleMoneyLocal.Value  = Shove._Convert.StrToDouble(dtLottery.Rows[0]["totalSaleMoneyLocal"].ToString(), -1);
        t_IsuseInfo.TotalAwardMoneyLocal.Value = Shove._Convert.StrToDouble(dtLottery.Rows[0]["totalAwardMoneyLocal"].ToString(), -1);
        t_IsuseInfo.IssueID.Value              = IsuseID;

        if (new DAL.Tables.T_IsuseInfo().GetCount("IssueID=" + IsuseID.ToString()) < 1)
        {
            t_IsuseInfo.Insert();
        }
        else
        {
            t_IsuseInfo.Update("IssueID=" + IsuseID.ToString());
        }

        DataTable dtWinTypes = new DAL.Tables.T_WinTypes().Open("", " LotteryID =" + LotteryID.ToString(), "");

        if ((dtWinTypes == null) || dtWinTypes.Rows.Count < 1)
        {
            //log.Write("执行电子票--获取彩种: " + LotteryID.ToString() + ",奖金等级时出现错误!");

            Body = "<body><result>0</result></body>";

            ReNotice("1202", Body);

            return;
        }

        double[] WinMoneyList = new double[dtWinTypes.Rows.Count * 2];

        double DefaultMoney          = 0;
        double DefaultMoneyNoWithTax = 0;

        for (int i = 0; i < dtWinTypes.Rows.Count; i++)
        {
            DefaultMoney          = Shove._Convert.StrToDouble(dtWinTypes.Rows[i]["DefaultMoney"].ToString(), 0);
            DefaultMoneyNoWithTax = Shove._Convert.StrToDouble(dtWinTypes.Rows[i]["DefaultMoneyNoWithTax"].ToString(), 0);

            WinMoneyList[i * 2]     = DefaultMoney == 0 ? 1 : DefaultMoneyNoWithTax;
            WinMoneyList[i * 2 + 1] = DefaultMoneyNoWithTax == 0 ? 1 : DefaultMoneyNoWithTax;
        }

        DataTable dtSchemesWithTaskDetails = new DAL.Views.V_Schemes().Open("", " IsuseName = '" + number + "' and LotteryID = " + LotteryID.ToString() + " and WinMoney = 0  and Buyed = 0 and ID in ( select ID from V_ChaseTaskDetails where IsuseName = '" + number + "' and LotteryID = " + LotteryID.ToString() + ")", "");

        string LotteryNumber = "";

        SLS.Lottery.LotteryBase lb = new SLS.Lottery()[LotteryID];

        int    ReturnValue       = 0;
        string ReturnDescription = "";
        string Description       = "";
        double WinMoneyNoWithTax = 0;

        for (int i = 0; i < dtSchemesWithTaskDetails.Rows.Count; i++)
        {
            LotteryNumber = dtSchemesWithTaskDetails.Rows[i]["LotteryNumber"].ToString();

            Description       = "";
            WinMoneyNoWithTax = 0;

            double WinMoney = lb.ComputeWin(LotteryNumber, WinNumber.Trim(), ref Description, ref WinMoneyNoWithTax, int.Parse(dtSchemesWithTaskDetails.Rows[i]["PlayTypeID"].ToString()), WinMoneyList);

            if (WinMoney > 0)
            {
                if (DAL.Procedures.P_ChaseTaskStopWhenWin(Shove._Convert.StrToLong(dtSchemesWithTaskDetails.Rows[i]["SiteID"].ToString(), 0), Shove._Convert.StrToLong(dtSchemesWithTaskDetails.Rows[i]["ID"].ToString(), 0), WinMoney, ref ReturnValue, ref ReturnDescription) < 0)
                {
                    //log.Write("执行电子票--判断是否停止追号的时候出现错误");

                    continue;
                }
            }
        }

        Body = "<body><result>0</result></body>";

        ReNotice("1202", Body);
    }