public ActionResult Create(GroupModel model) { var roles = GetForeignData(); ViewBag.Data_RolesList = roles; if (ModelState.IsValid) { try { Group gps = new Group(); gps.Name = model.Name; gps.Description = model.Description; var rolesArray = model.RolesList.Split(',').Select(x => Convert.ToInt32(x)); var RoleList = roleService.GetALL(rolesArray); gps.Roles.AddRange(RoleList); groupService.Create(gps); return RedirectToAction("index"); } catch (Exception ex) { ViewBag.Message = ex.Message; return View(model); } } else { return View(model); } }
public ActionResult Create(GroupModel group) { log4net.Config.XmlConfigurator.Configure(); ILog log = LogManager.GetLogger("Inside Group Controller- Create HttpPost"); try { if (Session["OrganizationGUID"] != null) { if (ModelState.IsValid) { Group Group = new Group(); Group.GroupGUID = Guid.NewGuid(); Group.Name = group.Name; Group.Description = group.Description; Group.OrganizationGUID = new Guid(Session["OrganizationGUID"].ToString()); Group.IsDefault = false; _IGroupRepository.InsertGroup(Group); _IGroupRepository.Save(); return RedirectToAction("Index"); } return View(group); } else { TempData["msg"] = "<script>ModalPopupsAlert('Workers-In-Motion','Session Expired');</script>"; return RedirectToAction("../User/Login"); } } catch (Exception ex) { log.Debug(ex.Message); return View(group); } }
public static RequirementDetailModel ToRequirementDetailModel(this requirement entity, MemberModel member, GroupModel group) { if (entity == null) return null; var model = new RequirementDetailModel() { Description = entity.Description, GroupID = entity.GroupID, GroupName = entity.GroupName, ID = entity.ID, IsPrivate = entity.IsPrivate, MemberID = entity.MemberID, MemberName = entity.MemberName, RequirementTypeName = entity.RequirementTypeName, Title = entity.Title, EndDate = entity.EndDate, StartDate = entity.StartDate, Remark = entity.Remark, Member = member, Group = group, Status = entity.Status }; return model; }
public void Update(GroupModel updatedGroup) { var existing = Get(updatedGroup.Id); if (existing != null) { existing.DisplayName = updatedGroup.DisplayName; existing.Members = updatedGroup.Members; } }
public bool AreUsersLoaded(GroupModel group) { if (group.Users.Count == 1 && group.Users[0] == dummyUser) { return false; } else { return true; } }
public GroupModel GetModel(Group group, bool includeDummy) { GroupModel model = new GroupModel(); model.Name = group.Name; model.Properties = new ThreadSafeObservableCollection<PropertyModel>(); model.Users = new ThreadSafeObservableCollection<UserModel>(); if (includeDummy) { model.Users.Add(dummyUser); } return model; }
/// <summary> /// GroupData convert to GroupModel /// </summary> /// <param name="gd"></param> /// <returns></returns> public GroupModel GroupDataToModel(GroupData gd) { GroupModel gm = new GroupModel() { Description = gd.Description, id = gd.id, isSelected = gd.isSelected, Name = gd.Name, StoriesCount = gd.StoriesCount, UsersCount = gd.UsersCount }; return gm; }
/// <summary> /// GroupModel convert to GroupData /// </summary> /// <param name="gm"></param> /// <returns></returns> public GroupData GroupModelToData(GroupModel gm) { GroupData gd = new GroupData() { Description = gm.Description, id = gm.id, isSelected = gm.isSelected, Name = gm.Name, StoriesCount = gm.StoriesCount, UsersCount= gm.UsersCount }; return gd; }
public ActionResult Create(GroupModel model) { if (ModelState.IsValid) { GroupModel newGroup = GroupService.CreateNewGroup(model); if (newGroup != null) { return RedirectToAction("Index"); } else { return View(model); } } else { return View(model); } }
public IList<EntryModel> FindEntries(GroupModel group) { IList<EntryModel> model = new List<EntryModel> (); PwGroup pg = group.Group; bool bSubEntries = false; PwObjectList<PwEntry> pwlSource = ((pg != null) ? pg.GetEntries (bSubEntries) : new PwObjectList<PwEntry> ()); m_dtCachedNow = DateTime.Now; if (pg != null) { foreach (PwEntry pe in pwlSource) { EntryModel entry = new EntryModel (); entry.Group = group; entry.Entry = pe; string strMain = GetEntryFieldEx (pe, ColumnType.Title, true); entry.Title = strMain; if (pe.Expires && (pe.ExpiryTime <= m_dtCachedNow)) { entry.CustomIconId = (int)PwIcon.Expired; } // get data for the other columns... entry.UserName = GetEntryFieldEx (pe, ColumnType.UserName, true); entry.Password = GetEntryFieldEx (pe, ColumnType.Password, true); entry.Url = GetEntryFieldEx (pe, ColumnType.Url, true); entry.Notes = GetEntryFieldEx (pe, ColumnType.Notes, true); model.Add (entry); } } return model; }
public async Task <ActionResult <GroupModel> > Update(GroupModel userModel) { return(Ok(await groupService.Update(userModel))); }
public void Post(GroupModel @group) { _repository.Add(group); }
private void CreateGroupExecuted() { if (string.IsNullOrEmpty(NewData.GroupName)) { // TODO : set error return; } if (Groups.SingleOrDefault(g => g.Name == NewData.GroupName) != null) { // TODO : set error return; } // TODO : create real group - not necessary var newGroup = new GroupModel {Name = NewData.GroupName, Words = new ObservableCollection<WordModel>()}; Groups.Add(newGroup); NewData.GroupName = string.Empty; SelectedGroup = newGroup; SelectedGroupExecuted(); // TODO : Set message - the group will be created with it's first word only }
private void RecursiveAddGroup(TreeGroupModel tree, GroupModel parent, PwGroup pgContainer, PwGroup pgFind) { if (pgContainer == null) return; IList<GroupModel> tnc; if (parent == null) tnc = tree.Nodes; else tnc = parent.Childs; foreach (PwGroup pg in pgContainer.Groups) { string strName = pg.Name; // + GetGroupSuffixText(pg); int nIconID = ((!pg.CustomIconUuid.EqualsValue (PwUuid.Zero)) ? ((int)PwIcon.Count + db.GetCustomIconIndex (pg.CustomIconUuid)) : (int)pg.IconId); bool bExpired = (pg.Expires && (pg.ExpiryTime <= m_dtCachedNow)); if (bExpired) nIconID = (int) PwIcon.Expired; GroupModel node = new GroupModel () { Name = strName, ImageIndex = nIconID, SelectedImageIndex = nIconID, Group = pg, Expires = pg.Expires, ExpiryTime = pg.ExpiryTime }; tnc.Add (node); RecursiveAddGroup (tree, node, pg, pgFind); } }
public ActionResult Edit(string id = "") { log4net.Config.XmlConfigurator.Configure(); ILog log = LogManager.GetLogger("Inside Group Controller- Edit"); try { if (Session["OrganizationGUID"] != null) { GroupModel group = new GroupModel(); group.GroupGUID = id; Group Group = _IGroupRepository.GetGroupByID(new Guid(group.GroupGUID)); if (Group == null) { return HttpNotFound(); } else { group.GroupGUID = Group.GroupGUID.ToString(); group.Name = Group.Name; group.Description = Group.Description; group.OrganizationGUID = Group.OrganizationGUID.ToString(); } return View(group); } else { TempData["msg"] = "<script>ModalPopupsAlert('Workers-In-Motion','Session Expired');</script>"; return RedirectToAction("../User/Login"); } } catch (Exception ex) { log.Debug(ex.Message); return View(); } }
public OrgUnitGroupPermissionModel(OrgUnitGroupPermission permission) { _permission = permission; _group = new GroupModel(_permission.Group); }
public Task <PlanModel[]> GetGroupPlansAsync(GroupModel group) { return(GetManyAsync <PlanModel>($"groups/{group.Id}/plans")); }
public ActionResult Edit(GroupModel model) { var rolesArray = model.RolesList.Split(',').Select(x => Convert.ToInt32(x)).ToList(); var roles = GetForeignData(rolesArray); ViewBag.Data_RolesList = roles; if (ModelState.IsValid) { try { groupService.Update(model); return RedirectToAction("index"); } catch (Exception ex) { ViewBag.Message = ex.Message; return View(model); } } else { return View(model); } }
public Task <DriveItemModel[]> GetGroupDriveItemsAsync(GroupModel group) { return(GetManyAsync <DriveItemModel>($"groups/{group.Id}/drive/root/children?select=id,name,webUrl")); }
public Task <ConversationModel[]> GetGroupConversationsAsync(GroupModel group) { return(GetManyAsync <ConversationModel>($"groups/{group.Id}/conversations")); }
public Task <UserModel[]> GetGroupUsersAsync(GroupModel group) { return(GetManyAsync <UserModel>($"groups/{group.Id}/members")); }
/* Prawa medyków * 1. Reanimowanie, * 2. Zakuwanie * 3. Prowadzenie, * 4. MDT * */ public Paramedic(GroupModel group) : base(group) { }
public static Group ToEntity(this GroupModel contactModel) { return(Mapper.Map <GroupModel, Group>(contactModel)); }
public void Update(GroupModel updatedGroup) { throw new NotImplementedException(); }
public Task <GroupModel> AddGroupAsync(GroupModel group) { return(PostAsync("groups/", group)); }
public void Post(GroupModel @group) { throw new NotImplementedException(); }
public Task <NewConversationModel> AddGroupConversation(GroupModel group, NewConversationModel conversation) { return(PostAsync($"groups/{group.Id}/threads", conversation)); }
void CreateGroup(object sender, EventArgs args) { var group = new GroupModel(GroupName.Text, Description.Text); viewModel.CreateGroupCommand.Execute(group); }
public RuleWindow(List <ProgramList.ID> ids, FirewallRule rule) { InitializeComponent(); this.Title = Translate.fmt("wnd_rule"); this.grpRule.Header = Translate.fmt("lbl_rule"); this.lblName.Text = Translate.fmt("lbl_name"); this.lblGroup.Text = Translate.fmt("lbl_group"); this.grpProgram.Header = Translate.fmt("lbl_program"); this.lblProgram.Text = Translate.fmt("lbl_program"); this.lblExecutable.Text = Translate.fmt("lbl_exe"); this.lblService.Text = Translate.fmt("lbl_svc"); this.lblApp.Text = Translate.fmt("lbl_app"); this.grpAction.Header = Translate.fmt("grp_action"); this.lblAction.Text = Translate.fmt("lbl_action"); this.radProfileAll.Content = Translate.fmt("lbl_prof_all"); this.radProfileCustom.Content = Translate.fmt("lbl_prof_sel"); this.chkPublic.Content = Translate.fmt("lbl_prof_pub"); this.chkDomain.Content = Translate.fmt("lbl_prof_dmn"); this.chkPrivate.Content = Translate.fmt("lbl_prof_priv"); this.radNicAll.Content = Translate.fmt("lbl_itf_all"); this.radNicCustom.Content = Translate.fmt("lbl_itf_select"); this.chkLAN.Content = Translate.fmt("lbl_itf_lan"); this.chkVPN.Content = Translate.fmt("lbl_itf_vpn"); this.chkWiFi.Content = Translate.fmt("lbl_itf_wifi"); this.grpNetwork.Header = Translate.fmt("grp_network"); this.lblDirection.Text = Translate.fmt("lbl_direction"); this.lblProtocol.Text = Translate.fmt("lbl_protocol"); this.lblLocalPorts.Text = Translate.fmt("lbl_local_port"); this.lblRemotePorts.Text = Translate.fmt("lbl_remote_port"); this.lblICMP.Text = Translate.fmt("lbl_icmp"); this.lblLocalIP.Text = Translate.fmt("lbl_local_ip"); this.lblRemoteIP.Text = Translate.fmt("lbl_remote_ip"); this.btnOK.Content = Translate.fmt("lbl_ok"); this.btnCancel.Content = Translate.fmt("lbl_cancel"); Rule = rule; bool bNew = Rule.guid == Guid.Empty; viewModel = new RuleWindowViewModel(); DataContext = viewModel; //txtName.Text = Rule.Name; viewModel.RuleName = Rule.Name; cmbGroup.ItemsSource = GroupModel.GetInstance().Groups; WpfFunc.CmbSelect(cmbGroup, Rule.Grouping); if (cmbGroup.SelectedItem == null) { cmbGroup.Text = Rule.Grouping; } txtInfo.Text = Rule.Description; foreach (ProgramList.ID id in ids) { ContentControl program = new ContentControl() { Content = id.GetDisplayName(), Tag = id }; cmbProgram.Items.Add(program); if (Rule.mID != null && id.CompareTo(Rule.mID) == 0) { cmbProgram.SelectedItem = program; } } cmbAction.Items.Add(new ContentControl() { Content = Translate.fmt("str_allow"), Tag = Firewall.Actions.Allow }); cmbAction.Items.Add(new ContentControl() { Content = Translate.fmt("str_block"), Tag = Firewall.Actions.Block }); //WpfFunc.CmbSelect(cmbAction, Rule.Action.ToString()); viewModel.RuleAction = WpfFunc.CmbPick(cmbAction, Rule.Action.ToString()); if (Rule.Profile == (int)Firewall.Profiles.All) { radProfileAll.IsChecked = true; chkPrivate.IsChecked = true; chkDomain.IsChecked = true; chkPublic.IsChecked = true; } else { radProfileCustom.IsChecked = true; chkPrivate.IsChecked = ((Rule.Profile & (int)Firewall.Profiles.Private) != 0); chkDomain.IsChecked = ((Rule.Profile & (int)Firewall.Profiles.Domain) != 0); chkPublic.IsChecked = ((Rule.Profile & (int)Firewall.Profiles.Public) != 0); } if (Rule.Interface == (int)Firewall.Interfaces.All) { radNicAll.IsChecked = true; chkLAN.IsChecked = true; chkVPN.IsChecked = true; chkWiFi.IsChecked = true; } else { radNicCustom.IsChecked = true; chkLAN.IsChecked = ((Rule.Interface & (int)Firewall.Interfaces.Lan) != 0); chkVPN.IsChecked = ((Rule.Interface & (int)Firewall.Interfaces.RemoteAccess) != 0); chkWiFi.IsChecked = ((Rule.Interface & (int)Firewall.Interfaces.Wireless) != 0); } if (bNew) { cmbDirection.Items.Add(new ContentControl() { Content = Translate.fmt("str_inandout"), Tag = Firewall.Directions.Bidirectiona }); } cmbDirection.Items.Add(new ContentControl() { Content = Translate.fmt("str_outbound"), Tag = Firewall.Directions.Outboun }); cmbDirection.Items.Add(new ContentControl() { Content = Translate.fmt("str_inbound"), Tag = Firewall.Directions.Inbound }); WpfFunc.CmbSelect(cmbDirection, Rule.Direction.ToString()); cmbProtocol.Items.Add(new ContentControl() { Content = Translate.fmt("pro_any"), Tag = (int)NetFunc.KnownProtocols.Any }); for (int i = (int)NetFunc.KnownProtocols.Min; i <= (int)NetFunc.KnownProtocols.Max; i++) { string name = NetFunc.Protocol2Str(i); if (name != null) { cmbProtocol.Items.Add(new ContentControl() { Content = i.ToString() + " - " + name, Tag = i }); } } //if (!WpfFunc.CmbSelect(cmbProtocol, Rule.Protocol.ToString())) // cmbProtocol.Text = Rule.Protocol.ToString(); viewModel.Protocol = WpfFunc.CmbPick(cmbProtocol, Rule.Protocol.ToString()); if (viewModel.Protocol == null) { viewModel.ProtocolTxt = Rule.Protocol.ToString(); } UpdatePorts(); addrDest.Address = Rule.RemoteAddresses; addrSrc.Address = Rule.LocalAddresses; WpfFunc.LoadWnd(this, "Rule"); }
public ActionResult Delete(string id = "") { log4net.Config.XmlConfigurator.Configure(); ILog log = LogManager.GetLogger("Inside Group Controller- Delete"); try { if (Session["OrganizationGUID"] != null) { GroupModel group = new GroupModel(); group.GroupGUID = id; _IGroupRepository.DeleteGroup(new Guid(group.GroupGUID)); _IGroupRepository.Save(); return RedirectToAction("Index"); } else { TempData["msg"] = "<script>ModalPopupsAlert('Workers-In-Motion','Session Expired');</script>"; return RedirectToAction("../User/Login"); } } catch (Exception ex) { log.Debug(ex.Message); return RedirectToAction("Index"); } }
protected void Page_Load(object sender, EventArgs e) { if (Request.QueryString["ID"] != null) { id = int.Parse(Request.QueryString["ID"].ToString()); } if (!IsPostBack) { txtTime.Text = DateTime.Now.ToString("yyyy-MM-dd"); if (id > 0) { Group = service.Get_GroupModel(id); LoadPage(); } } }
public void Update(GroupModel model) { var rolesArray = model.RolesList.Split(',').Select(x => Convert.ToInt32(x)).ToList(); var target = IncludeFind(model.ID); DB_Service.Attach<Group>(target); target.Name = model.Name; target.Description = model.Description; var RoleList = roleService.GetALL(rolesArray); var currentroleArray = target.Roles.Select(x => x.ID).ToList(); foreach (Roles rl in roleService.GetALL()) { if (rolesArray.Contains(rl.ID)) { if (!currentroleArray.Contains(rl.ID)) { target.Roles.Add(rl); } } else { if (currentroleArray.Contains(rl.ID)) { target.Roles.Remove(rl); } } } DB_Service.Commit(); }
public void GetAllGroupsOfUser() { InMemoryDbContextFactory Db = new InMemoryDbContextFactory(); var dbContext = Db.CreateDbContext(); GroupMemberRepository groupMemberRepository = new GroupMemberRepository(dbContext); GroupRepository groupRepository = new GroupRepository(dbContext); GroupModel groupModel1 = new GroupModel { Id = Guid.NewGuid(), Name = "První skupina", Description = "Popisek1", }; GroupModel groupModel2 = new GroupModel { Id = Guid.NewGuid(), Name = "Druhá skupina", Description = "Popisek2", }; GroupModel groupModel3 = new GroupModel { Id = Guid.NewGuid(), Name = "Třetí skupina", Description = "Popisek3", }; UserModel userModel1 = new UserModel { Id = Guid.NewGuid(), Name = "Karel", Surname = "Vlach", Email = "*****@*****.**", Password = "******", TelephoneNumber = "+420420420420", }; UserModel userModel2 = new UserModel { Id = Guid.NewGuid(), Name = "Pavel", Surname = "Vlach", Email = "*****@*****.**", Password = "******", TelephoneNumber = "+420420420420", }; UserModel userModel3 = new UserModel { Id = Guid.NewGuid(), Name = "Martin", Surname = "Vlach", Email = "*****@*****.**", Password = "******", TelephoneNumber = "+420420420420", }; groupRepository.Insert(groupModel1); groupRepository.Insert(groupModel2); groupRepository.Insert(groupModel3); var groupRepositoryResponse1 = groupRepository.GetById(groupModel1.Id); var groupRepositoryResponse2 = groupRepository.GetById(groupModel2.Id); var groupRepositoryResponse3 = groupRepository.GetById(groupModel3.Id); Assert.NotNull(groupRepositoryResponse1); Assert.NotNull(groupRepositoryResponse2); Assert.NotNull(groupRepositoryResponse3); GroupMemberModel groupMemberModel1 = new GroupMemberModel { Id = Guid.NewGuid(), Group = groupModel1, User = userModel1, Permission = PermissionEnum.User }; GroupMemberModel groupMemberModel2 = new GroupMemberModel { Id = Guid.NewGuid(), Group = groupModel2, User = userModel2, Permission = PermissionEnum.User }; GroupMemberModel groupMemberModel3 = new GroupMemberModel { Id = Guid.NewGuid(), Group = groupModel2, User = userModel1, Permission = PermissionEnum.Admin }; dbContext.DetachAllEntities(); groupMemberRepository.Insert(groupMemberModel1); groupMemberRepository.Insert(groupMemberModel2); groupMemberRepository.Insert(groupMemberModel3); var groupMemberRepositoryResponse1 = groupMemberRepository.GetById(groupMemberModel1.Id); var groupMemberRepositoryResponse2 = groupMemberRepository.GetById(groupMemberModel2.Id); var groupMemberRepositoryResponse3 = groupMemberRepository.GetById(groupMemberModel3.Id); Assert.NotNull(groupMemberRepositoryResponse1); Assert.NotNull(groupMemberRepositoryResponse2); Assert.NotNull(groupMemberRepositoryResponse3); var groupRepositoryResponseUsers = groupRepository.GetAllGroupsByEmail("*****@*****.**"); Assert.NotNull(groupRepositoryResponseUsers); Assert.Equal(groupRepositoryResponseUsers.ElementAt(0).Id, groupModel1.Id); Assert.Equal(groupRepositoryResponseUsers.ElementAt(1).Id, groupModel2.Id); }
public TreeGroupModel FindGroups() { TreeGroupModel model = new TreeGroupModel (); DateTime m_dtCachedNow = DateTime.Now; GroupModel root = null; // add root if exists if (db.RootGroup != null) { int nIconID = ((!db.RootGroup.CustomIconUuid.EqualsValue (PwUuid.Zero)) ? ((int)PwIcon.Count + db.GetCustomIconIndex ( db.RootGroup.CustomIconUuid)) : (int)db.RootGroup.IconId); if (db.RootGroup.Expires && (db.RootGroup.ExpiryTime <= m_dtCachedNow)) nIconID = (int) PwIcon.Expired; root = new GroupModel () { Name = db.RootGroup.Name, ImageIndex = nIconID, SelectedImageIndex = nIconID, Group = db.RootGroup, Expires = db.RootGroup.Expires, ExpiryTime = db.RootGroup.ExpiryTime }; model.Nodes.Add (root); } RecursiveAddGroup (model, root, db.RootGroup, null); return model; }
public CPU(GroupModel group, string ClientID) { Group = group; InitializeComponent(); GetPerformanceInfo(ClientID); }
public void SetGroup(GroupModel group) { model.SetGroup(group); }
public ActionResult Edit(int id) { GroupModel gpm = new GroupModel(); Group gps = new Group(); gps = groupService.IncludeFind(id); gpm.ID = gps.GroupID; gpm.Name = gps.Name; gpm.Description = gps.Description; List<int> RolesList = new List<int>(); RolesList = gps.Roles.Select(x => x.ID).ToList(); var roles = GetForeignData(RolesList); ViewBag.Data_RolesList = roles; return View(gpm); }
public ActionResult Create() { GroupModel model = new GroupModel(); return View(model); }
public ULS(GroupModel group, string ClientId) { Group = group; InitializeComponent(); GetULSInfo(ClientId); }
public void Load(Guid id) { model = repository.GetById(id); }
public ShowSubjectsDialogViewModel() { var groupmodel = new GroupModel(); _groupsList = groupmodel.GetConnectionedList(); }