public SaftValidationResumeViewModel(INavigationService navService, ISaftValidator saftValidator) { //injected properties this.navService = navService; this.saftValidator = saftValidator; OpenHeaderCommand = new DelegateCommand(OnOpenHeader); OpenCustomersCommand = new DelegateCommand(OnOpenCustomers); }
public SaftCustomersPageViewModel(IScreen screen) : base(screen, MenuIds.SAFT_CUSTOMERS_PAGE) { saftValidator = Locator.Current.GetService <ISaftValidator>(); dialogManager = Locator.Current.GetService <IDialogManager>(); DoPrintCommand = ReactiveCommand.CreateFromTask(OnDoPrint); SearchCommand = ReactiveCommand.Create <string>(OnSearch); SearchClearCommand = ReactiveCommand.Create(OnSearchClear); }
public StocksProductsPageViewModel(IScreen screen) : base(screen, MenuIds.STOCKS_PRODUCTS_PAGE) { saftValidator = Locator.Current.GetService <ISaftValidator>(); dialogManager = Locator.Current.GetService <IDialogManager>(); DoPrintCommand = ReactiveCommand.CreateFromTask(OnDoPrint); SearchCommand = ReactiveCommand.Create <string>(OnSearch); SearchClearCommand = ReactiveCommand.Create(OnSearchClear); }
public HomeViewModel(IFileService fileService, INavigationService navService, IMessageService messageService, ISaftValidator saftValidator) { //injected properties this.fileService = fileService; this.navService = navService; this.messageService = messageService; this.saftValidator = saftValidator; //init commands OpenSaftFileCommand = new DelegateCommand(OnOpenSaftFile); }
public SaftDialogResumeViewModel(IScreen router) { this.router = router; saftValidator = Locator.Current.GetService <ISaftValidator>(); dialogManager = Locator.Current.GetService <IDialogManager>(); OpenHeaderCommand = ReactiveCommand.Create(OnOpenHeader); OpenCustomersCommand = ReactiveCommand.Create(OnOpenCustomers); CloseDialogCommand = ReactiveCommand.Create(OnCloseDialog); OpenInvoicesCommand = ReactiveCommand.Create(OnOpenInvoices); }
public SaftPaymentsPageViewModel(IScreen screen) : base(screen, MenuIds.SAFT_PAYMENTS_PAGE) { saftValidator = Locator.Current.GetService <ISaftValidator>(); dialogManager = Locator.Current.GetService <IDialogManager>(); DoPrintCommand = ReactiveCommand.CreateFromTask(OnDoPrint); DoPrintTaxesCommand = ReactiveCommand.CreateFromTask(OnDoPrintTaxes); SearchCommand = ReactiveCommand.Create <string>(OnSearch); SearchClearCommand = ReactiveCommand.Create(OnSearchClear); SearchDetailsCommand = ReactiveCommand.Create <string>(OnSearchDetails); SearchDetailsClearCommand = ReactiveCommand.Create(OnSearchDetailsClear); ShowCustomerCommand = ReactiveCommand.Create(OnShowCustomer); ShowInvoiceDetailsCommand = ReactiveCommand.Create(OnShowInvoiceDetails); DoOpenExcelCommand = ReactiveCommand.CreateFromTask(OnDoOpenExcel); }
public MainWindowViewModel() { DatabaseReady = false; Router = new RoutingState(); Activator = new ViewModelActivator(); ShowMenu = false; dialogManager = Locator.Current.GetService <IDialogManager>(); saftValidator = Locator.Current.GetService <ISaftValidator>(); databaseService = Locator.Current.GetService <IDatabaseService>(); var canOpen = this.WhenValueChanged(x => x.DatabaseReady) .ObserveOn(RxApp.MainThreadScheduler); var canClearFiles = this.WhenAnyValue(x => x.RecentFiles, recentFiles => recentFiles != null && recentFiles.Count() > 0); ExitCommand = ReactiveCommand.Create(OnExit); OpenSaftCommand = ReactiveCommand.CreateFromTask(OnOpenSaft, canOpen); OpenTransportCommand = ReactiveCommand.Create(OnOpenTransport, canOpen); OpenStocksCommand = ReactiveCommand.CreateFromTask(OnOpenStocks, canOpen); OpenRecentFileCommand = ReactiveCommand.CreateFromTask <string>(OnOpenRecentSaftFile); OpenMenuSaftCommand = ReactiveCommand.Create <string>(OnOpenMenuSaft); OpenMenuStocksCommand = ReactiveCommand.Create <string>(OnOpenMenuStocks); OpenMenuTransportCommand = ReactiveCommand.Create <string>(OnOpenMenuTransport); ClearRecentFilesCommand = ReactiveCommand.Create(OnClearRecentFiles); OpenPemDialogCommand = ReactiveCommand.CreateFromTask(OnOpenPemDialog); OpenHashDialogCommand = ReactiveCommand.CreateFromTask(OnOpenHashDialog); MenuHeader = new string[] { "Erros", "Cabeçalho" }; MenuTables = new string[] { "Clientes", "Fornecedores", "Produtos", "Impostos" }; MenuInvoices = new string[] { "Documentos Faturação", "Pagamentos", "Documentos Conferência", "Documentos Movimentação" }; MenuStock = new string[] { "Cabeçalho", "Produtos", }; this.WhenActivated(disposables => { this.WhenValueChanged(x => x.SelectedSaftMenu) .InvokeCommand(OpenMenuSaftCommand) .DisposeWith(disposables); this.WhenValueChanged(x => x.SelectedStocksMenu) .InvokeCommand(OpenMenuStocksCommand) .DisposeWith(disposables); }); dialogManager.AddMessage("A iniciar base de dados"); Task.Run(() => { databaseService.InitDatabase(); dialogManager.AddMessage(""); var recentFiles = databaseService.GetRecentFiles(); var recentMenu = new List <MenuItemViewModel>( recentFiles.Select(r => new MenuItemViewModel { Header = r, Command = OpenRecentFileCommand, CommandParameter = r })) { new MenuItemViewModel { Header = "Limpar", Command = ClearRecentFilesCommand } }; RecentFiles = new ObservableCollection <MenuItemViewModel>(); var recentFilesMenu = new MenuItemViewModel[] { new MenuItemViewModel { Header = "_Recentes", Items = recentMenu } }; RecentFiles.AddRange(recentFilesMenu); DatabaseReady = true; }); dialogManager.UpdateVersionInfo(databaseService.GetAppVersion()); }
public static Models.Saft.Header GetHeader(ISaftValidator saftValidator) { Models.Saft.Header header = null; if (saftValidator?.SaftFileV4?.Header != null) { var h = saftValidator.SaftFileV4.Header; header = new Models.Saft.Header { AuditFileVersion = h.AuditFileVersion, BusinessName = h.BusinessName, CompanyAddress = new Models.Saft.AddressStructurePT { AddressDetail = h.CompanyAddress?.AddressDetail, BuildingNumber = h.CompanyAddress?.BuildingNumber, City = h.CompanyAddress?.City, Country = h.CompanyAddress?.Country?.ToString(), PostalCode = h.CompanyAddress?.PostalCode, Region = h.CompanyAddress?.Region, StreetName = h.CompanyAddress?.StreetName }, CompanyID = h.CompanyID, CompanyName = h.CompanyName, CurrencyCode = h.CurrencyCode?.ToString(), DateCreated = h.DateCreated, Email = h.Email, EndDate = h.EndDate, Fax = h.Fax, FiscalYear = h.FiscalYear, HeaderComment = h.HeaderComment, ProductCompanyTaxID = h.ProductCompanyTaxID, ProductID = h.ProductID, ProductVersion = h.ProductVersion, SoftwareCertificateNumber = h.SoftwareCertificateNumber, StartDate = h.StartDate, TaxAccountingBasis = h.TaxAccountingBasis.ToString(), TaxEntity = h.TaxEntity, TaxRegistrationNumber = h.TaxRegistrationNumber, Telephone = h.Telephone, Website = h.Website, TooltipAddressDetail = h.TooltipAddressDetail, TooltipAuditFileVersion = h.TooltipAuditFileVersion, TooltipBuildingNumber = h.TooltipBuildingNumber, TooltipBusinessName = h.TooltipBusinessName, TooltipCity = h.TooltipCity, TooltipCompanyAddress = h.TooltipCompanyAddress, TooltipCompanyID = h.TooltipCompanyID, TooltipCompanyName = h.TooltipCompanyName, TooltipCountry = h.TooltipCountry, TooltipCurrencyCode = h.TooltipCurrencyCode, TooltipDateCreated = h.TooltipDateCreated, TooltipEmail = h.TooltipEmail, TooltipEndDate = h.TooltipEndDate, TooltipFax = h.TooltipFax, TooltipFiscalYear = h.TooltipFiscalYear, TooltipHeaderComment = h.TooltipHeaderComment, TooltipPostalCode = h.TooltipPostalCode, TooltipProductCompanyTaxID = h.TooltipProductCompanyTaxID, TooltipProductID = h.TooltipProductID, TooltipProductVersion = h.TooltipProductVersion, TooltipRegion = h.TooltipRegion, TooltipSoftwareCertificateNumber = h.TooltipSoftwareCertificateNumber, TooltipStartDate = h.TooltipStartDate, TooltipStreetName = h.TooltipStreetName, TooltipTaxAccountingBasis = h.TooltipTaxAccountingBasis, TooltipTaxEntity = h.TooltipTaxEntity, TooltipTaxRegistrationNumber = h.TooltipTaxRegistrationNumber, TooltipTelephone = h.TooltipTelephone, TooltipWebsite = h.TooltipWebsite }; } else if (saftValidator?.SaftFileV3?.Header != null) { var h = saftValidator.SaftFileV3.Header; header = new Models.Saft.Header { AuditFileVersion = h.AuditFileVersion, BusinessName = h.BusinessName, CompanyAddress = new Models.Saft.AddressStructurePT { AddressDetail = h.CompanyAddress?.AddressDetail, BuildingNumber = h.CompanyAddress?.BuildingNumber, City = h.CompanyAddress?.City, Country = h.CompanyAddress?.Country?.ToString(), PostalCode = h.CompanyAddress?.PostalCode, Region = h.CompanyAddress?.Region, StreetName = h.CompanyAddress?.StreetName }, CompanyID = h.CompanyID, CompanyName = h.CompanyName, CurrencyCode = h.CurrencyCode?.ToString(), DateCreated = h.DateCreated, Email = h.Email, EndDate = h.EndDate, Fax = h.Fax, FiscalYear = h.FiscalYear, HeaderComment = h.HeaderComment, ProductCompanyTaxID = h.ProductCompanyTaxID, ProductID = h.ProductID, ProductVersion = h.ProductVersion, SoftwareCertificateNumber = h.SoftwareCertificateNumber, StartDate = h.StartDate, TaxAccountingBasis = h.TaxAccountingBasis.ToString(), TaxEntity = h.TaxEntity, TaxRegistrationNumber = h.TaxRegistrationNumber, Telephone = h.Telephone, Website = h.Website, TooltipAddressDetail = h.TooltipAddressDetail, TooltipAuditFileVersion = h.TooltipAuditFileVersion, TooltipBuildingNumber = h.TooltipBuildingNumber, TooltipBusinessName = h.TooltipBusinessName, TooltipCity = h.TooltipCity, TooltipCompanyAddress = h.TooltipCompanyAddress, TooltipCompanyID = h.TooltipCompanyID, TooltipCompanyName = h.TooltipCompanyName, TooltipCountry = h.TooltipCountry, TooltipCurrencyCode = h.TooltipCurrencyCode, TooltipDateCreated = h.TooltipDateCreated, TooltipEmail = h.TooltipEmail, TooltipEndDate = h.TooltipEndDate, TooltipFax = h.TooltipFax, TooltipFiscalYear = h.TooltipFiscalYear, TooltipHeaderComment = h.TooltipHeaderComment, TooltipPostalCode = h.TooltipPostalCode, TooltipProductCompanyTaxID = h.TooltipProductCompanyTaxID, TooltipProductID = h.TooltipProductID, TooltipProductVersion = h.TooltipProductVersion, TooltipRegion = h.TooltipRegion, TooltipSoftwareCertificateNumber = h.TooltipSoftwareCertificateNumber, TooltipStartDate = h.TooltipStartDate, TooltipStreetName = h.TooltipStreetName, TooltipTaxAccountingBasis = h.TooltipTaxAccountingBasis, TooltipTaxEntity = h.TooltipTaxEntity, TooltipTaxRegistrationNumber = h.TooltipTaxRegistrationNumber, TooltipTelephone = h.TooltipTelephone, TooltipWebsite = h.TooltipWebsite }; } return(header); }
public SaftHeaderPageViewModel(IScreen screen) : base(screen, MenuIds.SAFT_HEADER_PAGE) { saftValidator = Locator.Current.GetService <ISaftValidator>(); }