Fix DbDriver ResumeGet
This commit is contained in:
@@ -1,6 +1,8 @@
|
|||||||
<div class="top-bar">
|
<div class="top-bar">
|
||||||
@for(resume of myResumes; track myResumes.length){
|
@for(resume of myResumes; track myResumes.length){
|
||||||
<button (click)="changeSelectedResume(5)">{{ resume.title }}</button>
|
@if (resume.id != null){
|
||||||
|
<button (click)="changeSelectedResume(resume.id)">{{ resume.title }}</button>
|
||||||
|
}
|
||||||
}
|
}
|
||||||
<button routerLink="/resumes/editor" >NEW RESUME</button>
|
<button routerLink="/resumes/editor" >NEW RESUME</button>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -58,41 +58,48 @@ namespace BoredCareers.Services.DatabaseService {
|
|||||||
return resumes.ToArray();
|
return resumes.ToArray();
|
||||||
}
|
}
|
||||||
|
|
||||||
private async Task<DbDataReader> ExecuteReaderAsync(MySqlConnection conn, string query, int resumeId) {
|
|
||||||
var cmd = new MySqlCommand(query, conn);
|
|
||||||
cmd.Parameters.AddWithValue("@ResumeID", resumeId);
|
|
||||||
return await cmd.ExecuteReaderAsync();
|
|
||||||
}
|
|
||||||
|
|
||||||
public async Task<Resume?> GetResume(int ResumeID) {
|
public async Task<Resume?> GetResume(int ResumeID) {
|
||||||
using (var conn = GetConnection()) {
|
using (var conn = GetConnection()) {
|
||||||
await conn.OpenAsync();
|
await conn.OpenAsync();
|
||||||
|
|
||||||
Resume? resume = await GetResumeHeader(await ExecuteReaderAsync(conn, "SELECT * FROM Resume WHERE ID = @ResumeID;", ResumeID));
|
// Check if resume header exists
|
||||||
|
Resume? resume = await GetResumeHeader(ResumeID);
|
||||||
if (resume == null) { return null; }
|
if (resume == null) { return null; }
|
||||||
|
|
||||||
Task<DbDataReader>[] tasks = [
|
// Create parallel threads
|
||||||
ExecuteReaderAsync(conn, "SELECT * FROM ResumeExperience WHERE ResumeID = @ResumeID;", ResumeID),
|
Task<ResumeExperience[]> experienceTask = GetResumeExperience(ResumeID);
|
||||||
ExecuteReaderAsync(conn, "SELECT * FROM ResumeExperienceBullet WHERE ResumeID = @ResumeID;", ResumeID),
|
Task<ResumeExperienceBullet[]> experienceBulletsTask = GetResumeExperienceBullets(ResumeID);
|
||||||
ExecuteReaderAsync(conn, "SELECT * FROM ResumeMilitary WHERE ResumeID = @ResumeID;", ResumeID),
|
Task<ResumeMilitary?> militaryTask = GetResumeMilitary(ResumeID);
|
||||||
ExecuteReaderAsync(conn, "SELECT * FROM ResumeMilitaryBullet WHERE ResumeID = @ResumeID;", ResumeID),
|
Task<ResumeMilitaryBullet[]> militaryBulletsTask = GetResumeMilitaryBullets(ResumeID);
|
||||||
ExecuteReaderAsync(conn, "SELECT * FROM ResumeEducation WHERE ResumeID = @ResumeID;", ResumeID),
|
Task<ResumeEducation[]> educationTask = GetResumeEducation(ResumeID);
|
||||||
ExecuteReaderAsync(conn, "SELECT * FROM ResumeSkill WHERE ResumeID = @ResumeID;", ResumeID),
|
Task<ResumeSkill[]> skillsTask = GetResumeSkills(ResumeID);
|
||||||
ExecuteReaderAsync(conn, "SELECT * FROM ResumeLanguage WHERE ResumeID = @ResumeID;", ResumeID),
|
Task<ResumeLanguage[]> languagesTask = GetResumeLanguages(ResumeID);
|
||||||
ExecuteReaderAsync(conn, "SELECT * FROM ResumeCertification WHERE ResumeID = @ResumeID;", ResumeID),
|
Task<ResumeCertification[]> certificationTask = GetResumeCertification(ResumeID);
|
||||||
ExecuteReaderAsync(conn, "SELECT * FROM ResumeProject WHERE ResumeID = @ResumeID;", ResumeID),
|
Task<ResumeProject[]> projectsTask = GetResumeProjects(ResumeID);
|
||||||
];
|
|
||||||
await Task.WhenAll(tasks);
|
|
||||||
|
|
||||||
ResumeExperience[] experience = await GetResumeExperience(await tasks[0]);
|
// Run all in parallel
|
||||||
ResumeExperienceBullet[] bullets = await GetResumeExperienceBullets(await tasks[1]);
|
await Task.WhenAll(
|
||||||
ResumeMilitary? military = await GetResumeMilitary(await tasks[2]);
|
experienceTask,
|
||||||
ResumeMilitaryBullet[] militaryBullets = await GetResumeMilitaryBullets(await tasks[3]);
|
experienceBulletsTask,
|
||||||
ResumeEducation[] education = await GetResumeEducation(await tasks[4]);
|
militaryTask,
|
||||||
ResumeSkill[] skills = await GetResumeSkills(await tasks[5]);
|
militaryBulletsTask,
|
||||||
ResumeLanguage[] languages = await GetResumeLanguages(await tasks[6]);
|
educationTask,
|
||||||
ResumeCertification[] certs = await GetResumeCertification(await tasks[7]);
|
skillsTask,
|
||||||
ResumeProject[] projects = await GetResumeProjects(await tasks[8]);
|
languagesTask,
|
||||||
|
certificationTask,
|
||||||
|
projectsTask
|
||||||
|
);
|
||||||
|
|
||||||
|
// Get results from parallel processes
|
||||||
|
ResumeExperience[] experience = await experienceTask;
|
||||||
|
ResumeExperienceBullet[] bullets = await experienceBulletsTask;
|
||||||
|
ResumeMilitary? military = await militaryTask;
|
||||||
|
ResumeMilitaryBullet[] militaryBullets = await militaryBulletsTask;
|
||||||
|
ResumeEducation[] education = await educationTask;
|
||||||
|
ResumeSkill[] skills = await skillsTask;
|
||||||
|
ResumeLanguage[] languages = await languagesTask;
|
||||||
|
ResumeCertification[] certs = await certificationTask;
|
||||||
|
ResumeProject[] projects = await projectsTask;
|
||||||
|
|
||||||
Dictionary<int, ResumeExperienceBullet[]> groupedExperienceBullets = bullets.GroupBy(b => Convert.ToInt32(b.ResumeExperienceID)).ToDictionary(g => g.Key, g => g.ToArray());
|
Dictionary<int, ResumeExperienceBullet[]> groupedExperienceBullets = bullets.GroupBy(b => Convert.ToInt32(b.ResumeExperienceID)).ToDictionary(g => g.Key, g => g.ToArray());
|
||||||
foreach (var exp in experience) {
|
foreach (var exp in experience) {
|
||||||
|
|||||||
@@ -1,24 +1,33 @@
|
|||||||
using BoredCareers.Entities;
|
using BoredCareers.Entities;
|
||||||
|
using MySql.Data.MySqlClient;
|
||||||
using System.Data;
|
using System.Data;
|
||||||
using System.Data.Common;
|
using System.Data.Common;
|
||||||
|
|
||||||
namespace BoredCareers.Services.DatabaseService {
|
namespace BoredCareers.Services.DatabaseService {
|
||||||
public partial class DatabaseService {
|
public partial class DatabaseService {
|
||||||
|
|
||||||
public async Task<Resume?> GetResumeHeader(DbDataReader reader) {
|
string GetString(DbDataReader reader, string name) {
|
||||||
|
return reader.IsDBNull(reader.GetOrdinal(name)) ? "" : reader.GetString(name);
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task<Resume?> GetResumeHeader(int ResumeID) {
|
||||||
|
using (MySqlConnection connection = GetConnection()) {
|
||||||
|
await connection.OpenAsync();
|
||||||
|
MySqlCommand cmd = new MySqlCommand("SELECT * FROM Resume WHERE ID = @ID;", connection);
|
||||||
|
cmd.Parameters.AddWithValue("@ID", ResumeID);
|
||||||
|
using (DbDataReader reader = await cmd.ExecuteReaderAsync()) {
|
||||||
while (await reader.ReadAsync()) {
|
while (await reader.ReadAsync()) {
|
||||||
if (reader == null) { break; }
|
|
||||||
int _id = reader.GetInt32("ID");
|
int _id = reader.GetInt32("ID");
|
||||||
int _accountid = reader.GetInt32("AccountID");
|
int _accountid = reader.GetInt32("AccountID");
|
||||||
string _title = reader.GetString("Title");
|
string _title = GetString(reader, "Title");
|
||||||
string _name = reader.GetString("Name");
|
string _name = GetString(reader, "Name");
|
||||||
string _field = reader.GetString("Field");
|
string _field = GetString(reader, "Field");
|
||||||
string _email = reader.GetString("Email");
|
string _email = GetString(reader, "Email");
|
||||||
string _phonenumber = reader.GetString("PhoneNumber");
|
string _phonenumber = GetString(reader, "PhoneNumber");
|
||||||
string _postalcode = reader.GetString("PostalCode");
|
string _postalcode = GetString(reader, "PostalCode");
|
||||||
string _country = reader.GetString("Country");
|
string _country = GetString(reader, "Country");
|
||||||
string _state = reader.GetString("StateOrRegion");
|
string _state = GetString(reader, "StateOrRegion");
|
||||||
string _city = reader.GetString("City");
|
string _city = GetString(reader, "City");
|
||||||
bool _isactive = reader.GetBoolean("IsActive");
|
bool _isactive = reader.GetBoolean("IsActive");
|
||||||
return new Resume() {
|
return new Resume() {
|
||||||
ID = _id,
|
ID = _id,
|
||||||
@@ -35,39 +44,27 @@ namespace BoredCareers.Services.DatabaseService {
|
|||||||
IsActive = _isactive
|
IsActive = _isactive
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<ResumeExperienceBullet[]> GetResumeExperienceBullets(DbDataReader reader) {
|
public async Task<ResumeExperience[]> GetResumeExperience(int resumeId) {
|
||||||
List<ResumeExperienceBullet> experienceBullets = new List<ResumeExperienceBullet>();
|
|
||||||
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<ResumeExperience[]> GetResumeExperience(DbDataReader reader) {
|
|
||||||
List<ResumeExperience> experience = new List<ResumeExperience>();
|
List<ResumeExperience> experience = new List<ResumeExperience>();
|
||||||
|
using (var conn = GetConnection()) {
|
||||||
|
await conn.OpenAsync();
|
||||||
|
var cmd = new MySqlCommand("SELECT * FROM ResumeExperience WHERE ResumeID = @ResumeID;", conn);
|
||||||
|
cmd.Parameters.AddWithValue("@ResumeID", resumeId);
|
||||||
|
using (DbDataReader reader = await cmd.ExecuteReaderAsync()) {
|
||||||
while (await reader.ReadAsync()) {
|
while (await reader.ReadAsync()) {
|
||||||
if (reader == null) { break; }
|
|
||||||
int _id = reader.GetInt32("ID");
|
int _id = reader.GetInt32("ID");
|
||||||
int _resumeid = reader.GetInt32("ResumeID");
|
int _resumeid = reader.GetInt32("ResumeID");
|
||||||
string _jobtitle = reader.GetString("JobTitle");
|
string _jobtitle = GetString(reader, "JobTitle");
|
||||||
string _company = reader.GetString("Company");
|
string _company = GetString(reader, "Company");
|
||||||
string _postalcode = reader.GetString("PostalCode");
|
string _postalcode = GetString(reader, "PostalCode");
|
||||||
string _country = reader.GetString("Country");
|
string _country = GetString(reader, "Country");
|
||||||
string _state = reader.GetString("StateOrRegion");
|
string _state = GetString(reader, "StateOrRegion");
|
||||||
string _city = reader.GetString("City");
|
string _city = GetString(reader, "City");
|
||||||
DateTime _datestarted = reader.GetDateTime("DateStarted");
|
DateTime _datestarted = reader.GetDateTime("DateStarted");
|
||||||
bool _stillempoyed = reader.GetBoolean("StillEmployed");
|
bool _stillempoyed = reader.GetBoolean("StillEmployed");
|
||||||
DateTime _dateended = reader.GetDateTime("DateEnded");
|
DateTime _dateended = reader.GetDateTime("DateEnded");
|
||||||
@@ -85,18 +82,48 @@ namespace BoredCareers.Services.DatabaseService {
|
|||||||
DateEnded = _dateended,
|
DateEnded = _dateended,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
return experience.ToArray();
|
return experience.ToArray();
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<ResumeMilitaryBullet[]> GetResumeMilitaryBullets(DbDataReader reader) {
|
public async Task<ResumeExperienceBullet[]> GetResumeExperienceBullets(int resumeId) {
|
||||||
List<ResumeMilitaryBullet> militaryBullets = new List<ResumeMilitaryBullet>();
|
List<ResumeExperienceBullet> experienceBullets = new List<ResumeExperienceBullet>();
|
||||||
|
using (var conn = GetConnection()) {
|
||||||
|
await conn.OpenAsync();
|
||||||
|
var cmd = new MySqlCommand("SELECT * FROM ResumeExperienceBullet WHERE ResumeID = @ResumeID;", conn);
|
||||||
|
cmd.Parameters.AddWithValue("@ResumeID", resumeId);
|
||||||
|
using (DbDataReader reader = await cmd.ExecuteReaderAsync()) {
|
||||||
|
while (await reader.ReadAsync()) {
|
||||||
|
int _id = reader.GetInt32("ID");
|
||||||
|
int _resumeid = reader.GetInt32("ResumeID");
|
||||||
|
int _experienceid = reader.GetInt32("ResumeExperienceID");
|
||||||
|
string _jobfunction = GetString(reader, "JobFunction");
|
||||||
|
experienceBullets.Add(new ResumeExperienceBullet() {
|
||||||
|
ID = _id,
|
||||||
|
ResumeID = _resumeid,
|
||||||
|
ResumeExperienceID = _experienceid,
|
||||||
|
JobFunction = _jobfunction
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return experienceBullets.ToArray();
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task<ResumeMilitaryBullet[]> GetResumeMilitaryBullets(int resumeId) {
|
||||||
|
List<ResumeMilitaryBullet> militaryBullets = new List<ResumeMilitaryBullet>();
|
||||||
|
using (var conn = GetConnection()) {
|
||||||
|
await conn.OpenAsync();
|
||||||
|
var cmd = new MySqlCommand("SELECT * FROM ResumeMilitaryBullet WHERE ResumeID = @ResumeID;", conn);
|
||||||
|
cmd.Parameters.AddWithValue("@ResumeID", resumeId);
|
||||||
|
using (DbDataReader reader = await cmd.ExecuteReaderAsync()) {
|
||||||
while (await reader.ReadAsync()) {
|
while (await reader.ReadAsync()) {
|
||||||
if (reader == null) { break; }
|
|
||||||
int _id = reader.GetInt32("ID");
|
int _id = reader.GetInt32("ID");
|
||||||
int _resumeid = reader.GetInt32("ResumeID");
|
int _resumeid = reader.GetInt32("ResumeID");
|
||||||
int _experienceid = reader.GetInt32("ResumeMilitaryID");
|
int _experienceid = reader.GetInt32("ResumeMilitaryID");
|
||||||
string _achievement = reader.GetString("Achievement");
|
string _achievement = GetString(reader, "Achievement");
|
||||||
string _description = reader.GetString("Description");
|
string _description = GetString(reader, "Description");
|
||||||
militaryBullets.Add(new ResumeMilitaryBullet() {
|
militaryBullets.Add(new ResumeMilitaryBullet() {
|
||||||
ID = _id,
|
ID = _id,
|
||||||
ResumeID = _resumeid,
|
ResumeID = _resumeid,
|
||||||
@@ -105,17 +132,23 @@ namespace BoredCareers.Services.DatabaseService {
|
|||||||
Description = _description
|
Description = _description
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
return militaryBullets.ToArray();
|
return militaryBullets.ToArray();
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<ResumeMilitary?> GetResumeMilitary(DbDataReader reader) {
|
public async Task<ResumeMilitary?> GetResumeMilitary(int resumeId) {
|
||||||
ResumeMilitary? military = null;
|
ResumeMilitary? military = null;
|
||||||
|
using (var conn = GetConnection()) {
|
||||||
|
await conn.OpenAsync();
|
||||||
|
var cmd = new MySqlCommand("SELECT * FROM ResumeMilitary WHERE ResumeID = @ResumeID;", conn);
|
||||||
|
cmd.Parameters.AddWithValue("@ResumeID", resumeId);
|
||||||
|
using (DbDataReader reader = await cmd.ExecuteReaderAsync()) {
|
||||||
while (await reader.ReadAsync()) {
|
while (await reader.ReadAsync()) {
|
||||||
if (reader == null) { break; }
|
|
||||||
int _id = reader.GetInt32("ID");
|
int _id = reader.GetInt32("ID");
|
||||||
int _resumeid = reader.GetInt32("ResumeID");
|
int _resumeid = reader.GetInt32("ResumeID");
|
||||||
string _country = reader.GetString("Country");
|
string _country = GetString(reader, "Country");
|
||||||
string _rank = reader.GetString("Rank");
|
string _rank = GetString(reader, "Rank");
|
||||||
DateTime _datestarted = reader.GetDateTime("DateStarted");
|
DateTime _datestarted = reader.GetDateTime("DateStarted");
|
||||||
bool _stillServing = reader.GetBoolean("StillServing");
|
bool _stillServing = reader.GetBoolean("StillServing");
|
||||||
DateTime _dateended = reader.GetDateTime("DateEnded");
|
DateTime _dateended = reader.GetDateTime("DateEnded");
|
||||||
@@ -129,22 +162,28 @@ namespace BoredCareers.Services.DatabaseService {
|
|||||||
DateEnded = _dateended,
|
DateEnded = _dateended,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
return military;
|
return military;
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<ResumeEducation[]> GetResumeEducation(DbDataReader reader) {
|
public async Task<ResumeEducation[]> GetResumeEducation(int resumeId) {
|
||||||
List<ResumeEducation>? education = new List<ResumeEducation>();
|
List<ResumeEducation>? education = new List<ResumeEducation>();
|
||||||
|
using (var conn = GetConnection()) {
|
||||||
|
await conn.OpenAsync();
|
||||||
|
var cmd = new MySqlCommand("SELECT * FROM ResumeEducation WHERE ResumeID = @ResumeID;", conn);
|
||||||
|
cmd.Parameters.AddWithValue("@ResumeID", resumeId);
|
||||||
|
using (DbDataReader reader = await cmd.ExecuteReaderAsync()) {
|
||||||
while (await reader.ReadAsync()) {
|
while (await reader.ReadAsync()) {
|
||||||
if (reader == null) { break; }
|
|
||||||
int _id = reader.GetInt32("ID");
|
int _id = reader.GetInt32("ID");
|
||||||
int _resumeid = reader.GetInt32("ResumeID");
|
int _resumeid = reader.GetInt32("ResumeID");
|
||||||
string _degreetype = reader.GetString("DegreeType");
|
string _degreetype = GetString(reader, "DegreeType");
|
||||||
string _degreefield = reader.GetString("DegreeField");
|
string _degreefield = GetString(reader, "DegreeField");
|
||||||
string _school = reader.GetString("School");
|
string _school = GetString(reader, "School");
|
||||||
string _postalcode = reader.GetString("PostalCode");
|
string _postalcode = GetString(reader, "PostalCode");
|
||||||
string _country = reader.GetString("Country");
|
string _country = GetString(reader, "Country");
|
||||||
string _state = reader.GetString("StateOrRegion");
|
string _state = GetString(reader, "StateOrRegion");
|
||||||
string _city = reader.GetString("City");
|
string _city = GetString(reader, "City");
|
||||||
DateTime _datestarted = reader.GetDateTime("DateStarted");
|
DateTime _datestarted = reader.GetDateTime("DateStarted");
|
||||||
bool _stillstudying = reader.GetBoolean("StillStudying");
|
bool _stillstudying = reader.GetBoolean("StillStudying");
|
||||||
DateTime _dateended = reader.GetDateTime("DateEnded");
|
DateTime _dateended = reader.GetDateTime("DateEnded");
|
||||||
@@ -163,17 +202,23 @@ namespace BoredCareers.Services.DatabaseService {
|
|||||||
DateEnded = _dateended
|
DateEnded = _dateended
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
return education.ToArray();
|
return education.ToArray();
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<ResumeSkill[]> GetResumeSkills(DbDataReader reader) {
|
public async Task<ResumeSkill[]> GetResumeSkills(int resumeId) {
|
||||||
List<ResumeSkill> skills = new List<ResumeSkill>();
|
List<ResumeSkill> skills = new List<ResumeSkill>();
|
||||||
|
using (var conn = GetConnection()) {
|
||||||
|
await conn.OpenAsync();
|
||||||
|
var cmd = new MySqlCommand("SELECT * FROM ResumeSkill WHERE ResumeID = @ResumeID;", conn);
|
||||||
|
cmd.Parameters.AddWithValue("@ResumeID", resumeId);
|
||||||
|
using (DbDataReader reader = await cmd.ExecuteReaderAsync()) {
|
||||||
while (await reader.ReadAsync()) {
|
while (await reader.ReadAsync()) {
|
||||||
if (reader == null) { break; }
|
|
||||||
int _id = reader.GetInt32("ID");
|
int _id = reader.GetInt32("ID");
|
||||||
int _resumeid = reader.GetInt32("ResumeID");
|
int _resumeid = reader.GetInt32("ResumeID");
|
||||||
string _name = reader.GetString("Name");
|
string _name = GetString(reader, "Name");
|
||||||
string _description = reader.GetString("Description");
|
string _description = GetString(reader, "Description");
|
||||||
skills.Add(new ResumeSkill {
|
skills.Add(new ResumeSkill {
|
||||||
ID = _id,
|
ID = _id,
|
||||||
ResumeID = _resumeid,
|
ResumeID = _resumeid,
|
||||||
@@ -181,17 +226,23 @@ namespace BoredCareers.Services.DatabaseService {
|
|||||||
Description = _description
|
Description = _description
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
return skills.ToArray();
|
return skills.ToArray();
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<ResumeLanguage[]> GetResumeLanguages(DbDataReader reader) {
|
public async Task<ResumeLanguage[]> GetResumeLanguages(int resumeId) {
|
||||||
List<ResumeLanguage>? languages = new List<ResumeLanguage>();
|
List<ResumeLanguage>? languages = new List<ResumeLanguage>();
|
||||||
|
using (var conn = GetConnection()) {
|
||||||
|
await conn.OpenAsync();
|
||||||
|
var cmd = new MySqlCommand("SELECT * FROM ResumeLanguage WHERE ResumeID = @ResumeID;", conn);
|
||||||
|
cmd.Parameters.AddWithValue("@ResumeID", resumeId);
|
||||||
|
using (DbDataReader reader = await cmd.ExecuteReaderAsync()) {
|
||||||
while (await reader.ReadAsync()) {
|
while (await reader.ReadAsync()) {
|
||||||
if (reader == null) { break; }
|
|
||||||
int _id = reader.GetInt32("ID");
|
int _id = reader.GetInt32("ID");
|
||||||
int _resumeid = reader.GetInt32("ResumeID");
|
int _resumeid = reader.GetInt32("ResumeID");
|
||||||
string _language = reader.GetString("Language");
|
string _language = GetString(reader, "Language");
|
||||||
string _proficiency = reader.GetString("Proficiency");
|
string _proficiency = GetString(reader, "Proficiency");
|
||||||
languages.Add(new ResumeLanguage {
|
languages.Add(new ResumeLanguage {
|
||||||
ID = _id,
|
ID = _id,
|
||||||
ResumeID = _resumeid,
|
ResumeID = _resumeid,
|
||||||
@@ -199,18 +250,24 @@ namespace BoredCareers.Services.DatabaseService {
|
|||||||
Proficiency = _proficiency
|
Proficiency = _proficiency
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
return languages.ToArray();
|
return languages.ToArray();
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<ResumeCertification[]> GetResumeCertification(DbDataReader reader) {
|
public async Task<ResumeCertification[]> GetResumeCertification(int resumeId) {
|
||||||
List<ResumeCertification> certs = new List<ResumeCertification>();
|
List<ResumeCertification> certs = new List<ResumeCertification>();
|
||||||
|
using (var conn = GetConnection()) {
|
||||||
|
await conn.OpenAsync();
|
||||||
|
var cmd = new MySqlCommand("SELECT * FROM ResumeCertification WHERE ResumeID = @ResumeID;", conn);
|
||||||
|
cmd.Parameters.AddWithValue("@ResumeID", resumeId);
|
||||||
|
using (DbDataReader reader = await cmd.ExecuteReaderAsync()) {
|
||||||
while (await reader.ReadAsync()) {
|
while (await reader.ReadAsync()) {
|
||||||
if (reader == null) { break; }
|
|
||||||
int _id = reader.GetInt32("ID");
|
int _id = reader.GetInt32("ID");
|
||||||
int _resumeid = reader.GetInt32("ResumeID");
|
int _resumeid = reader.GetInt32("ResumeID");
|
||||||
string _name = reader.GetString("Name");
|
string _name = GetString(reader, "Name");
|
||||||
string _url = reader.GetString("VerificationURL");
|
string _url = GetString(reader, "VerificationURL");
|
||||||
string _description = reader.GetString("Description");
|
string _description = GetString(reader, "Description");
|
||||||
certs.Add(new ResumeCertification {
|
certs.Add(new ResumeCertification {
|
||||||
ID = _id,
|
ID = _id,
|
||||||
ResumeID = _resumeid,
|
ResumeID = _resumeid,
|
||||||
@@ -219,18 +276,24 @@ namespace BoredCareers.Services.DatabaseService {
|
|||||||
Description = _description
|
Description = _description
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
return certs.ToArray();
|
return certs.ToArray();
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<ResumeProject[]> GetResumeProjects(DbDataReader reader) {
|
public async Task<ResumeProject[]> GetResumeProjects(int resumeId) {
|
||||||
List<ResumeProject>? projects = new List<ResumeProject>();
|
List<ResumeProject>? projects = new List<ResumeProject>();
|
||||||
|
using (var conn = GetConnection()) {
|
||||||
|
await conn.OpenAsync();
|
||||||
|
var cmd = new MySqlCommand("SELECT * FROM ResumeProject WHERE ResumeID = @ResumeID;", conn);
|
||||||
|
cmd.Parameters.AddWithValue("@ResumeID", resumeId);
|
||||||
|
using (DbDataReader reader = await cmd.ExecuteReaderAsync()) {
|
||||||
while (await reader.ReadAsync()) {
|
while (await reader.ReadAsync()) {
|
||||||
if (reader == null) { break; }
|
|
||||||
int _id = reader.GetInt32("ID");
|
int _id = reader.GetInt32("ID");
|
||||||
int _resumeid = reader.GetInt32("ResumeID");
|
int _resumeid = reader.GetInt32("ResumeID");
|
||||||
string _name = reader.GetString("Name");
|
string _name = GetString(reader, "Name");
|
||||||
string _url = reader.GetString("URL");
|
string _url = GetString(reader, "URL");
|
||||||
string _description = reader.GetString("Description");
|
string _description = GetString(reader, "Description");
|
||||||
projects.Add(new ResumeProject {
|
projects.Add(new ResumeProject {
|
||||||
ID = _id,
|
ID = _id,
|
||||||
ResumeID = _resumeid,
|
ResumeID = _resumeid,
|
||||||
@@ -239,8 +302,9 @@ namespace BoredCareers.Services.DatabaseService {
|
|||||||
Description = _description
|
Description = _description
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
return projects.ToArray();
|
return projects.ToArray();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user