예제 #1
0
        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;
            }
        }
예제 #2
0
        public SeasonViewModel()
        {
            SeasonModel sm      = new SeasonModel();
            DataTable   seasons = sm.All();

            Seasons = sm.GiveCollection(seasons);
        }
예제 #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;
            }
        }
예제 #4
0
        private void FillSeasons()
        {
            SeasonModel season = new SeasonModel();
            BindableCollection <SeasonModel> ss = season.GiveCollection(season.All());

            Seasons     = new BindableCollection <SeasonModel>();
            season.Year = "All";
            Seasons.Add(season);
            season = new SeasonModel
            {
                Year = "None"
            };
            Seasons.Add(season);
            foreach (SeasonModel s in ss)
            {
                Seasons.Add(s);
            }
        }
예제 #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;
            }
        }
예제 #6
0
        public void FillBalanceData()
        {
            SeasonModel season = new SeasonModel();
            BindableCollection <SeasonModel> ss = season.GiveCollection(season.All());

            Seasons     = new BindableCollection <SeasonModel>();
            season.Year = "None";
            season.Id   = 0;
            Seasons.Add(season);
            season = new SeasonModel
            {
                Id   = 0,
                Year = "All"
            };
            Seasons.Add(season);
            foreach (SeasonModel s in ss)
            {
                Seasons.Add(s);
            }
            BalanceSeasons = Seasons;
            BalanceSeason  = BalanceSeasons[0];
        }
예제 #7
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;
            }
        }