public BalanceOrderStaticsticsInfo GetOrdersStaticsticsInfo(int supplierId, bool isBalanceOver) { BalanceOrderStaticsticsInfo balanceOrderStaticsticsInfo = new BalanceOrderStaticsticsInfo(); StringBuilder stringBuilder = new StringBuilder($"select count(1) as orderNum,isnull(SUM(OrderCostPrice)+SUM(Freight),0) as amount from dbo.Hishop_Orders where SupplierId={supplierId}"); stringBuilder.AppendFormat(" and IsBalanceOver ={0}", isBalanceOver ? 1 : 0); if (!isBalanceOver) { stringBuilder.AppendFormat(" And (OrderStatus={0} or (OrderStatus={1} and ShippingDate is not null))", 5, 4); } DbCommand sqlStringCommand = base.database.GetSqlStringCommand(stringBuilder.ToString()); try { using (IDataReader dataReader = base.database.ExecuteReader(sqlStringCommand)) { if (dataReader.Read()) { balanceOrderStaticsticsInfo.Amount = (decimal)((IDataRecord)dataReader)["amount"]; balanceOrderStaticsticsInfo.OrderNum = (int)((IDataRecord)dataReader)["orderNum"]; } } } catch (Exception) { } return(balanceOrderStaticsticsInfo); }
private void BindStaticsticsInfo() { bool flag = base.Request.QueryString["BalanceOver"].ToInt(0) != 0; BalanceOrderStaticsticsInfo ordersStaticsticsInfo = BalanceOrderHelper.GetOrdersStaticsticsInfo(HiContext.Current.Manager.StoreId, flag); this.lblBalanceText.Text = (flag ? "已结算总金额" : "预计结算总金额"); this.lblBalanceValue.Text = ordersStaticsticsInfo.Amount.F2ToString("f2"); this.lblOrderNumText.Text = (flag ? "已结算订单总数" : "待结算订单总数"); this.lblOrderNumValue.Text = ordersStaticsticsInfo.OrderNum.ToString("F0"); }
private void BindStaticsticsInfo() { bool flag = base.Request.QueryString["BalanceOver"].ToInt(0) != 0; BalanceOrderStaticsticsInfo ordersStaticsticsInfo = BalanceOrderHelper.GetOrdersStaticsticsInfo(base.Request.QueryString["SupplierId"].ToInt(0), flag); this.lblBalanceText.Text = (flag ? "已结算总金额" : "预计结算总金额"); this.lblBalanceValue.Text = ordersStaticsticsInfo.Amount.F2ToString("f2"); this.lblOrderNumText.Text = (flag ? "已结算订单总数" : "待结算订单总数"); this.lblOrderNumValue.Text = ordersStaticsticsInfo.OrderNum.ToString("F0"); this.lblName.Text = base.GetParameter("Name"); }