From 53877643f6a53103c5f1533b2bf358e2cd2b5456 Mon Sep 17 00:00:00 2001 From: Derek Holloway Date: Mon, 14 Jul 2025 16:55:39 -0700 Subject: [PATCH] Create split out functions --- .../ResumeParts/GetResumeParts.cs | 244 ++++++++++++++++++ 1 file changed, 244 insertions(+) create mode 100644 src/Server/Services/DatabaseService/ResumeParts/GetResumeParts.cs diff --git a/src/Server/Services/DatabaseService/ResumeParts/GetResumeParts.cs b/src/Server/Services/DatabaseService/ResumeParts/GetResumeParts.cs new file mode 100644 index 0000000..b471f52 --- /dev/null +++ b/src/Server/Services/DatabaseService/ResumeParts/GetResumeParts.cs @@ -0,0 +1,244 @@ +using BoredCareers.Entities; +using System.Data; +using System.Data.Common; + +namespace BoredCareers.Services.DatabaseService { + public partial class DatabaseService { + + public async Task GetResume(DbDataReader reader) { + while (await reader.ReadAsync()) { + if (reader == null) { break; } + int _id = reader.GetInt32("ID"); + int _accountid = reader.GetInt32("AccountID"); + string _name = reader.GetString("Name"); + string _field = reader.GetString("Field"); + string _email = reader.GetString("Email"); + string _phonenumber = reader.GetString("PhoneNumber"); + string _postalcode = reader.GetString("PostalCode"); + string _country = reader.GetString("Country"); + string _state = reader.GetString("StateOrRegion"); + string _city = reader.GetString("City"); + bool _isactive = reader.GetBoolean("IsActive"); + return new Resume() { + ID = _id, + AccountID = _accountid, + Name = _name, + Field = _field, + Email = _email, + PhoneNumber = _phonenumber, + PostalCode = _postalcode, + Country = _country, + StateOrRegion = _state, + City = _city, + IsActive = _isactive + }; + } + return null; + } + + public async Task GetResumeExperienceBullets(DbDataReader reader) { + List experienceBullets = new List(); + while (await reader.ReadAsync()) { + if (reader == null) { break; } + int _id = reader.GetInt32("ID"); + int _resumeid = reader.GetInt32("ResumeID"); + int _experienceid = reader.GetInt32("ResumeExperienceID"); + string _jobfunction = reader.GetString("JobFunction"); + experienceBullets.Add(new ResumeExperienceBullet() { + ID = _id, + ResumeID = _resumeid, + ResumeExperienceID = _experienceid, + JobFunction = _jobfunction + }); + } + return experienceBullets.ToArray(); + } + + public async Task GetResumeExperience(DbDataReader reader) { + List experience = new List(); + while (await reader.ReadAsync()) { + if (reader == null) { break; } + int _id = reader.GetInt32("ID"); + int _resumeid = reader.GetInt32("ResumeID"); + string _jobtitle = reader.GetString("JobTitle"); + string _company = reader.GetString("Company"); + string _postalcode = reader.GetString("PostalCode"); + string _country = reader.GetString("Country"); + string _state = reader.GetString("StateOrRegion"); + string _city = reader.GetString("City"); + DateTime _datestarted = reader.GetDateTime("DateStarted"); + bool _stillempoyed = reader.GetBoolean("StillEmployed"); + DateTime _dateended = reader.GetDateTime("DateEnded"); + experience.Add(new ResumeExperience() { + ID = _id, + ResumeID = _resumeid, + JobTitle = _jobtitle, + Company = _company, + PostalCode = _postalcode, + Country = _country, + StateOrRegion = _state, + City = _city, + DateStarted = _datestarted, + StillEmployed = _stillempoyed, + DateEnded = _dateended, + }); + } + return experience.ToArray(); + } + + public async Task GetResumeMilitaryBullets(DbDataReader reader) { + List militaryBullets = new List(); + 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 + }); + } + return militaryBullets.ToArray(); + } + + public async Task GetResumeMilitary(DbDataReader reader) { + 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, + }; + } + return military; + } + + public async Task GetResumeEducation(DbDataReader reader) { + List? education = new List(); + while (await reader.ReadAsync()) { + if (reader == null) { break; } + int _id = reader.GetInt32("ID"); + int _resumeid = reader.GetInt32("ResumeID"); + string _degreetype = reader.GetString("DegreeType"); + string _degreefield = reader.GetString("DegreeField"); + string _school = reader.GetString("School"); + string _postalcode = reader.GetString("PostalCode"); + string _country = reader.GetString("Country"); + string _state = reader.GetString("StateOrRegion"); + string _city = reader.GetString("City"); + DateTime _datestarted = reader.GetDateTime("DateStarted"); + bool _stillstudying = reader.GetBoolean("StillStudying"); + DateTime _dateended = reader.GetDateTime("DateEnded"); + education.Add(new ResumeEducation { + ID = _id, + ResumeID = _resumeid, + DegreeType = _degreetype, + DegreeField = _degreefield, + School = _school, + PostalCode = _postalcode, + Country = _country, + StateOrRegion = _state, + City = _city, + DateStarted = _datestarted, + StillStudying = _stillstudying, + DateEnded = _dateended + }); + } + return education.ToArray(); + } + + public async Task GetResumeSkills(DbDataReader reader) { + List skills = new List(); + while (await reader.ReadAsync()) { + if (reader == null) { break; } + int _id = reader.GetInt32("ID"); + int _resumeid = reader.GetInt32("ResumeID"); + string _name = reader.GetString("Name"); + string _description = reader.GetString("Description"); + skills.Add( new ResumeSkill { + ID = _id, + ResumeID = _resumeid, + Name = _name, + Description = _description + } ); + } + return skills.ToArray(); + } + + public async Task GetResumeLanguages(DbDataReader reader) { + List? languages = new List(); + while (await reader.ReadAsync()) { + if (reader == null) { break; } + int _id = reader.GetInt32("ID"); + int _resumeid = reader.GetInt32("ResumeID"); + string _language = reader.GetString("Language"); + string _proficiency = reader.GetString("Proficiency"); + languages.Add( new ResumeLanguage { + ID = _id, + ResumeID = _resumeid, + Language = _language, + Proficiency = _proficiency + } ); + } + return languages.ToArray(); + } + + public async Task GetResumeCertification(DbDataReader reader) { + List certs = new List(); + while (await reader.ReadAsync()) { + if (reader == null) { break; } + int _id = reader.GetInt32("ID"); + int _resumeid = reader.GetInt32("ResumeID"); + string _name = reader.GetString("Name"); + string _url = reader.GetString("VerificationURL"); + string _description = reader.GetString("Description"); + certs.Add( new ResumeCertification { + ID = _id, + ResumeID = _resumeid, + Name = _name, + VerificationURL = _url, + Description = _description + } ); + } + return certs.ToArray(); + } + + public async Task GetResumeProjects(DbDataReader reader) { + List? projects = new List(); + while (await reader.ReadAsync()) { + if (reader == null) { break; } + int _id = reader.GetInt32("ID"); + int _resumeid = reader.GetInt32("ResumeID"); + string _name = reader.GetString("Name"); + string _url = reader.GetString("URL"); + string _description = reader.GetString("Description"); + projects.Add( new ResumeProject { + ID = _id, + ResumeID = _resumeid, + Name = _name, + URL = _url, + Description = _description + } ); + } + return projects.ToArray(); + } + + } +}