Exemplo n.º 1
0
    public static string GetScriptResTable(string val)
    {
        try
        {
            string way = GetPassWay(val);               //得到过关方式

            StringBuilder sb = new StringBuilder();

            val = val.Trim();

            int Istart, Ilen;

            GetStrScope(val, "[", "]", out Istart, out Ilen);

            string matchlist = val.Substring(Istart + 1, Ilen - 1);

            string type = val.Split(';')[0];

            if (type.Substring(0, 2) != "72" && type.Substring(0, 2) != "73")
            {
                return val;
            }

            int PlayTypeID = Shove._Convert.StrToInt(val.Split(';')[0], 7201);

            if (type.Substring(0, 2) == "72")
            {
                sb.Append("<div class=\"tdbback\"><table width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\" class=\"tablelay\">");
                sb.Append("<th scope='col' width='60'>赛事编号</th>");
                sb.Append("<th scope='col' width='100'>联赛</th><th scope='col' width='150'>主队 VS 客队</th>");
                sb.Append("<th scope='col' width='150'>预计停售时间</th><th scope='col' width='50'>设胆</th><th scope='col'>投注内容</th><th scope='col'>赛果</th>");
            }
            else
            {
                sb.Append("<div class=\"tdbback\"><table width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\" class=\"tablelay\">");
                sb.Append("<th scope='col' width='60'>赛事编号</th>");
                sb.Append("<th scope='col' width='100'>联赛</th><th scope='col' width='150'>客队 VS 主队</th>");
                sb.Append("<th scope='col' width='150'>预计停售时间</th><th scope='col' width='50'>设胆</th><th scope='col'>投注内容</th><th scope='col'>赛果</th>");
            }

            string Matchids = "";
            string[] ArrRes = null;
            string MatchListDan = "";
            string MatchidsDan = "";

            DataTable dtMatch = new DataTable();

            dtMatch.Columns.Add("MatchID", typeof(System.String));
            dtMatch.Columns.Add("PlayType", typeof(System.String));

            if (val.Split(';').Length == 4)
            {
                MatchListDan = matchlist.Split(']')[0];
                matchlist = matchlist.Split('[')[1];

                foreach (string match in MatchListDan.Split('|'))
                {
                    DataRow dr = dtMatch.NewRow();

                    dr["MatchID"] = match.Split('(')[0];
                    dr["PlayType"] = match.Split('(')[1].Substring(0, match.Split('(')[1].LastIndexOf(')'));

                    MatchidsDan += match.Split('(')[0] + ",";
                    Matchids += match.Split('(')[0] + ",";

                    dtMatch.Rows.Add(dr);
                    dtMatch.AcceptChanges();
                }

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

                if (string.IsNullOrEmpty(MatchidsDan))
                {
                    return val;
                }
            }

            foreach (string match in matchlist.Split('|'))
            {
                DataRow dr = dtMatch.NewRow();

                dr["MatchID"] = match.Split('(')[0];
                dr["PlayType"] = match.Split('(')[1].Substring(0, match.Split('(')[1].LastIndexOf(')'));

                Matchids += match.Split('(')[0] + ",";

                dtMatch.Rows.Add(dr);
                dtMatch.AcceptChanges();
            }

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

            if (string.IsNullOrEmpty(Matchids))
            {
                return val;
            }

            DataTable table = null;

            if (type.Substring(0, 2) == "72")
            {
                string SQL = "game,mainteam +'VS'+guestteam teamname,MatchNumber,DATEADD(minute, (select SystemEndAheadMinute from T_PlayTypes where id = " + PlayTypeID + ") * -1, StopSellingTime) date, id";

                switch (PlayTypeID)
                {
                    case 7201:
                        {
                            SQL += ", SPFResult as Result";
                        }
                        break;
                    case 7202:
                        {
                            SQL += ", ZQBFResult  as Result";
                        }
                        break;
                    case 7203:
                        {
                            SQL += ",ZJQSResult  as Result ";
                        }
                        break;
                    case 7204:
                        {
                            SQL += ", BQCResult as Result ";
                        }
                        break;
                }

                table = new DAL.Tables.T_Match().Open(SQL, "id in (" + Matchids + ")", "");
            }
            else
            {
                string SQL = "game,guestteam +'VS'+mainteam teamname,MatchNumber,DATEADD(minute, (select SystemEndAheadMinute from T_PlayTypes where id = " + PlayTypeID + ") * -1, StopSellingTime) date, id";

                switch (PlayTypeID)
                {
                    case 7301:
                        {
                            SQL += ", SFResult as Result";
                        }
                        break;
                    case 7302:
                        {
                            SQL += ", RFSFResult  as Result";
                        }
                        break;
                    case 7303:
                        {
                            SQL += ",SFCResult  as Result ";
                        }
                        break;
                    case 7304:
                        {
                            SQL += ", DXResult as Result ";
                        }
                        break;
                }

                table = new DAL.Tables.T_MatchBasket().Open(SQL, "id in (" + Matchids + ")", "");
            }

            if (table == null)
            {
                return val;
            }

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

            string res = "";
            string Result = "";

            foreach (DataRow dr in table.Rows)
            {
                sb.Append("<tr class=\"trbg2\" bgcolor=\"#ffffff\"><td>" + dr["MatchNumber"].ToString() + "</td><td>" + dr["game"].ToString() + "</td><td>" + dr["teamname"].ToString() + "</td><td>" + Shove._Convert.StrToDateTime(dr["date"].ToString(), DateTime.Now.ToString()).ToString("yy-MM-dd HH:mm") + "</td>");
                sb.Append("<td>");

                if (MatchidsDan.IndexOf(dr["id"].ToString()) >= 0)
                {
                    sb.Append("是");
                }

                sb.Append("</td>");

                res = dtMatch.Select("MatchID='" + dr["id"].ToString() + "'")[0]["PlayType"].ToString();

                ArrRes = res.Split(',');
                sb.Append("<td>");

                foreach (string r in ArrRes)
                {
                    Result = Getesult(type, r);
                    if (Result.Equals(dr["Result"].ToString()))
                    {
                        Result = "<span class=\"red eng\">" + Result + "</span>";
                    }

                    sb.Append(Result + " ");
                }

                sb.Append("</td><td><span class=\"red eng\">" + dr["Result"].ToString() + "</span>");
                sb.Append("</td></tr>");
            }

            sb.Append("</table></div>");
            sb.Append("<div style=\"text-align:center;width:660px;\">过关方式:" + way + "</div>");

            return sb.ToString();
        }
        catch (System.Exception ex)
        {
            new Log("TWZT").Write(ex.Message);

            return val;
        }
    }
Exemplo n.º 2
0
    public string GetScriptResTable(string val)
    {
        try
        {
            val = val.Trim();

            int Istart, Ilen;

            GetStrScope(val, "[", "]", out Istart, out Ilen);

            string matchlist = val.Substring(Istart + 1, Ilen - 1);

            string type = val.Split(';')[0];

            if (type.Substring(0, 2) != "72" && type.Substring(0, 2) != "73")
            {
                return val;
            }

            string Matchids = "";
            string MatchListDan = "";

            if (val.Split(';').Length == 4)
            {
                MatchListDan = matchlist.Split(']')[0];

                foreach (string match in MatchListDan.Split('|'))
                {
                    Matchids += match.Split('(')[0] + ",";
                }
            }

            foreach (string match in matchlist.Split('|'))
            {
                Matchids += match.Split('(')[0] + ",";
            }

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

            DataTable table = null;

            if (type.Substring(0, 2) == "72")
            {
                table = new DAL.Tables.T_Match().Open("StopSellingTime", "id in (" + Matchids + ")", " StopSellingTime ");
            }
            else
            {
                table = new DAL.Tables.T_MatchBasket().Open("StopSellingTime", "id in (" + Matchids + ")", " StopSellingTime");
            }

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

            DataTable dtPlayType = new DAL.Tables.T_PlayTypes().Open("SystemEndAheadMinute", "ID=" + type.Substring(0, 4), "");

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

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

            return Shove._Convert.StrToDateTime(table.Rows[0]["StopSellingTime"].ToString(), DateTime.Now.AddDays(-1).ToString()).AddMinutes(Shove._Convert.StrToInt(dtPlayType.Rows[0]["SystemEndAheadMinute"].ToString(), 0) * -1).ToString();
        }
        catch {
            return "";
        }
    }