public UploadReportHierarchyViewModel(StringBuilder log, C1DataGrid grid, BcontrolDataHandler bcontrolDataHandler)
        {
            eventaggregator = EventAggregator.Instance;
            _log = log;
            _grid = grid;

            PreviewCommand = new RelayCommand(PreviewAction);
            PreviewCommand.IsEnabled = false;
            UploadCommand = new RelayCommand(UploadAction);
            UploadCommand.IsEnabled = false;

            CloseCommand = new RelayCommand(CloseAction);
            CloseCommand.IsEnabled = true;

            _datahandler = bcontrolDataHandler;

            _datahandler.ClearBcontrolHierarchyDataRetrieved += new EventHandler<ClearBcontrolHierarchyDataCompletedEventArgs>(_datahandler_ClearBcontrolHierarchyDataRetrieved);
            _datahandler.AddBcontrolHierarchyDataRetrieved += new EventHandler<AddBcontrolHierarchyDataCompletedEventArgs>(_datahandler_AddBcontrolHierarchyDataRetrieved);
            _datahandler.CompleteAddBcontrolHierarchyDataRetrieved += new EventHandler<CompleteAddBcontrolHierarchyDataCompletedEventArgs>(_datahandler_CompleteAddBcontrolHierarchyDataRetrieved);

            _columns = new Dictionary<string, ReportField>();
            
            _columns.Add("Map Name", new ReportField(100, true));
            _columns.Add("Level", new ReportField(500, true));
            _columns.Add("FunctionalHead", new ReportField(50, false));
            _columns.Add("AdditionalData", new ReportField(100, false));
            _columns.Add("TOM", new ReportField(100, false));
            _columns.Add("REN", new ReportField(100, false));
            _columns.Add("Bcontrol Function Structure", new ReportField(100, false));
            _columns.Add("Taxonomy Level 3", new ReportField(100, false));
            _columns.Add("BusinessHierarchy1", new ReportField(100, false));
            _columns.Add("BusinessHierarchy2", new ReportField(100, false));
            _columns.Add("BusinessHierarchy3", new ReportField(100, false));

        }
        public OrgStructureViewModel(string siteUrl,string subSiteUrl, StringBuilder log, string mainCheckListName)
        {
            _log = log;
            _dispatcher = Deployment.Current.Dispatcher;
            _OrgStructureServiceAgent = new OrgStructureServiceAgent(siteUrl, log);
            _mainCheckListName = mainCheckListName;
            _subSiteUrl = subSiteUrl;
            Levels = new ObservableCollection<OrgStructureEntityModel>();


            AddCommand = new RelayCommand(AddAction);
            AddCommand.IsEnabled = false;

            EditCommand = new RelayCommand(EditAction);
            EditCommand.IsEnabled = false;

            DeleteCommand = new RelayCommand(DeleteAction);
            DeleteCommand.IsEnabled = false;

            AddGlobalCommand = new RelayCommand(AddGlobalAction);
            AddGlobalCommand.IsEnabled = true;

            CancelCommand = new RelayCommand(CancelAction);
            CancelCommand.IsEnabled = true;

            _confirmDialog = new DialogService(340, 120);
            
            LoadOrgStructureEntityModel();

        }
        public ListSettingsDialogViewModel(String listAsmxUrl, string listOrgAsmxUrl, string peopleAsmxUrl, string customPermissionsAsmxUrl, SPList dropDownSelectedList, string siteURL,string siteRootURL, StringBuilder log,List<BusinessUnit> units)
        {
            EventAggregator.Instance.Publish<bCheck.Admin.MainPage.MessageSample>(new bCheck.Admin.MainPage.MessageSample());
            PeopleAsmx = peopleAsmxUrl;
            SPClientContext = new ClientContext(siteURL);
            CustomPermissionsAsmx = customPermissionsAsmxUrl;
            _dispatcher = Deployment.Current.Dispatcher;
            ListCollection = new ObservableCollection<SharepointList>();
            SiteRootUrl = siteRootURL;
            ListSettingsAgent = new ListSettingsServiceAgent(listAsmxUrl, listOrgAsmxUrl, siteURL, SiteRootUrl);
            dialogService = new DialogService();
            dialogService.Width = 180;
            dialogService.Height = 120;
            PermissionsAgent = new PermissionsServiceAgent(PeopleAsmx, CustomPermissionsAsmx);            
            SaveListCommand = new RelayCommand(SaveListAction);
            DeleteListCommand = new RelayCommand(DeleteListAction);
            ListPermissionsCommand = new RelayCommand(ListPermissionsAction);
            CloseCommand = new RelayCommand(CloseAction);
            CloseCommand.IsEnabled = true;
            SaveListCommand.IsEnabled = false;
            SelectedList = new SharepointList();
            SelectedList.IsQuickLaunchEnabled = true;
            PeoplePickerCommand = new RelayCommand(PeoplePickerAction);
            DropDownSelectedList = dropDownSelectedList;
            AvailableListName = dropDownSelectedList.ListName;
            IsDropDownListSelected = false;
            SiteUrl = siteURL;
           
            _log = log;
            if (AvailableListName != null)
            {
                EditListSelected = true;
                IsNewListEnabled = false;
                NewListSelected = false;
                IsDropDownListSelected = true;
            }
            else
            {
                NewListSelected = true;
                IsNewListEnabled = true;
            }

            if (units != null)
            {
                BusinessUnitDropDownValues = new ObservableCollection<string>();
                foreach (BusinessUnit unit in units)
                    BusinessUnitDropDownValues.Add(unit.Title);
            }                                            
        }
        public PeopleEditorViewModel(StringBuilder log, string siteURL,Dispatcher d,string SearchString,ClientUtility.PrincipalType searchType)
         {                  
             PeopleEditorAgent = new PeopleEditorServiceAgent(siteURL,log);
             SearchCommand = new RelayCommand(SearchUserAction);
             SearchCommand.IsEnabled = true;
             OKCommand = new RelayCommand(OkAction);
             OKCommand.IsEnabled = true;
             SearchResults = new ObservableCollection<ClientUtility.PrincipalInfo>();
             SelectedResults = new ObservableCollection<ClientUtility.PrincipalInfo>();
             IsBusy = false;
             _dispatcher = d;
             _searchType = searchType;

             this.SearchString = SearchString;
             if (!string.IsNullOrEmpty(SearchString)) SearchCommand.Execute(null);
         }
        public UserGroupsViewModel(UserSecurityAdminViewModel model, Dispatcher d)
        {
            _parentModel = model;            
            _dispatcher = d;            

            CancelCommand = new RelayCommand(CancelAction);
            CancelCommand.IsEnabled = true;

            GetGroupsCommand = new RelayCommand(GetGroupsAction);
            GetGroupsCommand.IsEnabled = false;

            SaveCommand = new RelayCommand(SaveAction);
            SaveCommand.IsEnabled =false;

            UserGroups = new ObservableCollection<Group>();
            IsUsersFound = false;
        }
 public LocationTaskViewModel(String listasmx, string siteURL, StringBuilder log)
 {
     _log = log;
     GroupedTasks = new ObservableCollection<TaskSummary>();
     TaskSummaryAgent = new TaskSummaryServiceAgent(listasmx, siteURL);
     TaskSummaryItemSelected = new RelayCommand(TaskSummarySelectedAction);
     CloseDialog = new RelayCommand(CloseDialogAction);
     CloseDialog.IsEnabled = true;
     TaskswithDetail = new ObservableCollection<OperationsChecklistTask>();
     TaskSearch = "";
     IsBusy = true;
     LastQueriedTime = DateTime.UtcNow;
     TaskSummaryAgent.GetLocationDateSummary((result, tasks) =>
     {
         LastQueriedTime = DateTime.UtcNow;
         tasks.ToList().ForEach(t => GroupedTasks.Add(t));
         IsBusy = false;
     });
 }
Exemple #7
0
        public GroupViewModel(UserSecurityAdminViewModel model, StringBuilder log,Dispatcher d,string adminGroup)
        {
            _parentModel = model;
      
            _log = log;
            _dispatcher = d;

            CancelCommand = new RelayCommand(CancelAction);
            CancelCommand.IsEnabled = true;

            SearchCommand = new RelayCommand(SearchAction);
            SearchCommand.IsEnabled = true;

            CreateCommand = new RelayCommand(CreateAction);
            CreateCommand.IsEnabled = true;

            EditGroupCommand = new RelayCommand(EditGroupAction);
            EditGroupCommand.IsEnabled = false;

            NewGroupCommand = new RelayCommand(NewGroupAction);
            NewGroupCommand.IsEnabled = false;

            SaveCommand = new RelayCommand(SaveAction);
            SaveCommand.IsEnabled = true;            
         
            _groupServiceAgent = model.UserGroupServiceAgent;

            GroupPermissionLevels = new ObservableCollection<PermissionLevel>();
            NewGroupPermissionLevels = new ObservableCollection<PermissionLevel>();
            EditGroupPermissionLevels = new ObservableCollection<PermissionLevel>();
            SelectedGroupPermissionLevels = new ObservableCollection<PermissionLevel>();
            OriginalSelectedGroupPermissionLevels = new ObservableCollection<PermissionLevel>();

            LoadPermissionlevels();
            LoadSiteUrls();
                         
            _group = new bCheck.Admin.Data.Group();                                   
            _peopleServiceAgent = new PeopleEditorServiceAgent(_parentModel._siteURL, log);

            _adminGroup = adminGroup;
            LoadDefaultGroupOwner(adminGroup);
        }
        public GroupUsersViewModel(UserSecurityAdminViewModel model, Dispatcher d)
        {
            _parentModel = model;
            _dispatcher = d;

            CancelCommand = new RelayCommand(CancelAction);
            CancelCommand.IsEnabled = true;

            RemoveUserCommand = new RelayCommand(RemoveUserAction);
            RemoveUserCommand.IsEnabled = true;

            AddUserCommand = new RelayCommand(AddUserAction);
            AddUserCommand.IsEnabled = false;

            GroupUsersCommand = new RelayCommand(GetGroupUsersAction);
            GroupUsersCommand.IsEnabled = false;

            GroupUsers = new ObservableCollection<User>();

            dialogService = new DialogService();
            dialogService.Width = 350;
            dialogService.Height = 140;
        }
        public ViewAllPermissionViewModel(UserSecurityAdminViewModel model, StringBuilder log, Dispatcher d)
        {
            _parentModel = model;
            _log = log;
            _dispatcher = d;

            GoCommand = new RelayCommand(GoAction);
            GoCommand.IsEnabled = true;

            CancelCommand = new RelayCommand(CancelAction);
            CancelCommand.IsEnabled = true;

            InitializeCommand = new RelayCommand(InitializeViewAllAction);
            InitializeCommand.IsEnabled = true;

            SiteUrls = new List<string>();
            
            _parentModel.UserGroupServiceAgent.GetSubSiteList((list, e) => {
                SiteUrls.Add(Constants.Select);
                foreach (string s in list)                
                    SiteUrls.Add(s);                
            });
        }
        public UserSecurityAdminViewModel(string siteURL,string siteSubURL, Dispatcher d,StringBuilder log,string adminGroup)
        {
            _log = log;
            _isBusy = false;
            SearchString = Constants.FILTER_USERS;
            
            
            CancelCommand = new RelayCommand(CancelAction);
            CancelCommand.IsEnabled = true;

            SearchCommand = new RelayCommand(SearchAction);
            SearchCommand.IsEnabled = true;
            SearchedUsers = new ObservableCollection<User>();
            SearchedGroups = new ObservableCollection<Group>();
            AllGroups = new ObservableCollection<Group>();

            UserGroupCommand = new RelayCommand(GetGroupsAction);
            UserGroupCommand.IsEnabled = false;
            UserGroups = new ObservableCollection<Group>();

            UpdateUserGroupsCommand = new RelayCommand(UpdateUserGroupsAction);
            UpdateUserGroupsCommand.IsEnabled = false;

            _dispatcher = d;    

            ChangeOwnerCommand = new RelayCommand(ChangeOwnerAction);    
            ChangeOwnerCommand.IsEnabled = true;
        
            NewGroupCommand = new RelayCommand(CreateNewGroupAction);
            NewGroupCommand.IsEnabled = true;

            EditGroupCommand = new RelayCommand(EditGroupAction);
            EditGroupCommand.IsEnabled = false;

            ViewAllPermissionsCommand = new RelayCommand(ViewAllPermissionAction);
            ViewAllPermissionsCommand.IsEnabled = false;

            GetGroupUsersCommand = new RelayCommand(GroupUsersAction);
            GetGroupUsersCommand.IsEnabled = false;
                    
            _siteURL = siteURL;
            UserGroupServiceAgent = new UserGroupServiceAgent( siteURL,siteSubURL,log);

            dialogService = new DialogService();
            dialogService.Width = 350;
            dialogService.Height = 120;

            ViewModelLocator vmlocator = new ViewModelLocator();
            object[] args = new object[] { this, _log, _dispatcher, adminGroup };
            GroupViewModel vm = (GroupViewModel)vmlocator.GetViewModel(typeof(GroupViewModel), true, args);
            InnerGroupViewModel = vm;
            InnerGroupViewModel.Visibility = false;

            object[] args1 = new object[] { this, _log, _dispatcher};
            ViewAllPermissionViewModel vm1 = (ViewAllPermissionViewModel)vmlocator.GetViewModel(typeof(ViewAllPermissionViewModel), true, args1);
            InnerPermissionViewModel = vm1;
            InnerPermissionViewModel.Visibility = false;

            object[] args2 = new object[] { this, _dispatcher };
            UserGroupsViewModel vm2 = (UserGroupsViewModel)vmlocator.GetViewModel(typeof(UserGroupsViewModel), true, args2);
            InnerUserGroupsViewModel = vm2;
            InnerUserGroupsViewModel.Visibility = false;

            GroupUsersViewModel vm3 = (GroupUsersViewModel)vmlocator.GetViewModel(typeof(GroupUsersViewModel), true, args2);
            InnerGroupUsersViewModel = vm3;
            InnerGroupUsersViewModel.Visibility = false;
          
            IsSearchByGroup = true;
            SearchCommand.Execute(null);

        }
        public EditFunctionalDialogViewModel(String listguid, String ListAsmx)
        {
            IsBusy = true;
            ExceptionMessage = "";
            ListGuid = listguid;
            dialogService = new DialogService();
            dialogService.Width = 180;
            dialogService.Height = 120;
            FunctionalServiceAgent = new FucntionalChoicesServicesAgent(ListAsmx);
            AddChoiceCommand = new RelayCommand(AddChoice);
            UpdateChoicesCommand = new RelayCommand(UpdateChoices);
            CancelCommand = new RelayCommand(Cancel);
            DeleteChoiceCommand = new RelayCommand(Delete);
            UpdateChoicesCommand.IsEnabled = true;
            CancelCommand.IsEnabled = true;
            AddChoiceCommand.IsEnabled = true;

            FuntionalChoices = new ObservableCollection<string>();
            if (IsDesignTime == true)
            {
                FuntionalChoices.Add("IsDesignTime");
                FuntionalChoices.Add("More");
            }
            else
            {
                FunctionalServiceAgent.GetFunctionalChoices(ListGuid, (strcollection) =>
                                                                {
                                                                    IsBusy = false;
                                                                    if (strcollection != null)
                                                                    {
                                                                        if (strcollection.Count > 0)
                                                                        {
                                                                            strcollection.ForEach(str =>
                                                                                                      {
                                                                                                          FuntionalChoices.Add(str);
                                                                                                      }
                                                                                );
                                                                        }
                                                                        else
                                                                        {
                                                                            ExceptionMessage = "No items found!";
                                                                            //DispatcherTimer timer = new DispatcherTimer();
                                                                            //timer.Interval = new TimeSpan(0, 0, 0, 4);
                                                                            //timer.Tick += (s, t) =>
                                                                            //{
                                                                            //    ExceptionMessage = "";
                                                                            //    timer.Stop();
                                                                            //};
                                                                            //timer.Start();
                                                                        }
                                                                    }
                                                                    else
                                                                    {
                                                                        ExceptionMessage = "Unable to get items. Please contact admin";
                                                                        //DispatcherTimer timer = new DispatcherTimer();
                                                                        //timer.Interval = new TimeSpan(0, 0, 0, 4);
                                                                        UpdateChoicesCommand.IsEnabled = false;
                                                                        AddChoiceCommand.IsEnabled = false;
                                                                        //timer.Tick += (s, t) =>
                                                                        //{
                                                                        //    ExceptionMessage = "";
                                                                        //    timer.Stop();
                                                                        //};
                                                                        //timer.Start();
                                                                    }
                                                                });
            }
        }