Пример #1
0
        protected override async void InjectProperties(IOrder toUpdate)
        {
            await UpdateDataSets();

            _Id = toUpdate.Id;
            ProductQuantities.Clear();
            foreach (KeyValuePair <uint, uint> pair in toUpdate.ProductIdQuantityMap)
            {
                IProduct product = Products.First(p => p.Id == pair.Key);
                ProductQuantities.Add(new ProductQuantityViewModel(product, pair.Value));
            }
            OrderDate = toUpdate.OrderDate;
            if (toUpdate.DeliveryDate.HasValue)
            {
                DeliveryDate = toUpdate.DeliveryDate.Value;
                Delivered    = true;
            }
            else
            {
                DeliveryDate = DateTime.Now;
                Delivered    = false;
            }
            ClientUsernameIndex = -1;
            for (int i = 0; i < ClientUsernames.Length; ++i)
            {
                if (ClientUsernames[i] == toUpdate.ClientUsername)
                {
                    ClientUsernameIndex = i;
                    break;
                }
            }
        }
Пример #2
0
        protected override async void ResetProperties()
        {
            await UpdateDataSets();

            OrderDate           = DateTime.Now;
            DeliveryDate        = DateTime.Now;
            Delivered           = false;
            ClientUsernameIndex = 0;
            ProductQuantities.Clear();
        }