public void AddClientCommand_Executed(object sender) { if (AppProperties.FormHaveModifications) { _contoData.ClientAdd(new Client { Name = Name, Address = Address, City = City, PostalCode = PostalCode, FiscalCode = FiscalCode, VatCode = VatCode }); Name = string.Empty; Address = string.Empty; City = string.Empty; PostalCode = string.Empty; FiscalCode = string.Empty; VatCode = string.Empty; _completeList = new List <Client>(_contoData.ClientsGet()); NumberOfPages = (int)Math.Ceiling((double)_completeList.Count / NumberOfRowsInClientsGrid); SetClientsList(); AppProperties.FormHaveModifications = false; } }
public InvoiceViewModel() : base(NumberOfRowsInInvoicesGrid) { _contoData = new ContoData(); Clients = new List <Client>(_contoData.ClientsGet()); InvoiceDate = DateTime.Today; Measures = new List <Measures>(_contoData.MeasuresGet()); var invoiceRowId = Guid.NewGuid(); InvoiceRows = new List <NewInvoiceContent> { new NewInvoiceContent(invoiceRowId) { Rows = new List <NewInvoiceMaterialRow> { new NewInvoiceMaterialRow { MasterId = invoiceRowId } } } }; Initialize(OnPropertyChanged, _contoData.InvoicesMasterGet); AppProperties.FormHaveModifications = false; }
public ClientsViewModel() { _contoData = new ContoData(); _completeList = new List <Client>(_contoData.ClientsGet()); NumberOfPages = (int)Math.Ceiling((double)_completeList.Count / NumberOfRowsInClientsGrid); SetClientsList(); AddClientCommand = new RelayCommand(AddClientCommand_Executed); RemoveClientCommand = new RelayCommand(RemoveClientCommand_Executed); ModifyClientCommand = new RelayCommand(ModifyClientCommand_Executed); UpdateClientCommand = new RelayCommand(UpdateClientCommand_Executed); UpdateClientCloseCommand = new RelayCommand(UpdateClientCommandClose_Executed); UpdatePanelVisibility = Visibility.Collapsed; }