public void Save(CheckedListBox clbVisibilityToUsers)
 {
     if (clbVisibilityToUsers != null)
     {
         clbVisibilityToUsers.DoThreadSafe(() =>
         {
             for (int i = 0; i < clbVisibilityToUsers.Items.Count; i++)
             {
                 SINnerUserRight obj = (SINnerUserRight)clbVisibilityToUsers.Items[i];
                 clbVisibilityToUsers.SetItemChecked(i, obj.CanEdit.Value);
             }
         });
     }
 }
Esempio n. 2
0
        public void AddVisibilityForEmail(string email)
        {
            if (!IsValidEmail(email))
            {
                Program.MainForm.ShowMessageBox("Please enter a valid email address!");
                return;
            }
            SINnerUserRight ur = new SINnerUserRight()
            {
                EMail   = email,
                CanEdit = true,
                Id      = Guid.NewGuid()
            };
            var found = from a in this.UserRightsObservable where email != null && a != null && a.EMail != null && a.EMail?.ToLowerInvariant() == email.ToLowerInvariant() select a;

            if (found.Any())
            {
                ur = found.FirstOrDefault();
            }
            if (!this.UserRightsObservable.Contains(ur))
            {
                this.UserRightsObservable.Add(ur);
            }
        }