Пример #1
0
        public void BindGridData(SpecialLottery result)
        {
            var dataList = new List<SpecialDataModel>();
            foreach (LotteryTypeCount item in result.LotteryTypeCount)
            {
                var data = new SpecialDataModel()
                {
                    Date = item.Date,
                    Small = string.Format("{0}次", item.Small),
                    Big = string.Format("{0}次", item.Big),
                    Middle = string.Format("{0}次", item.Middle),
                    Side = string.Format("{0}次", item.Side),
                    Odd = string.Format("{0}次", item.Odd),
                    Dual = string.Format("{0}次", item.Dual),
                    NoAppearNum = item.NoAppearNum,
                    BestNum = item.BestNum
                };
                dataList.Add(data);
            }

            dgvData.DataSource = dataList;

            for (int i = 0; i < dgvData.Columns.Count; i++)
            {
                switch (i)
                {
                    case 0:
                        dgvData.Columns[i].Width = 95;
                        break;
                    case 7:
                        dgvData.Columns[i].Width = 350;
                        break;
                    case 8:
                        dgvData.Columns[i].Width = 95;
                        break;
                    default:
                        dgvData.Columns[i].Width = 52;
                        break;
                }
                if (i == dgvData.Columns.Count - 1) dgvData.Columns[i].AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill;
                dgvData.Columns[i].DefaultCellStyle.BackColor = Color.White;
                dgvData.Columns[i].DefaultCellStyle.SelectionBackColor = Color.White;
                dgvData.Columns[i].DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter;
            }
        }
Пример #2
0
        public void BindGridTrend(SpecialLottery result)
        {
            List<SpecialTrendModel> listTemp = new List<SpecialTrendModel>();

            var temp = new SpecialTrendModel()
            {
                NumberOne = Convert.ToString(result.LotteryTypeAvg.PBig),
                NumberTwo = Convert.ToString(result.LotteryTypeAvg.PSmall),
                NumberThree = Convert.ToString(result.LotteryTypeAvg.POdd),
                NumberFour = Convert.ToString(result.LotteryTypeAvg.PDual),
                NumberFive = Convert.ToString(result.LotteryTypeAvg.PMiddle),
                NumberSix = Convert.ToString(result.LotteryTypeAvg.PSide),
                AriseNumberOne = Convert.ToString(result.LotteryStableNumber.DayAndCnt1),
                AriseNumberTwo = Convert.ToString(result.LotteryStableNumber.DayAndCnt2),
                AriseNumberThree = Convert.ToString(result.LotteryStableNumber.DayAndCnt3)
            };
            listTemp.Add(temp);
            dgvTrend.DataSource = listTemp;
            dgvTrend.Rows[0].Height = 26;
            for (int i = 0; i < dgvTrend.Columns.Count; i++)
            {
                if (i == 0 || i == 7)
                {
                    dgvTrend.Columns[i].Width = 95;
                }
                else if (i > 7)
                {
                    dgvTrend.Columns[i].Width = 128;
                }
                else
                {
                    dgvTrend.Columns[i].Width = 52;
                }
                if (i == dgvTrend.Columns.Count - 1) dgvTrend.Columns[i].AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill;
                dgvTrend.Columns[i].DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter;
                dgvTrend.Columns[i].DefaultCellStyle.BackColor = Color.White;
                dgvTrend.Columns[i].DefaultCellStyle.SelectionBackColor = Color.White;
                dgvTrend.Columns[i].DefaultCellStyle.SelectionForeColor = Color.Black;
            }
        }
Пример #3
0
 public void BindGridNumber(SpecialLottery result)
 {
     List<SpecialNumberModel> listTemp = new List<SpecialNumberModel>();
     var temp = new SpecialNumberModel()
     {
         NumberOne = string.Format("{0}次", result.LotteryTypeAvg.AvgBig),
         NumberTwo = string.Format("{0}次", result.LotteryTypeAvg.AvgSmall),
         NumberThree = string.Format("{0}次", result.LotteryTypeAvg.AvgOdd),
         NumberFour = string.Format("{0}次", result.LotteryTypeAvg.AvgDual),
         NumberFive = string.Format("{0}次", result.LotteryTypeAvg.AvgMiddle),
         NumberSix = string.Format("{0}次", result.LotteryTypeAvg.AvgSide),
         StableNumberOne = UtilsModel.LoadNumImage(result.LotteryStableNumber.RetNum1),
         StableNumberTwo = UtilsModel.LoadNumImage(result.LotteryStableNumber.RetNum2),
         StableNumberThree = UtilsModel.LoadNumImage(result.LotteryStableNumber.RetNum3)
     };
     listTemp.Add(temp);
     dgvNumber.DataSource = listTemp;
     dgvNumber.Rows[0].Height = 26;
     for (int i = 0; i < dgvNumber.Columns.Count; i++)
     {
         if (i == 0 || i == 7)
         {
             dgvNumber.Columns[i].Width = 95;
         }
         else if (i > 7)
         {
             dgvNumber.Columns[i].Width = 128;
         }
         else
         {
             dgvNumber.Columns[i].Width = 52;
         }
         if (i == dgvNumber.Columns.Count - 1) dgvNumber.Columns[i].AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill;
         dgvNumber.Columns[i].DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter;
         dgvNumber.Columns[i].DefaultCellStyle.BackColor = Color.White;
         dgvNumber.Columns[i].DefaultCellStyle.SelectionBackColor = Color.White;
         dgvNumber.Columns[i].DefaultCellStyle.SelectionForeColor = Color.Black;
     }
 }