public QuickLogOn.Models.QuickLogOnUserInfo GetUserInfo(Orchard.Security.IUser user) { var part = user.As <QQUserInfoPart>(); if (part != null) { part.Record.Loader( () => _repository .Fetch(x => x.UserId == user.Id).FirstOrDefault()); var record = part.Record.Value; if (record != null) { var model = new QuickLogOnUserInfo { UniqueId = record.openid, NickName = record.nickname, HeadimgUrl = record.figureurl_qq_1, Sex = record.gender, Original = record }; return(model); } } return(null); }
public ActionResult List(ListOrdersViewModel model, PagerParameters pagerParameters) { if (!_orchardServices.Authorizer.Authorize(OrderPermissions.ViewOwnOrders, null, T("Cannot view own orders"))) { return(new HttpUnauthorizedResult()); } var pager = new Pager(_siteService.GetSiteSettings(), pagerParameters); var query = _contentManager.Query <OrderPart, OrderPartRecord>(VersionOptions.Latest); var states = OrderPart.States.ToList(); if (model.Options == null) { model.Options = new ContentOptions(); } if (!string.IsNullOrWhiteSpace(model.Options.Search)) { int id; query = int.TryParse(model.Options.Search, out id) ? query.Where(o => o.Id == id) : query.Where(o => o.Customer.Contains(model.Options.Search)); } var filterOption = model.Options.SelectedFilter; if (string.IsNullOrWhiteSpace(filterOption) || filterOption.Equals("active", StringComparison.OrdinalIgnoreCase)) { query = query.Where( o => o.Status != OrderPart.Archived && o.Status != OrderPart.Cancelled); } else if (!filterOption.Equals("any", StringComparison.OrdinalIgnoreCase)) { if (!states.Contains(filterOption)) { return(HttpNotFound()); } query = query.Where(o => o.Status == filterOption); } switch (model.Options.OrderBy) { case ContentsOrder.Modified: query.OrderByDescending <CommonPartRecord>(cr => cr.ModifiedUtc); break; case ContentsOrder.Created: query.OrderByDescending <CommonPartRecord>(cr => cr.CreatedUtc); break; } model.Options.FilterOptions = _orderService.StatusLabels.Select(kvp => new KeyValuePair <string, string>(kvp.Key, kvp.Value.Text)); if (!_orchardServices.Authorizer.Authorize(OrderPermissions.ManageOrders)) { Orchard.Security.IUser currentUser = _orchardServices.WorkContext.CurrentUser; query = query.Join <CommonPartRecord>().Where(c => c.OwnerId == currentUser.Id).Join <OrderPartRecord>(); } var pagerShape = Shape.Pager(pager).TotalItemCount(query.Count()); var pageOfContentItems = query.Slice(pager.GetStartIndex(), pager.PageSize).ToList(); var list = Shape.List(); list.AddRange(pageOfContentItems.Select(ci => _contentManager.BuildDisplay(ci, "SummaryAdmin"))); dynamic viewModel = Shape.ViewModel() .ContentItems(list) .Pager(pagerShape) .Options(model.Options); return(View((object)viewModel)); }
public QuickLogOn.Models.QuickLogOnUserInfo GetUserInfo(Orchard.Security.IUser user) { throw new NotImplementedException(); }