public List<General_View> LoadGridData() { List<General_View> DataGridData = new List<General_View>(); var joinedTables = JoinTables(); var baselogic = new BaseLogic(); var departments = baselogic.Departments.GetAll(); var country = baselogic.Country.GetAll(); var gender = baselogic.gender.GetAll(); for (int i = 0; i < joinedTables.Count; i++) { var query1 = departments.FirstOrDefault(w => w.id_department == joinedTables[i].id_dep); joinedTables[i].Department = (query1 != null ? query1.Name: null); var query2 = departments.FirstOrDefault(w => w.id_department == joinedTables[i].id_fac); joinedTables[i].Faculty = (query2 != null ? query2.Name : null); var query3 = departments.FirstOrDefault(w => w.id_department == joinedTables[i].id_uni); joinedTables[i].University = (query3 != null ? query3.Name : null); var query4 = country.FirstOrDefault(w => w.id_country == joinedTables[i].id_city); joinedTables[i].Citizenship = (query4 != null ? query4.Name : null); var query5 = gender.FirstOrDefault(w => w.id_gender == joinedTables[i].id_gender); joinedTables[i].Gender = (query5 != null ? query5.Name : null); } return joinedTables; }
public List <General_View> LoadGridData() { List <General_View> DataGridData = new List <General_View>(); var joinedTables = JoinTables(); var baselogic = new BaseLogic(); var departments = baselogic.Departments.GetAll(); var country = baselogic.Country.GetAll(); var gender = baselogic.gender.GetAll(); for (int i = 0; i < joinedTables.Count; i++) { var query1 = departments.FirstOrDefault(w => w.id_department == joinedTables[i].id_dep); joinedTables[i].Department = (query1 != null ? query1.Name: null); var query2 = departments.FirstOrDefault(w => w.id_department == joinedTables[i].id_fac); joinedTables[i].Faculty = (query2 != null ? query2.Name : null); var query3 = departments.FirstOrDefault(w => w.id_department == joinedTables[i].id_uni); joinedTables[i].University = (query3 != null ? query3.Name : null); var query4 = country.FirstOrDefault(w => w.id_country == joinedTables[i].id_city); joinedTables[i].Citizenship = (query4 != null ? query4.Name : null); var query5 = gender.FirstOrDefault(w => w.id_gender == joinedTables[i].id_gender); joinedTables[i].Gender = (query5 != null ? query5.Name : null); } return(joinedTables); }
private void Save_OnClick(object sender, RoutedEventArgs e) { BaseLogic baselogic = new BaseLogic(); UpdateLogic updatelogic = new UpdateLogic(); TableUpdateViewModel data = new TableUpdateViewModel(); InsertLogic Insert_Logic = new InsertLogic(); if (_generic.PHDAssignmentViewModel.EndDate == null) { MessageBox.Show("Моля въведете Крайна Дата"); return; } if (_generic.PHDAssignmentViewModel.StartDate == null) { MessageBox.Show("Моля въведете Начална Дата"); return; } if (_generic.PHDAssignmentViewModel.id_department == null) { MessageBox.Show("Моля въведете Катедра на Обучение"); return; } if (_generic.PersonsViewModel.FirstName == null) { MessageBox.Show("Моля въведете Първо Име"); return; } if (_generic.PersonsViewModel.LastName == null) { MessageBox.Show("Моля въведете Фамилия"); return; } if (_generic.PersonsViewModel.id_gender == null) { MessageBox.Show("Моля въведете ПОЛ"); return; } if (EditData == null) { Insert_Logic.Insert_Entry(_generic); } else { updatelogic.Update_Entry(_generic, EditData.id); } Close(); }