public static MerchantStat GetMerchantStat(int sellerId) { MerchantStat m = new MerchantStat(); string[] statString = new string[] { "account", "active", "goods", "material", "orders" }; List <MySqlParameter> parameters = new List <MySqlParameter>(); foreach (var stat in statString) { string commandText = string.Format(@"select count(*) from {0} where sellerId = ?sellerId", stat); parameters.Clear(); parameters.Add(new MySqlParameter("?sellerId", sellerId)); try { using (var conn = Utility.ObtainConn(Utility._gameDbConn)) { MySqlDataReader reader = MySqlHelper.ExecuteReader(conn, CommandType.Text, commandText, parameters.ToArray()); while (reader.Read()) { switch (stat) { case "account": m.UserCount = reader.GetInt32(0); break; case "active": m.ActiveCount = reader.GetInt32(0); break; case "goods": m.GoodsCount = reader.GetInt32(0); break; case "material": m.ImgCount = reader.GetInt32(0); break; case "orders": m.OrderNumber = reader.GetInt32(0); break; default: break; } } } } catch (System.Exception ex) { throw; } } string moneyCmd = @"select count(totalprice) from orders where sellerid=?sellerId and status = 2"; parameters.Clear(); parameters.Add(new MySqlParameter("?sellerId", sellerId)); try { using (var conn = Utility.ObtainConn(Utility._gameDbConn)) { MySqlDataReader reader = MySqlHelper.ExecuteReader(conn, CommandType.Text, moneyCmd, parameters.ToArray()); while (reader.Read()) { m.MoneyCount = reader.GetInt32(0); } } } catch (System.Exception ex) { throw; } return(m); }
protected void Page_Load(object sender, EventArgs e) { MerchantStat = SystemHelper.GetMerchantStat(Int32.Parse(SellerId)); MerchantStat.AnnouncementContent = AnnouncementHelper.GetNewsItem().Content; Fastlinkslist = DevSystemHelper.GetPagFastlinks(0, 0).Results.ToList(); }