/// <summary> /// 创建一个群组 /// </summary> /// <param name="gname">要创建的群组的名称</param> /// <param name="ispublic">是否公开群组,“0”表示私有群组,1表示公开群组</param> /// <returns></returns> public GroupListModel Create(string gname, string ispublic) { GroupListModel Group = new GroupListModel(); Group.Error_Code = "10001"; if (string.IsNullOrEmpty(gname)) { return(Group); } List <Parameter> Que = new List <Parameter>(); Que.Add(new Parameter("g_name", gname)); if (!string.IsNullOrEmpty(ispublic)) { Que.Add(new Parameter("is_public", ispublic)); } string Result = base.SyncRequest(TypeOption.MD_GROUP_CREATE, Que, null); if (!string.IsNullOrEmpty(Result)) { return(XmlSerializationHelper.XmlToObject <GroupListModel>(Result)); } return(null); }
public virtual ActionResult Group() { var model = new GroupListModel(); model.Active = _comm.GetActiveList(); return(View(model)); }
private void PopulateCartList() { if (App.ProductsInCart != null && App.ProductsInCart.Count > 0) { Items = new ObservableCollection <object>(); var deliveryProducts = App.ProductsInCart.Where(p => p.DeliveryType == DeliveryType.HomeDelivery)?.ToList(); var takeAwayProducts = App.ProductsInCart.Where(p => p.DeliveryType == DeliveryType.TakeAway)?.ToList(); if (takeAwayProducts != null && takeAwayProducts.Count > 0) { var groupModel = new GroupListModel { GroupTitle = "Take away items", GroupImageSource = ImageSource.FromFile("ic_take_away.png"), GroupQuantity = takeAwayProducts.Count }; var listItems = new ObservableCollection <ListItem>(); foreach (ProductModel product in takeAwayProducts) { var listItem = new ListItem { Title = product.title, Price = product.Price, Quantity = product.Quantity, Size = product.Size, Model = product }; if (!string.IsNullOrEmpty(product.photoUrl)) { listItem.ImageSource = ImageSource.FromUri(new Uri(product.photoUrl)); } listItems.Add(listItem); } Items.Add(new Grouping <GroupListModel, ListItem>(groupModel, listItems)); } if (deliveryProducts != null && deliveryProducts.Count > 0) { var groupModel = new GroupListModel { GroupTitle = "Delivery items", GroupImageSource = ImageSource.FromFile("ic_deliver_items.png"), GroupQuantity = takeAwayProducts.Count }; var listItems = new ObservableCollection <ListItem>(); foreach (ProductModel product in deliveryProducts) { var listItem = new ListItem { Title = product.title, Price = product.Price, Quantity = product.Quantity, Size = product.Size, ImageSource = ImageSource.FromUri(new Uri(product.photoUrl)), Model = product }; listItems.Add(listItem); } Items.Add(new Grouping <GroupListModel, ListItem>(groupModel, listItems)); } } }
private async void MyTappedItem(object sender, ItemTappedEventArgs e) { //Get selected item and convert it back to Original Data type var selectedItem = e.Item as GroupListModel; GroupListModel group = new GroupListModel() { groupName = selectedItem.groupName, groupID = selectedItem.groupID }; //Add Data to Storage/Cache var json = JsonSerializer.Serialize <GroupListModel>(group); if (!Application.Current.Properties.ContainsKey("CurrentGroup")) { Application.Current.Properties.Add("CurrentGroup", json); } else { Application.Current.Properties["CurrentGroup"] = json; } //Navigate to Modal page await Navigation.PushModalAsync(new ChatPage()); }
public async Task InitialAccountInfo(Account account) { GroupListModel groupsModel = await this.InvokeAction <GroupListModel>(SettingModel.act_friendshipGroups, -1, -1); account.Groups.AddRange(groupsModel.Groups); var statusList = (await this.InvokeAction <StatusList>(SettingModel.act_statusesFriendsTimeLine, -1, -1)); account.Statuses.AddRange(statusList.Statuses); }
public async Task <IActionResult> Index() { if (CurrentUser.UserName == null) { CurrentUser.UserName = User.Identity.Name; } var currentUserId = this.userService.GetCurrUser().Id; var gr = await this.groupService.GetGroupsAsync(); var groups = gr.Select(x => GroupListModel.FromDTO(x)).Where(x => x.UserIDs.Contains(currentUserId)) .ToList(); return(View(groups)); }
public async Task <ActionResult> Index(GroupListModel model, int page = 1, int pageSize = 20) { using (ZavrsniEFentities db = new ZavrsniEFentities()) { var currentUser = User.Identity.GetUserName(); var user = db.User.FirstOrDefault(u => u.Username.Equals(currentUser)); var groups = (from u in db.Group where u.IDgroupOwner == user.IDuser || u.IDgroupOwner == null orderby u.Name select u).Include(u => u.GroupType).Include(u => u.User); model.GroupList = new PagedList <Group>(groups, page, pageSize); return(View(model)); } }
// GET api/<controller> public GroupListModel Get(int employeeId, int page, int rows) { var employeeType = (EmployeeType)employeeId; int totalRecords; var model = new GroupListModel { Rows = GroupRepository.Search(employeeType, string.Empty, page, rows, out totalRecords), Page = page, Total = (totalRecords / rows) + 1, Records = rows, UserData = totalRecords }; if (model.Rows != null) { var branchId = UserContext.GetDefaultBranch(); model.Rows = model.Rows.Where(c => c.BranchId == branchId).ToList(); } return(model); }
public virtual ActionResult GroupList(DataSourceRequest command, GroupListModel model) { if (string.IsNullOrEmpty(model.GroupName) && string.IsNullOrEmpty(model.Description) && model.IsActive_ID == 0) { var GroupItems = _groupService.GetAllGroups(); var gridModel = new DataSourceResult { Data = GroupItems.Select(x => new GroupModel { GroupName = x.GroupName, IsActive_ID = x.Active, Group_ID = x.Group_ID, IsActive = _comm.GetLiteralByInt(x.Active), Description = x.Description, LastUpdateUser_ID = x.LastUpdateUser_ID }), Total = GroupItems.Count() }; return(Json(gridModel)); } else { var UserItems = _groupService.SearchGroups(model.GroupName, model.Description, model.IsActive_ID); var gridModel = new DataSourceResult { Data = UserItems.Select(x => new GroupModel { GroupName = x.GroupName, Description = x.Description, Group_ID = x.Group_ID, LastUpdateUser_ID = x.LastUpdateUser_ID, IsActive_ID = x.Active, IsActive = _comm.GetLiteralByInt(x.Active) }), Total = UserItems.Count() }; return(Json(gridModel)); } }
public ActionResult Index(GroupFilter filter, FetchOptoins fetchOptoins, int page = 0) { int pageSize = 5; if (page < 0) { page = 0; } fetchOptoins.First = page * pageSize; fetchOptoins.Count = pageSize; var model = new GroupListModel { Items = groupRepository.Find(filter, fetchOptoins), CurrentPage = page, }; return(View(model)); }
public BindableCollection <GroupListModel> GetGroupList(HttpClient client) { BindableCollection <GroupListModel> groups = new BindableCollection <GroupListModel>(); HttpResponseMessage response = client.GetAsync("Relativity.REST/Relativity/Group").Result; string jsonString; if (response.IsSuccessStatusCode) { jsonString = response.Content.ReadAsStringAsync().Result; } else { throw new Exception("Failed to get groups from Relativity"); } JObject jsonObject = JObject.Parse(jsonString); foreach (JToken result in jsonObject["Results"]) { if (!int.TryParse(result["Artifact ID"].ToString(), out int artifactId)) { throw new Exception("Unable to cast user ArtifactID to Int32"); } GroupListModel group = new GroupListModel { ArtifactId = artifactId, Name = result["Relativity Text Identifier"].ToString(), }; groups.Add(group); } return(groups); }
public ActionResult GroupList() { return(View(@"~/Areas/Manager/Views/Settings/GroupList.cshtml", GroupListModel.Get())); }
public ActionResult GroupSummary(string courseCode) { GroupListModel glm = new GroupListModel(); currentCourseCode = courseCode; glm.CourseCode = courseCode; glm.SuggestedGroups = null; glm.AllGroups = null; GroupSummaryForUser gsfu = _groupCom.GetGroupSummary(User.Identity.Name, courseCode); if (gsfu != null) { //if(string.IsNullOrWhiteSpace(gsfu.registeredGroupCode)) //show group summary //{ if (gsfu.registeredGroup != null) { glm.registeredGroup = new GT.BuddyUp.WebApp.Models.GroupSummary() { GroupCode = gsfu.registeredGroup.GroupCode, GroupName = gsfu.registeredGroup.GroupName, Objective = gsfu.registeredGroup.Objective, TimeZone = gsfu.registeredGroup.activeTimeZone }; } if (gsfu.suggestedGroups != null && gsfu.suggestedGroups.Count > 0) { glm.SuggestedGroups = new List <GT.BuddyUp.WebApp.Models.GroupSummary>(); foreach (var grp in gsfu.suggestedGroups) { glm.SuggestedGroups.Add(new GT.BuddyUp.WebApp.Models.GroupSummary() { GroupCode = grp.GroupCode, GroupName = grp.GroupName, TimeZone = grp.activeTimeZone, Objective = grp.Objective }); } } if (gsfu.AllGroups != null && gsfu.AllGroups.Count > 0) { glm.AllGroups = new List <GT.BuddyUp.WebApp.Models.GroupSummary>(); foreach (var grp in gsfu.AllGroups) { glm.AllGroups.Add(new GT.BuddyUp.WebApp.Models.GroupSummary() { GroupCode = grp.GroupCode, GroupName = grp.GroupName, TimeZone = grp.activeTimeZone, Objective = grp.Objective }); } } return(View(glm)); //} //else//redirect to group detail page //{ // return RedirectToAction("GroupDetail", "Group", routeValues: new { groupCode = gsfu.registeredGroupCode }); //} } ModelState.AddModelError("", "Oops! Something wrong happened! Please try again."); return(View(glm)); }
public async Task <GroupListModel> GroupList([FromBody] GroupListQueryModel model) { var userId = userManager.GetUserId(User); var groups = await groupService.QueryGroupAsync(userId); var ret = new GroupListModel(); if (model.Filter.Id != 0) { groups = groups.Where(i => i.Id == model.Filter.Id); } if (!string.IsNullOrEmpty(model.Filter.Name)) { groups = groups.Where(i => i.Name.Contains(model.Filter.Name)); } var groupJoin = await groupService.QueryGroupJoinRecordsAsync(); if (model.Filter.Status.Count < 2) { if (!string.IsNullOrEmpty(userId)) { foreach (var status in allStatus) { if (!model.Filter.Status.Contains(status)) { groups = status switch { 0 => groups.Where(i => groupJoin.Any(j => j.GroupId == i.Id && j.UserId == userId)), 1 => groups.Where(i => !groupJoin.Any(j => j.GroupId == i.Id && j.UserId == userId)), _ => groups }; } } } } if (model.RequireTotalCount) { ret.TotalCount = await groups.Select(i => i.Id).CountAsync(); } groups = groups.OrderByDescending(i => i.Id); if (model.StartId == 0) { groups = groups.Skip(model.Start); } else { groups = groups.Where(i => i.Id <= model.StartId); } ret.Groups = await groups.Take(model.Count).Select(i => new GroupListModel.GroupListItemModel { Id = i.Id, CreationTime = i.CreationTime, IsPrivate = i.IsPrivate, Name = i.Name, UserId = i.UserId, UserName = i.UserInfo.UserName }).ToListAsync(); return(ret); }
public async Task <ActionResult> Configure(string id) { ActionResult result = null; if (id.Equals("Users", System.StringComparison.CurrentCultureIgnoreCase)) { var model = new UserListModel(); (await Users.GetUsers()).ForEach(i => { model.Users.Add(new UserModel() { Enabled = i.Enabled, Name = i.Name, FirstName = i.FirstName, LastName = i.LastName, Username = i.Username, Email = i.Email, Role = i.Role, Gravatar = i.Gravatar, Theme = i.Theme }); }); (await Roles.GetRoles()).ForEach(i => { model.Roles.Add(new RoleModel() { Name = i.Name, Builtin = i.Builtin }); }); result = View("Users", model); } if (id.Equals("Roles", System.StringComparison.CurrentCultureIgnoreCase)) { var model = new RoleListModel(); (await Roles.GetRoles()).ForEach(i => { model.Roles.Add(new RoleModel() { Name = i.Name, Builtin = i.Builtin }); }); result = View("Roles", model); } if (id.Equals("Pages", System.StringComparison.CurrentCultureIgnoreCase)) { var model = new PageListModel(); (await Pages.GetPages()).ForEach(i => { model.Pages.Add(new PageModel() { Group = i.Group, Name = i.Name, Url = i.Url, AbsoluteUrl = string.Format("{0}://{1}:{2}{3}", Request.Url.Scheme, Request.Url.Host, Request.Url.Port, i.Url.Replace("/", "/?")) }); }); result = View("Pages", model); } if (id.Equals("Groups", System.StringComparison.CurrentCultureIgnoreCase)) { var model = new GroupListModel(); (await Groups.GetGroups()).ForEach(i => { model.Groups.Add(new GroupModel() { Name = i.Name, Builtin = i.Builtin }); }); result = View("Groups", model); } if (id.Equals("Authorization", System.StringComparison.CurrentCultureIgnoreCase)) { var model = new PolicyListModel(); (await Roles.GetRoles()).ForEach(i => { model.Roles.Add(new RoleModel() { Name = i.Name, Builtin = i.Builtin }); }); (await Groups.GetGroups()).ForEach(i => { model.Groups.Add(new GroupModel() { Name = i.Name, Builtin = i.Builtin }); }); (await Policies.GetPolicies()).ForEach(i => { model.Policies.Add(new PolicyModel() { Role = i.Role, Group = i.Group, Effect = i.Effect ? "ALLOW" : "DENY" }); }); result = View("Authorization", model); } return(result); }
public ActionResult GroupList() { return(View("GroupList", GroupListModel.Get())); }