Ejemplo n.º 1
0
        public DataHandler(IExcelParams excelParams, MainPage page)
        {
            _page = page;
            _excelParams = excelParams;
            UpdateHandlerQueue = new List<RowHandler>();
            _listHelper = new ListHelper(page);

            ListAsmx = Constants.InitParams.ListAsmx(page);
            ListOrgAsmx = Constants.InitParams.ListOrgAsmx(page);
            FrequencyAsmx = Constants.InitParams.FrequencyAsmx(page);

            _listHelper.UpdateComplete += listHelper_UpdateComplete;
            _listHelper.DeleteComplete += listHelper_DeleteComplete;
            _listsService = new ListsSoapClient("ListsSoap", ServiceParamStatHelper.SetParams(ListAsmx, ServiceParamStatHelper.Actions.QUERY, "UNKNOWN"));
            _listsOrgService = new ListsSoapClient("ListsSoap", ServiceParamStatHelper.SetParams(ListOrgAsmx, ServiceParamStatHelper.Actions.QUERY, Constants.OrgStructure));
            _frequencyService = new ListsSoapClient("ListsSoap", ServiceParamStatHelper.SetParams(FrequencyAsmx, ServiceParamStatHelper.Actions.QUERY, "FrequencyValidation"));

            _updateTimer = new DispatcherTimer();
            _updateTimer.Interval = new TimeSpan(0, 0, Constants.UpdateTimerOffset);
            _updateTimer.Tick += updateTimer_Tick;
            _updateTimer.Start();

            _listsOrgService.GetListItemsCompleted += ListsOrgService_GetListItemsCompleted;
            _listsService.GetListCollectionCompleted += Service_GetListCollectionCompleted;
            _listsService.GetListItemsCompleted += Service_GetListItemsCompleted;
            //_listsService.GetListAndViewCompleted += Service_GetListAndViewCompleted;
            _frequencyService.GetListItemsCompleted += FrequencyService_GetListItemsCompleted;

            ListSettingsAgent = new ListSettingsServiceAgent(ListOrgAsmx);
            BusinessUnitAgent = new BusinessUnitServiceAgent(Constants.InitParams.SiteRootURL(page), page._sLog);
            HelperAgent = new HelperServiceAgent();
            _dispatcher = Deployment.Current.Dispatcher;
            InitiateStaticData();
            if (_current == null)
            {
                _current = this;
            }
        }
Ejemplo n.º 2
0
        public MainPage(IDictionary<string, string> initParams)
        {
            InitializeComponent();

            eventaggregator = EventAggregator.Instance;
            eventaggregator.Subscribe<SPList>(new Action<SPList>(ListUpdatedSubscription));
            eventaggregator.Subscribe<LogErrorMessage>(new Action<LogErrorMessage>(AddMessageToLog));
            _sLists = new StringBuilder();
            InitParams = initParams;

            if (Constants.Logging)
                _sLog = new StringBuilder();

            if (HtmlPage.Document.QueryString.ContainsKey("save"))
                btnSave.Visibility = Visibility.Visible;

            _excelGrid = new ExcelGrid(excelGridControl, 30, _sLog, txtTextLine, lblTextBlock);

            AddToLog("Control Instantiated");

            _dataHandlerUser = new DataHandlerUser(_excelGrid, this);
            _liveUpdateHandler = new LiveUpdateHandler(this);

            // Fetching Login info and groups for the login user
            _userAccessHandler = new UserAccessHandler(this);
            _userAccessHandler.UserGroupsRetrieved += handler_UserGroupsRetrieved;
            _userAccessHandler.GetUserLoginIdAndMemberGroups();

            _handler = new DataHandler(_excelGrid, this);
            _handler.ListDataRetrieved += handler_ListDataRetrieved;
            _handler.ListsRetrieved += handler_ListsRetrieved;
            _handler.ListDeleted += handler_ListDeleted;


            _handler.GetSiteLists();
            _handler.GetFrequencyValidations();


            chooseUsers.InitializeComponent(_dataHandlerUser, _excelGrid);
            sbMenuShow.Completed += sbMenuShow_Completed;
            sbMenuHide.Completed += sbMenuHide_Completed;
            ldgLists.StartRotating();

            _excelGrid.DisplayColumnSpacer = true;
            _excelGrid.RowChangedEvent += excelGrid_RowChangedEvent;
            _excelGrid.AttachHandler(this);

            _excelGrid.UpdateStatus("Retrieving lists...");

            _excelGrid.AddHint("Use the list dropdown to select another list to edit. If a list is already loading you'll have to wait until it's finished before selecting another.");
            _excelGrid.AddHint("Use the 'Live Update' button to either generate or update tasks in the live system. If a task with the same ID1 was already generated in the system in the last day, the task will be updated, otherwise a new one will be generated.");
            _excelGrid.AddHint("View the version history of a task using the 'Version History' button.");
            _excelGrid.AddHint("Setup Alerts using the 'Alert Me' button. Try changing the frequency of the alert to 'Daily' or 'Weekly' if you find you're receiving too many.");
            _excelGrid.AddHint("You'll only be able to select the relevant 'Business Area' under an 'Asset Category'. These have been setup by the admin team. Please email 'BCheck L2 Support' if you believe the structure is incorrect.");
            _excelGrid.AddHint("Clicking on a user cell will popup the user edit window. From here you can add and remove users. If the user hasn't been inserted before, the name will turn blue as the system tries to identify them. If the user cannot be indentified the name will turn red, otherwise it will turn grey.");

            sbMenuShow.Begin();

            MessageDialog.SetupMessage(LayoutRoot);
            _columnFactory = new CustomColumnFactory();


            _deleteReady = false;
            _settingsAllowed = false;
            _settingsReady = false;

            string CurrentUrl = HtmlPage.Document.DocumentUri.ToString();
            _isRcoUrl = (CurrentUrl.ToUpper().IndexOf(Constants.RcoChecklistAdminPage) > 0) ? true : false;

            _bcontrolDataHandler = new BcontrolDataHandler(this);

            activityPopup.InitializeComponent(_bcontrolDataHandler, activityPopup.SearchResultsGrid);

            BusinessUnits = _handler.GetBusinessUnits();

        }