public CustomerListViewModel(IDataService dataService, IUserSession userSession) { _badlist = new List <ServerResponse>(); _dataService = dataService; _userSession = userSession; Customers = new ObservableCollection <CustomerListItemViewModel>(); SelectedCustomerListItems = new ObservableCollection <CustomerListItemViewModel>(); SelectedCustomerListItems.CollectionChanged += SelectedCustomerListItemsChanged_EventHandler; _filter = new Filter(); InternalCommands.InvoiceSelected.RegisterCommand(new DelegateCommand <InvoiceListItemView>(RefreshInvoice)); InternalCommands.RefreshCustomers.RegisterCommand(new DelegateCommand(RefreshCustomers)); InternalCommands.UpdateInvoiceList.RegisterCommand(new DelegateCommand(UpdateInvoiceListFromSelectedCustomer)); InternalCommands.InvoiceIDSelected.RegisterCommand(new DelegateCommand(InvoiceIDSelected)); InternalCommands.ReloadInvoiceSearchFilter.RegisterCommand(new DelegateCommand(LoadAllInvoices)); ApplyFilterCommand = new DelegateCommand <object>(ExecuteApplyFilter); ResetFilterCommand = new DelegateCommand <object>(ExecuteResetFilter); AutoGenerateCommand = new DelegateCommand <object>(ExecuteAutoGenerate, CanExecuteAutoGenerate); FinalizeDraftCommand = new DelegateCommand <object>(ExecuteFinalizeDraftCommand, CanExecuteFinalizeDraftCommand); //LoadCustomerViews(); InternalCommands.ReloadInvoiceSearchFilter.Execute(null); EndDate = new DateTime(DateTime.Today.Year, DateTime.Today.Month, 1).AddDays(-1); SelectedInvoice = new InvoiceListItemView(); }
public TimeEntryListItemViewModel(CreditNote timeEntry, InvoiceListItemView invoice, IUserRepository userRepository, IDataService dataService) { _timeEntry = ConvertCreditNoteToTimeEntry(timeEntry); _invoice = invoice; _userRepository = userRepository; _dataService = dataService; ExcludeTimeEntryCommand = new DelegateCommand(ExecuteExcludeTimeEntry, () => TimeEntry.IsStopped); }
public TimeEntryListItemViewModel(TimeEntry timeEntry, InvoiceListItemView invoice, IUserRepository userRepository, IDataService dataService) { _timeEntry = timeEntry; _invoice = invoice; _userRepository = userRepository; _dataService = dataService; ExcludeTimeEntryCommand = new DelegateCommand(ExecuteExcludeTimeEntry); }
private void ExecuteEditInvoiceCompleted(InvoiceListItemView obj) { var invoiceLine = Invoices.SingleOrDefault(i => i.Id == obj.ID); if (invoiceLine == null) { Invoices.Add(new InvoiceListItemViewModel(obj, _dataService)); } }
public void RecalculateInvoice(InvoiceListItemView invoice, Action action) { _dataService.RecalculateInvoice(invoice.ID, invoice.StartDate, invoice.EndDate, invoice.CustomerInvoiceGroupId) .Subscribe(r => Execute.InUIThread(() => { InternalCommands.ReloadInvoices.Execute(null); InternalCommands.RefreshCustomers.Execute(null); action.Invoke(); })); }
private void CustomerSelected(CustomersInvoiceView obj) { _customerInvoiceView = obj; CreateNewInvoiceCommand.RaiseCanExecuteChanged(); _invoiceListItemView = null; PreviewInvoiceCommand.RaiseCanExecuteChanged(); PreviewSpecificationCommand.RaiseCanExecuteChanged(); CreditNoteCommand.RaiseCanExecuteChanged(); Recalculateinvoice.RaiseCanExecuteChanged(); EmailInvoice.RaiseCanExecuteChanged(); RegenerateFiles.RaiseCanExecuteChanged(); }
public InvoiceListItemViewModel(InvoiceListItemView invoice, IDataService dataservice) { _data = dataservice; Invoice = invoice; DeleteInvoice = new DelegateCommand <object>(ExecuteDeleteInvoice, CanExecuteDeleteinvoice); ToggleDelivered = new DelegateCommand <object>(ExecuteToggleDelivered, CanExecuteToggleDelivered); InternalCommands.ReloadInvoiceCommentField.RegisterCommand(new DelegateCommand <int?>(ReloadComment)); ToggleDeliver(false); InternalCommands.UpdateExclVAT.RegisterCommand(new DelegateCommand <int?>(UpdateExclVAT)); }
public InvoiceActionsViewModel(InvoiceListItemView invoice) { _invoice = invoice; EditInvoice = new DelegateCommand <object>(ExecuteEditInvoice, CanEditInvoice); ManageInvoiceLines = new DelegateCommand <object>(ExecuteManageInvoiceLines, CanManageInvoiceLines); ViewInvoice = new DelegateCommand <object>(ExecuteViewInvoice, CanViewInvoice); ViewSpecification = new DelegateCommand <object>(ExecuteViewSpecification, CanViewSpecification); ViewNonBillableSpecification = new DelegateCommand <object>(ExecuteViewNonBillableSpecification, CanViewNonBillableSpecification); }
private void InvoiceSelected(InvoiceListItemView obj) { ActionPanels.Clear(); var invoiceActions = new InvoiceActionPanelViewFactory(obj); ActionPanels.Add(invoiceActions.CreateActionPanelView()); _invoiceListItemView = obj; PreviewInvoiceCommand.RaiseCanExecuteChanged(); PreviewSpecificationCommand.RaiseCanExecuteChanged(); CreditNoteCommand.RaiseCanExecuteChanged(); Recalculateinvoice.RaiseCanExecuteChanged(); EmailInvoice.RaiseCanExecuteChanged(); RegenerateFiles.RaiseCanExecuteChanged(); }
public ServerResponse SaveInvoiceChanges(InvoiceListItemView invoicedata) { try { return(_invoiceService.SaveInvoiceChanges(invoicedata));; } catch (InvalidOperationException ex) { LogError(ex); return(new ServerResponse("tried to save, a deleted draft", false)); } catch (Exception ex) { LogError(ex); return(new ServerResponse("Invoice was not saved", false)); } }
/// <summary> /// /// </summary> /// <param name="invoicedata"></param> /// <returns></returns> public ServerResponse SaveInvoiceChanges(InvoiceListItemView invoicedata) { using (var db = _trexContextProvider.TrexEntityContext) { var invoice = (from i in db.Invoices where i.ID == invoicedata.ID select i).First(); invoice.InvoiceDate = invoicedata.InvoiceDate; invoice.EndDate = invoicedata.EndDate; invoice.DueDate = invoicedata.DueDate; invoice.Regarding = invoicedata.Regarding; invoice.StartDate = invoicedata.StartDate; invoice.Delivered = invoicedata.Delivered; invoice.DeliveredDate = invoicedata.DeliveredDate; invoice.Closed = invoicedata.Closed; invoice.Attention = invoicedata.attention; invoice.AmountPaid = invoicedata.AmountPaid; db.Invoices.ApplyChanges(invoice); db.SaveChanges(); return(new ServerResponse("Invoice succesfully saved", true)); } }
public InvoiceActionPanelViewFactory(InvoiceListItemView task) { _invoice = task; }
private void RefreshInvoice(InvoiceListItemView obj) { SelectedInvoice = obj; FinalizeDraftCommand.RaiseCanExecuteChanged(); }
public IObservable <ServerResponse> SaveInvoiceChanges(InvoiceListItemView invoiceData) { return(_saveInvoiceChanges(invoiceData).ObserveOnDispatcher()); }
public void RecalculateInvoice(InvoiceListItemView invoice) { RecalculateInvoice(invoice, () => { }); }