コード例 #1
0
ファイル: TouzhuForm.cs プロジェクト: xiaobeixin50/test
        private void BindGridView()
        {
            DataSet ds = new PeilvDAL().GetPeilvDataFromKaijiang();
            dgPeilv.DataSource = ds.Tables[0];

            SortedSet<string> liansai = new SortedSet<string>();

            foreach (DataRow row in ds.Tables[0].Rows)
            {
                liansai.Add(row["liansai"].ToString());

            }

            cbLiansai.Items.Clear();
            cbLiansai.Items.Add("全部");
            foreach (string bisai in liansai)
            {
                cbLiansai.Items.Add(bisai);
            }
            cbLiansai.SelectedIndex = 0;

        }
コード例 #2
0
ファイル: YuceTouzhuForm.cs プロジェクト: xiaobeixin50/test
        private void TouzhuByMingren()
        {
            //重新绑定 
            DateTime date = dtpTouzhushijian.Value.Date;
            DataSet dsYuce = new YucerawdataDAL().GetYucerawdataAnalysisHasMingRen(date);

            PeilvDAL dal = new PeilvDAL();
            string riqi = dtpTouzhushijian.Value.Date.ToString("yyyy-MM-dd");
            string liansai = "全部";
            DataSet ds = dal.SearchPeilv(riqi, liansai);
            dgvTuijian.DataSource = ds.Tables[0];

            foreach (DataRow row in dsYuce.Tables[0].Rows)
            {
                //string kedui = row["kedui"].ToString();
                //string zhudui = row["zhudui"].ToString();
                string kedui = row["keduireal"].ToString();
                string zhudui = row["zhuduireal"].ToString();
                string yucespf = row["yucespf"].ToString();
                string hasrangqiu = row["hasrangqiu"].ToString();
                string rangqiushu = row["rangqiushu"].ToString();

                foreach (DataGridViewRow gridRow in dgvTuijian.Rows)
                {
                    if (gridRow.Index == dgvTuijian.Rows.Count - 1)
                    {
                        continue;
                    }
                    if (gridRow.Cells[2].Value.ToString().Equals(zhudui) || gridRow.Cells[3].Value.ToString().Equals(kedui))
                    {
                        if (hasrangqiu.Equals("0") && gridRow.Cells[4].Value.ToString().Equals("0"))
                        {
                            char[] chars = yucespf.ToCharArray();
                            foreach (char ch in chars)
                            {
                                if (ch <= '9' && ch >= '0')
                                {
                                    switch (ch)
                                    {
                                        case '0': SetCellColor(gridRow.Cells[7]); break;
                                        case '1': SetCellColor(gridRow.Cells[6]); break;
                                        case '3': SetCellColor(gridRow.Cells[5]); break;

                                    }
                                }
                            }
                        }
                        else if (hasrangqiu.Equals("1") && !gridRow.Cells[4].Value.ToString().Equals("0"))
                        {
                            char[] chars = yucespf.ToCharArray();
                            foreach (char ch in chars)
                            {
                                if (ch <= '9' && ch >= '0')
                                {
                                    switch (ch)
                                    {
                                        case '0': SetCellColor(gridRow.Cells[7]); break;
                                        case '1': SetCellColor(gridRow.Cells[6]); break;
                                        case '3': SetCellColor(gridRow.Cells[5]); break;

                                    }
                                }
                            }
                        }

                    }
                }

            }
            TouzhuByNatureForMingren(); 
        }
コード例 #3
0
        private void ImportPeilv(DateTime importdate)
        {
            try
            {
                DateTime importDate = importdate;
                string url = GetKaijiangUrl(importDate);
                string jsonData = GetHtmlFromUrl(url);

                Dictionary<string, object> dict = JsonConvert.DeserializeObject<Dictionary<string, object>>(jsonData);
                String raceList = dict["raceList"].ToString();
                Dictionary<string, object> dict2 = JsonConvert.DeserializeObject<Dictionary<string, object>>(raceList);
                String weekDay = dict["weekDay"].ToString();
                string weekDate = dict["weekDate"].ToString();

                foreach (string key in dict2.Keys)
                {
                    string value = dict2[key].ToString();
                    Race race = JsonConvert.DeserializeObject<Race>(value);
                    Peilv peilv = new Peilv();
                    peilv.Bianhao = key;
                    peilv.Liansai = race.matchName;
                    peilv.Zhudui = race.homeTeam;
                    peilv.Kedui = race.guestTeam;
                    peilv.Riqi = weekDate;
                    peilv.Operator = "开奖导入";
                    peilv.OperateTime = DateTime.Now;
                    peilv.EndTime = Convert.ToDateTime(race.endTime);

                    string[] xsp = race.xspfSp.Split('-');
                    string[] sp = race.spfSp.Split('-');
                    peilv.Rangqiu = 0;
                    peilv.ShengSp = Convert.ToDouble(xsp[0]);
                    peilv.PingSp = Convert.ToDouble(xsp[1]);
                    peilv.FuSp = Convert.ToDouble(xsp[2]);

                    PeilvDAL dal = new PeilvDAL();
                    dal.InsertPeilv(peilv);

                    peilv.Rangqiu = Convert.ToInt32(race.concede);
                    peilv.ShengSp = Convert.ToDouble(sp[0]);
                    peilv.PingSp = Convert.ToDouble(sp[1]);
                    peilv.FuSp = Convert.ToDouble(sp[2]);
                    dal.InsertPeilv(peilv);
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
            }
        }
コード例 #4
0
ファイル: TouzhuForm.cs プロジェクト: xiaobeixin50/test
        private void btnSearch_Click(object sender, EventArgs e)
        {
            PeilvDAL dal = new PeilvDAL();
            string riqi = dtpRiqi.Value.Date.ToString("yyyy-MM-dd");
            string liansai = cbLiansai.Text;            
            DataSet ds = dal.SearchPeilvFromKaijiang(riqi,liansai);
            dgPeilv.DataSource = ds.Tables[0];

            //更新联赛集合
            cbLiansai.Items.Clear();
            cbLiansai.Items.Add("全部");
            DataSet dsLiansai = new PeilvDAL().GetPeilvLiansaiFromKaijiang(riqi);
            foreach (DataRow row in dsLiansai.Tables[0].Rows)
            {
                cbLiansai.Items.Add(row["liansai"].ToString());

            }            
            cbLiansai.SelectedIndex = 0;
        }