From 8d5dbcabff136d00adee856181db379139db3a32 Mon Sep 17 00:00:00 2001 From: "derek.holloway" Date: Mon, 14 Jul 2025 12:22:31 -0700 Subject: [PATCH] Add military to resume db --- src/Server/Services/DatabaseService/Resume.cs | 67 +++++++++++++++---- 1 file changed, 55 insertions(+), 12 deletions(-) diff --git a/src/Server/Services/DatabaseService/Resume.cs b/src/Server/Services/DatabaseService/Resume.cs index 3429f1b..4df0349 100644 --- a/src/Server/Services/DatabaseService/Resume.cs +++ b/src/Server/Services/DatabaseService/Resume.cs @@ -150,6 +150,10 @@ namespace BoredCareers.Services.DatabaseService { } } + if (resume == null) { + return resume; + } + List experienceBullets = new List(); using (DbDataReader reader = await ResumeExperienceBulletReader) { while (await reader.ReadAsync()) { @@ -167,9 +171,7 @@ namespace BoredCareers.Services.DatabaseService { } } Dictionary> groupedExperienceBullets = experienceBullets - .GroupBy(b => b.ResumeExperienceID) - .ToDictionary(g => g.Key, g => g.ToList()); - + .GroupBy(b => b.ResumeExperienceID).ToDictionary(g => g.Key, g => g.ToList()); using (DbDataReader reader = await ResumeExperienceReader) { List experience = new List(); while (await reader.ReadAsync()) { @@ -187,8 +189,7 @@ namespace BoredCareers.Services.DatabaseService { DateTime _datestarted = reader.GetDateTime("DateStarted"); bool _stillempoyed = reader.GetBoolean("StillEmployed"); DateTime _dateended = reader.GetDateTime("DateEnded"); - - experience.Add( new ResumeExperience() { + experience.Add(new ResumeExperience() { ID = _id, ResumeID = _resumeid, JobTitle = _jobtitle, @@ -201,16 +202,58 @@ namespace BoredCareers.Services.DatabaseService { StillEmployed = _stillempoyed, DateEnded = _dateended, ExperienceBullets = groupedExperienceBullets[_id].ToArray() - } ); + }); + } + resume.Experience = experience.ToArray(); + } + + List militaryBullets = new List(); + using (DbDataReader reader = await ResumeMilitaryBulletReader) { + while (await reader.ReadAsync()) { + if (reader == null) { break; } + int _id = reader.GetInt32("ID"); + int _resumeid = reader.GetInt32("ResumeID"); + int _experienceid = reader.GetInt32("ResumeMilitaryID"); + string _achievement = reader.GetString("Achevement"); + string _description = reader.GetString("Description"); + militaryBullets.Add(new ResumeMilitaryBullet() { + ID = _id, + ResumeID = _resumeid, + ResumeMilitaryID = _experienceid, + Achevement = _achievement, + Description = _description + }); } } - - using (DbDataReader reader = await ResumeMilitaryBulletReader) { - - } - + Dictionary> groupedMilitaryBullets = militaryBullets + .GroupBy(b => b.ResumeMilitaryID).ToDictionary(g => g.Key, g => g.ToList()); using (DbDataReader reader = await ResumeMilitaryReader) { - + ResumeMilitary? military = null; + while (await reader.ReadAsync()) { + if (reader == null) { + break; + } + int _id = reader.GetInt32("ID"); + int _resumeid = reader.GetInt32("ResumeID"); + string _country = reader.GetString("Country"); + string _rank = reader.GetString("Rank"); + DateTime _datestarted = reader.GetDateTime("DateStarted"); + bool _stillServing = reader.GetBoolean("StillServing"); + DateTime _dateended = reader.GetDateTime("DateEnded"); + military = new ResumeMilitary() { + ID = _id, + ResumeID = _resumeid, + Country = _country, + Rank = _rank, + DateStarted = _datestarted, + StillServing = _stillServing, + DateEnded = _dateended, + MillitaryBullets = groupedMilitaryBullets[_id].ToArray() + }; + } + if (military != null) { + resume.Millitary = military; + } } using (DbDataReader reader = await ResumeEducationReader) {