|
@ -20,6 +20,7 @@ namespace eCompanies |
|
|
{ |
|
|
{ |
|
|
InitializeComponent(); |
|
|
InitializeComponent(); |
|
|
currentCompany = c; |
|
|
currentCompany = c; |
|
|
|
|
|
if (currentCompany.dataGridRowStatus == DataGridRowStatus.DEFAULT) |
|
|
currentCompany.Users = App.getUsers(c.CompanyId); |
|
|
currentCompany.Users = App.getUsers(c.CompanyId); |
|
|
updateCompanyItem = d; |
|
|
updateCompanyItem = d; |
|
|
updateUsersGrid(c); |
|
|
updateUsersGrid(c); |
|
@ -42,8 +43,8 @@ namespace eCompanies |
|
|
currentCompany.Users.Clear(); |
|
|
currentCompany.Users.Clear(); |
|
|
foreach (Users u in (ObservableCollection<Users>)usersGrid.DataContext) |
|
|
foreach (Users u in (ObservableCollection<Users>)usersGrid.DataContext) |
|
|
{ |
|
|
{ |
|
|
if ((u.Login == null || u.Password == null || u.Name == null) |
|
|
if (u.dataGridRowStatus != DataGridRowStatus.REMOVED) |
|
|
&& (u.dataGridRowStatus != DataGridRowStatus.REMOVED)) |
|
|
if (u.Login == null || u.Password == null || u.Name == null) |
|
|
switch (App.fieldHasNotFilled()) |
|
|
switch (App.fieldHasNotFilled()) |
|
|
{ |
|
|
{ |
|
|
case MessageBoxResult.No: return; |
|
|
case MessageBoxResult.No: return; |
|
@ -55,6 +56,7 @@ namespace eCompanies |
|
|
} |
|
|
} |
|
|
currentCompany.ContractStatus = contractStatusComboBox.SelectedIndex; |
|
|
currentCompany.ContractStatus = contractStatusComboBox.SelectedIndex; |
|
|
currentCompany.Name = companyNameBox.Text; |
|
|
currentCompany.Name = companyNameBox.Text; |
|
|
|
|
|
if (currentCompany.dataGridRowStatus != DataGridRowStatus.NEW) |
|
|
currentCompany.dataGridRowStatus = DataGridRowStatus.UPDATED; |
|
|
currentCompany.dataGridRowStatus = DataGridRowStatus.UPDATED; |
|
|
updateCompanyItem(currentCompany); |
|
|
updateCompanyItem(currentCompany); |
|
|
} |
|
|
} |
|
@ -77,9 +79,6 @@ namespace eCompanies |
|
|
e.NewItem = new Users(); |
|
|
e.NewItem = new Users(); |
|
|
var newItem = e.NewItem as Users; |
|
|
var newItem = e.NewItem as Users; |
|
|
newItem.dataGridRowStatus = DataGridRowStatus.NEW; |
|
|
newItem.dataGridRowStatus = DataGridRowStatus.NEW; |
|
|
var c = ((DataGrid)sender).DataContext as ObservableCollection<Users>; |
|
|
|
|
|
if (c.Count != 0) |
|
|
|
|
|
newItem.UserId = c[c.Count - 1].UserId + 1; |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|