2 using System
.Collections
.Generic
;
6 using System
.Web
.UI
.WebControls
;
7 using PumpkinHouseDatabase
;
8 using PumpkinHouse
.Utils
;
10 namespace PumpkinHouse
.Admin
12 public class ShopPriceStat
14 public string Code { get; set; }
15 public string Name { get; set; }
16 public int Lt50 { get; set; }
17 public int Btw50N100 { get; set; }
18 public int Btw100N200 { get; set; }
19 public int Btw200N300 { get; set; }
20 public int Btw300N500 { get; set; }
21 public int Gt500 { get; set; }
22 public int NoPrice { get;set;}
23 public int Total { get { return Lt50 + Btw50N100 + Btw100N200 + Btw200N300 + Btw300N500 + Gt500 + NoPrice; }
}
26 public partial class ShopStat
: System
.Web
.UI
.Page
28 protected void Page_Load(object sender
, EventArgs e
)
33 private string[] names
= new string[] { "", "淘宝", "京东", "(天猫)淘宝商城", "宜家", "凡客", "阿里巴巴", "当当", "亚马逊中国", "拍拍", "优雅", "趣玩", "51悠品", "易趣网", "一号店", "苏宁", "国美" }
;
35 protected void StartCalc(object sender
, EventArgs e
)
37 Dictionary
<Shop
, ShopPriceStat
> dict
= new Dictionary
<Shop
, ShopPriceStat
>();
39 foreach (var s
in (Shop
[])Enum
.GetValues(typeof(Shop
)))
41 if (s
== Shop
.NotShop
) continue;
42 dict
.Add(s
, new ShopPriceStat { Code = Enum.GetName(typeof(Shop), s), Name = names[(byte)s] }
);
45 using (DataUtils utils
= new DataUtils())
47 IList
<DB_Picture
> pictures
= utils
.FindAllPictures(null, true).ToList();
48 foreach (var pic
in pictures
)
50 Shop shop
= (Shop
)pic
.Shop
;
51 ShopPriceStat stat
= dict
[shop
];
56 else if (pic
.Price
<= 50)
60 else if (pic
.Price
<= 100)
64 else if (pic
.Price
<= 200)
68 else if (pic
.Price
<= 300)
72 else if (pic
.Price
<= 500)
83 ShopGridView
.DataSource
= dict
.Values
.OrderByDescending(i
=> i
.Total
);
84 ShopGridView
.DataBind();