Example #1
0
        /// <summary>
        /// ��ѯij�û���Ͷע�б�
        /// </summary>
        /// <param name="userid"></param>
        /// <returns></returns>
        public string GetBetRecordList(string userid)
        {
            JSONHelper json = new JSONHelper();
            ds = dal.GetList(userid);
            json.success = true;
            foreach (DataRow dr in ds.Tables[0].Rows)
            {
                //Ͷע��¼������
                json.AddItem("id", dr["id"].ToString());
                json.AddItem("lineid", dr["lineid"].ToString());
                json.AddItem("teamname", dr["teamname"].ToString());
                json.AddItem("traditional", dr["traditional"].ToString());
                json.AddItem("starttime", dr["starttime"].ToString());
                json.AddItem("endtime", dr["endtime"].ToString());
                json.AddItem("bettime", dr["bettime"].ToString());
                json.AddItem("itemid", dr["itemid"].ToString());
                json.AddItem("detailid", dr["detailid"].ToString());
                json.AddItem("betmoney", dr["betmoney"].ToString());
                json.AddItem("returnmoney", dr["returnmoney"].ToString());
                json.AddItem("result", dr["result"].ToString());
                json.AddItem("sourceid", dr["sourceid"].ToString());
                //Ͷע�̱߳�����
                json.AddItem("linename", dr["linename"].ToString());
                json.AddItem("linebetmoney", dr["linebetmoney"].ToString());
                json.AddItem("profit", dr["profit"].ToString());
                json.AddItem("state", dr["state"].ToString());
                json.AddItem("iscomplete", dr["iscomplete"].ToString());
                json.AddItem("isbetting", dr["isbetting"].ToString());
                //Ͷע��Ŀ������
                json.AddItem("itemname", dr["itemname"].ToString());
                //Ͷעϸ������
                json.AddItem("detailname", dr["detailname"].ToString());

                json.ItemOk();
            }
            json.totlalCount = ds.Tables[0].Rows.Count;
            string betRecordlist = json.ToString();
            return betRecordlist;
        }
Example #2
0
        public string GetOddsPointChartsData(string scheduleID, string[] companyids)
        {
            JSONHelper json = new JSONHelper();
            json.success = true;
            DataSet dsAllTime = dal.GetChangeTimesByCompanys(scheduleID, string.Join(",", companyids));

            List<float> avehomeklist = new List<float>();
            List<float> avedrawklist = new List<float>();
            List<float> aveawayklist = new List<float>();
            List<float> avehomevlist = new List<float>();
            List<float> avedrawvlist = new List<float>();
            List<float> aveawayvlist = new List<float>();
            List<float> avereratelist = new List<float>();

            Odds1x2History lastmodel = new Odds1x2History();
            foreach (DataRow dr in dsAllTime.Tables[0].Rows)
            {
                ds = dal.GetAvgNumber(int.Parse(scheduleID), DateTime.Parse(dr[0].ToString()));
                List<Odds1x2History> oddsList = dal.GetLastListByCompanys(int.Parse(scheduleID), string.Join(",", companyids), DateTime.Parse(dr["time"].ToString()));
                List<float> homeklist = new List<float>();
                List<float> drawklist = new List<float>();
                List<float> awayklist = new List<float>();
                List<float> reratelist = new List<float>();
                foreach (Odds1x2History item in oddsList)
                {
                    homeklist.Add(item.home * float.Parse(ds.Tables[0].Rows[0]["avghomep"].ToString()));
                    drawklist.Add(item.draw * float.Parse(ds.Tables[0].Rows[0]["avgdrawp"].ToString()));
                    awayklist.Add(item.away * float.Parse(ds.Tables[0].Rows[0]["avgawayp"].ToString()));
                    reratelist.Add(item.returnrate * 100);
                }
                avehomeklist.Add(homeklist.Average());
                avedrawklist.Add(drawklist.Average());
                aveawayklist.Add(awayklist.Average());
                avehomevlist.Add(this.CalculationVariance(homeklist));
                avedrawvlist.Add(this.CalculationVariance(drawklist));
                aveawayvlist.Add(this.CalculationVariance(awayklist));
                avereratelist.Add(reratelist.Average());
            }
            int h = 0, d = 0, a = 0;
            int hh = 0, dd = 0, aa = 0;
            for (int i = 1; i < avehomeklist.Count; i++)
            {
                if (avehomeklist[i] < avehomeklist[i - 1])
                    h++;
                else if (avehomeklist[i] > avehomeklist[i - 1])
                    h--;
                if (avedrawklist[i] < avedrawklist[i - 1])
                    d++;
                else if (avedrawklist[i] > avedrawklist[i - 1])
                    d--;
                if (aveawayklist[i] < aveawayklist[i - 1])
                    a++;
                else if (aveawayklist[i] > aveawayklist[i - 1])
                    a--;
                if (avehomevlist[i] <= avehomevlist[i - 1])
                {
                    if (avehomeklist[i] < avehomeklist[i - 1])
                        hh++;
                    else if (avehomeklist[i] > avehomeklist[i - 1])
                        hh--;
                }
                if (avedrawvlist[i] <= avedrawvlist[i - 1])
                {
                    if (avedrawklist[i] < avedrawklist[i - 1])
                        dd++;
                    else if (avedrawklist[i] > avedrawklist[i - 1])
                        dd--;
                }
                if (aveawayvlist[i] <= aveawayvlist[i - 1])
                {
                    if (aveawayklist[i] < aveawayklist[i - 1])
                        aa++;
                    else if (aveawayklist[i] > aveawayklist[i - 1])
                        aa--;
                }
            }
            json.AddItem("name", "主胜");
            json.AddItem("point", h.ToString());
            json.AddItem("xpoint", hh.ToString());
            json.ItemOk();
            json.AddItem("name", "平局");
            json.AddItem("point", d.ToString());
            json.AddItem("xpoint", dd.ToString());
            json.ItemOk();
            json.AddItem("name", "客胜");
            json.AddItem("point", a.ToString());
            json.AddItem("xpoint", aa.ToString());
            json.ItemOk();

            json.totlalCount = 3;
            return json.ToString();
        }
Example #3
0
        /// <summary>
        /// 获得历史改变的赔率
        /// </summary>
        /// <param name="scheduleid"></param>
        /// <param name="companyids"></param>
        /// <param name="companynames"></param>
        /// <returns></returns>
        public string GetOdds1x2ChangeList(string scheduleid, string[] companyids, string[] companynames, string tcompanyid)
        {
            JSONHelper json = new JSONHelper();
            for (int i = 0; i < companyids.Length; i++)
            {
                List<Odds1x2History> list = dal.GetList(scheduleid, companyids[i]);
                json.success = true;
                foreach (Odds1x2History model in list)
                {
                    this.FillOdds1x2Kelly(model, tcompanyid);
                    //投注记录表数据
                    json.AddItem("id", model.id.ToString());
                    json.AddItem("scheduleid", model.scheduleid.ToString());
                    json.AddItem("companyid", model.companyid.ToString());
                    json.AddItem("companyname", companynames[i]);
                    json.AddItem("home", model.home.ToString());
                    json.AddItem("draw", model.draw.ToString());
                    json.AddItem("away", model.away.ToString());
                    json.AddItem("homep", model.homep.ToString());
                    json.AddItem("drawp", model.drawp.ToString());
                    json.AddItem("awayp", model.awayp.ToString());
                    json.AddItem("homek", model.homek.ToString());
                    json.AddItem("drawk", model.drawk.ToString());
                    json.AddItem("awayk", model.awayk.ToString());
                    json.AddItem("returnrate", model.returnrate.ToString());
                    json.AddItem("time", model.time.ToString("yyyy-MM-dd HH:mm"));

                    json.ItemOk();
                }
                json.totlalCount += list.Count;
            }

            return json.ToString();
        }
Example #4
0
        public string GetOddsCompanyChartsData(string scheduleID, string[] companyids, double time)
        {
            JSONHelper json = new JSONHelper();
            json.success = true;
            DataSet dsStart = dal.GetCompanyStartPoint(scheduleID, companyids);
            DataSet dsEnd = dal.GetCompanyEndPoint(scheduleID, companyids);
            DateTime firsttime;
            DateTime lasttime = DateTime.Parse(dsEnd.Tables[0].Rows[0][0].ToString());
            if (time == 0)
            {
                firsttime = DateTime.Parse(dsStart.Tables[0].Rows[0][0].ToString());
            }
            else
            {
                firsttime = lasttime.AddSeconds(0 - time);
            }

            double timespace = (lasttime - firsttime).TotalSeconds / 60;

            while (firsttime <= lasttime)
            {
                Odds1x2History model = new Odds1x2History();
                ds = dal.GetAvgNumber(int.Parse(scheduleID), firsttime);
                DataRow dr = ds.Tables[0].Rows[0];

                List<Odds1x2History> oddsList = dal.GetLastListByCompanys(int.Parse(scheduleID), string.Join(",", companyids), firsttime);
                int home = 0;
                int draw = 0;
                int away = 0;
                int nhome = 0;
                int ndraw = 0;
                int naway = 0;
                int count = 0;
                foreach (Odds1x2History item in oddsList)
                {
                    item.homek = item.home * float.Parse(dr["avghomep"].ToString());
                    item.drawk = item.draw * float.Parse(dr["avgdrawp"].ToString());
                    item.awayk = item.away * float.Parse(dr["avgawayp"].ToString());
                    if (item.homek < item.returnrate * 100 - 2)
                    {
                        home++;
                    }
                    else if (item.homek >= item.returnrate * 100 + 2)
                    {
                        nhome--;
                    }
                    if (item.drawk < item.returnrate * 100 - 2)
                    {
                        draw++;
                    }
                    else if (item.drawk >= item.returnrate * 100 + 2)
                    {
                        ndraw--;
                    }
                    if (item.awayk < item.returnrate * 100 - 2)
                    {
                        away++;
                    }
                    else if (item.awayk >= item.returnrate * 100 + 2)
                    {
                        naway--;
                    }
                    count++;
                }
                json.AddItem("home", home.ToString());
                json.AddItem("draw", draw.ToString());
                json.AddItem("away", away.ToString());
                json.AddItem("nhome", nhome.ToString());
                json.AddItem("ndraw", ndraw.ToString());
                json.AddItem("naway", naway.ToString());
                json.AddItem("count", count.ToString());
                json.AddItem("time", firsttime.ToString());
                json.ItemOk();
                firsttime = firsttime.AddSeconds(timespace);

            }
            json.totlalCount = ds.Tables[0].Rows.Count;
            return json.ToString();
        }
Example #5
0
        public string GetAveKellyChartsData(string scheduleID, string[] companyids)
        {
            JSONHelper json = new JSONHelper();
            json.success = true;
            List<Odds1x2History> firstOddsList = dal.GetFirstListByCompanys(int.Parse(scheduleID), string.Join(",", companyids));
            List<float> firstHomekList = new List<float>();
            List<float> firstDrawkList = new List<float>();
            List<float> firstAwaykList = new List<float>();
            int firstHomekCount = 0;
            int firstDrawkCount = 0;
            int firstAwaykCount = 0;
            foreach (Odds1x2History model in firstOddsList)
            {
                this.FillOdds1x2Kelly(model, "");
                firstHomekList.Add(model.homek);
                firstDrawkList.Add(model.drawk);
                firstAwaykList.Add(model.awayk);
                if (model.homek < model.awayk && model.homek < model.drawk)
                {
                    firstHomekCount++;
                }
                else if (model.homek >= 100)
                {
                    firstHomekCount--;
                }
                if (model.drawk < model.awayk && model.drawk < model.homek)
                {
                    firstDrawkCount++;
                }
                else if (model.drawk >= 100)
                {
                    firstDrawkCount--;
                }
                if (model.awayk < model.homek && model.awayk < model.drawk)
                {
                    firstAwaykCount++;
                }
                else if (model.awayk >= 100)
                {
                    firstAwaykCount--;
                }
            }

            List<Odds1x2History> lastOddsList = dal.GetLastListByCompanys(int.Parse(scheduleID), string.Join(",", companyids));
            List<float> lastHomekList = new List<float>();
            List<float> lastDrawkList = new List<float>();
            List<float> lastAwaykList = new List<float>();
            int lastHomekCount = 0;
            int lastDrawkCount = 0;
            int lastAwaykCount = 0;
            foreach (Odds1x2History model in lastOddsList)
            {
                this.FillOdds1x2Kelly(model, "");
                lastHomekList.Add(model.homek);
                lastDrawkList.Add(model.drawk);
                lastAwaykList.Add(model.awayk);
                if (model.homek < model.awayk && model.homek < model.drawk)
                {
                    lastHomekCount++;
                }
                else if (model.homek >= 100)
                {
                    lastHomekCount--;
                }
                if (model.drawk < model.awayk && model.drawk < model.homek)
                {
                    lastDrawkCount++;
                }
                else if (model.drawk >= 100)
                {
                    lastDrawkCount--;
                }
                if (model.awayk < model.homek && model.awayk < model.drawk)
                {
                    lastAwaykCount++;
                }
                else if (model.awayk >= 100)
                {
                    lastAwaykCount--;
                }
            }

            json.AddItem("name", "主胜");
            json.AddItem("firstkelly", firstHomekList.Average().ToString());
            json.AddItem("lastkelly", lastHomekList.Average().ToString());
            json.AddItem("firstsupport", firstHomekCount.ToString());
            json.AddItem("lastsupport", lastHomekCount.ToString());
            json.ItemOk();
            json.AddItem("name", "平局");
            json.AddItem("firstkelly", firstDrawkList.Average().ToString());
            json.AddItem("lastkelly", lastDrawkList.Average().ToString());
            json.AddItem("firstsupport", firstDrawkCount.ToString());
            json.AddItem("lastsupport", lastDrawkCount.ToString());
            json.ItemOk();
            json.AddItem("name", "客胜");
            json.AddItem("firstkelly", firstAwaykList.Average().ToString());
            json.AddItem("lastkelly", lastAwaykList.Average().ToString());
            json.AddItem("firstsupport", firstAwaykCount.ToString());
            json.AddItem("lastsupport", lastAwaykCount.ToString());
            json.ItemOk();

            return json.ToString();
        }