示例#1
0
 public override AdminStatisticsInfo GetStatistics()
 {
     DbCommand sqlStringCommand = database.GetSqlStringCommand("SELECT  (SELECT COUNT(OrderId) FROM Hishop_Orders WHERE OrderStatus = 2) AS orderNumbWaitConsignment, (SELECT COUNT(PurchaseOrderId) FROM Hishop_PurchaseOrders WHERE PurchaseStatus = 2) AS purchaseOrderNumbWaitConsignment, (select Count(LeaveId) from Hishop_LeaveComments l where (select count(replyId) from Hishop_LeaveCommentReplys where leaveId =l.leaveId)=0) as leaveComments,(select Count(ConsultationId) from Hishop_ProductConsultations where ReplyUserId is null) as productConsultations,(select Count(ReceiveMessageId) from Hishop_ReceivedMessages where IsRead=0 and Addressee='admin' and Addresser in (select UserName from vw_aspnet_Members)) as messages, isnull((select sum(OrderTotal)-isnull(sum(RefundAmount),0) from hishop_orders where (OrderStatus=2 or  OrderStatus=3 or OrderStatus=5)   and OrderDate>='" + DataHelper.GetSafeDateTimeFormat(DateTime.Now.Date) + "'),0) as orderPriceToday, isnull((select sum(PurchaseProfit) from Hishop_PurchaseOrders where  (PurchaseStatus=2 or  PurchaseStatus=3 or PurchaseStatus=5)   and PurchaseDate>='" + DataHelper.GetSafeDateTimeFormat(DateTime.Now.Date) + "'),0) as PurchaseOrderProfitToday, isnull((select sum(OrderProfit) from Hishop_Orders where  (OrderStatus=2 or  OrderStatus=3 or OrderStatus=5)  and OrderDate>='" + DataHelper.GetSafeDateTimeFormat(DateTime.Now.Date) + "'),0) as orderProfitToday, (select count(*) from vw_aspnet_Members where CreateDate>='" + DataHelper.GetSafeDateTimeFormat(DateTime.Now.Date) + "' ) as userNewAddToday, (select count(*) from vw_aspnet_Distributors where CreateDate>='" + DataHelper.GetSafeDateTimeFormat(DateTime.Now.Date) + "' ) as distroNewAddToday, isnull((select sum(balance) from vw_aspnet_Members),0) as memberBalance, isnull((select sum(balance) from vw_aspnet_Distributors),0) as distroBalance,(select count(*) from (select ProductId from Hishop_SKUs where Stock<=AlertStock group by ProductId) as a) as productAlert");
     AdminStatisticsInfo info = new AdminStatisticsInfo();
     using (IDataReader reader = database.ExecuteReader(sqlStringCommand))
     {
         if (reader.Read())
         {
             info.OrderNumbWaitConsignment = (int)reader["orderNumbWaitConsignment"];
             info.PurchaseOrderNumbWaitConsignment = (int)reader["purchaseOrderNumbWaitConsignment"];
             info.LeaveComments = (int)reader["LeaveComments"];
             info.ProductConsultations = (int)reader["ProductConsultations"];
             info.Messages = (int)reader["Messages"];
             info.PurchaseOrderProfitToday = (decimal)reader["PurchaseOrderProfitToday"];
             info.OrderProfitToday = (decimal)reader["orderProfitToday"];
             info.UserNewAddToday = (int)reader["userNewAddToday"];
             info.DistroButorsNewAddToday = (int)reader["distroNewAddToday"];
             info.MembersBalance = (decimal)reader["memberBalance"];
             info.DistrosBalance = (decimal)reader["distroBalance"];
             info.OrderPriceToday = (decimal)reader["orderPriceToday"];
             info.ProductAlert = (int)reader["productAlert"];
         }
     }
     return info;
 }
示例#2
0
 private void BindStatistics(AdminStatisticsInfo statistics)
 {
     IUser user = Users.GetUser(HiContext.Current.User.UserId);
     ltrAdminName.Text = user.Username;
     lblTime.Time = user.LastLoginDate;
     ltrWaitSendOrdersNumber.Text = (statistics.OrderNumbWaitConsignment > 0) ? statistics.OrderNumbWaitConsignment.ToString() : string.Empty;
     ltrWaitSendPurchaseOrdersNumber.Text = (statistics.PurchaseOrderNumbWaitConsignment > 0) ? statistics.PurchaseOrderNumbWaitConsignment.ToString() : string.Empty;
     hpkLiuYan.Text = (statistics.LeaveComments > 0) ? statistics.LeaveComments.ToString() : "0";
     hpkZiXun.Text = (statistics.ProductConsultations > 0) ? statistics.ProductConsultations.ToString() : "0";
     hpkMessages.Text = (statistics.Messages > 0) ? statistics.Messages.ToString() : "0";
     hpkLiuYan.NavigateUrl = Globals.ApplicationPath + "/Admin/comment/ManageLeaveComments.aspx?MessageStatus=3";
     hpkZiXun.NavigateUrl = Globals.ApplicationPath + "/Admin/comment/ProductConsultations.aspx";
     hpkMessages.NavigateUrl = Globals.ApplicationPath + "/Admin/comment/ReceivedMessages.aspx?IsRead=0";
     lblTodayOrderAmout.Text = (statistics.OrderPriceToday > 0M) ? Globals.FormatMoney(statistics.OrderPriceToday) : string.Empty;
     lblTodaySalesProfile.Text = (statistics.ProfitTotal != 0M) ? Globals.FormatMoney(statistics.ProfitTotal) : string.Empty;
     ltrTodayAddMemberNumber.Text = (statistics.UserNewAddToday > 0) ? statistics.UserNewAddToday.ToString() : string.Empty;
     ltrTodayAddDistroNumber.Text = (statistics.DistroButorsNewAddToday > 0) ? statistics.DistroButorsNewAddToday.ToString() : string.Empty;
     lblMembersBalanceTotal.Text = Globals.FormatMoney(statistics.MembersBalance);
     lblDistrosBalanceTotal.Text = Globals.FormatMoney(statistics.DistrosBalance);
     lblAllBalanceTotal.Text = Globals.FormatMoney(statistics.BalanceTotal);
     lblProductCountTotal.Text = (statistics.ProductAlert > 0) ? ("<a href='" + Globals.ApplicationPath + "/Admin/product/ProductAlert.aspx'>" + statistics.ProductAlert.ToString() + "</a>") : "0";
 }