コード例 #1
0
        public void LoadData()
        {
            if (CurrentPage > TotalPage)
            {
                CurrentPage = 0;
            }
            if (CurrentPageAlbum > TotalPageAlbum)
            {
                CurrentPageAlbum = 0;
            }

            List <PhotoInfo> temp = new List <PhotoInfo>();
            int length            = (CurrentPage + 1) * RPP;

            if (length > PhotoInfos.Count)
            {
                length = PhotoInfos.Count;
            }
            for (int i = CurrentPage * RPP; i < length; i++)
            {
                temp.Add(PhotoInfos[i]);
            }

            List <DirInfo> temp1 = new List <DirInfo>();
            int            l     = (CurrentPageAlbum + 1) * RPPAlbum;

            if (l > DirInfos.Count)
            {
                l = DirInfos.Count;
            }
            for (int i = CurrentPageAlbum * RPPAlbum; i < l; i++)
            {
                temp1.Add(DirInfos[i]);
            }

            //ilist = ilist.Take(CurrentPage * RPP + RPP > TotalRecord ? TotalRecord % RPP : RPP);

            if (temp1.Count == 0)
            {
                Conten.Visible = false;
            }
            else
            {
                Conten.Visible = true;
            }
            Pictype.DataSource = temp1;
            Pictype.DataBind();

            Pic.DataSource = temp;
            Pic.DataBind();
        }
コード例 #2
0
ファイル: Display.ascx.cs プロジェクト: minhchau2236/pgkh
        public void LoadData()
        {
            if (CurrentPage > TotalPage)
            {
                CurrentPage = 0;
            }
            if (CurrentPageAlbum > TotalPageAlbum)
            {
                CurrentPageAlbum = 0;
            }

            List <PhotoInfo> temp = new List <PhotoInfo>();

            for (int i = 0; i < PhotoInfos.Count; i++)
            {
                temp.Add(PhotoInfos[i]);
            }

            List <DirInfo> temp1 = new List <DirInfo>();
            int            l     = (CurrentPageAlbum + 1) * RPPAlbum;

            if (l > DirInfos.Count)
            {
                l = DirInfos.Count;
            }
            for (int i = CurrentPageAlbum * RPPAlbum; i < l; i++)
            {
                temp1.Add(DirInfos[i]);
            }

            if (temp1.Count == 0)
            {
                Conten.Visible = false;
            }
            else
            {
                Conten.Visible = true;
            }

            Pictype.DataSource = temp1;
            Pictype.DataBind();

            Pic.DataSource = temp;
            Pic.DataBind();
        }
コード例 #3
0
        private void Bind_Pic()
        {
            var X = List_Account.Select(P => P.Account_Time);
            var Y = List_Account.Select(P => P.Account_Price);
            List <Car_Account>  List_AccTemp = List_Account;
            List <SelectResult> Temp_result  = new List <SelectResult>();

            #region 地点处理
            if (CB_Province.SelectedIndex > 0)
            {
                if (CB_City.SelectedIndex > 0)
                {
                    if (CB_Shop.SelectedIndex > 0)
                    {
                        List_AccTemp = List_AccTemp.Where(P => P.Account_Shop == ShopID).ToList();
                    }
                    else
                    {
                    }
                }
                else
                {
                }
            }
            #endregion
            #region 时间处理
            if (CB_Year.SelectedIndex > 0)
            {
                List_AccTemp = List_AccTemp.Where(P => P.Account_Time.Year == Convert.ToInt32(CB_Year.SelectedItem.ToString())).ToList();
                if (CB_Month.SelectedIndex > 0)
                {
                    List_AccTemp = List_AccTemp.Where(P => P.Account_Time.Month == Convert.ToInt32(CB_Month.SelectedItem.ToString())).ToList();
                    if (CB_Day.SelectedIndex > 0)
                    {
                        int day = DateTime.DaysInMonth(
                            Convert.ToInt32(CB_Year.SelectedItem.ToString()),
                            Convert.ToInt32(CB_Month.SelectedItem.ToString()));
                        List_AccTemp = List_AccTemp.Where(P => P.Account_Time.Day == Convert.ToInt32(CB_Day.SelectedItem.ToString())).ToList();
                        for (int i = 0; i < 24; i++)
                        {
                            SelectResult k = (from P in List_AccTemp
                                              where (P.Account_Time.Hour == i)
                                              group P by P.Account_Time.Hour into K
                                              select new SelectResult
                            {
                                Time = i,
                                Price = K.Sum(P => P.Account_Price)
                            }).FirstOrDefault();
                            Temp_result.Add(k ?? new SelectResult()
                            {
                                Price = 0, Time = i
                            });
                        }
                    }
                    else
                    {
                        int day = DateTime.DaysInMonth(
                            Convert.ToInt32(CB_Year.SelectedItem.ToString()),
                            Convert.ToInt32(CB_Month.SelectedItem.ToString()));
                        for (int i = 1; i <= day; i++)
                        {
                            SelectResult k = (from P in List_AccTemp
                                              where (P.Account_Time.Day == i)
                                              group P by P.Account_Time.Day into K
                                              select new SelectResult
                            {
                                Time = i,
                                Price = K.Sum(P => P.Account_Price)
                            }).FirstOrDefault();
                            Temp_result.Add(k ?? new SelectResult()
                            {
                                Price = 0, Time = i
                            });
                        }
                    }
                }
                else
                {
                    for (int i = 1; i <= 12; i++)
                    {
                        SelectResult k = (from P in List_AccTemp
                                          where (P.Account_Time.Month == i)
                                          group P by P.Account_Time.Month into K
                                          select new SelectResult
                        {
                            Time = i,
                            Price = K.Sum(P => P.Account_Price)
                        }).FirstOrDefault();
                        Temp_result.Add(k ?? new SelectResult()
                        {
                            Price = 0, Time = i
                        });
                    }
                }
            }
            else
            {
                for (int i = DateTime.Now.Year - 5; i <= DateTime.Now.Year; i++)
                {
                    SelectResult k = (from P in List_AccTemp
                                      where (P.Account_Time.Year == i)
                                      group P by P.Account_Time.Year into K
                                      select new SelectResult
                    {
                        Time = i,
                        Price = K.Sum(P => P.Account_Price)
                    }).FirstOrDefault();
                    Temp_result.Add(k ?? new SelectResult()
                    {
                        Price = 0, Time = i
                    });
                }
            }
            #endregion


            Pic.Series["交易额"].Points.DataBind(Temp_result, "Time", "Price", "AxisLabel=Time,Label=Price");
            Pic.Series["交易额"].ChartType           = SeriesChartType.Column;
            Pic.Series["交易额"].IsValueShownAsLabel = true;
            //Pic.Series["S1"].Points.DataBindXY(X,Y);

            //foreach (DataPoint point in Pic.Series["S1"].Points)
            //{
            //    point["Exploded"] = "false";
            //    if(point.AxisLabel=
            //}

            //Pic.DataSource = Temp_result;
            Pic.DataBind();
        }