Changeset 7639
- Timestamp:
- 03/20/12 13:39:59 (13 years ago)
- Location:
- branches/ClientUserManagement
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/ClientUserManagement/HeuristicLab.Clients.Access.Administration/3.3/Views/UserGroupView.Designer.cs
r7637 r7639 28 28 this.groupNameTextBox = new System.Windows.Forms.TextBox(); 29 29 this.idTextBox = new System.Windows.Forms.TextBox(); 30 this.refreshableLightweightUserView = new HeuristicLab.Clients.Access.Views.RefreshableLightweightUserView(); 31 this.storeButton = new System.Windows.Forms.Button(); 30 32 this.SuspendLayout(); 31 33 // … … 50 52 // groupNameTextBox 51 53 // 52 this.groupNameTextBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) 53 | System.Windows.Forms.AnchorStyles.Right)));54 this.groupNameTextBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) 55 | System.Windows.Forms.AnchorStyles.Right))); 54 56 this.groupNameTextBox.Location = new System.Drawing.Point(79, 3); 55 57 this.groupNameTextBox.Name = "groupNameTextBox"; 56 this.groupNameTextBox.Size = new System.Drawing.Size( 282, 20);58 this.groupNameTextBox.Size = new System.Drawing.Size(675, 20); 57 59 this.groupNameTextBox.TabIndex = 2; 58 60 this.groupNameTextBox.TextChanged += new System.EventHandler(this.groupNameTextBox_TextChanged); … … 60 62 // idTextBox 61 63 // 62 this.idTextBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) 63 | System.Windows.Forms.AnchorStyles.Right)));64 this.idTextBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) 65 | System.Windows.Forms.AnchorStyles.Right))); 64 66 this.idTextBox.Enabled = false; 65 67 this.idTextBox.Location = new System.Drawing.Point(79, 29); 66 68 this.idTextBox.Name = "idTextBox"; 67 this.idTextBox.Size = new System.Drawing.Size( 282, 20);69 this.idTextBox.Size = new System.Drawing.Size(675, 20); 68 70 this.idTextBox.TabIndex = 3; 71 // 72 // refreshableLightweightUserView 73 // 74 this.refreshableLightweightUserView.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) 75 | System.Windows.Forms.AnchorStyles.Left) 76 | System.Windows.Forms.AnchorStyles.Right))); 77 this.refreshableLightweightUserView.Caption = "RefreshableLightweightUser View"; 78 this.refreshableLightweightUserView.Content = null; 79 this.refreshableLightweightUserView.FetchSelectedUsers = null; 80 this.refreshableLightweightUserView.Location = new System.Drawing.Point(0, 55); 81 this.refreshableLightweightUserView.Name = "refreshableLightweightUserView"; 82 this.refreshableLightweightUserView.ReadOnly = false; 83 this.refreshableLightweightUserView.Size = new System.Drawing.Size(754, 282); 84 this.refreshableLightweightUserView.TabIndex = 4; 85 // 86 // storeButton 87 // 88 this.storeButton.Image = HeuristicLab.Common.Resources.VSImageLibrary.PublishToWeb; 89 this.storeButton.Location = new System.Drawing.Point(31, 58); 90 this.storeButton.Name = "storeButton"; 91 this.storeButton.Size = new System.Drawing.Size(24, 24); 92 this.storeButton.TabIndex = 5; 93 this.storeButton.UseVisualStyleBackColor = true; 94 this.storeButton.Click += new System.EventHandler(this.storeButton_Click); 69 95 // 70 96 // UserGroupView … … 72 98 this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); 73 99 this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; 100 this.Controls.Add(this.storeButton); 101 this.Controls.Add(this.refreshableLightweightUserView); 74 102 this.Controls.Add(this.idTextBox); 75 103 this.Controls.Add(this.groupNameTextBox); … … 77 105 this.Controls.Add(this.label1); 78 106 this.Name = "UserGroupView"; 79 this.Size = new System.Drawing.Size( 364, 54);107 this.Size = new System.Drawing.Size(757, 340); 80 108 this.ResumeLayout(false); 81 109 this.PerformLayout(); … … 89 117 private System.Windows.Forms.TextBox groupNameTextBox; 90 118 private System.Windows.Forms.TextBox idTextBox; 119 private Views.RefreshableLightweightUserView refreshableLightweightUserView; 120 private System.Windows.Forms.Button storeButton; 91 121 } 92 122 } -
branches/ClientUserManagement/HeuristicLab.Clients.Access.Administration/3.3/Views/UserGroupView.cs
r7637 r7639 20 20 #endregion 21 21 22 using System; 23 using System.Collections.Generic; 22 24 using HeuristicLab.Core.Views; 23 25 using HeuristicLab.MainForm; … … 42 44 groupNameTextBox.Clear(); 43 45 idTextBox.Clear(); 46 47 refreshableLightweightUserView.Content = null; 48 refreshableLightweightUserView.FetchSelectedUsers = null; 44 49 } else { 45 50 groupNameTextBox.Text = Content.Name; 46 51 idTextBox.Text = Content.Id.ToString(); 52 53 refreshableLightweightUserView.Content = Access.AccessClient.Instance; 54 refreshableLightweightUserView.FetchSelectedUsers = new Func<List<Guid>>(delegate { return AccessAdministrationClient.CallAccessService<List<Guid>>(s => s.GetUserGroupIdsOfGroup(Content.Id)); }); 47 55 } 48 56 } … … 52 60 Content.Name = this.groupNameTextBox.Text; 53 61 } 62 63 private void storeButton_Click(object sender, EventArgs e) { 64 Action storeAction = new Action(delegate { 65 foreach (var ug in refreshableLightweightUserView.GetCheckedUsers()) { 66 AccessAdministrationClient.CallAccessService(s => s.AddUserGroupBaseToGroup(ug, Content)); 67 } 68 }); 69 70 Action deleteAction = new Action(delegate { 71 foreach (var ug in refreshableLightweightUserView.GetDeletedUsers()) { 72 AccessAdministrationClient.CallAccessService(s => s.RemoveUserGroupBaseFromGroup(ug, Content)); 73 } 74 }); 75 76 AccessAdministrationClient.Instance.ExecuteActionAsync(storeAction, PluginInfrastructure.ErrorHandling.ShowErrorDialog); 77 AccessAdministrationClient.Instance.ExecuteActionAsync(deleteAction, PluginInfrastructure.ErrorHandling.ShowErrorDialog); 78 } 54 79 } 55 80 } -
branches/ClientUserManagement/HeuristicLab.Clients.Access.Views/3.3/UserViews/RefreshableLightweightUserView.cs
r7555 r7639 38 38 39 39 //set an action like a webservice call to retrieve the users which should be marked as checked 40 public Func<List<Guid>> FetchSelectedUsers { get; set; } 40 private Func<List<Guid>> fetchSelectedUsers; 41 public Func<List<Guid>> FetchSelectedUsers { 42 get { return fetchSelectedUsers; } 43 set { 44 fetchSelectedUsers = value; 45 selectedUsers = null; 46 lightweightUserView.Content = null; 47 } 48 } 49 41 50 private List<Guid> selectedUsers; 51 52 protected override void OnContentChanged() { 53 base.OnContentChanged(); 54 55 selectedUsers = null; 56 lightweightUserView.Content = null; 57 } 42 58 43 59 protected override void RefreshData() { … … 66 82 } 67 83 84 public IItemList<UserGroupBase> GetDeletedUsers() { 85 if (lightweightUserView.Content == null) { 86 return null; 87 } else { 88 var deletedIds = selectedUsers.Where(x => lightweightUserView.Content.Count(y => y.Id == x) == 0); 89 List<UserGroupBase> deletedUGs = Content.UsersAndGroups.Where(x => deletedIds.Contains(x.Id)).ToList(); 90 return new ItemList<UserGroupBase>(deletedUGs); 91 } 92 } 93 68 94 public IItemList<UserGroupBase> GetCheckedUsers() { 69 return (lightweightUserView.Content == null) ? null : lightweightUserView.Content;95 return (lightweightUserView.Content == null) ? null : new ItemList<UserGroupBase>(lightweightUserView.Content.Where(x => !selectedUsers.Contains(x.Id))); 70 96 } 71 97 -
branches/ClientUserManagement/HeuristicLab.Clients.Access/3.3/ServiceClients/AccessServiceClient.cs
r7612 r7639 2 2 // <auto-generated> 3 3 // This code was generated by a tool. 4 // Runtime Version:4.0.30319. 2614 // Runtime Version:4.0.30319.530 5 5 // 6 6 // Changes to this file may cause incorrect behavior and will be lost if … … 28 28 [System.Runtime.Serialization.KnownTypeAttribute(typeof(HeuristicLab.Clients.Access.ClientLog))] 29 29 [System.Runtime.Serialization.KnownTypeAttribute(typeof(HeuristicLab.Clients.Access.UserGroupBase))] 30 [System.Runtime.Serialization.KnownTypeAttribute(typeof(HeuristicLab.Clients.Access.LightweightUser))] 30 31 [System.Runtime.Serialization.KnownTypeAttribute(typeof(HeuristicLab.Clients.Access.UserGroup))] 31 32 [System.Runtime.Serialization.KnownTypeAttribute(typeof(HeuristicLab.Clients.Access.User))] 32 [System.Runtime.Serialization.KnownTypeAttribute(typeof(HeuristicLab.Clients.Access.LightweightUser))]33 33 public partial class AccessItem : object, System.Runtime.Serialization.IExtensibleDataObject, System.ComponentModel.INotifyPropertyChanged { 34 34 … … 46 46 47 47 public event System.ComponentModel.PropertyChangedEventHandler PropertyChanged; 48 49 50 48 } 51 49 … … 665 663 "")] 666 664 [System.SerializableAttribute()] 665 [System.Runtime.Serialization.KnownTypeAttribute(typeof(HeuristicLab.Clients.Access.LightweightUser))] 667 666 [System.Runtime.Serialization.KnownTypeAttribute(typeof(HeuristicLab.Clients.Access.UserGroup))] 668 667 [System.Runtime.Serialization.KnownTypeAttribute(typeof(HeuristicLab.Clients.Access.User))] 669 [System.Runtime.Serialization.KnownTypeAttribute(typeof(HeuristicLab.Clients.Access.LightweightUser))]670 668 public partial class UserGroupBase : HeuristicLab.Clients.Access.AccessItem { 671 669 … … 689 687 [System.Diagnostics.DebuggerStepThroughAttribute()] 690 688 [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Runtime.Serialization", "4.0.0.0")] 689 [System.Runtime.Serialization.DataContractAttribute(Name = "LightweightUser", Namespace = "http://schemas.datacontract.org/2004/07/HeuristicLab.Services.Access.DataTransfer" + 690 "")] 691 [System.SerializableAttribute()] 692 public partial class LightweightUser : HeuristicLab.Clients.Access.UserGroupBase { 693 694 [System.Runtime.Serialization.OptionalFieldAttribute()] 695 private string FullNameField; 696 697 [System.Runtime.Serialization.OptionalFieldAttribute()] 698 private System.Collections.Generic.List<HeuristicLab.Clients.Access.UserGroup> GroupsField; 699 700 [System.Runtime.Serialization.OptionalFieldAttribute()] 701 private System.Collections.Generic.List<HeuristicLab.Clients.Access.Role> RolesField; 702 703 [System.Runtime.Serialization.OptionalFieldAttribute()] 704 private string UserNameField; 705 706 [System.Runtime.Serialization.DataMemberAttribute()] 707 public string FullName { 708 get { 709 return this.FullNameField; 710 } 711 set { 712 if ((object.ReferenceEquals(this.FullNameField, value) != true)) { 713 this.FullNameField = value; 714 this.RaisePropertyChanged("FullName"); 715 } 716 } 717 } 718 719 [System.Runtime.Serialization.DataMemberAttribute()] 720 public System.Collections.Generic.List<HeuristicLab.Clients.Access.UserGroup> Groups { 721 get { 722 return this.GroupsField; 723 } 724 set { 725 if ((object.ReferenceEquals(this.GroupsField, value) != true)) { 726 this.GroupsField = value; 727 this.RaisePropertyChanged("Groups"); 728 } 729 } 730 } 731 732 [System.Runtime.Serialization.DataMemberAttribute()] 733 public System.Collections.Generic.List<HeuristicLab.Clients.Access.Role> Roles { 734 get { 735 return this.RolesField; 736 } 737 set { 738 if ((object.ReferenceEquals(this.RolesField, value) != true)) { 739 this.RolesField = value; 740 this.RaisePropertyChanged("Roles"); 741 } 742 } 743 } 744 745 [System.Runtime.Serialization.DataMemberAttribute()] 746 public string UserName { 747 get { 748 return this.UserNameField; 749 } 750 set { 751 if ((object.ReferenceEquals(this.UserNameField, value) != true)) { 752 this.UserNameField = value; 753 this.RaisePropertyChanged("UserName"); 754 } 755 } 756 } 757 } 758 759 [System.Diagnostics.DebuggerStepThroughAttribute()] 760 [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Runtime.Serialization", "4.0.0.0")] 691 761 [System.Runtime.Serialization.DataContractAttribute(Name = "UserGroup", Namespace = "http://schemas.datacontract.org/2004/07/HeuristicLab.Services.Access.DataTransfer" + 692 762 "")] … … 845 915 this.LastPasswordChangedDateField = value; 846 916 this.RaisePropertyChanged("LastPasswordChangedDate"); 847 }848 }849 }850 851 [System.Runtime.Serialization.DataMemberAttribute()]852 public string UserName {853 get {854 return this.UserNameField;855 }856 set {857 if ((object.ReferenceEquals(this.UserNameField, value) != true)) {858 this.UserNameField = value;859 this.RaisePropertyChanged("UserName");860 }861 }862 }863 }864 865 [System.Diagnostics.DebuggerStepThroughAttribute()]866 [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Runtime.Serialization", "4.0.0.0")]867 [System.Runtime.Serialization.DataContractAttribute(Name = "LightweightUser", Namespace = "http://schemas.datacontract.org/2004/07/HeuristicLab.Services.Access.DataTransfer" +868 "")]869 [System.SerializableAttribute()]870 public partial class LightweightUser : HeuristicLab.Clients.Access.UserGroupBase {871 872 [System.Runtime.Serialization.OptionalFieldAttribute()]873 private string FullNameField;874 875 [System.Runtime.Serialization.OptionalFieldAttribute()]876 private System.Collections.Generic.List<HeuristicLab.Clients.Access.UserGroup> GroupsField;877 878 [System.Runtime.Serialization.OptionalFieldAttribute()]879 private System.Collections.Generic.List<HeuristicLab.Clients.Access.Role> RolesField;880 881 [System.Runtime.Serialization.OptionalFieldAttribute()]882 private string UserNameField;883 884 [System.Runtime.Serialization.DataMemberAttribute()]885 public string FullName {886 get {887 return this.FullNameField;888 }889 set {890 if ((object.ReferenceEquals(this.FullNameField, value) != true)) {891 this.FullNameField = value;892 this.RaisePropertyChanged("FullName");893 }894 }895 }896 897 [System.Runtime.Serialization.DataMemberAttribute()]898 public System.Collections.Generic.List<HeuristicLab.Clients.Access.UserGroup> Groups {899 get {900 return this.GroupsField;901 }902 set {903 if ((object.ReferenceEquals(this.GroupsField, value) != true)) {904 this.GroupsField = value;905 this.RaisePropertyChanged("Groups");906 }907 }908 }909 910 [System.Runtime.Serialization.DataMemberAttribute()]911 public System.Collections.Generic.List<HeuristicLab.Clients.Access.Role> Roles {912 get {913 return this.RolesField;914 }915 set {916 if ((object.ReferenceEquals(this.RolesField, value) != true)) {917 this.RolesField = value;918 this.RaisePropertyChanged("Roles");919 917 } 920 918 } … … 1076 1074 System.Collections.Generic.List<HeuristicLab.Clients.Access.UserGroupMapping> GetUserGroupMapping(); 1077 1075 1076 [System.ServiceModel.OperationContractAttribute(Action = "http://tempuri.org/IAccessService/GetUserGroupIdsOfGroup", ReplyAction = "http://tempuri.org/IAccessService/GetUserGroupIdsOfGroupResponse")] 1077 System.Collections.Generic.List<System.Guid> GetUserGroupIdsOfGroup(System.Guid groupId); 1078 1078 1079 [System.ServiceModel.OperationContractAttribute(Action = "http://tempuri.org/IAccessService/GetRoles", ReplyAction = "http://tempuri.org/IAccessService/GetRolesResponse")] 1079 1080 System.Collections.Generic.List<HeuristicLab.Clients.Access.Role> GetRoles(); … … 1280 1281 } 1281 1282 1283 public System.Collections.Generic.List<System.Guid> GetUserGroupIdsOfGroup(System.Guid groupId) { 1284 return base.Channel.GetUserGroupIdsOfGroup(groupId); 1285 } 1286 1282 1287 public System.Collections.Generic.List<HeuristicLab.Clients.Access.Role> GetRoles() { 1283 1288 return base.Channel.GetRoles(); -
branches/ClientUserManagement/HeuristicLab.Services.Access/3.3/AccessService.cs
r7637 r7639 716 716 } 717 717 } 718 719 public IEnumerable<Guid> GetUserGroupIdsOfGroup(Guid groupId) { 720 using (DA.AccessServiceDataContext context = new DA.AccessServiceDataContext()) { 721 var query = from u in context.UserGroupUserGroups 722 where u.UserGroupUserGroupId == groupId 723 select u.UserGroupId; 724 return query.ToList(); 725 } 726 } 718 727 #endregion 719 728 -
branches/ClientUserManagement/HeuristicLab.Services.Access/3.3/IAccessService.cs
r7612 r7639 187 187 [OperationContract] 188 188 IEnumerable<UserGroupMapping> GetUserGroupMapping(); 189 190 [OperationContract] 191 IEnumerable<Guid> GetUserGroupIdsOfGroup(Guid groupId); 189 192 #endregion 190 193
Note: See TracChangeset
for help on using the changeset viewer.