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 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;
            }
        }
Example #3
0
        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 CustomersViewModel()
        {
            CustomerModel cm        = new CustomerModel();
            DataTable     customers = cm.All();

            Customers = cm.GiveCollection(customers);
            SetSearchTypes();
        }
Example #5
0
        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;
            }
        }
Example #6
0
        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;
            }
        }
Example #7
0
        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;
            }
        }