Esempio n. 1
0
        private void UpdateSource()
        {
            using RoleData roleData             = new RoleData(settings.ConnectionString);
            using PositionData positionData     = new PositionData(settings.ConnectionString);
            using PermissionData permissionData = new PermissionData(settings.ConnectionString);

            List <RoleModel> retrievedRoles = roleData.GetDataCollection();

            retrievedRoles.ForEach(x => Roles.Add(x));
            Roles.Remove(Roles.FirstOrDefault(r => r.Name.Equals("Administrator")));
            Roles.Remove(Roles.FirstOrDefault(r => r.Name.Equals("nullRole")));

            List <PositionModel> retrievedPositions = positionData.GetDataCollection();

            retrievedPositions.ForEach(x => Positions.Add(x));
            Positions.Remove(Positions.FirstOrDefault(r => r.Name.Equals("Директор")));

            List <PermissionModel> retrievedPermissions = permissionData.GetDataCollection();

            retrievedPermissions.ForEach(x => Permissions.Add(x));
            FillListCollections();
        }
Esempio n. 2
0
        private void UserManageUserControlLoad(object sender, EventArgs e)
        {
            using (PositionData data = new PositionData(ConnectionString))
            {
                positions = data.GetDataCollection().Where(p => !p.Name.Equals("Директор")).ToList();
            }

            positionsComboBox.Items.Clear();
            foreach (PositionModel position in positions)
            {
                positionsComboBox.Items.Add(position.Name);
            }

            fNameTextBox.Text         = user.FirstName;
            mNameTextBox.Text         = user.MiddleName;
            lNameTextBox.Text         = user.LastName;
            contactNumberTextBox.Text = user.ContactNumber;

            if (!user.ID.Equals(Guid.Empty))
            {
                positionsComboBox.SelectedItem = positions.FirstOrDefault(p => p.ID.Equals(user.Position.ID)).Name;
            }
        }