Пример #1
0
        void mrsClient_GetRevisionTypeAccessCompleted(object sender, GetRevisionTypeAccessCompletedEventArgs e)
        {
            revisionTypeIds = string.Empty;
            if (e.Error == null)
            {
                foreach (var item in e.Result)
                {
                    if (revisionTypeIds == string.Empty)
                        revisionTypeIds = "#" + item.RevisionTypeId.ToString() + "#";
                    else
                        revisionTypeIds += ",#" + item.RevisionTypeId.ToString() + "#";
                }

                WorkspacePanel.Visibility = System.Windows.Visibility.Visible;

                if (revisionTypeIds == "#1#") // If the selected Role allows access to Sales Consultant revision only
                {
                    NewJobsPanel.Visibility = System.Windows.Visibility.Collapsed;
                    AcceptedPanel.Visibility = System.Windows.Visibility.Collapsed;
                    RejectedPanel.Visibility = System.Windows.Visibility.Collapsed;
                    OnHoldPanel.Visibility = System.Windows.Visibility.Collapsed;
                    CancelledPanel.Visibility = System.Windows.Visibility.Collapsed;
                    AppointmentPanel.Visibility = System.Windows.Visibility.Collapsed;
                }

                else
                {
                    NewJobsPanel.Visibility = System.Windows.Visibility.Visible;
                    AcceptedPanel.Visibility = System.Windows.Visibility.Visible;
                    OnHoldPanel.Visibility = System.Windows.Visibility.Visible;
                    CancelledPanel.Visibility = System.Windows.Visibility.Visible;

                    if (revisionTypeIds.IndexOf("#2#") >= 0) // Only check resubmitted jobs when user have access to Sales Accept revision
                    {
                        RejectedPanel.Visibility = System.Windows.Visibility.Visible;

                        RetailSystemClient mrsClient = new RetailSystemClient();
                        mrsClient.Endpoint.Address = new System.ServiceModel.EndpointAddress(Utilities.GetMetriconRetailSystemWcfClientEndpointUrl());

                        mrsClient.GetResubmittedEstimateCountCompleted += new EventHandler<GetResubmittedEstimateCountCompletedEventArgs>(mrsClient_GetResubmittedEstimateCountCompleted);
                        if (_currentApp.IsManager)
                            mrsClient.GetResubmittedEstimateCountAsync(0, _currentApp.CurrentRegionId);
                        else
                            mrsClient.GetResubmittedEstimateCountAsync(_currentApp.CurrentUserId, 0);
                    }
                    else
                    {
                        RejectedPanel.Visibility = System.Windows.Visibility.Collapsed;
                        AlertPanel.Visibility = System.Windows.Visibility.Collapsed;
                    }

                    // Only display appointment to Studio M roles
                    if (revisionTypeIds.IndexOf("#7#") >= 0 ||
                        revisionTypeIds.IndexOf("#8#") >= 0 ||
                        revisionTypeIds.IndexOf("#9#") >= 0 ||
                        revisionTypeIds.IndexOf("#10#") >= 0 ||
                        revisionTypeIds.IndexOf("#11#") >= 0 ||
                        revisionTypeIds.IndexOf("#12#") >= 0)
                    {
                        AppointmentPanel.Visibility = System.Windows.Visibility.Visible;
                    }
                    else
                    {
                        AppointmentPanel.Visibility = System.Windows.Visibility.Collapsed;
                    }
                }

                //RetailSystemClient mrsClient = new RetailSystemClient();
                //mrsClient.Endpoint.Address = new System.ServiceModel.EndpointAddress(Utilities.GetMetriconRetailSystemWcfClientEndpointUrl());

                //mrsClient.GetOnHoldEstimateCountCompleted += new EventHandler<GetOnHoldEstimateCountCompletedEventArgs>(mrsClient_GetOnHoldEstimateCountCompleted);
                //if (_currentApp.IsManager)
                //    mrsClient.GetOnHoldEstimateCountAsync(revisionTypeIds, 0, _currentApp.CurrentRegionId);
                //else
                //    mrsClient.GetOnHoldEstimateCountAsync(revisionTypeIds, _currentApp.CurrentUserId, 0);

            }
            else
                ExceptionHandler.PopUpErrorMessage(e.Error, "GetRevisionTypeAccessCompleted");

            if (BusyIndicator2.IsBusy)
                BusyIndicator2.IsBusy = false;
        }