Esempio n. 1
0
        public IActionResult ManageUserRanks(int?pageIndex, int pageSize = 20)
        {
            NameValueCollection from           = RequestHelper.GetQueryParams(Request);
            UserRanksQuery      userRanksQuery = new UserRanksQuery();

            userRanksQuery.Rank       = from["Rank"];
            userRanksQuery.RankName   = from["RankName"];
            userRanksQuery.PointLower = from["PointLower"];

            if (!string.IsNullOrWhiteSpace(userRanksQuery.Rank))
            {
                ViewData["Rank"] = userRanksQuery.Rank;
            }
            if (!string.IsNullOrWhiteSpace(userRanksQuery.RankName))
            {
                ViewData["RankName"] = userRanksQuery.RankName;
            }
            if (!string.IsNullOrWhiteSpace(userRanksQuery.PointLower))
            {
                ViewData["PointLower"] = userRanksQuery.PointLower;
            }


            pageIndex = pageIndex ?? 1;
            userRanksQuery.UserRanksSortBy = UserRanksSortBy.Rank;

            PagingDataSet <UserRanks> userRanksPaging = userRanksService.GetUserRanks(userRanksQuery, pageIndex.Value, pageSize);

            if (pageIndex > 1 && (userRanksPaging == null || userRanksPaging.Count() == 0))
            {
                userRanksPaging = userRanksService.GetUserRanks(userRanksQuery, pageSize, pageIndex.Value - 1);
            }

            return(View(userRanksPaging));
        }
Esempio n. 2
0
        public IActionResult ManageRoles(int?pageIndex, int pageSize = 20)
        {
            NameValueCollection from       = RequestHelper.GetQueryParams(Request);
            RolesQuery          rolesQuery = new RolesQuery();

            rolesQuery.Keyword = from["keyWord"];

            string isEnabled = from["isEnabled"],
                   isPublic  = from["isPublic"],
                   isBuiltin = from["isBuiltin"];

            if (!string.IsNullOrWhiteSpace(rolesQuery.Keyword))
            {
                ViewData["Keyword"] = rolesQuery.Keyword;
            }
            if (!string.IsNullOrWhiteSpace(isEnabled))
            {
                rolesQuery.IsEnabled = isEnabled.AsBool();
            }
            if (!string.IsNullOrWhiteSpace(isBuiltin))
            {
                rolesQuery.IsBuiltin = isBuiltin.AsBool();
            }
            if (!string.IsNullOrWhiteSpace(isPublic))
            {
                rolesQuery.IsPublic = isPublic.AsBool();
            }

            Dictionary <bool, string> enabledValues = new Dictionary <bool, string> {
                { true, "已启用" }, { false, "未启用" }
            };

            ViewData["IsEnabled"] = new SelectList(enabledValues.Select(m => new { text = m.Value, value = m.Key.ToString().ToLower() }), "value", "text", rolesQuery.IsEnabled);

            Dictionary <bool, string> publicValues = new Dictionary <bool, string> {
                { true, "已公开" }, { false, "未公开" }
            };

            ViewData["IsPublic"] = new SelectList(publicValues.Select(m => new { text = m.Value, value = m.Key.ToString().ToLower() }), "value", "text", rolesQuery.IsPublic);

            Dictionary <bool, string> builtinValues = new Dictionary <bool, string> {
                { true, "是" }, { false, "否" }
            };

            ViewData["IsBuiltin"] = new SelectList(builtinValues.Select(m => new { text = m.Value, value = m.Key.ToString().ToLower() }), "value", "text", rolesQuery.IsBuiltin);

            pageIndex             = pageIndex ?? 1;
            rolesQuery.RoleSortBy = RoleSortBy.Rolename;

            PagingDataSet <Roles> rolesPaging = rolesService.GetRoles(rolesQuery, pageIndex.Value, pageSize);

            if (pageIndex > 1 && (rolesPaging == null || rolesPaging.Count() == 0))
            {
                rolesPaging = rolesService.GetRoles(rolesQuery, pageSize, pageIndex.Value - 1);
            }

            return(View(rolesPaging));
        }
        public IActionResult _GetGoodsBrowseLogs(long userId, int?pageIndex, int pageSize = 5)
        {
            if (userId == 0)
            {
                return(Json(new StatusMessageData(StatusMessageType.Error, "没有此用户!")));
            }
            pageIndex = pageIndex ?? 1;
            PagingDataSet <GoodsBrowseLogs> goodsBrowseLogsPading = goodsBrowseLogsService.GetGoodsBrowseLogs(userId, pageIndex.Value, pageSize);

            if (pageIndex > 1 && (goodsBrowseLogsPading == null || goodsBrowseLogsPading.Count() == 0))
            {
                goodsBrowseLogsPading = goodsBrowseLogsService.GetGoodsBrowseLogs(userId, pageSize, pageIndex.Value - 1);
            }

            if (goodsBrowseLogsPading.Count() <= 0)
            {
                return(Json(new StatusMessageData(StatusMessageType.Error, "此用户没有商品浏览记录!")));
            }

            return(View(goodsBrowseLogsPading));
        }
        public IActionResult _GetGoodsCollectionLogs(long userId, int?pageIndex, int pageSize = 5)
        {
            if (userId == 0)
            {
                return(Json(new StatusMessageData(StatusMessageType.Error, "没有此用户!")));
            }
            pageIndex = pageIndex ?? 1;
            PagingDataSet <GoodsCollectionLogs> padingSet = goodsCollectionLogsService.GetGoodsCollectionLogs(userId, pageIndex.Value, pageSize);

            if (pageIndex > 1 && (padingSet == null || padingSet.Count() == 0))
            {
                padingSet = goodsCollectionLogsService.GetGoodsCollectionLogs(userId, pageSize, pageIndex.Value - 1);
            }

            if (padingSet.Count() <= 0)
            {
                return(Json(new StatusMessageData(StatusMessageType.Error, "此用户没有商品收藏记录!")));
            }


            return(View(padingSet));
        }
Esempio n. 5
0
        /// <summary>
        /// 首页秒杀管理
        /// </summary>
        /// <param name="pageIndex"></param>
        /// <param name="pageSize"></param>
        /// <returns></returns>
        public IActionResult HomeSeckillSetting(int?pageIndex, int pageSize = 20)
        {
            ViewBag.Module = "首页模块";
            ViewBag.Site   = "首页秒杀管理";

            pageIndex = pageIndex ?? 1;
            PagingDataSet <HomeDynamicSettings> paging = homeDynamicSettingsService.GetPageHomeDynamic((int)DynamicSettingsType.Seckill, pageIndex.Value, pageSize);

            if (pageIndex > 1 && (paging == null || paging.Count() == 0))
            {
                paging = homeDynamicSettingsService.GetPageHomeDynamic((int)DynamicSettingsType.Seckill, pageSize, pageIndex.Value - 1);
            }
            return(View(paging));
        }
Esempio n. 6
0
        /// <summary>
        /// 管理操作日志
        /// </summary>
        /// <returns></returns>
        public IActionResult ManageOperation(int?pageIndex, int pageSize = 20)
        {
            var from = RequestHelper.GetQueryParams(Request);

            ViewData["currentUser"] = UserContext.CurrentUser;

            OperationLogsQuery query = new OperationLogsQuery();

            query.OperationName = from["name"];
            query.OperationType = from["type"];
            query.Username      = from["username"];

            if (!string.IsNullOrWhiteSpace(query.OperationName))
            {
                ViewData["OperationName"] = query.OperationName;
            }
            if (!string.IsNullOrWhiteSpace(query.Username))
            {
                ViewData["Username"] = query.Username;
            }

            DateTime result = new DateTime();

            if (DateTime.TryParse(from["timeLowerLimit"], out result))
            {
                query.TimeLowerLimit       = from["timeLowerLimit"].AsDateTime();
                ViewData["TimeLowerLimit"] = query.TimeLowerLimit;
            }
            if (DateTime.TryParse(from["timeUpperLimit"], out result))
            {
                query.TimeUpperLimit       = from["timeUpperLimit"].AsDateTime();
                ViewData["TimeUpperLimit"] = query.TimeUpperLimit;
            }

            Dictionary <string, string> values = new Dictionary <string, string> {
                { "LeftMenu", "左侧菜单" }, { "OrdinaryButton", "普通按钮" }
            };

            ViewData["OperationType"] = new SelectList(values.Select(w => new { text = w.Value, value = w.Key.ToString() }), "value", "text", query.OperationType);

            pageIndex = pageIndex ?? 1;
            PagingDataSet <OperationLogs> paging = operationLogsService.GetPageOperationLogs(query, pageIndex.Value, pageSize);

            if (pageIndex > 1 && (paging == null || paging.Count() == 0))
            {
                paging = operationLogsService.GetPageOperationLogs(query, pageSize, pageIndex.Value - 1);
            }
            return(View(paging));
        }
Esempio n. 7
0
        /// <summary>
        /// 首页轮换管理
        /// </summary>
        /// <returns></returns>
        public IActionResult HomeLoopSetting(int?pageIndex, int pageSize = 20)
        {
            ViewBag.Module = "首页模块";
            ViewBag.Site   = "首页动态设置";

            //ViewData["Model"] = new HomeDynamicModel().ToHomeDynamicModel(HomeDynamicSettings.New());

            pageIndex = pageIndex ?? 1;
            PagingDataSet <HomeDynamicSettings> paging = homeDynamicSettingsService.GetPageHomeDynamic((int)DynamicSettingsType.Loop, pageIndex.Value, pageSize);

            if (pageIndex > 1 && (paging == null || paging.Count() == 0))
            {
                paging = homeDynamicSettingsService.GetPageHomeDynamic((int)DynamicSettingsType.Loop, pageSize, pageIndex.Value - 1);
            }
            return(View(paging));
        }
Esempio n. 8
0
        /// <summary>
        /// 评论照片动态
        /// </summary>
        /// <param name="ActivityId"></param>
        /// <returns></returns>
        //[DonutOutputCache(CacheProfile = "Frequently")]
        public ActionResult _CommentPhoto(long ActivityId)
        {
            //实例化动态
            Activity activity = activityService.Get(ActivityId);

            if (activity == null)
            {
                return(Content(string.Empty));
            }
            ViewData["Activity"] = activity;

            //实例化评论
            PagingDataSet <Comment> commentPaging = commentService.GetRootComments(TenantTypeIds.Instance().Photo(), activity.ReferenceId, 1, SortBy_Comment.DateCreatedDesc);
            //去掉评论作者相同的评论然后取前3个
            IEnumerable <long> commentUserIds = commentPaging.AsEnumerable().Select(n => n.UserId).Distinct().Take(3);
            List <Comment>     commentList    = new List <Comment>();

            foreach (var commentUserId in commentUserIds)
            {
                commentList.Add(commentPaging.First(n => n.UserId == commentUserId));
            }
            IEnumerable <Comment> comments = commentList.AsEnumerable();

            if (comments == null)
            {
                return(Content(string.Empty));
            }
            ViewData["CommentCount"] = commentPaging.Count();

            //实例化照片
            Photo photo = photoService.GetPhoto(activity.ReferenceId);

            if (photo == null)
            {
                return(Content(string.Empty));
            }
            ViewData["Photo"] = photo;

            return(View(comments));
        }
        /// <summary>
        /// 查看状态记录
        /// </summary>
        /// <param name="orderId"></param>
        /// <param name="pageIndex"></param>
        /// <param name="pageSize"></param>
        /// <returns></returns>
        public IActionResult SeeStatusLogs(long orderId, int?pageIndex, int pageSize = 5)
        {
            if (orderId == 0)
            {
                return(Json(new StatusMessageData(StatusMessageType.Error, "没有此订单!")));
            }

            pageIndex = pageIndex ?? 1;

            var result = orderStatusLogsService.IsExistsStatusLogs(orderId);

            if (!result)
            {
                return(Json(new StatusMessageData(StatusMessageType.Error, "该订单还未有状态变更记录!")));
            }

            PagingDataSet <OrderStatusLogs> paging = orderStatusLogsService.GetPageOrderStatusLogs(orderId, pageIndex.Value, pageSize);

            if (pageIndex > 1 && (paging == null || paging.Count() == 0))
            {
                paging = orderStatusLogsService.GetPageOrderStatusLogs(orderId, pageSize, pageIndex.Value - 1);
            }
            return(View("_StatusLogs", paging));
        }
Esempio n. 10
0
        public IActionResult _UserFocus(long userId, int?pageIndex, int pageSize = 5)
        {
            if (userId == 0)
            {
                return(Json(new StatusMessageData(StatusMessageType.Error, "没有此用户!")));
            }

            pageIndex = pageIndex ?? 1;

            IEnumerable <long> focusIds = followsService.GetFocusIds(userId);

            if (focusIds.Count() <= 0)
            {
                return(Json(new StatusMessageData(StatusMessageType.Error, "此用户没有关注用户!")));
            }

            PagingDataSet <User> userPaging = userService.GetUsers(focusIds, pageIndex.Value, pageSize);

            if (pageIndex > 1 && (userPaging == null || userPaging.Count() == 0))
            {
                userPaging = userService.GetUsers(focusIds, pageSize, pageIndex.Value - 1);
            }
            return(View(userPaging));
        }
        /// <summary>
        /// 管理订单
        /// </summary>
        /// <param name="keyword"></param>
        /// <param name="type"></param>
        /// <param name="mode"></param>
        /// <param name="rights"></param>
        /// <param name="sort"></param>
        /// <param name="status"></param>
        /// <param name="pay"></param>
        /// <param name="pageIndex"></param>
        /// <param name="pageSize"></param>
        /// <returns></returns>
        public IActionResult ManageOrders(KeyWordEnum keyword, OrderType?type, OrderLogisticsMode?mode, OrderRightsStatus?rights, OrderInfoSortBy?sort, OrderModifyStatus?status, OrderPayType?pay, int?pageIndex, int pageSize = 20)
        {
            var from = RequestHelper.GetQueryParams(Request);

            ViewData["currentUser"] = UserContext.CurrentUser;
            string         keyvalue          = from["keyvalue"];
            OrderInfoQuery query             = new OrderInfoQuery();
            var            isUse             = from["isUse"];
            var            isCompleteComment = from["isCompleteComment"];

            if (!string.IsNullOrWhiteSpace(isUse))
            {
                query.IsUse = isUse.AsBool();
            }
            if (!string.IsNullOrWhiteSpace(isCompleteComment))
            {
                query.IsCompleteComment = isCompleteComment.AsBool();
            }

            if (!string.IsNullOrWhiteSpace(keyvalue))
            {
                ViewData["Keyvalue"] = keyvalue;
                switch (keyword)
                {
                case KeyWordEnum.Buyers:
                    query.Buyers = from["keyvalue"];
                    break;

                case KeyWordEnum.BuyersPhone:
                    query.BuyersPhone = from["keyvalue"];
                    break;

                case KeyWordEnum.OrderNumber:
                    query.OrderNumber = from["keyvalue"];
                    break;

                case KeyWordEnum.WaybillNumber:
                    query.WaybillNumber = from["keyvalue"];
                    break;

                case KeyWordEnum.OtherOrderNumber:
                    query.OtherOrderNumber = from["keyvalue"];
                    break;
                }
            }


            if (sort.HasValue)
            {
                query.OrderInfoSortBy = sort.Value;
                ViewData["Sort"]      = query.OrderInfoSortBy;
            }
            decimal result = decimal.Zero;

            if (decimal.TryParse(from["realPriceLowerLimit"], out result))
            {
                query.RealPriceLowerLimit       = from["realPriceLowerLimit"].AsDecimal();
                ViewData["RealPriceLowerLimit"] = query.RealPriceLowerLimit;
            }

            if (decimal.TryParse(from["realPriceUpperLimit"], out result))
            {
                query.RealPriceUpperLimit       = from["realPriceUpperLimit"].AsDecimal();
                ViewData["RealPriceUpperLimit"] = query.RealPriceUpperLimit;
            }

            DateTime dateResult = DateTime.MinValue;

            if (DateTime.TryParse(from["orderTimeLowerLimit"], out dateResult))
            {
                query.OrderTimeLowerLimit       = dateResult;
                ViewData["OrderTimeLowerLimit"] = query.OrderTimeLowerLimit;
            }

            if (DateTime.TryParse(from["orderTimeUpperLimit"], out dateResult))
            {
                query.OrderTimeUpperLimit       = dateResult;
                ViewData["OrderTimeUpperLimit"] = query.OrderTimeUpperLimit;
            }

            if (!string.IsNullOrWhiteSpace(query.OrderNumber))
            {
                ViewData["OrderNumber"] = query.OrderNumber;
            }
            if (!string.IsNullOrWhiteSpace(query.WaybillNumber))
            {
                ViewData["WaybillNumber"] = query.WaybillNumber;
            }


            Dictionary <int, string> keywordValues = Utility.GetDictionaryByEnumMemberInfo(typeof(KeyWordEnum));

            ViewData["Keyword"] = new SelectList(keywordValues.Select(w => new { text = w.Value, value = w.Key }), "value", "text", query.KeyWordEnum);

            //订单类型
            if (type.HasValue)
            {
                query.OrderType = type;
            }
            Dictionary <int, string> typeValues = Utility.GetDictionaryByEnumMemberInfo(typeof(OrderType));

            ViewData["Type"] = new SelectList(typeValues.Select(w => new { text = w.Value, value = w.Key }), "value", "text", query.OrderType);

            //维权方式
            if (rights.HasValue)
            {
                query.OrderRightsStatus = rights;
            }
            Dictionary <int, string> rightsValues = Utility.GetDictionaryByEnumMemberInfo(typeof(OrderRightsStatus));

            ViewData["Rights"] = new SelectList(rightsValues.Select(w => new { text = w.Value, value = w.Key }), "value", "text", query.OrderRightsStatus);

            //物流方式
            if (mode.HasValue)
            {
                query.OrderType = type;
            }
            Dictionary <int, string> logisticsValues = Utility.GetDictionaryByEnumMemberInfo(typeof(OrderLogisticsMode));

            ViewData["Logistics"] = new SelectList(logisticsValues.Select(w => new { text = w.Value, value = w.Key }), "value", "text", query.OrderLogisticsMode);

            if (status.HasValue)
            {
                query.OrderInfoStatus   = status;
                ViewData["StatusValue"] = (int)status.Value;
            }
            else
            {
                ViewData["StatusValue"] = 0;
            }
            Dictionary <int, string> statusValues = Utility.GetDictionaryByEnumMemberInfo(typeof(OrderModifyStatus));

            ViewData["Status"] = new SelectList(statusValues.Select(w => new { text = w.Value, value = w.Key }), "value", "text", query.OrderInfoStatus);

            if (pay.HasValue)
            {
                query.OrderPayType = pay;
            }
            Dictionary <int, string> payValues = Utility.GetDictionaryByEnumMemberInfo(typeof(OrderPayType));

            ViewData["Pay"] = new SelectList(payValues.Select(w => new { text = w.Value, value = w.Key }), "value", "text", query.OrderPayType);


            Dictionary <bool, string> commentValues = new Dictionary <bool, string> {
                { true, "已完成评价" }, { false, "未完成评价" }
            };

            ViewData["IsCompleteComment"] = new SelectList(commentValues.Select(w => new { text = w.Value, value = w.Key.ToString().ToLower() }), "value", "text", query.IsCompleteComment);


            Dictionary <bool, string> useValues = new Dictionary <bool, string> {
                { true, "已使用优惠券" }, { false, "未使用优惠券" }
            };

            ViewData["IsUse"] = new SelectList(useValues.Select(w => new { text = w.Value, value = w.Key.ToString().ToLower() }), "value", "text", query.IsUse);


            pageIndex = pageIndex ?? 1;
            PagingDataSet <OrderInfo> paging = orderInfoService.GetPageOrderInfo(query, pageIndex.Value, pageSize);

            if (pageIndex > 1 && (paging == null || paging.Count() == 0))
            {
                paging = orderInfoService.GetPageOrderInfo(query, pageSize, pageIndex.Value - 1);
            }
            return(View(paging));
        }
Esempio n. 12
0
        public IActionResult ManageUser(int?pageIndex, int pageSize = 20)
        {
            var from = RequestHelper.GetQueryParams(Request);

            ViewData["currentUser"] = UserContext.CurrentUser;

            UserQuery userQuery = new UserQuery();

            userQuery.Keyword            = from["keyWord"];
            userQuery.AccountEmailFilter = from["accountEmail"];
            userQuery.RoleName           = from["rolename"];

            var isActivated = from["isActivated"];
            var isModerated = from["isModerated"];
            var isBanned    = from["isBanned"];



            if (!string.IsNullOrWhiteSpace(isActivated))
            {
                userQuery.IsActivated = isActivated.AsBool();
            }
            if (!string.IsNullOrWhiteSpace(isModerated))
            {
                userQuery.IsModerated = isModerated.AsBool();
            }
            if (!string.IsNullOrWhiteSpace(isBanned))
            {
                userQuery.IsBanned = isBanned.AsBool();
            }

            int result = 0;

            if (int.TryParse(from["userRankLowerLimit"], out result))
            {
                userQuery.UserRankLowerLimit   = from["userRankLowerLimit"].AsInt();
                ViewData["UserRankLowerLimit"] = userQuery.UserRankLowerLimit;
            }

            if (int.TryParse(from["userRankUpperLimit"], out result))
            {
                userQuery.UserRankUpperLimit   = from["userRankUpperLimit"].AsInt();
                ViewData["UserRankUpperLimit"] = userQuery.UserRankUpperLimit;
            }

            DateTime dateResult = DateTime.MinValue;

            if (DateTime.TryParse(from["registerTimeLowerLimit"], out dateResult))
            {
                userQuery.RegisterTimeLowerLimit   = from["registerTimeLowerLimit"].AsDateTime();
                ViewData["RegisterTimeLowerLimit"] = userQuery.RegisterTimeLowerLimit;
            }

            if (DateTime.TryParse(from["registerTimeUpperLimit"], out dateResult))
            {
                userQuery.RegisterTimeUpperLimit   = from["registerTimeUpperLimit"].AsDateTime();
                ViewData["RegisterTimeUpperLimit"] = userQuery.RegisterTimeUpperLimit;
            }

            if (!string.IsNullOrWhiteSpace(userQuery.Keyword))
            {
                ViewData["Keyword"] = userQuery.Keyword;
            }
            if (!string.IsNullOrWhiteSpace(userQuery.AccountEmailFilter))
            {
                ViewData["AccountEmailFilter"] = userQuery.AccountEmailFilter;
            }


            IEnumerable <Roles> roles = rolesService.GetRoles();

            if (roles != null)
            {
                ViewData["Rolename"] = new SelectList(roles, "Rolename", "FriendlyRolename", userQuery.RoleName);
            }

            Dictionary <bool, string> activatedValues = new Dictionary <bool, string> {
                { true, "已激活" }, { false, "未激活" }
            };

            ViewData["IsActivated"] = new SelectList(activatedValues.Select(w => new { text = w.Value, value = w.Key.ToString().ToLower() }), "value", "text", userQuery.IsActivated);


            Dictionary <bool, string> moderatedValues = new Dictionary <bool, string> {
                { true, "已管制" }, { false, "未管制" }
            };

            ViewData["IsModerated"] = new SelectList(moderatedValues.Select(w => new { text = w.Value, value = w.Key.ToString().ToLower() }), "value", "text", userQuery.IsModerated);

            Dictionary <bool, string> bannedValues = new Dictionary <bool, string> {
                { true, "已封禁" }, { false, "未封禁" }
            };

            ViewData["IsBanned"] = new SelectList(bannedValues.Select(w => new { text = w.Value, value = w.Key.ToString().ToLower() }), "value", "text", userQuery.IsBanned);

            pageIndex = pageIndex ?? 1;
            PagingDataSet <User> userPaging = userService.GetUsers(userQuery, pageIndex.Value, pageSize);

            if (pageIndex > 1 && (userPaging == null || userPaging.Count() == 0))
            {
                userPaging = userService.GetUsers(userQuery, pageSize, pageIndex.Value - 1);
            }
            return(View(userPaging));
        }
Esempio n. 13
0
        public IActionResult ManageAddress(int?pageIndex, int pageSize = 20)
        {
            NameValueCollection from             = RequestHelper.GetQueryParams(Request);
            UserAddressQuery    userAddressQuery = new UserAddressQuery();

            userAddressQuery.Name     = from["name"];
            userAddressQuery.Phone    = from["phone"];
            userAddressQuery.Address  = from["address"];
            userAddressQuery.UserName = from["userName"];

            string isDefault  = from["isDefault"],
                   isDeleted  = from["isDeleted"],
                   provinceid = from["provinceid"],
                   cityid     = from["cityid"],
                   areaid     = from["areaid"],
                   userId     = from["userId"];

            if (!string.IsNullOrWhiteSpace(isDefault))
            {
                userAddressQuery.IsDefault = isDefault.AsBool();
            }
            if (!string.IsNullOrWhiteSpace(isDeleted))
            {
                userAddressQuery.IsDeleted = isDeleted.AsBool();
            }

            if (!string.IsNullOrWhiteSpace(userId))
            {
                userAddressQuery.UserId = long.Parse(userId);
            }
            if (!string.IsNullOrWhiteSpace(provinceid))
            {
                ViewData["provinceid"] = userAddressQuery.Provinceid = provinceid.AsInt();
            }
            if (!string.IsNullOrWhiteSpace(cityid))
            {
                ViewData["cityid"] = userAddressQuery.Cityid = cityid.AsInt();
            }
            if (!string.IsNullOrWhiteSpace(areaid))
            {
                ViewData["areaid"] = userAddressQuery.Areaid = areaid.AsInt();
            }

            if (!string.IsNullOrWhiteSpace(userAddressQuery.UserName))
            {
                ViewData["userName"] = userAddressQuery.UserName;
            }
            if (!string.IsNullOrWhiteSpace(userAddressQuery.Name))
            {
                ViewData["name"] = userAddressQuery.Name;
            }
            if (!string.IsNullOrWhiteSpace(userAddressQuery.Phone))
            {
                ViewData["phone"] = userAddressQuery.Phone;
            }
            if (!string.IsNullOrWhiteSpace(userAddressQuery.Address))
            {
                ViewData["address"] = userAddressQuery.Address;
            }

            Dictionary <bool, string> builtinValues = new Dictionary <bool, string> {
                { true, "是" }, { false, "否" }
            };

            ViewData["IsDeleted"] = ViewData["IsDefault"] = new SelectList(builtinValues.Select(m => new { text = m.Value, value = m.Key.ToString().ToLower() }), "value", "text", userAddressQuery.IsDefault);

            pageIndex = pageIndex ?? 1;
            userAddressQuery.UserAddressSortBy = UserAddressSortBy.Name;

            PagingDataSet <UserAddress> userAddressPaging = userAddressService.GetUserAddress(userAddressQuery, pageIndex.Value, pageSize);

            if (pageIndex > 1 && (userAddressPaging == null || userAddressPaging.Count() == 0))
            {
                userAddressPaging = userAddressService.GetUserAddress(userAddressQuery, pageSize, pageIndex.Value - 1);
            }

            return(View(userAddressPaging));
        }
Esempio n. 14
0
        public ActionResult ManageUsers(int?pageIndex, int pageSize = 30)
        {
            pageResourceManager.InsertTitlePart("用户管理");

            #region 组装搜索条件


            UserQuery query = new UserQuery();
            query.Keyword            = Request.QueryString.GetString("uname", string.Empty);
            query.AccountEmailFilter = Request.QueryString.GetString("uemail", string.Empty);
            query.RoleName           = Request.QueryString.GetString("RoleName", string.Empty);

            if (!string.IsNullOrEmpty(Request.QueryString["IsActivated"]))
            {
                query.IsActivated = Request.QueryString.GetBool("IsActivated", false);
            }

            if (!string.IsNullOrEmpty(Request.QueryString["IsModerated"]))
            {
                query.IsModerated = Request.QueryString.GetBool("IsModerated", false);
            }

            if (!string.IsNullOrEmpty(Request.QueryString["IsBanned"]))
            {
                query.IsBanned = Request.QueryString.GetBool("IsBanned", false);
            }


            int result = 0;
            if (int.TryParse(Request.QueryString["rankstart"], out result))
            {
                query.UserRankLowerLimit = Request.QueryString.GetInt("rankstart", 0);
            }

            if (int.TryParse(Request.QueryString["rankend"], out result))
            {
                query.UserRankUpperLimit = Request.QueryString.GetInt("rankend", 0);
            }

            if (Request.QueryString.Get <DateTime>("startdate") != DateTime.MinValue)
            {
                query.RegisterTimeLowerLimit = Request.QueryString.Get <DateTime>("startdate");
            }

            if (Request.QueryString.Get <DateTime>("enddate") != DateTime.MinValue)
            {
                query.RegisterTimeUpperLimit = Request.QueryString.Get <DateTime>("enddate");
            }

            #endregion

            #region 组装搜索下拉列表

            IEnumerable <Role> roles = roleService.GetRoles();
            if (roles != null)
            {
                ViewData["RoleName"] = new SelectList(roles, "RoleName", "FriendlyRoleName", query.RoleName);
            }

            Dictionary <bool, string> activatedValues = new Dictionary <bool, string> {
                { true, "已激活" }, { false, "未激活" }
            };
            ViewData["IsActivated"] = new SelectList(activatedValues.Select(n => new { text = n.Value, value = n.Key.ToString().ToLower() }), "value", "text", query.IsActivated);

            Dictionary <bool, string> moderatedValues = new Dictionary <bool, string> {
                { true, "管制" }, { false, "未管制" }
            };
            ViewData["IsModerated"] = new SelectList(moderatedValues.Select(n => new { text = n.Value, value = n.Key.ToString().ToLower() }), "value", "text", query.IsModerated);

            Dictionary <bool, string> bannedValues = new Dictionary <bool, string> {
                { true, "封禁" }, { false, "未封禁" }
            };
            ViewData["IsBanned"] = new SelectList(bannedValues.Select(n => new { text = n.Value, value = n.Key.ToString().ToLower() }), "value", "text", query.IsBanned);

            #endregion
            pageIndex = pageIndex ?? 1;
            PagingDataSet <User> users = userService.GetUsers(query, pageSize, pageIndex.Value);
            if (pageIndex > 1 && (users == null || users.Count() == 0))
            {
                users = userService.GetUsers(query, pageSize, pageIndex.Value - 1);
                var dd = Request.Url.Query;
            }

            return(View(users));
        }
        /// <summary>
        /// 管理商品
        /// </summary>
        /// <param name="pageIndex"></param>
        /// <param name="pageSize"></param>
        /// <returns></returns>
        public IActionResult ManageGoods(GoodsInfoSortBy?sort, int?pageIndex, int pageSize = 20, GoodsInfoStatus status = GoodsInfoStatus.Sale)
        {
            var from = RequestHelper.GetQueryParams(Request);

            ViewData["currentUser"] = UserContext.CurrentUser;

            GoodsInfoQuery query = new GoodsInfoQuery();

            query.Keyword         = from["keyWord"];
            query.Keynum          = from["keynum"];
            query.CategoryLavel   = from["categoryLavel"];
            query.GoodsInfoStatus = status;
            ViewData["Status"]    = status;

            if (sort.HasValue)
            {
                query.GoodsInfoSortBy = sort.Value;
                ViewData["Sort"]      = query.GoodsInfoSortBy;
            }
            decimal result = decimal.Zero;

            if (decimal.TryParse(from["goodsPriceLowerLimit"], out result))
            {
                query.GoodsPriceLowerLimit       = from["goodsPriceLowerLimit"].AsDecimal();
                ViewData["GoodsPriceLowerLimit"] = query.GoodsPriceLowerLimit;
            }

            if (decimal.TryParse(from["goodsPriceUpperLimit"], out result))
            {
                query.GoodsPriceUpperLimit       = from["goodsPriceUpperLimit"].AsDecimal();
                ViewData["GoodsPriceUpperLimit"] = query.GoodsPriceUpperLimit;
            }

            int buyResult = 0;

            if (int.TryParse(from["buyCountLowerLimit"], out buyResult))
            {
                query.BuyCountLowerLimit       = from["buyCountLowerLimit"].AsInt();
                ViewData["BuyCountLowerLimit"] = query.BuyCountLowerLimit;
            }

            if (int.TryParse(from["buyCountUpperLimit"], out buyResult))
            {
                query.BuyCountUpperLimit       = from["buyCountTimeUpperLimit"].AsInt();
                ViewData["BuyCountUpperLimit"] = query.BuyCountUpperLimit;
            }

            if (!string.IsNullOrWhiteSpace(query.Keyword))
            {
                ViewData["Keyword"] = query.Keyword;
            }
            if (!string.IsNullOrWhiteSpace(query.Keynum))
            {
                ViewData["Keynum"] = query.Keynum;
            }

            pageIndex = pageIndex ?? 1;
            PagingDataSet <GoodsInfo> paging = goodsInfoService.GetPageGoodsInfo(query, pageIndex.Value, pageSize);

            if (pageIndex > 1 && (paging == null || paging.Count() == 0))
            {
                paging = goodsInfoService.GetPageGoodsInfo(query, pageSize, pageIndex.Value - 1);
            }
            return(View(paging));
        }