Пример #1
0
        /// <summary>
        /// This method is used for generating CRL30 File. 
        /// </summary>
        /// <param name="mortgageLoanBillingFileModel"></param>
        public void GenerateCRL30File(MortgageLoanBillingFileModel mortgageLoanBillingFileModel, string inputFile)
        {
            try
            {
                // Creating output file path
                CreateOutputPath(inputFile);
                using (var output = new StandardFile())
                {
                    Logger.Info("Creating NCP Header records...");
                    var lineCnt = 3;
                    output.CreateNew(_outputFile, "BHM");
                    var ncp05 = RecordManager.NewInputFileInfoRecord(Ncp05Version);
                    ncp05.Description = Ncp05Description;
                    ncp05.FileReceivedDate = Convert.ToDateTime(CommonHelper.GetFormatedDateTimeWithAmPm(mortgageLoanBillingFileModel.InputFileDate));
                    ncp05.InputFileName = mortgageLoanBillingFileModel.InputFileName; //TODO:Add properties in mortgage model
                    ncp05.InputFileSize = mortgageLoanBillingFileModel.InputFileSize;
                    ncp05.FileNumber = 1;
                    ncp05.TrackingId = Convert.ToInt32(mortgageLoanBillingFileModel.TrackingId);
                    output.AddInputFileInfoRecord(ncp05);
                    lineCnt++;

                    Logger.Info("Creating NCP07 records...");
                    //TODO: Revisit
                    output.AddLogRecord("CONV", "START", "Carrington_Mortgage + CONVERSION STARTED");
                    string InputFiledate = CommonHelper.GetFormatedDateTimeWithAmPm(mortgageLoanBillingFileModel.InputFileDate);
                    output.AddLogRecord("CONV", "INFO", $"LoanBillExtractInfo - FileDate = {InputFiledate}");
                    output.AddLogRecord("CONV", "INFO", $"LoanBillExtractInfo - Institution = {mortgageLoanBillingFileModel.InstitutionRecords.Rssi_Institution_Name}");
                    output.AddLogRecord("CONV", "INFO",
                        mortgageLoanBillingFileModel.InstitutionRecords.Rssi_Inst_Phone != null
                            ? $"LoanBillExtractInfo - Institution Phone = {mortgageLoanBillingFileModel.InstitutionRecords.Rssi_Inst_Phone}"
                            : $"LoanBillExtractInfo - Institution Phone = {mortgageLoanBillingFileModel.InstitutionRecords.Rssi_Alt_Coup_Ph_No_1}");
                    lineCnt += 10;

                    Logger.Info("Creating NCP09 records...");
                    output.AddAttribute(Ncp09DataKeyCategory, Ncp09DataKeyAccountsTotalCount, Convert.ToString(mortgageLoanBillingFileModel.TotalNumberOfAccount));
                    lineCnt++;

                    Logger.Info("Starting Account records process...");
                    var primaryIndex = 1;
                    var line = new StringBuilder();
                    int counter = 0;
                    foreach (var extractAccount in mortgageLoanBillingFileModel.AccountModelList)
                    {
                        counter++;
                        Logger.Info("Account records extracting...: " + counter);
                        //if (extractAccount.MasterFileDataPart_1Model.Rssi_Acct_No == "0000000011")//"0000714479")//"0000905973") //"0000714479")
                        //{

                        //}

                        _accountTypeHold = string.Empty;

                        var account = new CustomerAccount(primaryIndex, 1)
                        {
                            Standard = RecordManager.NewStandardRecord(Ncp10Version),
                            Workflow = new WorkflowRecord_NCP11_2
                            {
                                PrintDelivery = true,
                                ElectronicDelivery = true,
                                ElectronicDeliveryMethod = "A",
                                IMBIndicator = "I",
                                OptionNumber = null
                            }
                        };

                        account.Standard.AccountNumber = extractAccount.MasterFileDataPart_1Model.Rssi_Acct_No;
                        account.Standard.AccountSequenceNumber = primaryIndex;

                        //Mailing address
                        account.Standard.OriginalAddressLine1 = extractAccount.MasterFileDataPart_1Model.Rssi_Mail_Adrs_1;
                        account.Standard.OriginalAddressLine2 = extractAccount.MasterFileDataPart_1Model.Rssi_Mail_Adrs_2;
                        account.Standard.OriginalAddressLine3 = extractAccount.MasterFileDataPart_1Model.Rssi_Mail_Adrs_3;

                        //City,State and Zip
                        //account.Standard.OriginalCity = extractAccount.MasterFileDataPart_1Model.Rssi_Mail_Adrs_3;
                        //account.Standard.OriginalState = extractAccount.MasterFileDataPart_1Model.Rssi_Mail_Adrs_3;
                        //account.Standard.OriginalZip4 = extractAccount.MasterFileDataPart_1Model.Rssi_Mail_Adrs_3;
                        //account.Standard.OriginalZip5 = extractAccount.MasterFileDataPart_1Model.Rssi_Mail_Adrs_3;


                        //For Raw Data
                        line = GetRawData(extractAccount);
                        account.AddCustomerRecord(FormatCustomer.BuildRecord("RAW", primaryIndex, line));

                        //Get all the data from input file and create Raw data rows
                        BuildPMRawData(extractAccount, account, primaryIndex);

                        // Check the account for bankrupcy 
                        bool isBankrupt = string.IsNullOrEmpty(extractAccount.ActiveBankruptcyInformationRecordModel.Rssi_B_Chap) ? true : false;

                        var borrowerList = new List<BorrowerModel>();

                        if (!isBankrupt)
                        {
                            //Assigning Flex fields for Primary borrower
                            borrowerList = StatementType.GetPrimaryStandardStatement(extractAccount);

                            if (borrowerList.Count > 0)
                            {
                                account.Standard.FlexField1 = borrowerList.FirstOrDefault()?.FlexField1;
                                account.Standard.FlexField2 = borrowerList.FirstOrDefault()?.FlexField2;
                                account.Standard.FlexField3 = borrowerList.FirstOrDefault()?.FlexField3;
                                account.Standard.FlexField4 = borrowerList.FirstOrDefault()?.FlexField4;
                                account.Standard.FlexField5 = borrowerList.FirstOrDefault()?.FlexField5;
                                account.Standard.FlexField6 = borrowerList.FirstOrDefault()?.FlexField6;
                            }
                              

                            account.Standard.SSN = extractAccount.MasterFileDataPart_1Model.Rssi_Primary_Social_Sec;
                            account.Standard.StatementDate = CommonHelper.GetFormatedDateTime(extractAccount.MasterFileDataPart_1Model.Rssi_Run_Date);
                            account.Standard.PaymentDueDate = CommonHelper.GetFormatedDateTime(extractAccount.MasterFileDataPart_1Model.Rssi_Due_Date) >
                               CommonHelper.GetFormatedDateTime(extractAccount.MasterFileDataPart_1Model.Rssi_Cur_Due_Dte) ?
                               CommonHelper.GetFormatedDateTime(extractAccount.MasterFileDataPart_1Model.Rssi_Due_Date) :
                               CommonHelper.GetFormatedDateTime(extractAccount.MasterFileDataPart_1Model.Rssi_Cur_Due_Dte);
                            if (extractAccount.LateChargeDetailRecordModel.Rssi_Lcd_Pymt_Due_Dt_PackedData != null)
                            {
                                account.Standard.LatePaymentDueDate = CommonHelper.GetFormatedDateTime(extractAccount.LateChargeDetailRecordModel.Rssi_Lcd_Pymt_Due_Dt_PackedData);
                            }
                            else { account.Standard.LatePaymentDueDate = null; }

                            account.Standard.PaymentAmount = Convert.ToDecimal(ChapterSevenBillingStatement.GetPaymentAmount(extractAccount));

                            account.Standard.LatePaymentAmount = (StandardBillingStatement.GetLatePaymentAmount(extractAccount) != null
                                && StandardBillingStatement.GetLatePaymentAmount(extractAccount) != "N/A") ?
                                Convert.ToDecimal(StandardBillingStatement.GetLatePaymentAmount(extractAccount)) : 0;//TODO: Convert the calling method
                            account.Standard.EmailAddress = extractAccount.MasterFileDataPart_1Model.Rssi_Primary_Email_Adr;
                            account.Standard.FormattedAccount = extractAccount.MasterFileDataPart_1Model.Rssi_Acct_No;
                            account.Standard.TwoDRecordCode = 3;


                            lineCnt++;
                            line.Clear();
                            if (borrowerList.Count > 0)
                            {
                                //Get Statement based on the Flex fields for account
                                switch (borrowerList.FirstOrDefault()?.FlexField2)
                                {

                                    //For Chapter 7 Option ARM Statement
                                    case "A07":
                                        line = ChapterSevenOptionARMStatement.GetFinalChapterSevenOptionARMStatement(extractAccount);
                                        account.AddCustomerRecord(FormatCustomer.BuildRecord("A07", primaryIndex, line));
                                        break;

                                    //For Chapter 13 Option ARM Statement
                                    case "A13":
                                        line = ChapterThirteenOptionARMStatement.GetFinalChapterThirteenOptionARMStatement(extractAccount);
                                        account.AddCustomerRecord(FormatCustomer.BuildRecord("A13", primaryIndex, line));
                                        break;

                                    //For Option ARM Billing  Statement
                                    case "ARM":
                                        line = OptionARMBillingStatement.GetFinalOptionARMBillingStatement(extractAccount);
                                        account.AddCustomerRecord(FormatCustomer.BuildRecord("ARM", primaryIndex, line));
                                        break;

                                    //For Chapter 7 Billing Statement
                                    case "S07":
                                        line = ChapterSevenBillingStatement.GetFinalChapterSevenBillingStatement(extractAccount);
                                        account.AddCustomerRecord(FormatCustomer.BuildRecord("S07", primaryIndex, line));
                                        break;

                                    //For Chapter 13 Billing Statement
                                    case "S13":
                                        line = ChapterThirteenBillingStatement.GetFinalChapterThirteenBillingStatement(extractAccount);
                                        account.AddCustomerRecord(FormatCustomer.BuildRecord("S13", primaryIndex, line));
                                        break;

                                    //For Standard Billing Statement
                                    case "STD":
                                        line = StandardBillingStatement.GetFinalStringStandardBilling(extractAccount);
                                        account.AddCustomerRecord(FormatCustomer.BuildRecord("STD", primaryIndex, line));
                                        break;

                                    default:
                                        break;

                                }

                                                            
                                line.Clear();

                               

                                //Removing the primary borrower from the list leaving co borrower details inside
                                borrowerList.RemoveAt(0);
                            }
                        }

                        //Check if primary account is rejected or not 
                        var primaryAccountRejected = RejectStatement.IsRejectAccount(extractAccount);
                        if (primaryAccountRejected || isBankrupt)
                        {
                            string bankruptcy = string.Empty;
                            if (isBankrupt)
                            {
                                bankruptcy = " - Active Bankruptcy";
                            }
                            RejectAccount(account, "Invalid Account" + bankruptcy);
                        }
                            


                        account.SequenceTransactions();
                        output.AddAccount(account);
                        primaryIndex++;

                        if (borrowerList.Count > 0 && extractAccount.CoBorrowerRecordModel.Rssi_Acct_No != null)
                        {
                            //Add records for Co-Borrower Section 
                            foreach (var borrower in borrowerList)
                            {

                                if (borrower.DistinctAdditionalRecord)
                                {
                                    //Setting FlexFields according to co-borrower conditions
                                    account.Standard.FlexField1 = borrower.FlexField1;
                                    account.Standard.FlexField2 = borrower.FlexField2;
                                    account.Standard.FlexField3 = borrower.FlexField3;
                                    account.Standard.FlexField4 = borrower.FlexField4;
                                    account.Standard.FlexField5 = borrower.FlexField5;
                                    account.Standard.FlexField6 = borrower.FlexField6;

                                    switch (borrower.FlexField2)
                                    {
                                        //For Chapter 7 Option ARM Statement
                                        case "A07":
                                            //Set Mailing address according to the conditions
                                            account.Standard.OriginalAddressLine1 = ChapterSevenOptionARMStatement.GetMailingBKAttorneyAddressLine1(extractAccount, true);
                                            account.Standard.OriginalAddressLine2 = ChapterSevenOptionARMStatement.GetMailingBKAttorneyAddressLine2(extractAccount, true);
                                            string A07_cityStateZip = ChapterSevenOptionARMStatement.GetBorrowerAttorneyMailingCityStateZip(extractAccount, true);
                                            if(!string.IsNullOrEmpty(A07_cityStateZip))
                                            {
                                                var arr = A07_cityStateZip.Split(',');
                                                account.Standard.OriginalCity = arr[0].Trim();
                                                account.Standard.OriginalState = arr[1].Trim();
                                                account.Standard.OriginalZip5 = arr[2].Trim();
                                                account.Standard.OrigCszLength = A07_cityStateZip.Length - 2; // Remove 2 for commas (",")

                                            }
                                            break;

                                        //For Chapter 13 Option ARM Statement
                                        case "A13":
                                            //Set Mailing address according to the conditions
                                            account.Standard.OriginalAddressLine1 = ChapterThirteenOptionARMStatement.GetMailingBKAttorneyAddressLine1(extractAccount, true);
                                            account.Standard.OriginalAddressLine2 = ChapterThirteenOptionARMStatement.GetMailingBKAttorneyAddressLine2(extractAccount, true);
                                            string A13_cityStateZip = ChapterThirteenOptionARMStatement.GetBorrowerAttorneyMailingCityStateZip(extractAccount, true);
                                            if (!string.IsNullOrEmpty(A13_cityStateZip))
                                            {
                                                var arr = A13_cityStateZip.Split(',');
                                                account.Standard.OriginalCity = arr[0].Trim();
                                                account.Standard.OriginalState = arr[1].Trim();
                                                account.Standard.OriginalZip5 = arr[2].Trim();
                                                account.Standard.OrigCszLength = A13_cityStateZip.Length-2;

                                            }
                                            break;

                                        //For Option ARM Billing  Statement
                                        case "ARM":
                                            //Set Mailing address according to the conditions
                                            account.Standard.OriginalAddressLine1 = OptionARMBillingStatement.GetMailingAddressLine1(extractAccount, true);
                                            account.Standard.OriginalAddressLine2 = OptionARMBillingStatement.GetMailingAddressLine2(extractAccount, true);
                                            string ARM_cityStateZip = OptionARMBillingStatement.GetMailingCityStateZip(extractAccount, true);
                                            if (!string.IsNullOrEmpty(ARM_cityStateZip))
                                            {
                                                var arr = ARM_cityStateZip.Split(',');
                                                account.Standard.OriginalCity = arr[0].Trim();
                                                account.Standard.OriginalState = arr[1].Trim();
                                                account.Standard.OriginalZip5 = arr[2].Trim();
                                                account.Standard.OrigCszLength = ARM_cityStateZip.Length-2;
                                            }
                                            break;

                                        //For Chapter 7 Billing Statement
                                        case "S07":
                                            //Set Mailing address according to the conditions
                                            account.Standard.OriginalAddressLine1 = ChapterSevenBillingStatement.GetMailingBKAttorneyAddressLine1(extractAccount, true);
                                            account.Standard.OriginalAddressLine2 = ChapterSevenBillingStatement.GetMailingBKAttorneyAddressLine2(extractAccount, true);
                                            string S07_cityStateZip = ChapterSevenBillingStatement.GetBorrowerAttorneyMailingCityStateZip(extractAccount, true);
                                            if (!string.IsNullOrEmpty(S07_cityStateZip))
                                            {
                                                var arr = S07_cityStateZip.Split(',');
                                                account.Standard.OriginalCity = arr[0].Trim();
                                                account.Standard.OriginalState = arr[1].Trim();
                                                account.Standard.OriginalZip5 = arr[2].Trim();
                                                account.Standard.OrigCszLength = S07_cityStateZip.Length-2;

                                            }
                                            break;

                                        //For Chapter 13 Billing Statement
                                        case "S13":
                                            //Set Mailing address according to the conditions
                                            account.Standard.OriginalAddressLine1 = ChapterThirteenBillingStatement.GetMailingBKAttorneyAddressLine1(extractAccount, true);
                                            account.Standard.OriginalAddressLine2 = ChapterThirteenBillingStatement.GetMailingBKAttorneyAddressLine2(extractAccount, true);
                                            string S13_cityStateZip = ChapterThirteenBillingStatement.GetBorrowerAttorneyMailingCityStateZip(extractAccount, true);
                                            if (!string.IsNullOrEmpty(S13_cityStateZip))
                                            {
                                                var arr = S13_cityStateZip.Split(',');
                                                account.Standard.OriginalCity = arr[0].Trim();
                                                account.Standard.OriginalState = arr[1].Trim();
                                                account.Standard.OriginalZip5 = arr[2].Trim();
                                                account.Standard.OrigCszLength = S13_cityStateZip.Length-2;

                                            }
                                            break;

                                        //For Standard Billing Statement
                                        case "STD":
                                            //Set Mailing address according to the conditions
                                            account.Standard.OriginalAddressLine1 = StandardBillingStatement.GetMailingAddressLine1(extractAccount, true);
                                            account.Standard.OriginalAddressLine2 = StandardBillingStatement.GetMailingAddressLine2(extractAccount, true);
                                            string STD_cityStateZip = StandardBillingStatement.GetMailingCityStateZip(extractAccount, true);
                                            if (!string.IsNullOrEmpty(STD_cityStateZip))
                                            {
                                                var arr = STD_cityStateZip.Split(',');
                                                account.Standard.OriginalCity = arr[0].Trim();
                                                account.Standard.OriginalState = arr[1].Trim();
                                                account.Standard.OriginalZip5 = arr[2].Trim();
                                                account.Standard.OrigCszLength = STD_cityStateZip.Length-2;

                                            }
                                            break;

                                        default:
                                            break;

                                    }

                                    //Reject co-borrower account if the primary account is rejected
                                    if (primaryAccountRejected)
                                        RejectAccount(account, "Invalid Account");


                                    account.SequenceTransactions();

                                    output.AddAccount(account);
                                    primaryIndex++;//TODO: Need to check this when this task is complete                          
                                }
                            }
                        }
                        //Setting to false for other primary accounts
                        primaryAccountRejected = false;
                    }

                    output.CloseFile();
                    Logger.Info($"Lines written: {lineCnt}");
                }
            }
            catch (Exception ex)
            {
                Logger.Error(ex, "GenerateCRL30File Failed :");
            }

        }
Пример #2
0
        public MethodEditViewModel(IEventAggregator aggregator,
                                   IDataService <LabDbEntities> labDbData,
                                   ISpecificationService specificationService) : base()
        {
            _labDbData            = labDbData;
            _editMode             = false;
            _eventAggregator      = aggregator;
            _specificationService = specificationService;

            OrganizationList = _labDbData.RunQuery(new OrganizationsQuery()
            {
                Role = OrganizationsQuery.OrganizationRoles.StandardPublisher
            })
                               .ToList();;
            PropertyList = _labDbData.RunQuery(new PropertiesQuery()).ToList();

            Measurements = new List <SubMethod>();

            AddFileCommand = new DelegateCommand(
                () =>
            {
                OpenFileDialog fileDialog = new OpenFileDialog
                {
                    Multiselect = true
                };

                if (fileDialog.ShowDialog() == DialogResult.OK)
                {
                    foreach (string pth in fileDialog.FileNames)
                    {
                        StandardFile temp = new StandardFile
                        {
                            Path        = pth,
                            Description = "",
                            StandardID  = _methodInstance.StandardID
                        };

                        temp.Create();
                    }

                    RaisePropertyChanged("FileList");
                }
            },
                () => CanModify);

            CancelEditCommand = new DelegateCommand(
                () =>
            {
                EditMode = false;
            },
                () => EditMode);

            OpenFileCommand = new DelegateCommand(
                () =>
            {
                System.Diagnostics.Process.Start(_selectedFile.Path);
            },
                () => _selectedFile != null);

            OpenReportCommand = new DelegateCommand <Test>(
                tst =>
            {
                NavigationToken token = new NavigationToken((tst.TestRecord.RecordTypeID == 1) ? ReportViewNames.ReportEditView : ReportViewNames.ExternalReportEditView,
                                                            tst.TestRecord.Reports.First());

                _eventAggregator.GetEvent <NavigationRequested>()
                .Publish(token);
            });

            OpenSpecificationCommand = new DelegateCommand <Specification>(
                spec =>
            {
                NavigationToken token = new NavigationToken(SpecificationViewNames.SpecificationEdit,
                                                            spec);
                _eventAggregator.GetEvent <NavigationRequested>().Publish(token);
            });

            RemoveFileCommand = new DelegateCommand(
                () =>
            {
                _selectedFile.Delete();
                SelectedFile = null;
            },
                () => EditMode && _selectedFile != null);

            SaveCommand = new DelegateCommand(
                () =>
            {
                _methodInstance.Update();

                _specificationService.UpdateSubMethods(Measurements);
                _specificationService.UpdateMethodVariantRange(_methodVariantList);

                if (_selectedOrganization.ID != _methodInstance.Standard.OrganizationID)
                {
                    _methodInstance.Standard.OrganizationID = _selectedOrganization.ID;
                    _methodInstance.Standard.Update();
                }

                EditMode = false;
            },
                () => _editMode);

            StartEditCommand = new DelegateCommand(
                () =>
            {
                EditMode = true;
            },
                () => CanModify && !_editMode);

            UpdateCommand = new DelegateCommand(
                () =>
            {
                _specificationService.ModifyMethodTestList(_methodInstance);
            },
                () => CanModify);
        }
Пример #3
0
        public SpecificationEditViewModel(IDataService <LabDbEntities> labDbData,
                                          IEventAggregator aggregator,
                                          IReportService reportService)
        {
            _labDbData       = labDbData;
            _eventAggregator = aggregator;
            _reportService   = reportService;

            AddControlPlanCommand = new DelegateCommand(
                () =>
            {
                ControlPlan temp = _instance.AddControlPlan();

                RaisePropertyChanged("ControlPlanList");
            });

            AddFileCommand = new DelegateCommand(
                () =>
            {
                OpenFileDialog fileDialog = new OpenFileDialog
                {
                    Multiselect = true
                };

                if (fileDialog.ShowDialog() == DialogResult.OK)
                {
                    foreach (string pth in fileDialog.FileNames)
                    {
                        StandardFile temp = new StandardFile
                        {
                            Path        = pth,
                            Description = "",
                            StandardID  = _instance.StandardID
                        };

                        temp.Create();
                    }

                    RaisePropertyChanged("FileList");
                }
            },
                () => Thread.CurrentPrincipal.IsInRole(UserRoleNames.SpecificationEdit));

            AddTestCommand = new DelegateCommand <MethodVariant>(
                mtd =>
            {
                Requirement newReq = _reportService.GenerateRequirement(mtd);
                _instance.AddMethod(newReq);

                _eventAggregator.GetEvent <SpecificationMethodListChanged>()
                .Publish(_instance);
            },
                mtd => CanEdit);

            AddVersionCommand = new DelegateCommand(
                () =>
            {
                SpecificationVersion temp = new SpecificationVersion
                {
                    IsMain          = false,
                    Name            = "Nuova versione",
                    SpecificationID = _instance.ID
                };

                temp.Create();

                RaisePropertyChanged("VersionList");
            },
                () => CanEdit);

            CloseAddMethodViewCommand = new DelegateCommand(
                () =>
            {
                NavigationToken token = new NavigationToken(SpecificationViewNames.SpecificationVersionList,
                                                            null,
                                                            RegionNames.SpecificationVersionTestListEditRegion);

                _eventAggregator.GetEvent <NavigationRequested>()
                .Publish(token);
            });

            OpenFileCommand = new DelegateCommand(
                () =>
            {
                try
                {
                    System.Diagnostics.Process.Start(_selectedFile.Path);
                }
                catch (Exception)
                {
                    _eventAggregator.GetEvent <StatusNotificationIssued>().Publish("File non trovato");
                }
            },
                () => _selectedFile != null);

            OpenReportCommand = new DelegateCommand(
                () =>
            {
                NavigationToken token = new NavigationToken(Reports.ViewNames.ReportEditView,
                                                            SelectedReport);
                _eventAggregator.GetEvent <NavigationRequested>().Publish(token);
            },
                () => _selectedReport != null);

            RemoveControlPlanCommand = new DelegateCommand(
                () =>
            {
                _selectedControlPlan.Delete();
                RaisePropertyChanged("ControlPlanList");
                SelectedControlPlan = null;
            },
                () => CanEdit &&
                _selectedControlPlan != null &&
                !_selectedControlPlan.IsDefault);

            RemoveFileCommand = new DelegateCommand(
                () =>
            {
                _selectedFile.Delete();
                SelectedFile = null;
            },
                () => Thread.CurrentPrincipal.IsInRole(UserRoleNames.SpecificationEdit) && _selectedFile != null);

            SaveCommand = new DelegateCommand(
                () =>
            {
                _instance.Update();
                _instance.Standard.Update();
                EditMode = false;
            },
                () => _editMode && !HasErrors);

            StartEditCommand = new DelegateCommand(
                () =>
            {
                EditMode = true;
            },
                () => Thread.CurrentPrincipal.IsInRole(UserRoleNames.SpecificationEdit) && !_editMode);

            // Event Subscriptions

            _eventAggregator.GetEvent <MethodChanged>()
            .Subscribe(
                tkn =>
            {
                _methodVariantList = null;
                RaisePropertyChanged("MethodVariantList");
            });

            _eventAggregator.GetEvent <ReportCreated>().Subscribe(
                report => RaisePropertyChanged("ReportList"));
        }