working #28
@@ -8,6 +8,7 @@
|
||||
<input name="resumeemail" [(ngModel)]="resume.email" type="email" placeholder="no-reply@mistox.com" />
|
||||
<input name="resumephoneNumber" [(ngModel)]="resume.phoneNumber" type="tel" placeholder="+1 800-000-0000" />
|
||||
<input name="resumepostalCode" [(ngModel)]="resume.postalCode" type="text" placeholder="92020" />
|
||||
<input name="resumecountry" [(ngModel)]="resume.country" type="text" placeholder="US" />
|
||||
<input name="resumestateOrRegion" [(ngModel)]="resume.stateOrRegion" type="text" placeholder="CA" />
|
||||
<input name="resumecity" [(ngModel)]="resume.city" type="text" placeholder="San Diego" />
|
||||
<h1>Public: </h1><input name="active" [(ngModel)]="resume.isActive" type="checkbox" />
|
||||
@@ -16,7 +17,7 @@
|
||||
<!-- Experience -->
|
||||
<div class="resume-section">
|
||||
<button type="button" (click)="addExperience()">ADD Experience</button>
|
||||
@for(experience of resume.experience; track experience.trackUUID ){
|
||||
@for(experience of resume.experiences; track experience.trackUUID ){
|
||||
<div class="resume-sub-section">
|
||||
<input name="experiencejobTitle" [(ngModel)]="experience.jobTitle" type="text" placeholder="Data Entry Clerk" />
|
||||
<input name="experiencecompany" [(ngModel)]="experience.company" type="text" placeholder="San Diego Gas Electric" />
|
||||
@@ -53,7 +54,7 @@
|
||||
<input name="dateEnded" [(ngModel)]="resume.military.dateEnded" type="date" />
|
||||
}
|
||||
<button type="button" (click)="addMillitaryBullet()">Add Millitary Task</button>
|
||||
@for(military of resume.military.millitaryBullets; track military.trackUUID ){
|
||||
@for(military of resume.military.militaryBullets; track military.trackUUID ){
|
||||
<div>
|
||||
<input name="militaryachievement" [(ngModel)]="military.achievement" type="text" placeholder="Deployed Kuwait" />
|
||||
<textarea name="militarydescription" [(ngModel)]="military.description" placeholder="Delivered goods line-hall" ></textarea>
|
||||
@@ -66,7 +67,7 @@
|
||||
<!-- Education -->
|
||||
<div class="resume-section">
|
||||
<button type="button" (click)="addEducation()">ADD Education</button>
|
||||
@for(education of resume.education; track education.trackUUID){
|
||||
@for(education of resume.educations; track education.trackUUID){
|
||||
<div>
|
||||
<input name="educationdegreeType" [(ngModel)]="education.degreeType" type="text" placeholder="Masters" />
|
||||
<input name="educationdegreeField" [(ngModel)]="education.degreeField" type="text" placeholder="Computer Science" />
|
||||
@@ -113,7 +114,7 @@
|
||||
<!-- Certification -->
|
||||
<div class="resume-section">
|
||||
<button type="button" (click)="addCert()">ADD Certification</button>
|
||||
@for(cert of resume.certification; track cert.trackUUID){
|
||||
@for(cert of resume.certifications; track cert.trackUUID){
|
||||
<div>
|
||||
<input name="certname" [(ngModel)]="cert.name" type="text" placeholder="Comptia A+" />
|
||||
<input name="certverificationURL" [(ngModel)]="cert.verificationURL" type="text" placeholder="https://certmaster.com/certid" />
|
||||
|
||||
@@ -57,13 +57,13 @@ export class ResumesEditorComponent {
|
||||
}
|
||||
|
||||
addExperience(){
|
||||
this.resume.experience.push( new ResumeExperience );
|
||||
this.resume.experiences.push( new ResumeExperience );
|
||||
}
|
||||
delExperience(self: ResumeExperience){
|
||||
for(let i=0; i<this.resume.experience.length; i++){
|
||||
let cur = this.resume.experience[i];
|
||||
for(let i=0; i<this.resume.experiences.length; i++){
|
||||
let cur = this.resume.experiences[i];
|
||||
if (cur.trackUUID === self.trackUUID){
|
||||
this.resume.experience.splice( i, 1 );
|
||||
this.resume.experiences.splice( i, 1 );
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -93,14 +93,14 @@ export class ResumesEditorComponent {
|
||||
}
|
||||
}
|
||||
addMillitaryBullet(){
|
||||
this.resume.military?.millitaryBullets.push( new ResumeMilitaryBullet );
|
||||
this.resume.military?.militaryBullets.push( new ResumeMilitaryBullet );
|
||||
}
|
||||
delMillitaryBullet(self: ResumeMilitaryBullet){
|
||||
if (this.resume.military !== null){
|
||||
for(let i=0; i<this.resume.military.millitaryBullets.length; i++){
|
||||
let cur = this.resume.military.millitaryBullets[i];
|
||||
for(let i=0; i<this.resume.military.militaryBullets.length; i++){
|
||||
let cur = this.resume.military.militaryBullets[i];
|
||||
if (cur.trackUUID === self.trackUUID){
|
||||
this.resume.military.millitaryBullets.splice( i, 1 );
|
||||
this.resume.military.militaryBullets.splice( i, 1 );
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -108,13 +108,13 @@ export class ResumesEditorComponent {
|
||||
}
|
||||
|
||||
addEducation(){
|
||||
this.resume.education.push( new ResumeEducation );
|
||||
this.resume.educations.push( new ResumeEducation );
|
||||
}
|
||||
delEducation(self: ResumeEducation){
|
||||
for(let i=0; i<this.resume.education.length; i++){
|
||||
let cur = this.resume.education[i];
|
||||
for(let i=0; i<this.resume.educations.length; i++){
|
||||
let cur = this.resume.educations[i];
|
||||
if (cur.trackUUID === self.trackUUID){
|
||||
this.resume.education.splice( i, 1 );
|
||||
this.resume.educations.splice( i, 1 );
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -147,13 +147,13 @@ export class ResumesEditorComponent {
|
||||
}
|
||||
|
||||
addCert(){
|
||||
this.resume.certification.push( new ResumeCertification );
|
||||
this.resume.certifications.push( new ResumeCertification );
|
||||
}
|
||||
delCert(self: ResumeCertification){
|
||||
for(let i=0; i<this.resume.certification.length; i++){
|
||||
let cur = this.resume.certification[i];
|
||||
for(let i=0; i<this.resume.certifications.length; i++){
|
||||
let cur = this.resume.certifications[i];
|
||||
if (cur.trackUUID === self.trackUUID){
|
||||
this.resume.certification.splice( i, 1 );
|
||||
this.resume.certifications.splice( i, 1 );
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -68,7 +68,7 @@ namespace BoredCareers.Services.DatabaseService {
|
||||
using (var conn = GetConnection()) {
|
||||
await conn.OpenAsync();
|
||||
|
||||
Resume? resume = await GetResume(await ExecuteReaderAsync(conn, "SELECT * FROM Resume WHERE ID = @ResumeID;", ResumeID));
|
||||
Resume? resume = await GetResumeHeader(await ExecuteReaderAsync(conn, "SELECT * FROM Resume WHERE ID = @ResumeID;", ResumeID));
|
||||
if (resume == null) { return null; }
|
||||
|
||||
Task<DbDataReader>[] tasks = [
|
||||
@@ -94,21 +94,21 @@ namespace BoredCareers.Services.DatabaseService {
|
||||
ResumeCertification[] certs = await GetResumeCertification(await tasks[7]);
|
||||
ResumeProject[] projects = await GetResumeProjects(await tasks[8]);
|
||||
|
||||
Dictionary<int, ResumeExperienceBullet[]> groupedExperienceBullets = bullets.GroupBy(b => 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) {
|
||||
exp.ExperienceBullets = groupedExperienceBullets.TryGetValue(Convert.ToInt32(exp.ID), out var b) ? b : Array.Empty<ResumeExperienceBullet>();
|
||||
}
|
||||
|
||||
resume.Experience = experience;
|
||||
resume.Experiences = experience;
|
||||
resume.Educations = education;
|
||||
resume.Skills = skills;
|
||||
resume.Languages = languages;
|
||||
resume.Certification = certs;
|
||||
resume.Certifications = certs;
|
||||
resume.Projects = projects;
|
||||
|
||||
if (military != null) {
|
||||
military.MillitaryBullets = militaryBullets;
|
||||
resume.Millitary = military;
|
||||
military.MilitaryBullets = militaryBullets;
|
||||
resume.Military = military;
|
||||
}
|
||||
|
||||
return resume;
|
||||
@@ -116,23 +116,20 @@ namespace BoredCareers.Services.DatabaseService {
|
||||
}
|
||||
|
||||
public async Task SetResume(Resume resume) {
|
||||
using (var conn = GetConnection()) {
|
||||
await conn.OpenAsync();
|
||||
|
||||
// Set ResumeID on all nodes
|
||||
int _ResumeID = await SetResume(conn, resume);
|
||||
if (resume.Millitary != null) {
|
||||
resume.Millitary.ResumeID = _ResumeID;
|
||||
foreach (ResumeMilitaryBullet cur in resume.Millitary.MillitaryBullets) {
|
||||
int _ResumeID = await SetResumeHeader(resume);
|
||||
if (resume.Military != null) {
|
||||
resume.Military.ResumeID = _ResumeID;
|
||||
foreach (ResumeMilitaryBullet cur in resume.Military.MilitaryBullets) {
|
||||
cur.ResumeID = _ResumeID;
|
||||
}
|
||||
}
|
||||
foreach (ResumeEducation cur in resume.Educations) { cur.ResumeID = _ResumeID; }
|
||||
foreach (ResumeSkill cur in resume.Skills) { cur.ResumeID = _ResumeID; }
|
||||
foreach (ResumeLanguage cur in resume.Languages) { cur.ResumeID = _ResumeID; }
|
||||
foreach (ResumeCertification cur in resume.Certification) { cur.ResumeID = _ResumeID; }
|
||||
foreach (ResumeCertification cur in resume.Certifications) { cur.ResumeID = _ResumeID; }
|
||||
foreach (ResumeProject cur in resume.Projects) { cur.ResumeID = _ResumeID; }
|
||||
foreach (ResumeExperience cur in resume.Experience) {
|
||||
foreach (ResumeExperience cur in resume.Experiences) {
|
||||
cur.ResumeID = _ResumeID;
|
||||
foreach (ResumeExperienceBullet us in cur.ExperienceBullets) {
|
||||
us.ResumeID = _ResumeID;
|
||||
@@ -141,27 +138,27 @@ namespace BoredCareers.Services.DatabaseService {
|
||||
|
||||
// Async process all non child node SQL sets
|
||||
Task[] tasks = [
|
||||
SetResumeEducation(conn, resume.Educations),
|
||||
SetResumeSkills(conn, resume.Skills),
|
||||
SetResumeLanguages(conn, resume.Languages),
|
||||
SetResumeCertification(conn, resume.Certification),
|
||||
SetResumeProjects(conn, resume.Projects)
|
||||
SetResumeEducation(resume.Educations),
|
||||
SetResumeSkills(resume.Skills),
|
||||
SetResumeLanguages(resume.Languages),
|
||||
SetResumeCertification(resume.Certifications),
|
||||
SetResumeProjects(resume.Projects)
|
||||
];
|
||||
await Task.WhenAll(tasks);
|
||||
|
||||
// Setup military task
|
||||
if (resume.Millitary != null) {
|
||||
ResumeMilitary militaryTask = await SetResumeMilitary(conn, resume.Millitary);
|
||||
foreach (ResumeMilitaryBullet cur in resume.Millitary.MillitaryBullets) {
|
||||
if (resume.Military != null) {
|
||||
ResumeMilitary militaryTask = await SetResumeMilitary(resume.Military);
|
||||
foreach (ResumeMilitaryBullet cur in resume.Military.MilitaryBullets) {
|
||||
cur.ResumeMilitaryID = Convert.ToInt32(militaryTask.ID);
|
||||
}
|
||||
await SetResumeMilitaryBullets(conn, resume.Millitary.MillitaryBullets);
|
||||
await SetResumeMilitaryBullets(resume.Military.MilitaryBullets);
|
||||
}
|
||||
|
||||
// Setup async process all experience tasks
|
||||
List<Task<ResumeExperience>> experienceTasks = new List<Task<ResumeExperience>>();
|
||||
foreach (ResumeExperience cur in resume.Experience) {
|
||||
experienceTasks.Add(SetResumeExperience(conn, cur));
|
||||
foreach (ResumeExperience cur in resume.Experiences) {
|
||||
experienceTasks.Add(SetResumeExperience(cur));
|
||||
}
|
||||
await Task.WhenAll(experienceTasks);
|
||||
|
||||
@@ -169,14 +166,13 @@ namespace BoredCareers.Services.DatabaseService {
|
||||
List<Task> experienceBulletTasks = new List<Task>();
|
||||
for (int i = 0; i < experienceTasks.Count; i++) {
|
||||
ResumeExperience self = await experienceTasks[i];
|
||||
foreach (ResumeExperienceBullet cur in resume.Experience[i].ExperienceBullets) {
|
||||
foreach (ResumeExperienceBullet cur in resume.Experiences[i].ExperienceBullets) {
|
||||
cur.ResumeExperienceID = Convert.ToInt32(self.ID);
|
||||
experienceBulletTasks.Add(SetResumeExperienceBullets(conn, cur));
|
||||
experienceBulletTasks.Add(SetResumeExperienceBullets(cur));
|
||||
}
|
||||
}
|
||||
await Task.WhenAll(experienceBulletTasks);
|
||||
}
|
||||
}
|
||||
|
||||
public async Task DeleteResume( int ResumeID ) {
|
||||
using( MySqlConnection connection = GetConnection() ) {
|
||||
|
||||
@@ -5,7 +5,7 @@ using System.Data.Common;
|
||||
namespace BoredCareers.Services.DatabaseService {
|
||||
public partial class DatabaseService {
|
||||
|
||||
public async Task<Resume?> GetResume(DbDataReader reader) {
|
||||
public async Task<Resume?> GetResumeHeader(DbDataReader reader) {
|
||||
while (await reader.ReadAsync()) {
|
||||
if (reader == null) { break; }
|
||||
int _id = reader.GetInt32("ID");
|
||||
|
||||
@@ -4,7 +4,9 @@ using MySql.Data.MySqlClient;
|
||||
namespace BoredCareers.Services.DatabaseService {
|
||||
public partial class DatabaseService {
|
||||
|
||||
public async Task<int> SetResume(MySqlConnection connection, Resume resume) {
|
||||
public async Task<int> SetResumeHeader(Resume resume) {
|
||||
using (var conn = GetConnection()) {
|
||||
await conn.OpenAsync();
|
||||
string command = @"
|
||||
INSERT INTO Resume
|
||||
(ID,AccountID,Title,Name,Field,Email,PhoneNumber,PostalCode,Country,StateOrRegion,City,IsActive)
|
||||
@@ -26,7 +28,7 @@ namespace BoredCareers.Services.DatabaseService {
|
||||
SELECT LAST_INSERT_ID();
|
||||
";
|
||||
|
||||
MySqlCommand cmd = new MySqlCommand(command, connection);
|
||||
MySqlCommand cmd = new MySqlCommand(command, conn);
|
||||
cmd.Parameters.AddWithValue("@ID", resume.ID);
|
||||
cmd.Parameters.AddWithValue("@AccountID", resume.AccountID);
|
||||
cmd.Parameters.AddWithValue("@Title", resume.Title);
|
||||
@@ -48,10 +50,13 @@ namespace BoredCareers.Services.DatabaseService {
|
||||
return Convert.ToInt32(result);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public async Task SetResumeExperienceBullets(MySqlConnection connection, ResumeExperienceBullet bullet) {
|
||||
public async Task SetResumeExperienceBullets(ResumeExperienceBullet bullet) {
|
||||
using (var conn = GetConnection()) {
|
||||
await conn.OpenAsync();
|
||||
string command = @"
|
||||
INSERT INTO Resume
|
||||
INSERT INTO ResumeExperienceBullet
|
||||
(ID,ResumeID,ResumeExperienceID,JobFunction)
|
||||
VALUES
|
||||
(@ID,@ResumeID,@ResumeExperienceID,@JobFunction)
|
||||
@@ -61,7 +66,7 @@ namespace BoredCareers.Services.DatabaseService {
|
||||
JobFunction = @JobFunction;
|
||||
";
|
||||
|
||||
MySqlCommand cmd = new MySqlCommand(command, connection);
|
||||
MySqlCommand cmd = new MySqlCommand(command, conn);
|
||||
cmd.Parameters.AddWithValue("@ID", bullet.ID);
|
||||
cmd.Parameters.AddWithValue("@ResumeID", bullet.ResumeID);
|
||||
cmd.Parameters.AddWithValue("@ResumeExperienceID", bullet.ResumeExperienceID);
|
||||
@@ -69,10 +74,13 @@ namespace BoredCareers.Services.DatabaseService {
|
||||
|
||||
await cmd.ExecuteNonQueryAsync();
|
||||
}
|
||||
}
|
||||
|
||||
public async Task<ResumeExperience> SetResumeExperience(MySqlConnection connection, ResumeExperience experiences) {
|
||||
public async Task<ResumeExperience> SetResumeExperience(ResumeExperience experiences) {
|
||||
using (var conn = GetConnection()) {
|
||||
await conn.OpenAsync();
|
||||
string command = @"
|
||||
INSERT INTO Resume
|
||||
INSERT INTO ResumeExperience
|
||||
(ID,ResumeID,JobTitle,Company,PostalCode,Country,StateOrRegion,City,DateStarted,StillEmployed,DateEnded)
|
||||
VALUES
|
||||
(@ID,@ResumeID,@JobTitle,@Company,@PostalCode,@Country,@StateOrRegion,@City,@DateStarted,@StillEmployed,@DateEnded)
|
||||
@@ -91,11 +99,14 @@ namespace BoredCareers.Services.DatabaseService {
|
||||
SELECT LAST_INSERT_ID();
|
||||
";
|
||||
|
||||
MySqlCommand cmd = new MySqlCommand(command, connection);
|
||||
MySqlCommand cmd = new MySqlCommand(command, conn);
|
||||
cmd.Parameters.AddWithValue("@ID", experiences.ID);
|
||||
cmd.Parameters.AddWithValue("@ResumeID", experiences.ResumeID);
|
||||
cmd.Parameters.AddWithValue("@JobTitle", experiences.JobTitle);
|
||||
cmd.Parameters.AddWithValue("@Company", experiences.Company);
|
||||
cmd.Parameters.AddWithValue("@Country", experiences.Country);
|
||||
cmd.Parameters.AddWithValue("@StateOrRegion", experiences.StateOrRegion);
|
||||
cmd.Parameters.AddWithValue("@City", experiences.City);
|
||||
cmd.Parameters.AddWithValue("@PostalCode", experiences.PostalCode);
|
||||
cmd.Parameters.AddWithValue("@DateStarted", experiences.DateStarted.ToUniversalTime());
|
||||
cmd.Parameters.AddWithValue("@StillEmployed", experiences.StillEmployed);
|
||||
@@ -107,11 +118,14 @@ namespace BoredCareers.Services.DatabaseService {
|
||||
}
|
||||
return experiences;
|
||||
}
|
||||
}
|
||||
|
||||
public async Task SetResumeMilitaryBullets(MySqlConnection connection, ResumeMilitaryBullet[] bullets) {
|
||||
public async Task SetResumeMilitaryBullets(ResumeMilitaryBullet[] bullets) {
|
||||
using (var conn = GetConnection()) {
|
||||
await conn.OpenAsync();
|
||||
foreach (ResumeMilitaryBullet cur in bullets) {
|
||||
string command = @"
|
||||
INSERT INTO Resume
|
||||
INSERT INTO ResumeMilitaryBullet
|
||||
(ID,ResumeID,ResumeMilitaryID,Achievement)
|
||||
VALUES
|
||||
(@ID,@ResumeID,@ResumeMilitaryID,@Achievement)
|
||||
@@ -122,7 +136,7 @@ namespace BoredCareers.Services.DatabaseService {
|
||||
Description = @Description;
|
||||
";
|
||||
|
||||
MySqlCommand cmd = new MySqlCommand(command, connection);
|
||||
MySqlCommand cmd = new MySqlCommand(command, conn);
|
||||
cmd.Parameters.AddWithValue("@ID", cur.ID);
|
||||
cmd.Parameters.AddWithValue("@ResumeID", cur.ResumeID);
|
||||
cmd.Parameters.AddWithValue("@ResumeMilitaryID", cur.ResumeMilitaryID);
|
||||
@@ -132,18 +146,21 @@ namespace BoredCareers.Services.DatabaseService {
|
||||
await cmd.ExecuteNonQueryAsync();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public async Task<ResumeMilitary> SetResumeMilitary(MySqlConnection connection, ResumeMilitary? military) {
|
||||
public async Task<ResumeMilitary> SetResumeMilitary(ResumeMilitary? military) {
|
||||
using (var conn = GetConnection()) {
|
||||
await conn.OpenAsync();
|
||||
if (military != null) {
|
||||
string command = @"
|
||||
INSERT INTO Resume
|
||||
(ID,ResumeID,Country,Rank,DateStarted,StillServing,DateEnded)
|
||||
INSERT INTO ResumeMilitary
|
||||
(ID,ResumeID,Country,`Rank`,DateStarted,StillServing,DateEnded)
|
||||
VALUES
|
||||
(@ID,@ResumeID,@Country,@Rank,@DateStarted,@StillServing,@DateEnded)
|
||||
ON DUPLICATE KEY UPDATE
|
||||
ResumeID = @ResumeID,
|
||||
Country = @Country,
|
||||
Rank = @Rank,
|
||||
`Rank` = @Rank,
|
||||
DateStarted = @DateStarted,
|
||||
StillServing = @StillServing,
|
||||
DateEnded = @DateEnded;
|
||||
@@ -151,7 +168,7 @@ namespace BoredCareers.Services.DatabaseService {
|
||||
SELECT LAST_INSERT_ID();
|
||||
";
|
||||
|
||||
MySqlCommand cmd = new MySqlCommand(command, connection);
|
||||
MySqlCommand cmd = new MySqlCommand(command, conn);
|
||||
cmd.Parameters.AddWithValue("@ID", military.ID);
|
||||
cmd.Parameters.AddWithValue("@ResumeID", military.ResumeID);
|
||||
cmd.Parameters.AddWithValue("@Country", military.Country);
|
||||
@@ -168,11 +185,14 @@ namespace BoredCareers.Services.DatabaseService {
|
||||
}
|
||||
return new ResumeMilitary();
|
||||
}
|
||||
}
|
||||
|
||||
public async Task SetResumeEducation(MySqlConnection connection, ResumeEducation[] educations) {
|
||||
public async Task SetResumeEducation(ResumeEducation[] educations) {
|
||||
using (var conn = GetConnection()) {
|
||||
await conn.OpenAsync();
|
||||
foreach (ResumeEducation cur in educations) {
|
||||
string command = @"
|
||||
INSERT INTO Resume
|
||||
INSERT INTO ResumeEducation
|
||||
(ID,ResumeID,DegreeType,DegreeField,School,PostalCode,Country,StateOrRegion,City,DateStarted,StillStudying,DateEnded)
|
||||
VALUES
|
||||
(@ID,@ResumeID,@DegreeType,@DegreeField,@School,@PostalCode,@Country,@StateOrRegion,@City,@DateStarted,@StillStudying,@DateEnded)
|
||||
@@ -190,7 +210,7 @@ namespace BoredCareers.Services.DatabaseService {
|
||||
DateEnded = @DateEnded;
|
||||
";
|
||||
|
||||
MySqlCommand cmd = new MySqlCommand(command, connection);
|
||||
MySqlCommand cmd = new MySqlCommand(command, conn);
|
||||
cmd.Parameters.AddWithValue("@ID", cur.ID);
|
||||
cmd.Parameters.AddWithValue("@ResumeID", cur.ResumeID);
|
||||
cmd.Parameters.AddWithValue("@DegreeType", cur.DegreeType);
|
||||
@@ -207,11 +227,14 @@ namespace BoredCareers.Services.DatabaseService {
|
||||
await cmd.ExecuteNonQueryAsync();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public async Task SetResumeSkills(MySqlConnection connection, ResumeSkill[] skills) {
|
||||
public async Task SetResumeSkills(ResumeSkill[] skills) {
|
||||
using (var conn = GetConnection()) {
|
||||
await conn.OpenAsync();
|
||||
foreach (ResumeSkill cur in skills) {
|
||||
string command = @"
|
||||
INSERT INTO Resume
|
||||
INSERT INTO ResumeSkill
|
||||
(ID,ResumeID,Name,Description)
|
||||
VALUES
|
||||
(@ID,@ResumeID,@Name,@Description)
|
||||
@@ -221,7 +244,7 @@ namespace BoredCareers.Services.DatabaseService {
|
||||
Description = @Description;
|
||||
";
|
||||
|
||||
MySqlCommand cmd = new MySqlCommand(command, connection);
|
||||
MySqlCommand cmd = new MySqlCommand(command, conn);
|
||||
cmd.Parameters.AddWithValue("@ID", cur.ID);
|
||||
cmd.Parameters.AddWithValue("@ResumeID", cur.ResumeID);
|
||||
cmd.Parameters.AddWithValue("@Name", cur.Name);
|
||||
@@ -230,11 +253,14 @@ namespace BoredCareers.Services.DatabaseService {
|
||||
await cmd.ExecuteNonQueryAsync();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public async Task SetResumeLanguages(MySqlConnection connection, ResumeLanguage[] languages) {
|
||||
public async Task SetResumeLanguages(ResumeLanguage[] languages) {
|
||||
using (var conn = GetConnection()) {
|
||||
await conn.OpenAsync();
|
||||
foreach (ResumeLanguage cur in languages) {
|
||||
string command = @"
|
||||
INSERT INTO Resume
|
||||
INSERT INTO ResumeLanguage
|
||||
(ID,ResumeID,Language,Proficiency)
|
||||
VALUES
|
||||
(@ID,@ResumeID,@Language,@Proficiency)
|
||||
@@ -244,7 +270,7 @@ namespace BoredCareers.Services.DatabaseService {
|
||||
Proficiency = @Proficiency;
|
||||
";
|
||||
|
||||
MySqlCommand cmd = new MySqlCommand(command, connection);
|
||||
MySqlCommand cmd = new MySqlCommand(command, conn);
|
||||
cmd.Parameters.AddWithValue("@ID", cur.ID);
|
||||
cmd.Parameters.AddWithValue("@ResumeID", cur.ResumeID);
|
||||
cmd.Parameters.AddWithValue("@Language", cur.Language);
|
||||
@@ -253,22 +279,25 @@ namespace BoredCareers.Services.DatabaseService {
|
||||
await cmd.ExecuteNonQueryAsync();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public async Task SetResumeCertification(MySqlConnection connection, ResumeCertification[] certifications) {
|
||||
public async Task SetResumeCertification(ResumeCertification[] certifications) {
|
||||
using (var conn = GetConnection()) {
|
||||
await conn.OpenAsync();
|
||||
foreach (ResumeCertification cur in certifications) {
|
||||
string command = @"
|
||||
INSERT INTO Resume
|
||||
INSERT INTO ResumeCertification
|
||||
(ID,ResumeID,Name,VerificationURL,Description)
|
||||
VALUES
|
||||
(@ID,@ResumeID,@Name,@VerificationURL,@Description)
|
||||
ON DUPLICATE KEY UPDATE
|
||||
ResumeID = @ResumeID,
|
||||
Name = @DegreeNameType,
|
||||
Name = @Name,
|
||||
VerificationURL = @VerificationURL,
|
||||
Description = @Description;
|
||||
";
|
||||
|
||||
MySqlCommand cmd = new MySqlCommand(command, connection);
|
||||
MySqlCommand cmd = new MySqlCommand(command, conn);
|
||||
cmd.Parameters.AddWithValue("@ID", cur.ID);
|
||||
cmd.Parameters.AddWithValue("@ResumeID", cur.ResumeID);
|
||||
cmd.Parameters.AddWithValue("@Name", cur.Name);
|
||||
@@ -278,11 +307,14 @@ namespace BoredCareers.Services.DatabaseService {
|
||||
await cmd.ExecuteNonQueryAsync();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public async Task SetResumeProjects(MySqlConnection connection, ResumeProject[] projects) {
|
||||
public async Task SetResumeProjects(ResumeProject[] projects) {
|
||||
using (var conn = GetConnection()) {
|
||||
await conn.OpenAsync();
|
||||
foreach (ResumeProject cur in projects) {
|
||||
string command = @"
|
||||
INSERT INTO Resume
|
||||
INSERT INTO ResumeProject
|
||||
(ID,ResumeID,Name,URL,Description)
|
||||
VALUES
|
||||
(@ID,@ResumeID,@Name,@URL,@Description)
|
||||
@@ -293,7 +325,7 @@ namespace BoredCareers.Services.DatabaseService {
|
||||
Description = @Description;
|
||||
";
|
||||
|
||||
MySqlCommand cmd = new MySqlCommand(command, connection);
|
||||
MySqlCommand cmd = new MySqlCommand(command, conn);
|
||||
cmd.Parameters.AddWithValue("@ID", cur.ID);
|
||||
cmd.Parameters.AddWithValue("@ResumeID", cur.ResumeID);
|
||||
cmd.Parameters.AddWithValue("@Name", cur.Name);
|
||||
@@ -303,6 +335,7 @@ namespace BoredCareers.Services.DatabaseService {
|
||||
await cmd.ExecuteNonQueryAsync();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user