private void btnStaffSave_Click(object sender, RoutedEventArgs e) { if (FormMode == FormModes.View) { this.ActualParent.Close(); return; } if (FormMode == FormModes.New) { int _newUserID = UserRepo.Insert(User); UserDetail.UserID = _newUserID; UserDetail.created_by = Utilities.UserSession.UserID; UserDetail.updated_by = Utilities.UserSession.UserID; UserDetailRepo.Insert(UserDetail); foreach (var exp in ExperienceList) { exp.UserID = _newUserID; ExperienceRepo.Insert(exp); } foreach (var edu in EducationList) { edu.UserID = _newUserID; EducationRepo.Insert(edu); } } else { UserDetailRepo.Update(UserDetail); UserRepo.Update(User); foreach (var exp in ExperienceList) { if (exp.isNew) { exp.UserID = User.UserID; ExperienceRepo.Insert(exp); } else { ExperienceRepo.Update(exp); } } foreach (var edu in EducationList) { if (edu.isNew) { edu.UserID = User.UserID; EducationRepo.Insert(edu); } else { EducationRepo.Update(edu); } } } this.ActualParent.Close(); }
private void btnExperienceSave_Click(object sender, RoutedEventArgs e) { if (FormMode == FormModes.New) { var parent = (ucStaffDetailView)(this.ParentContainer); UserExperience.isNew = true; parent.AddToExperienceList(UserExperience); } else if (FormMode == FormModes.Edit) { ExperienceRepo.Update(UserExperience); } this.ActualParent.Close(); }