public ClientTabViewModel(IDataAccessService dataAccessService, Client currentClient)
        {
            _dataAccessService = dataAccessService;
            _currentClient = currentClient;
            _originalCurrentClinet = (Client)_currentClient.Clone();

            CloseTabCommand = new RelayCommand(closeTab);
            SaveCurrentCommand = new RelayCommand(saveCurrentClient, canSaveCurrentClientExecute);

        }
Beispiel #2
0
        private void btnTest_Click(object sender, RoutedEventArgs e)
        {
            Client client = new Client
            {
                NameEng = "testUser1"
            };

            using (var context = new EntitiesContext())
            {
                context.Clients.Add(client);
                context.SaveChanges();
            }
        }
Beispiel #3
0
 public void SaveClient(Client client)
 {
     using (var context = new EntitiesContext())
     {
         if (client.ClientID != 0)
         {
             context.Entry(client).State = EntityState.Modified;
         }
         else
         {
             context.Entry(client).State = EntityState.Added;
         }
         context.SaveChanges();
     }
 }
 public void SaveClient(Client client)
 {
     
 }
 public int AddClient(Client client)
 {
     _clients.Add(client);
     return 1;
 }
Beispiel #6
0
 void CloseClientTab(Client client)
 {
     var currentTab = (from ctvm in ClientTabVMs
                       where ctvm.CurrentClient.ClientID == client.ClientID
                       select ctvm).FirstOrDefault();
     if (currentTab != null)
     {
         ClientTabVMs.Remove(currentTab);
         SelectedClientTabItem = ClientTabVMs.FirstOrDefault();
     }
 }
Beispiel #7
0
 void OpenNewClientTab()
 {
     var newClient = new Client();
     this.OpenExistedClientTab(newClient);
 }
Beispiel #8
0
        void OpenExistedClientTab(Client client)
        {
            var newTab = (from ctvm in ClientTabVMs
                          where ctvm.CurrentClient.ClientID == client.ClientID
                          select ctvm).FirstOrDefault();
            if (newTab == null)
            {
                newTab = _viewModelLocator.GetClientTabViewModel(client);
                ClientTabVMs.Add(newTab);
            }
            SelectedClientTabItem = newTab;

        }
Beispiel #9
0
 public ClientTabViewModel GetClientTabViewModel(Client client)
 {
     return _container.Resolve<ClientTabViewModel>(new NamedParameter("currentClient", client));
 }
Beispiel #10
0
 public int AddClient(Client client)
 {
     throw new NotImplementedException();
 }