예제 #1
0
        /// <summary>
        /// Construct the viewmodel
        /// </summary>
        /// <param name="transaction">Transaction to checkout</param>
        /// <param name="purchasingCustomers">Customers to select as purchaser</param>
        /// <param name="owningCustomers">Customers to select as owner</param>
        /// <param name="countries">List of countries to select when creating a new customer</param>
        public TransactionCheckoutViewModel(Model.Transaction transaction, List <Model.Customer> owningCustomers,
                                            List <Model.Customer> purchasingCustomers, List <Model.Country> countries)
        {
            Transaction         = new TransactionViewModel(transaction);
            OwningCustomers     = owningCustomers.ToSelectList(x => x.ObjectId, x => x.Name);
            PurchasingCustomers = purchasingCustomers.ToSelectList(x => x.ObjectId, x => x.Name);

            //Set default selected Owning and Purchasing Customer
            //PurchasingCustomerId=..
            //OwningCustomerId=..
            ExistingPurchasingCustomer           = false;
            ExistingOwningCustomer               = false;
            OwningCustomerIsPurchasingCustomerId = true;
            NewPurchasingCustomer = new CustomerCreateViewModel(countries);
            NewOwningCustomer     = new CustomerCreateViewModel(countries);
        }
        /// <summary>
        /// Construct the viewmodel
        /// </summary>
        /// <param name="transaction">Transaction to checkout</param>
        /// <param name="purchasingCustomers">Customers to select as purchaser</param>
        /// <param name="owningCustomers">Customers to select as owner</param>
        /// <param name="countries">List of countries to select when creating a new customer</param>
        public TransactionCheckoutViewModel(Model.Transaction transaction, List<Model.Customer> owningCustomers, 
            List<Model.Customer> purchasingCustomers, List<Model.Country> countries)
        {
            Transaction = new TransactionViewModel(transaction);
            OwningCustomers = owningCustomers.ToSelectList(x => x.ObjectId, x => x.Name);
            PurchasingCustomers = purchasingCustomers.ToSelectList(x => x.ObjectId, x => x.Name);

            //Set default selected Owning and Purchasing Customer
            //PurchasingCustomerId=..
            //OwningCustomerId=..
            ExistingPurchasingCustomer = false;
            ExistingOwningCustomer = false;
            OwningCustomerIsPurchasingCustomerId = true;
            NewPurchasingCustomer = new CustomerCreateViewModel(countries);
            NewOwningCustomer = new CustomerCreateViewModel(countries);
        }