Esempio n. 1
0
        /// <summary>
        /// Загрузить справочник КСГ
        /// </summary>
        /// <returns></returns>
        public static bool Init()
        {
            string fileName = invox.Options.BaseDirectory + XML_NAME;

            if (!File.Exists(fileName))
            {
                return(false);
            }

            using (FileStream fs = new FileStream(fileName, FileMode.Open, FileAccess.Read)) {
                if (!fs.CanRead)
                {
                    return(false);
                }

                XDocument x = XDocument.Load(fs);
                if (x.Root.Name != "items")
                {
                    Logger.Log("Неверное имя корневого элемента в справочнике " + XML_NAME);
                    return(false);
                }
                int year = DateTime.Today.Year;
                Groups = new GroupsCollection(x.Root, year);
            }

            return(true);
        }
Esempio n. 2
0
        public void NewEmptyGroup()
        {
            // GroupsCollection.Groups.Clear();
            GroupsCollection.Clear();
            var group = GivenNewGroup(Name01);

            WhenPostingGroup(group);
            ThenThereIsGroupInTheGroupsCollection(group);
        }
Esempio n. 3
0
 public GroupsViewModel(string key, ulong parameter)
     : base(key, parameter)
 {
     _groups             = new GroupsCollection(parameter);
     _events             = new EventsCollection(parameter);
     _manage             = new GroupsManageCollection(parameter);
     Refresh             = new RelayCommand(() => Groups.Refresh());
     RefreshEvents       = new RelayCommand(() => Events.Refresh());
     RefreshGroupsManage = new RelayCommand(() => GroupsManage.Refresh());
 }
        Negotiator CreateNewGroup(string rootPath, IGroup partialGroup)
        {
            GroupsCollection.AddGroup(new Group
            {
                Name = partialGroup.Name
            });
            dynamic data = new ExpandoObject();

            data.Groups = GroupsCollection.Groups;
            return(Negotiate.WithStatusCode(HttpStatusCode.Created).WithView(rootPath + "/" + Constants.ViewNameGroups).WithModel((ExpandoObject)data).WithFullNegotiation());
        }
Esempio n. 5
0
        void InitCollections()
        {
            GroupsCollection.Init();

            GroupsCollection.Groups.AddRange(
                new List <IGroup> {
                new Group
                {
                    Name    = "Group01",
                    Members = new List <IUser>
                    {
                        new User {
                            FirstName = "John", LastName = "Smith", BirthDate = new DateTime(1900, 1, 1), City = "London"
                        },
                        new User {
                            FirstName = "John", LastName = "Doe", BirthDate = new DateTime(1953, 11, 12), City = "New York"
                        }
                    }
                },
                new Group
                {
                    Name    = "Group02",
                    Members = new List <IUser>
                    {
                        new User {
                            FirstName = "Patrick", LastName = "O'Neil", BirthDate = new DateTime(1971, 4, 3), City = "Dublin"
                        }
                    }
                },
                new Group(),
                new Group
                {
                    Name    = "Group04",
                    Members = new List <IUser>
                    {
                        new User {
                            FirstName = "John", LastName = "Doe", BirthDate = new DateTime(1953, 11, 13), City = "New York"
                        },
                        new User {
                            FirstName = "John", LastName = "Doe", BirthDate = new DateTime(1953, 11, 14), City = "New York"
                        },
                        new User {
                            FirstName = "John", LastName = "Doe", BirthDate = new DateTime(1953, 11, 15), City = "New York"
                        }
                    }
                }
            });

            UsersCollection.Init();

            GroupsCollection.Groups.ToList().ForEach(group => UsersCollection.Users.AddRange(group.Members));
        }
Esempio n. 6
0
        public void GetGroup()
        {
            // GroupsCollection.Groups.Clear();
            GroupsCollection.Clear();
            var @group = GivenNewGroup(Name02);

            @group.Id = _guid02;
            GroupsCollection.AddGroup(@group);

            WhenGettingGroup(_guid02);

            ThenThereIsGroupLoadedFromTheGroupsCollection(@group);
        }
Esempio n. 7
0
        static void Main()
        {
            GroupsCollection as47  = new GroupsCollection();
            AS_47            stud1 = new AS_47();

            as47.AddStudent(stud1);
            as47.NotifyStudent();
            Console.ReadLine();

            GroupsCollection ptm47 = new GroupsCollection();
            PTM_47           stud2 = new PTM_47();

            ptm47.AddStudent(stud2);
            ptm47.NotifyStudent();
            Console.ReadLine();
        }
        public EffectiveAccess(string path,
                               string targetMachine,
                               RawSecurityDescriptor shareSD,
                               SecurityIdentifier userSid,
                               SecurityIdentifier deviceSid,
                               ClaimValueDictionary userClaims,
                               ClaimValueDictionary deviceClaims,
                               GroupsCollection userGroups,
                               GroupsCollection deviceGroups)
        {
            if (string.IsNullOrEmpty(targetMachine) && shareSD != null)
            {
                throw new ArgumentException("targetMachine must be value when shareSD is not-empty", "targetMachine");
            }

            handle = NativeMethods.CreateFile(path,
                                                NativeMethods.FileAccess.GenericRead,
                                                NativeMethods.FileShare.Read
                                              | NativeMethods.FileShare.Write
                                              | NativeMethods.FileShare.Delete,
                                              IntPtr.Zero,
                                              NativeMethods.FileMode.OpenExisting,
                                              NativeMethods.FileFlagAttrib.BackupSemantics,
                                              IntPtr.Zero);
            if (handle.IsInvalid)
            {
                throw new Win32Exception(Marshal.GetLastWin32Error());
            }

            this.targetMachine = targetMachine;
            this.shareSD = shareSD;
            this.userSid = userSid;
            this.deviceSid = deviceSid;
            this.userClaims = userClaims;
            this.deviceClaims = deviceClaims;
            this.userGroups = userGroups;
            this.deviceGroups = deviceGroups;
        }
Esempio n. 9
0
 public OutlookShortcutBar()
 {
     Graphics graphics = base.CreateGraphics();
     ShortcutsCollection.m_scaleFactor = new SizeF(graphics.DpiX / 96f, graphics.DpiY / 96f);
     ShortcutsCollection.m_Spacing = (int) (5f * ShortcutsCollection.m_scaleFactor.Width);
     ShortcutsCollection.ParentControl = this;
     ShortcutsCollection.GestureDetected += new Resco.Controls.OutlookControls.GestureDetectedHandler(this.ShortcutsCollection_GestureDetected);
     ShortcutsCollection.m_Arrow[0] = new Point((int) (3f * ShortcutsCollection.m_scaleFactor.Width), (int) (6f * ShortcutsCollection.m_scaleFactor.Height));
     ShortcutsCollection.m_Arrow[1] = new Point((int) ((13f * ShortcutsCollection.m_scaleFactor.Width) - 1f), (int) (6f * ShortcutsCollection.m_scaleFactor.Height));
     ShortcutsCollection.m_Arrow[2] = new Point((int) ((8f * ShortcutsCollection.m_scaleFactor.Width) - 1f), (int) (11f * ShortcutsCollection.m_scaleFactor.Height));
     GroupsCollection.m_scaleFactor = ShortcutsCollection.m_scaleFactor;
     this.Text = null;
     this.Font = new Font("Tahoma", 8f, FontStyle.Regular);
     this.BackColor = SystemColors.Window;
     this.ForeColor = SystemColors.ControlText;
     this.m_groups = new GroupsCollection(this);
     this.m_groups.InsertCompleteEvent += new InsertCompleteEventHandler(this.OnGroupsUpdateInsert);
     this.m_groups.RemoveEvent += new RemoveEventHandler(this.OnGroupsUpdateRemove);
     this.m_groups.SetCompleteEvent += new SetCompleteEventHandler(this.OnGroupsUpdateSet);
     this.m_groups.SelectedGroupIndexChanged += new Resco.Controls.OutlookControls.SelectedIndexChangedEventHandler(this.OnSelectedGroupIndexChanged);
     this.m_groups.SelectedShortcutIndexChanged += new Resco.Controls.OutlookControls.SelectedIndexChangedEventHandler(this.OnSelectedShortcutIndexChanged);
     this.m_groups.ShortcutEntered += new Resco.Controls.OutlookControls.SelectedIndexChangedEventHandler(this.OnShortcutEntered);
     this.m_groups.Invalidating += new EventHandler(this.OnInvalidating);
 }
Esempio n. 10
0
 internal void Dispose()
 {
     this.m_Parent = null;
     this.DisableEvents();
     if (this.m_shortcuts != null)
     {
         this.m_shortcuts.Dispose();
         this.m_shortcuts = null;
     }
 }
Esempio n. 11
0
 protected override void Dispose(bool disposing)
 {
     if (disposing)
     {
         this.DisableEvents();
         if (this.m_backgroundImage != null)
         {
             this.m_backgroundImage.Dispose();
             this.m_backgroundImage = null;
         }
         if (this.m_bmp != null)
         {
             this.m_bmp.Dispose();
             this.m_bmp = null;
         }
         if (this.m_graphics != null)
         {
             this.m_graphics.Dispose();
             this.m_graphics = null;
         }
         if (this.m_penFrame != null)
         {
             this.m_penFrame.Dispose();
             this.m_penFrame = null;
         }
         if (this.m_groups != null)
         {
             this.m_groups.Dispose();
             this.m_groups = null;
         }
     }
     base.Dispose(disposing);
 }
Esempio n. 12
0
 public NewGroupModuleTests()
 {
     // GroupsCollection.Groups.Clear();
     GroupsCollection.Clear();
     _browser = new Browser(with => with.Modules(typeof(NewGroupModule)));
 }