示例#1
0
        public DataTable StatisticsProductSale(int currentPage, int pageSize, ProductSearchInfo productSearch, ref int count, DateTime startDate, DateTime endDate)
        {
            ShopMssqlPagerClass class2;
            List <ProductInfo>  list = new List <ProductInfo>();
            string         str       = string.Empty;
            MssqlCondition condition = new MssqlCondition();

            condition.Add("[AddDate]", startDate, ConditionType.MoreOrEqual);
            condition.Add("[AddDate]", endDate, ConditionType.Less);
            str = condition.ToString();
            if (str != string.Empty)
            {
                str = " AND" + str;
            }
            class2           = new ShopMssqlPagerClass();
            class2.TableName = "(SELECT ID,Name,ClassID,BrandID,IsSale, ISNULL(SellCount, 0) AS SellCount, ISNULL(SellMoney,0) AS SellMoney FROM " + ShopMssqlHelper.TablePrefix + "Product ";
            class2.TableName = class2.TableName + "LEFT OUTER JOIN (SELECT ProductID, SUM(BuyCount) AS SellCount, SUM(ProductPrice * BuyCount) AS SellMoney FROM ( ";
            string tableName = class2.TableName;

            class2.TableName   = tableName + "SELECT " + ShopMssqlHelper.TablePrefix + "OrderDetail.ProductID," + ShopMssqlHelper.TablePrefix + "OrderDetail.ProductPrice, " + ShopMssqlHelper.TablePrefix + "OrderDetail.BuyCount FROM " + ShopMssqlHelper.TablePrefix + "OrderDetail ";
            tableName          = class2.TableName;
            class2.TableName   = tableName + " INNER JOIN [" + ShopMssqlHelper.TablePrefix + "Order] ON " + ShopMssqlHelper.TablePrefix + "OrderDetail.OrderID = [" + ShopMssqlHelper.TablePrefix + "Order].ID WHERE ([" + ShopMssqlHelper.TablePrefix + "Order].OrderStatus = 6 " + str + ")) AS TEMP1 GROUP BY ProductID) AS TEMP2 ON " + ShopMssqlHelper.TablePrefix + "Product.ID = TEMP2.ProductID) As PageTable";
            class2.Fields      = "[ID],[Name],[ClassID],[SellCount],[SellMoney]";
            class2.CurrentPage = currentPage;
            class2.PageSize    = pageSize;
            class2.OrderField  = "[ID]";
            if (productSearch.ProductOrderType != string.Empty)
            {
                string productOrderType = productSearch.ProductOrderType;
                if (productOrderType != null)
                {
                    if (!(productOrderType == "SellCount"))
                    {
                        if (productOrderType == "SellMoney")
                        {
                            class2.OrderField = "[SellMoney],[ID]";
                        }
                    }
                    else
                    {
                        class2.OrderField = "[SellCount],[ID]";
                    }
                }
            }
            class2.OrderType = OrderType.Desc;
            this.PrepareCondition(class2.MssqlCondition, productSearch);
            class2.Count = count;
            count        = class2.Count;
            return(class2.ExecuteDataTable());
        }
示例#2
0
        public DataTable StatisticsSaleDetail(int currentPage, int pageSize, OrderSearchInfo orderSearch, ProductSearchInfo productSearch, ref int count)
        {
            ShopMssqlPagerClass class2 = new ShopMssqlPagerClass();

            class2.TableName   = ShopMssqlHelper.TablePrefix + "View_SaleDetail";
            class2.Fields      = "[Name],[ClassID],[BrandID],[BuyCount],[Money],[OrderNumber],[AddDate],[UserName]";
            class2.CurrentPage = currentPage;
            class2.PageSize    = pageSize;
            class2.OrderField  = "[AddDate],[ID]";
            class2.OrderType   = OrderType.Desc;
            this.PrepareCondition(class2.MssqlCondition, orderSearch, productSearch);
            class2.Count = count;
            count        = class2.Count;
            return(class2.ExecuteDataTable());
        }
示例#3
0
        public DataTable StatisticsUserActive(int currentPage, int pageSize, UserSearchInfo userSearch, ref int count, string orderField)
        {
            List <UserInfo>     list   = new List <UserInfo>();
            ShopMssqlPagerClass class2 = new ShopMssqlPagerClass();
            {
                class2.TableName   = ShopMssqlHelper.TablePrefix + "View_UserActive";
                class2.Fields      = "[ID],[UserName],[Sex],[RegisterDate],[LoginTimes],[CommentCount],[ReplyCount],[MessageCount]";
                class2.CurrentPage = currentPage;
                class2.PageSize    = pageSize;
            }
            string str = orderField;

            if (str != null)
            {
                if (!(str == "LoginTimes"))
                {
                    if (str == "CommentCount")
                    {
                        class2.OrderField = "[CommentCount],[ID]";
                        goto Label_00C1;
                    }
                    if (str == "ReplyCount")
                    {
                        class2.OrderField = "[ReplyCount],[ID]";
                        goto Label_00C1;
                    }
                    if (str == "MessageCount")
                    {
                        class2.OrderField = "[MessageCount],[ID]";
                        goto Label_00C1;
                    }
                }
                else
                {
                    class2.OrderField = "[LoginTimes],[ID]";
                    goto Label_00C1;
                }
            }
            class2.OrderField = "[LoginTimes],[ID]";
Label_00C1:
            class2.OrderType = OrderType.Desc;
            this.PrepareCondition(class2.MssqlCondition, userSearch);
            class2.Count = count;
            count        = class2.Count;
            return(class2.ExecuteDataTable());
        }
示例#4
0
        public DataTable StatisticsUserConsume(int currentPage, int pageSize, UserSearchInfo userSearch, ref int count, string orderField, DateTime startDate, DateTime endDate)
        {
            ShopMssqlPagerClass class2;
            List <UserInfo>     list = new List <UserInfo>();
            string         str       = string.Empty;
            string         str2      = string.Empty;
            string         str3      = string.Empty;
            MssqlCondition condition = new MssqlCondition();

            condition.Add("[AddDate]", startDate, ConditionType.MoreOrEqual);
            condition.Add("[AddDate]", endDate, ConditionType.Less);
            str = condition.ToString();
            if (str != string.Empty)
            {
                str  = " AND" + str;
                str2 = str.Replace("[AddDate]", "[RechargeDate]");
                str3 = str3.Replace("[ApplyDate]", "[RechargeDate]");
            }
            class2           = new ShopMssqlPagerClass();
            class2.TableName = "(SELECT ID,UserName,Sex,ISNULL(RechargeCount,0) AS RechargeCount,ISNULL(RechargeMoney,0) AS RechargeMoney,ISNULL(ApplyCount,0) AS ApplyCount,ISNULL(ApplyMoney,0) AS ApplyMoney,ISNULL(OrderCount,0) AS OrderCount,ISNULL(OrderMoney,0) AS OrderMoney ";
            class2.TableName = class2.TableName + "FROM [" + ShopMssqlHelper.TablePrefix + "User] ";
            string tableName = class2.TableName;

            class2.TableName   = tableName + "LEFT OUTER JOIN (SELECT UserID, COUNT(*) AS RechargeCount,Sum(Money) AS RechargeMoney FROM " + ShopMssqlHelper.TablePrefix + "UserRecharge WHERE IsFinish=1 " + str2 + " GROUP BY UserID) AS TEMP1 ON [" + ShopMssqlHelper.TablePrefix + "User].ID = TEMP1.UserID ";
            tableName          = class2.TableName;
            class2.TableName   = tableName + "LEFT OUTER JOIN (SELECT UserID, COUNT(*) AS ApplyCount,Sum(Money) AS ApplyMoney FROM " + ShopMssqlHelper.TablePrefix + "UserApply WHERE Status=2 " + str3 + " GROUP BY UserID) AS TEMP2 ON [" + ShopMssqlHelper.TablePrefix + "User].ID = TEMP2.UserID ";
            tableName          = class2.TableName;
            class2.TableName   = tableName + "LEFT OUTER JOIN (SELECT UserID, COUNT(*) AS OrderCount,Sum(ProductMoney-FavorableMoney+ShippingMoney+OtherMoney-CouponMoney) AS OrderMoney FROM [" + ShopMssqlHelper.TablePrefix + "Order] WHERE OrderStatus=6 " + str + " GROUP BY UserID) AS TEMP3 ON [" + ShopMssqlHelper.TablePrefix + "User].ID = TEMP3.UserID) AS PageTable";
            class2.Fields      = "[ID],[UserName],[Sex],[RechargeCount],[RechargeMoney],[ApplyCount],[ApplyMoney],[OrderCount],[OrderMoney]";
            class2.CurrentPage = currentPage;
            class2.PageSize    = pageSize;
            switch (orderField)
            {
            case "RechargeCount":
                class2.OrderField = "[RechargeCount],[ID]";
                break;

            case "RechargeMoney":
                class2.OrderField = "[RechargeMoney],[ID]";
                break;

            case "ApplyCount":
                class2.OrderField = "[ApplyCount],[ID]";
                break;

            case "ApplyMoney":
                class2.OrderField = "[ApplyMoney],[ID]";
                break;

            case "OrderCount":
                class2.OrderField = "[OrderCount],[ID]";
                break;

            case "OrderMoney":
                class2.OrderField = "[OrderMoney],[ID]";
                break;

            default:
                class2.OrderField = "[OrderCount],[ID]";
                break;
            }
            class2.OrderType = OrderType.Desc;
            this.PrepareCondition(class2.MssqlCondition, userSearch);
            class2.Count = count;
            count        = class2.Count;
            return(class2.ExecuteDataTable());
        }