Example #1
0
        public OrderDetailsViewModel(
            CustomerOrderTransaction customerOrderTransaction,
            OrderDetailsSelection selectedMode)
        {
            this.SetTransaction(customerOrderTransaction);

            this.mode = selectedMode;

            DM.StoreDataManager storeDataManager = new DM.StoreDataManager(
                SalesOrder.InternalApplication.Settings.Database.Connection,
                SalesOrder.InternalApplication.Settings.Database.DataAreaID);

            DM.EmployeeDataManager employeeDataManager = new DM.EmployeeDataManager(
                SalesOrder.InternalApplication.Settings.Database.Connection,
                SalesOrder.InternalApplication.Settings.Database.DataAreaID);

            // Collection of all employees
            employees = new ReadOnlyCollection <DataEntity.Employee>(employeeDataManager.GetEmployees(ApplicationSettings.Terminal.StoreId));

            // Set the default minimum expiration date to tomorrow (but do not overwrite the current expiration date already set on the transaction)
            this.MinimumOrderExpirationDate = DateTime.Today.AddDays(1);

            // Use the actual, recalled, expiration date if it is older.
            // This is needed to prevent the UI from forcing the older date to snap to the minimum.
            if (this.MinimumOrderExpirationDate > this.OrderExpirationDate)
            {
                this.MinimumOrderExpirationDate = this.OrderExpirationDate;
            }

            // Set the default sales person to the currently logged in operator
            if (string.IsNullOrWhiteSpace(this.SalesPersonId))
            {
                this.SalesPersonId = LSRetailPosis.Settings.ApplicationSettings.Terminal.TerminalOperator.OperatorId;
            }
        }