public ViewReceiptViewModel(ReceiptModel receipt, bool customer_fixed = false) { Receipt = receipt; // Fill Customers CustomerModel customers = new CustomerModel(); DataTable cs = customers.All(); Customers = customers.GiveCollection(cs); // Fill Seasons SeasonModel sm = new SeasonModel(); DataTable ss = sm.All(); Seasons = sm.GiveCollection(ss); //Fill Currencies CurrencyModel currency = new CurrencyModel(); DataTable cc = currency.All(); Currencies = currency.GiveCollection(cc); FillForm(cs, ss, cc); Enabled = false; MainButtonText = "Enable Editing"; FactureChanged = false; IsCustomerFixed = customer_fixed; if (customer_fixed == false) { IsCustomerEnabled = Enabled; } else { IsCustomerEnabled = false; } }
public ViewConversionViewModel(ConversionModel conversion) { // Fill Currencies DataTable CurrenciesTable = new DataTable(); CurrencyModel currency = new CurrencyModel(); CurrenciesTable = currency.All(); Currencies = currency.GiveCollection(CurrenciesTable); // Fill Data Conversion = conversion; Ratio = Conversion.Ratio; First = new CurrencyModel(); Second = new CurrencyModel(); First = First.Get(Conversion.First); Second = Second.Get(Conversion.Second); for (int i = 0; i < CurrenciesTable.Rows.Count; i++) { string index = CurrenciesTable.Rows[i][0].ToString(); string first = Conversion.First.ToString(); string second = Conversion.Second.ToString(); if (index == first) { SelectedFirst = i; } if (index == second) { SelectedSecond = i; } } }
public CreateConversionViewModel() { // Fill Currencies CurrencyModel currency = new CurrencyModel(); Currencies = currency.GiveCollection(currency.All()); }
public CreateProductViewModel(ProductModel product = null) { // Get Currencies CurrencyModel currency = new CurrencyModel(); Currencies = currency.GiveCollection(currency.All()); // Get Customers CustomerModel customers = new CustomerModel(); DataTable CustomersTable = customers.All(); Customers = customers.GiveCollection(CustomersTable); if (product != null) { for (int i = 0; i < Customers.Count; i++) { int id1 = Customers[i].Id; int id2 = (int)product.Customer; if (id1 == id2) { Customer = Customers[i]; break; } } IsEnabled = false; } else { IsEnabled = true; } }
public CreateReceiptViewModel(ReceiptModel receipt = null) { // Fill Customers CustomerModel customers = new CustomerModel(); Customers = customers.GiveCollection(customers.All()); // Fill Seasons SeasonModel sm = new SeasonModel(); Seasons = sm.GiveCollection(sm.All()); //Fill Currencies CurrencyModel currency = new CurrencyModel(); Currencies = currency.GiveCollection(currency.All()); Delivery = DateTime.UtcNow.Date; if (receipt != null) { for (int i = 0; i < Customers.Count; i++) { int id1 = Customers[i].Id; int id2 = (int)receipt.Customer; if (id1 == id2) { Customer = Customers[i]; break; } } IsEnabled = false; } else { IsEnabled = true; } }
public ViewFactureViewModel(FactureModel facture, bool customer_fixed = false) { // Fill Customers CustomerModel customers = new CustomerModel(); Customers = customers.GiveCollection(customers.All()); // Fill Seasons SeasonModel sm = new SeasonModel(); Seasons = sm.GiveCollection(sm.All()); //Fill Sizes SizeModel size = new SizeModel(); Sizes = size.GiveCollection(size.All()); //Fill Currencies CurrencyModel currency = new CurrencyModel(); Currencies = currency.GiveCollection(currency.All()); // Fill Data Facture = facture; Number = facture.Number; Name = facture.Name; Delivery = facture.Delivery; FillCombos(); // Fill Details FactureDetailsList = facture.GetFactureDetailsList(); FactureDetails = new BindableCollection <FactureDetailsModel>(FactureDetailsList); IsEnabled = false; BtnSaveText = "Enable Editing"; Cleared = facture.Cleared; IsCustomerFixed = customer_fixed; if (customer_fixed == false) { IsCustomerEnabled = IsEnabled; } else { IsCustomerEnabled = false; } }
public CreateFactureViewModel(FactureModel facture = null) { // Fill Customers CustomerModel customers = new CustomerModel(); Customers = customers.GiveCollection(customers.All()); // Fill Seasons SeasonModel sm = new SeasonModel(); Seasons = sm.GiveCollection(sm.All()); //Fill Sizes SizeModel size = new SizeModel(); Sizes = size.GiveCollection(size.All()); //Fill Currencies CurrencyModel currency = new CurrencyModel(); Currencies = currency.GiveCollection(currency.All()); Delivery = DateTime.UtcNow.Date; if (facture != null) { for (int i = 0; i < Customers.Count; i++) { int id1 = Customers[i].Id; int id2 = (int)facture.Customer; if (id1 == id2) { Customer = Customers[i]; break; } } IsEnabled = false; } else { IsEnabled = true; } }
private void FillData() { CustomerName = Customer.Id + " - " + Customer.Name; List <CustomerModel> customer_bound = new List <CustomerModel> { Customer }; CustomerBound = new BindableCollection <CustomerModel>(customer_bound); Products = Customer.GetMyProducts(); CurrencyModel currency = new CurrencyModel(); Currencies = currency.GiveCollection(currency.All()); if (Currencies.Count > 0) { BalanceCurrency = Currencies[0]; } FillSeasons(); FillFactures(); SetSearches(); FillReceipts(); FillBalanceData(); }
public EditProductViewModel(ProductModel product, bool contsant_customer = false) { // Get Currencies CurrencyModel currency = new CurrencyModel(); Currencies = currency.GiveCollection(currency.All()); // Get Customers CustomerModel customers = new CustomerModel(); DataTable CustomersTable = customers.All(); Customers = customers.GiveCollection(CustomersTable); // Fill Data Product = product; Product.Changed = new List <string>(); Id = product.Id; Name = product.Name; Customer = customers.Get((int)Product.Customer); Details = product.Details; if (product.Price != null && Product.Currency != null) { Price = product.Price; Currency = currency.Get((int)Product.Currency); } // Get Images Image = Product.GetImageFromDb(); Product.Changed = new List <string>(); FillSelected(product); if (contsant_customer) { IsCustomerEnabled = false; } else { IsCustomerEnabled = true; } }