|
|
@ -25,9 +25,10 @@ namespace eCompanies |
|
|
|
{ |
|
|
|
InitializeComponent(); |
|
|
|
currentCompany = c; |
|
|
|
currentCompany.Users = App.getUsers(currentCompany.CompanyId); |
|
|
|
companyNameBox.Text = c.Name; |
|
|
|
contractStatusComboBox.SelectedIndex = c.ContractStatus; |
|
|
|
usersGrid.DataContext = new ObservableCollection<Users>(c.Users.AsEnumerable<Users>()); |
|
|
|
usersGrid.DataContext = new ObservableCollection<Users>(c.Users.AsEnumerable()); |
|
|
|
} |
|
|
|
|
|
|
|
private void usersGrid_MouseDoubleClick(object sender, MouseButtonEventArgs e) |
|
|
@ -37,8 +38,25 @@ namespace eCompanies |
|
|
|
private void Window_Closing(object sender, System.ComponentModel.CancelEventArgs e) |
|
|
|
{ |
|
|
|
MessageBoxResult mbr = MessageBox.Show("Вы закрываете окно с компанией. Хотите сохранить результаты?", "Сохранение изменений", MessageBoxButton.YesNo); |
|
|
|
if (mbr == MessageBoxResult.Yes) |
|
|
|
App.updateCompany(currentCompany); |
|
|
|
if (mbr == MessageBoxResult.No) |
|
|
|
return; |
|
|
|
currentCompany.ContractStatus = contractStatusComboBox.SelectedIndex; |
|
|
|
currentCompany.Name = companyNameBox.Text; |
|
|
|
foreach (Users u in (ObservableCollection<Users>)usersGrid.DataContext) |
|
|
|
{ |
|
|
|
u.CompanyId = currentCompany.CompanyId; |
|
|
|
u.Company = currentCompany; |
|
|
|
currentCompany.Users.Add(u); |
|
|
|
} |
|
|
|
App.updateCompany(currentCompany); |
|
|
|
} |
|
|
|
|
|
|
|
private void usersGrid_RowEditEnding(object sender, DataGridRowEditEndingEventArgs e) |
|
|
|
{ |
|
|
|
} |
|
|
|
|
|
|
|
private void usersGrid_AddingNewItem(object sender, AddingNewItemEventArgs e) |
|
|
|
{ |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|