public ClientInfoViewModel(Client client = null)
        {
            _clientService = NinjectBootstrap.Kernel.Get<Service.Interface.IClientService>();
            _orderService = NinjectBootstrap.Kernel.Get<Service.Interface.IOrderService>();
            _discountCollection = new ObservableCollection<int>(new[] {0, 10, 15});

            if(client == null)
            {
                _isNew = true;
                Client = new Client
                             {
                                 ClientId = Guid.NewGuid(),
                                 DateBorn = DateTime.Now,
                                 IssuedDate = DateTime.Now
                             };
            }
            else
            {
                _isNew = false;
                Client = client;
                DatesAttended =
                    new ObservableCollection<string>(
                        _orderService.List(Client.ClientId).Select(
                            x => string.Format("{0} - {1}", x.Start, x.End)));
            }

            SetupDiscount();
            //Пересчитываем скидку:
            RecalculationDiscount();
        }
Exemplo n.º 2
0
 public FastOrderViewModel(int hall, DateTime start, DateTime end)
 {
     Client = new Client {ClientId = Guid.NewGuid()};
     Order = new Order {OrderId = Guid.NewGuid(), ClientId = Client.ClientId, Start = start, End = end, Hall = hall};
     _clientService = NinjectBootstrap.Kernel.Get<Service.Interface.IClientService>();
     _orderService = NinjectBootstrap.Kernel.Get<Service.Interface.IOrderService>();
 }
        public bool Save(Client client)
        {
            try
            {
                Database.DatabaseService.Current.Database.Save(client);
                Database.DatabaseService.Current.Database.Flush();

                return true;
            }
            catch (Exception exception)
            {
                Helpers.IsolatedStorageHelper.LogException("SterlingClientService.Save", exception.Message, exception.StackTrace);
                return false;
            }
        }
        public OrderAppoinmentViewModel(Client client, Order order, int hall, DateTime start, DateTime end)
        {
            _orderService = NinjectBootstrap.Kernel.Get<Service.Interface.IOrderService>();
            _clientService = NinjectBootstrap.Kernel.Get<Service.Interface.IClientService>();

            if(order == null)
            {
                Client = client;

                Order = new Order {OrderId = Guid.NewGuid(), ClientId = client.ClientId, Start = start, End = end, Hall = hall};
                _isNew = true;
                return;
            }

            Client = _clientService.Get(order.ClientId);
            _isNew = false;
            Order = order;
        }
Exemplo n.º 5
0
 public bool Save(Client client)
 {
     _localDatabase.ClientTable.Add(client);
     return true;
 }
Exemplo n.º 6
0
        private Color GetColor(Client client, Order order)
        {
            if (client.IsBlocked)
            {
                return new Color
                {
                    R = 241,
                    G = 129,
                    B = 129,
                    A = 100
                };
            }

            return SetColor(SelectedHall != 0 ? SelectedHall : order.Hall);
        }