Merge pull request 'working' (#28) from working into main
Docker Build and Release Upload / build (push) Successful in 1m23s
Docker Build and Release Upload / build (push) Successful in 1m23s
Reviewed-on: #28
This commit was merged in pull request #28.
This commit is contained in:
@@ -24,6 +24,9 @@ Server:
|
||||
Server.csproj:
|
||||
Find a way to keep all the libraries up to date
|
||||
|
||||
DbDriver:
|
||||
Make getConnection() -> Based on a connection pool so that more than a specific number of connections cannot be made
|
||||
|
||||
Client:
|
||||
jobs/editor:
|
||||
Job Listing Skills exists but isn't implimented in the UI
|
||||
@@ -50,6 +53,8 @@ Client:
|
||||
|
||||
resume/editor:
|
||||
Not fully tested yet
|
||||
When adding new fields the fields above it glitch out and disappear
|
||||
There is no data validation
|
||||
|
||||
Company:
|
||||
Need to impliment Add employee
|
||||
|
||||
@@ -48,7 +48,6 @@ CREATE TABLE IF NOT EXISTS `Resume` (
|
||||
CREATE TABLE IF NOT EXISTS `ResumeMilitary` (
|
||||
`ID` int NOT NULL AUTO_INCREMENT,
|
||||
`ResumeID` int NOT NULL,
|
||||
`Veteran` boolean DEFAULT 0,
|
||||
`Country` char(2) NOT NULL,
|
||||
`Rank` varchar(50) NOT NULL,
|
||||
`DateStarted` date NOT NULL,
|
||||
|
||||
@@ -13,12 +13,12 @@ export class Resume {
|
||||
public stateOrRegion: string = "";
|
||||
public city: string = "";
|
||||
public isActive: boolean = false;
|
||||
public experience: ResumeExperience[] = [];
|
||||
public military: ResumeMilitary = new ResumeMilitary;
|
||||
public education: ResumeEducation[] = [];
|
||||
public military: ResumeMilitary | null = null;
|
||||
public experiences: ResumeExperience[] = [];
|
||||
public educations: ResumeEducation[] = [];
|
||||
public skills: ResumeSkill[] = [];
|
||||
public languages: ResumeLanguage[] = [];
|
||||
public certification: ResumeCertification[] = [];
|
||||
public certifications: ResumeCertification[] = [];
|
||||
public projects: ResumeProject[] = [];
|
||||
public trackUUID: string = crypto.randomUUID();
|
||||
}
|
||||
@@ -53,13 +53,12 @@ export class ResumeMilitary {
|
||||
public id: number | null = null;
|
||||
public resumeID: number | null = null;
|
||||
|
||||
public veteran: boolean = false;
|
||||
public country: string = "";
|
||||
public rank: string = "";
|
||||
public dateStarted: Date = new Date();
|
||||
public stillServing: boolean = false;
|
||||
public dateEnded: Date = new Date();
|
||||
public millitaryBullets: ResumeMilitaryBullet[] = [];
|
||||
public militaryBullets: ResumeMilitaryBullet[] = [];
|
||||
public trackUUID: string = crypto.randomUUID();
|
||||
}
|
||||
|
||||
|
||||
@@ -2,37 +2,38 @@
|
||||
|
||||
<!-- Resume Header -->
|
||||
<div class="resume-section">
|
||||
<input name="resumetitle" [(ngModel)]="resume.title" type="text" placeholder="Resume 1" />
|
||||
<input name="resumename" [(ngModel)]="resume.name" type="text" placeholder="John Doe" />
|
||||
<input name="resumefield" [(ngModel)]="resume.field" type="text" placeholder="Data Scientist" />
|
||||
<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="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" />
|
||||
<input [name]="'resumetitle' + resume.trackUUID" [(ngModel)]="resume.title" type="text" placeholder="Resume 1" />
|
||||
<input [name]="'resumename' + resume.trackUUID" [(ngModel)]="resume.name" type="text" placeholder="John Doe" />
|
||||
<input [name]="'resumefield' + resume.trackUUID" [(ngModel)]="resume.field" type="text" placeholder="Data Scientist" />
|
||||
<input [name]="'resumeemail' + resume.trackUUID" [(ngModel)]="resume.email" type="email" placeholder="no-reply@mistox.com" />
|
||||
<input [name]="'resumephoneNumber' + resume.trackUUID" [(ngModel)]="resume.phoneNumber" type="tel" placeholder="+1 800-000-0000" />
|
||||
<input [name]="'resumepostalCode' + resume.trackUUID" [(ngModel)]="resume.postalCode" type="text" placeholder="92020" />
|
||||
<input [name]="'resumecountry' + resume.trackUUID" [(ngModel)]="resume.country" type="text" placeholder="US" />
|
||||
<input [name]="'resumestateOrRegion' + resume.trackUUID" [(ngModel)]="resume.stateOrRegion" type="text" placeholder="CA" />
|
||||
<input [name]="'resumecity' + resume.trackUUID" [(ngModel)]="resume.city" type="text" placeholder="San Diego" />
|
||||
<h1>Public: </h1><input [name]="'active' + resume.trackUUID" [(ngModel)]="resume.isActive" type="checkbox" />
|
||||
</div>
|
||||
|
||||
<!-- 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" />
|
||||
<input name="experiencepostalCode" [(ngModel)]="experience.postalCode" type="text" placeholder="92020" />
|
||||
<input name="experiencecountry" [(ngModel)]="experience.country" type="text" placeholder="US" />
|
||||
<input name="experiencestateOrRegion" [(ngModel)]="experience.stateOrRegion" type="text" placeholder="CA" />
|
||||
<input name="experiencecity" [(ngModel)]="experience.city" type="text" placeholder="San Diego" />
|
||||
<input name="experiencedateStarted" [(ngModel)]="experience.dateStarted" type="date" />
|
||||
<input name="experiencestillEmployed" [(ngModel)]="experience.stillEmployed" type="checkbox" />
|
||||
<input [name]="'experiencejobTitle' + experience.trackUUID" [(ngModel)]="experience.jobTitle" type="text" placeholder="Data Entry Clerk" />
|
||||
<input [name]="'experiencecompany' + experience.trackUUID" [(ngModel)]="experience.company" type="text" placeholder="San Diego Gas Electric" />
|
||||
<input [name]="'experiencepostalCode' + experience.trackUUID" [(ngModel)]="experience.postalCode" type="text" placeholder="92020" />
|
||||
<input [name]="'experiencecountry' + experience.trackUUID" [(ngModel)]="experience.country" type="text" placeholder="US" />
|
||||
<input [name]="'experiencestateOrRegion' + experience.trackUUID" [(ngModel)]="experience.stateOrRegion" type="text" placeholder="CA" />
|
||||
<input [name]="'experiencecity' + experience.trackUUID" [(ngModel)]="experience.city" type="text" placeholder="San Diego" />
|
||||
<input [name]="'experiencedateStarted' + experience.trackUUID" [(ngModel)]="experience.dateStarted" type="date" />
|
||||
<input [name]="'experiencestillEmployed' + experience.trackUUID" [(ngModel)]="experience.stillEmployed" type="checkbox" />
|
||||
@if(!experience.stillEmployed){
|
||||
<input name="experiencedateEnded" [(ngModel)]="experience.dateEnded" type="date" />
|
||||
<input [name]="'experiencedateEnded' + experience.trackUUID" [(ngModel)]="experience.dateEnded" type="date" />
|
||||
}
|
||||
<button type="button" (click)="addJobFunction(experience)">Add jobFunction</button>
|
||||
@for(bullet of experience.experienceBullets; track bullet.trackUUID){
|
||||
<div>
|
||||
<textarea name="bulletjobFunction" [(ngModel)]="bullet.jobFunction" placeholder="Processed database transactions" ></textarea>
|
||||
<textarea [name]="'bulletjobFunction' + bullet.trackUUID" [(ngModel)]="bullet.jobFunction" placeholder="Processed database transactions" ></textarea>
|
||||
<button type="button" (click)="delJobFunction(experience, bullet)">DEL jobFunction</button>
|
||||
</div>
|
||||
}
|
||||
@@ -43,20 +44,20 @@
|
||||
|
||||
<!-- Military -->
|
||||
<div class="resume-section">
|
||||
<h1>Is Veteran: </h1><input name="veteran" [(ngModel)]="resume.military.veteran" type="checkbox" />
|
||||
@if(resume.military.veteran){
|
||||
<input name="militarycountry" [(ngModel)]="resume.military.country" type="text" placeholder="US" />
|
||||
<input name="militaryrank" [(ngModel)]="resume.military.rank" type="text" placeholder="PVT" />
|
||||
<input name="militarydateStarted" [(ngModel)]="resume.military.dateStarted" type="date" />
|
||||
<h1>Still Serving: </h1><input name="stillServing" [(ngModel)]="resume.military.stillServing" type="checkbox" />
|
||||
<h1>Is Veteran: </h1><input [name]="'veteran' + resume.military?.trackUUID" type="checkbox" (change)="onVeteranChange($event)" />
|
||||
@if(resume.military !== null){
|
||||
<input [name]="'militarycountry' + resume.military.trackUUID" [(ngModel)]="resume.military.country" type="text" placeholder="US" />
|
||||
<input [name]="'militaryrank' + resume.military.trackUUID" [(ngModel)]="resume.military.rank" type="text" placeholder="PVT" />
|
||||
<input [name]="'militarydateStarted' + resume.military.trackUUID" [(ngModel)]="resume.military.dateStarted" type="date" />
|
||||
<h1>Still Serving: </h1><input [name]="'stillServing' + resume.military.trackUUID" [(ngModel)]="resume.military.stillServing" type="checkbox" />
|
||||
@if (!resume.military.stillServing){
|
||||
<input name="dateEnded" [(ngModel)]="resume.military.dateEnded" type="date" />
|
||||
<input [name]="'dateEnded' + resume.military.trackUUID" [(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>
|
||||
<input [name]="'militaryachievement' + military.trackUUID" [(ngModel)]="military.achievement" type="text" placeholder="Deployed Kuwait" />
|
||||
<textarea [name]="'militarydescription' + military.trackUUID" [(ngModel)]="military.description" placeholder="Delivered goods line-hall" ></textarea>
|
||||
<button type="button" (click)="delMillitaryBullet(military)">DEL Military Task</button>
|
||||
</div>
|
||||
}
|
||||
@@ -66,19 +67,19 @@
|
||||
<!-- 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" />
|
||||
<input name="educationschool" [(ngModel)]="education.school" type="text" placeholder="WGU" />
|
||||
<input name="educationpostalCode" [(ngModel)]="education.postalCode" type="text" placeholder="84107" />
|
||||
<input name="educationcountry" [(ngModel)]="education.country" type="text" placeholder="US" />
|
||||
<input name="educationstateOrRegion" [(ngModel)]="education.stateOrRegion" type="text" placeholder="UT" />
|
||||
<input name="educationcity" [(ngModel)]="education.city" type="text" placeholder="Salt Lake City" />
|
||||
<input name="educationdateStarted" [(ngModel)]="education.dateStarted" type="date" />
|
||||
<input name="educationstillStudying" [(ngModel)]="education.stillStudying" type="checkbox" />
|
||||
<input [name]="'educationdegreeType' + education.trackUUID" [(ngModel)]="education.degreeType" type="text" placeholder="Masters" />
|
||||
<input [name]="'educationdegreeField' + education.trackUUID" [(ngModel)]="education.degreeField" type="text" placeholder="Computer Science" />
|
||||
<input [name]="'educationschool' + education.trackUUID" [(ngModel)]="education.school" type="text" placeholder="WGU" />
|
||||
<input [name]="'educationpostalCode' + education.trackUUID" [(ngModel)]="education.postalCode" type="text" placeholder="84107" />
|
||||
<input [name]="'educationcountry' + education.trackUUID" [(ngModel)]="education.country" type="text" placeholder="US" />
|
||||
<input [name]="'educationstateOrRegion' + education.trackUUID" [(ngModel)]="education.stateOrRegion" type="text" placeholder="UT" />
|
||||
<input [name]="'educationcity' + education.trackUUID" [(ngModel)]="education.city" type="text" placeholder="Salt Lake City" />
|
||||
<input [name]="'educationdateStarted' + education.trackUUID" [(ngModel)]="education.dateStarted" type="date" />
|
||||
<input [name]="'educationstillStudying' + education.trackUUID" [(ngModel)]="education.stillStudying" type="checkbox" />
|
||||
@if (!education.stillStudying){
|
||||
<input name="educationdateEnded" [(ngModel)]="education.dateEnded" type="date" />
|
||||
<input [name]="'educationdateEnded' + education.trackUUID" [(ngModel)]="education.dateEnded" type="date" />
|
||||
}
|
||||
<button type="button" (click)="delEducation(education)">DEL Education</button>
|
||||
</div>
|
||||
@@ -90,8 +91,8 @@
|
||||
<button type="button" (click)="addSkill()">ADD Skill</button>
|
||||
@for(skill of resume.skills; track skill.trackUUID){
|
||||
<div>
|
||||
<input name="skillname" [(ngModel)]="skill.name" type="text" placeholder="Angular JS" />
|
||||
<textarea name="skilldescription" [(ngModel)]="skill.description" placeholder="Built this entire website using Angular JS"></textarea>
|
||||
<input [name]="'skillname' + skill.trackUUID" [(ngModel)]="skill.name" type="text" placeholder="Angular JS" />
|
||||
<textarea [name]="'skilldescription' + skill.trackUUID" [(ngModel)]="skill.description" placeholder="Built this entire website using Angular JS"></textarea>
|
||||
<button type="button" (click)="delSkill(skill)">DEL Skill</button>
|
||||
</div>
|
||||
}
|
||||
@@ -102,8 +103,8 @@
|
||||
<button type="button" (click)="addLanguage()">ADD Language</button>
|
||||
@for(language of resume.languages; track language.trackUUID){
|
||||
<div>
|
||||
<input name="languagelanguage" [(ngModel)]="language.language" type="text" placeholder="Spanish" />
|
||||
<input name="languageproficiency" [(ngModel)]="language.proficiency" type="text" placeholder="casual speaking" />
|
||||
<input [name]="'languagelanguage' + language.trackUUID" [(ngModel)]="language.language" type="text" placeholder="Spanish" />
|
||||
<input [name]="'languageproficiency' + language.trackUUID" [(ngModel)]="language.proficiency" type="text" placeholder="casual speaking" />
|
||||
<button type="button" (click)="delLanguage(language)">DEL Language</button>
|
||||
</div>
|
||||
}
|
||||
@@ -113,11 +114,11 @@
|
||||
<!-- 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" />
|
||||
<textarea name="certdescription" [(ngModel)]="cert.description" placeholder="Into to information technology"></textarea>
|
||||
<input [name]="'certname' + cert.trackUUID" [(ngModel)]="cert.name" type="text" placeholder="Comptia A+" />
|
||||
<input [name]="'certverificationURL' + cert.trackUUID" [(ngModel)]="cert.verificationURL" type="text" placeholder="https://certmaster.com/certid" />
|
||||
<textarea [name]="'certdescription' + cert.trackUUID" [(ngModel)]="cert.description" placeholder="Into to information technology"></textarea>
|
||||
<button type="button" (click)="delCert(cert)">DEL Certification</button>
|
||||
</div>
|
||||
}
|
||||
@@ -128,9 +129,9 @@
|
||||
<button type="button" (click)="addProject()">ADD Project</button>
|
||||
@for(proj of resume.projects; track proj.trackUUID){
|
||||
<div>
|
||||
<input name="projname" [(ngModel)]="proj.name" type="text" placeholder="boredcareers" />
|
||||
<input name="projurl" [(ngModel)]="proj.url" type="text" placeholder="mistox.com" />
|
||||
<textarea name="projdescription" [(ngModel)]="proj.description" placeholder="the project that your currently viewing"></textarea>
|
||||
<input [name]="'projname' + proj.trackUUID" [(ngModel)]="proj.name" type="text" placeholder="boredcareers" />
|
||||
<input [name]="'projurl' + proj.trackUUID" [(ngModel)]="proj.url" type="text" placeholder="mistox.com" />
|
||||
<textarea [name]="'projdescription' + proj.trackUUID" [(ngModel)]="proj.description" placeholder="the project that your currently viewing"></textarea>
|
||||
<button type="button" (click)="delProject(proj)">DEL Project</button>
|
||||
</div>
|
||||
}
|
||||
|
||||
@@ -4,7 +4,7 @@ import { FormsModule } from '@angular/forms';
|
||||
import { Router, ActivatedRoute, RouterModule } from '@angular/router';
|
||||
import { Title } from '@angular/platform-browser';
|
||||
import { CommonModule } from '@angular/common';
|
||||
import { Resume, ResumeCertification, ResumeEducation, ResumeExperience, ResumeExperienceBullet, ResumeLanguage, ResumeMilitaryBullet, ResumeProject, ResumeSkill } from 'app/models/Resume';
|
||||
import { Resume, ResumeCertification, ResumeEducation, ResumeExperience, ResumeExperienceBullet, ResumeLanguage, ResumeMilitary, ResumeMilitaryBullet, ResumeProject, ResumeSkill } from 'app/models/Resume';
|
||||
import { Authentication } from 'app/services/Authentication';
|
||||
import { HomeComponent } from "app/pages/home/home.component";
|
||||
|
||||
@@ -33,6 +33,7 @@ export class ResumesEditorComponent {
|
||||
this.http.get<Resume>("api/resume?ResumeID=" + ResumeID).subscribe({
|
||||
next: data => {
|
||||
this.resume = data;
|
||||
this.milCache = data.military;
|
||||
this.isNewResume = false;
|
||||
},
|
||||
error: err => {
|
||||
@@ -56,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;
|
||||
}
|
||||
}
|
||||
@@ -81,27 +82,39 @@ export class ResumesEditorComponent {
|
||||
}
|
||||
}
|
||||
|
||||
milCache: ResumeMilitary | null = new ResumeMilitary;
|
||||
onVeteranChange(event: Event){
|
||||
const checkbox = event.target as HTMLInputElement;
|
||||
const isChecked = checkbox.checked;
|
||||
if (isChecked){
|
||||
this.resume.military = this.milCache;
|
||||
} else {
|
||||
this.resume.military = null;
|
||||
}
|
||||
}
|
||||
addMillitaryBullet(){
|
||||
this.resume.military.millitaryBullets.push( new ResumeMilitaryBullet );
|
||||
this.resume.military?.militaryBullets.push( new ResumeMilitaryBullet );
|
||||
}
|
||||
delMillitaryBullet(self: ResumeMilitaryBullet){
|
||||
for(let i=0; i<this.resume.military.millitaryBullets.length; i++){
|
||||
let cur = this.resume.military.millitaryBullets[i];
|
||||
if (this.resume.military !== null){
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
@@ -134,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;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
<div class="top-bar">
|
||||
@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>
|
||||
</div>
|
||||
|
||||
@@ -12,18 +12,18 @@ namespace BoredCareers.Entities {
|
||||
public string StateOrRegion { get; set; } = "";
|
||||
public string City { get; set; } = "";
|
||||
public bool IsActive { get; set; } = false;
|
||||
public ResumeExperience[] Experience { get; set; } = [];
|
||||
public ResumeMilitary Millitary { get; set; } = new ResumeMilitary();
|
||||
public ResumeExperience[] Experiences { get; set; } = [];
|
||||
public ResumeMilitary? Military { get; set; } = null;
|
||||
public ResumeEducation[] Educations { get; set; } = [];
|
||||
public ResumeSkill[] Skills { get; set; } = [];
|
||||
public ResumeLanguage[] Languages { get; set; } = [];
|
||||
public ResumeCertification[] Certification { get; set; } = [];
|
||||
public ResumeCertification[] Certifications { get; set; } = [];
|
||||
public ResumeProject[] Projects { get; set; } = [];
|
||||
}
|
||||
|
||||
public class ResumeExperience {
|
||||
public int? ID { get; set; } // PK
|
||||
public int ResumeID { get; set; } // FK
|
||||
public int? ResumeID { get; set; } // FK
|
||||
public string JobTitle { get; set; } = "";
|
||||
public string Company { get; set; } = "";
|
||||
public string PostalCode { get; set; } = "";
|
||||
@@ -38,34 +38,33 @@ namespace BoredCareers.Entities {
|
||||
|
||||
public class ResumeExperienceBullet {
|
||||
public int? ID { get; set; } // PK
|
||||
public int ResumeID { get; set; } // FK
|
||||
public int ResumeExperienceID { get; set; } // FK
|
||||
public int? ResumeID { get; set; } // FK
|
||||
public int? ResumeExperienceID { get; set; } // FK
|
||||
public string JobFunction { get; set; } = "";
|
||||
}
|
||||
|
||||
public class ResumeMilitary {
|
||||
public int? ID { get; set; } // PK
|
||||
public int ResumeID { get; set; } // FK
|
||||
public bool Veteran { get; set; } = false;
|
||||
public int? ResumeID { get; set; } // FK
|
||||
public string Country { get; set; } = ""; // 2 Letter Country Code
|
||||
public string Rank { get; set; } = "";
|
||||
public DateTime DateStarted { get; set; } = new DateTime();
|
||||
public bool StillServing { get; set; } = false;
|
||||
public DateTime DateEnded { get; set; } = new DateTime();
|
||||
public ResumeMilitaryBullet[] MillitaryBullets = [];
|
||||
public ResumeMilitaryBullet[] MilitaryBullets { get; set; } = [];
|
||||
}
|
||||
|
||||
public class ResumeMilitaryBullet {
|
||||
public int? ID { get; set; } // PK
|
||||
public int ResumeID { get; set; } // FK
|
||||
public int ResumeMilitaryID { get; set; } // FK
|
||||
public int? ResumeID { get; set; } // FK
|
||||
public int? ResumeMilitaryID { get; set; } // FK
|
||||
public string Achievement { get; set; } = "";
|
||||
public string Description { get; set; } = "";
|
||||
}
|
||||
|
||||
public class ResumeEducation {
|
||||
public int? ID { get; set; } // PK
|
||||
public int ResumeID { get; set; } // FK
|
||||
public int? ResumeID { get; set; } // FK
|
||||
public string DegreeType { get; set; } = "";
|
||||
public string DegreeField { get; set; } = "";
|
||||
public string School { get; set; } = "";
|
||||
@@ -80,21 +79,21 @@ namespace BoredCareers.Entities {
|
||||
|
||||
public class ResumeSkill {
|
||||
public int? ID { get; set; } // PK
|
||||
public int ResumeID { get; set; } // FK
|
||||
public int? ResumeID { get; set; } // FK
|
||||
public string Name { get; set; } = "";
|
||||
public string Description { get; set; } = "";
|
||||
}
|
||||
|
||||
public class ResumeLanguage {
|
||||
public int? ID { get; set; } // PK
|
||||
public int ResumeID { get; set; } // FK
|
||||
public int? ResumeID { get; set; } // FK
|
||||
public string Language { get; set; } = "";
|
||||
public string Proficiency { get; set; } = "";
|
||||
}
|
||||
|
||||
public class ResumeCertification {
|
||||
public int? ID { get; set; } // PK
|
||||
public int ResumeID { get; set; } // FK
|
||||
public int? ResumeID { get; set; } // FK
|
||||
public string Name { get; set; } = "";
|
||||
public string VerificationURL { get; set; } = "";
|
||||
public string Description { get; set; } = "";
|
||||
@@ -102,7 +101,7 @@ namespace BoredCareers.Entities {
|
||||
|
||||
public class ResumeProject {
|
||||
public int? ID { get; set; } // PK
|
||||
public int ResumeID { get; set; } // FK
|
||||
public int? ResumeID { get; set; } // FK
|
||||
public string Name { get; set; } = "";
|
||||
public string URL { get; set; } = "";
|
||||
public string Description { get; set; } = "";
|
||||
|
||||
@@ -59,164 +59,126 @@ namespace BoredCareers.Services.DatabaseService {
|
||||
}
|
||||
|
||||
public async Task<Resume?> GetResume(int ResumeID) {
|
||||
// Open connections for multi-threaded request
|
||||
MySqlConnection resumeConnection = GetConnection();
|
||||
MySqlConnection ResumeExperienceConnection = GetConnection();
|
||||
MySqlConnection ResumeExperienceBulletConnection = GetConnection();
|
||||
MySqlConnection ResumeMilitaryConnection = GetConnection();
|
||||
MySqlConnection ResumeMilitaryBulletConnection = GetConnection();
|
||||
MySqlConnection ResumeEducationConnection = GetConnection();
|
||||
MySqlConnection ResumeSkillConnection = GetConnection();
|
||||
MySqlConnection ResumeLanguageConnection = GetConnection();
|
||||
MySqlConnection ResumeCertificationConnection = GetConnection();
|
||||
MySqlConnection ResumeProjectConnection = GetConnection();
|
||||
using (var conn = GetConnection()) {
|
||||
await conn.OpenAsync();
|
||||
|
||||
// Open the connections
|
||||
Task resumeopen = resumeConnection.OpenAsync();
|
||||
Task resumeexperienceopen = ResumeExperienceConnection.OpenAsync();
|
||||
Task resumeexperiencebulletopen = ResumeExperienceBulletConnection.OpenAsync();
|
||||
Task resumemilitaryopen = ResumeMilitaryConnection.OpenAsync();
|
||||
Task resumemilitarybulletopen = ResumeMilitaryBulletConnection.OpenAsync();
|
||||
Task resumeeducationopen = ResumeEducationConnection.OpenAsync();
|
||||
Task resumeskillopen = ResumeSkillConnection.OpenAsync();
|
||||
Task resumelanguageopen = ResumeLanguageConnection.OpenAsync();
|
||||
Task resumecertifcationopen = ResumeCertificationConnection.OpenAsync();
|
||||
Task resumeprojectopen = ResumeProjectConnection.OpenAsync();
|
||||
// Check if resume header exists
|
||||
Resume? resume = await GetResumeHeader(ResumeID);
|
||||
if (resume == null) { return null; }
|
||||
|
||||
// Wait for all the connections to open
|
||||
await Task.WhenAll(resumeopen, resumeexperienceopen, resumeexperiencebulletopen, resumemilitaryopen, resumemilitarybulletopen,
|
||||
resumeeducationopen, resumeskillopen, resumelanguageopen, resumecertifcationopen, resumeprojectopen);
|
||||
// Create parallel threads
|
||||
Task<ResumeExperience[]> experienceTask = GetResumeExperience(ResumeID);
|
||||
Task<ResumeExperienceBullet[]> experienceBulletsTask = GetResumeExperienceBullets(ResumeID);
|
||||
Task<ResumeMilitary?> militaryTask = GetResumeMilitary(ResumeID);
|
||||
Task<ResumeMilitaryBullet[]> militaryBulletsTask = GetResumeMilitaryBullets(ResumeID);
|
||||
Task<ResumeEducation[]> educationTask = GetResumeEducation(ResumeID);
|
||||
Task<ResumeSkill[]> skillsTask = GetResumeSkills(ResumeID);
|
||||
Task<ResumeLanguage[]> languagesTask = GetResumeLanguages(ResumeID);
|
||||
Task<ResumeCertification[]> certificationTask = GetResumeCertification(ResumeID);
|
||||
Task<ResumeProject[]> projectsTask = GetResumeProjects(ResumeID);
|
||||
|
||||
// Setup the commands for the connections
|
||||
MySqlCommand resumeCommand = new MySqlCommand("SELECT * FROM Resume WHERE ID = @ResumeID;", resumeConnection);
|
||||
MySqlCommand ResumeExperienceCommand = new MySqlCommand("SELECT * FROM ResumeExperience WHERE ResumeID = @ResumeID;", ResumeExperienceConnection);
|
||||
MySqlCommand ResumeExperienceBulletCommand = new MySqlCommand("SELECT * FROM ResumeExperienceBullet WHERE ResumeID = @ResumeID;", ResumeExperienceBulletConnection);
|
||||
MySqlCommand ResumeMilitaryCommand = new MySqlCommand("SELECT * FROM ResumeMilitary WHERE ResumeID = @ResumeID;", ResumeMilitaryConnection);
|
||||
MySqlCommand ResumeMilitaryBulletCommand = new MySqlCommand("SELECT * FROM ResumeMilitaryBullet WHERE ResumeID = @ResumeID", ResumeMilitaryBulletConnection);
|
||||
MySqlCommand ResumeEducationCommand = new MySqlCommand("SELECT * FROM ResumeEducation WHERE ResumeID = @ResumeID;", ResumeEducationConnection);
|
||||
MySqlCommand ResumeSkillCommand = new MySqlCommand("SELECT * FROM ResumeSkill WHERE ResumeID = @ResumeID;", ResumeSkillConnection);
|
||||
MySqlCommand ResumeLanguageCommand = new MySqlCommand("SELECT * FROM ResumeLanguage WHERE ResumeID = @ResumeID;", ResumeLanguageConnection);
|
||||
MySqlCommand ResumeCertificationCommand = new MySqlCommand("SELECT * FROM ResumeCertification WHERE ResumeID = @ResumeID;", ResumeCertificationConnection);
|
||||
MySqlCommand ResumeProjectCommand = new MySqlCommand("SELECT * FROM ResumeProject WHERE ResumeID = @ResumeID;", ResumeProjectConnection);
|
||||
// Run all in parallel
|
||||
await Task.WhenAll(
|
||||
experienceTask,
|
||||
experienceBulletsTask,
|
||||
militaryTask,
|
||||
militaryBulletsTask,
|
||||
educationTask,
|
||||
skillsTask,
|
||||
languagesTask,
|
||||
certificationTask,
|
||||
projectsTask
|
||||
);
|
||||
|
||||
// Add parameters to the commands
|
||||
resumeCommand.Parameters.AddWithValue("@ResumeID", ResumeID);
|
||||
ResumeExperienceCommand.Parameters.AddWithValue("@ResumeID", ResumeID);
|
||||
ResumeExperienceBulletCommand.Parameters.AddWithValue("@ResumeID", ResumeID);
|
||||
ResumeMilitaryCommand.Parameters.AddWithValue("@ResumeID", ResumeID);
|
||||
ResumeMilitaryBulletCommand.Parameters.AddWithValue("@ResumeID", ResumeID);
|
||||
ResumeEducationCommand.Parameters.AddWithValue("@ResumeID", ResumeID);
|
||||
ResumeSkillCommand.Parameters.AddWithValue("@ResumeID", ResumeID);
|
||||
ResumeLanguageCommand.Parameters.AddWithValue("@ResumeID", ResumeID);
|
||||
ResumeCertificationCommand.Parameters.AddWithValue("@ResumeID", ResumeID);
|
||||
ResumeProjectCommand.Parameters.AddWithValue("@ResumeID", ResumeID);
|
||||
// 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;
|
||||
|
||||
// Run the commands
|
||||
Task<DbDataReader> ResumeReader = resumeCommand.ExecuteReaderAsync();
|
||||
Task<DbDataReader> ResumeExperienceReader = ResumeExperienceCommand.ExecuteReaderAsync();
|
||||
Task<DbDataReader> ResumeExperienceBulletReader = ResumeExperienceBulletCommand.ExecuteReaderAsync();
|
||||
Task<DbDataReader> ResumeMilitaryReader = ResumeMilitaryCommand.ExecuteReaderAsync();
|
||||
Task<DbDataReader> ResumeMilitaryBulletReader = ResumeMilitaryBulletCommand.ExecuteReaderAsync();
|
||||
Task<DbDataReader> ResumeEducationReader = ResumeEducationCommand.ExecuteReaderAsync();
|
||||
Task<DbDataReader> ResumeSkillReader = ResumeSkillCommand.ExecuteReaderAsync();
|
||||
Task<DbDataReader> ResumeLanguageReader = ResumeLanguageCommand.ExecuteReaderAsync();
|
||||
Task<DbDataReader> ResumeCertificationReader = ResumeCertificationCommand.ExecuteReaderAsync();
|
||||
Task<DbDataReader> ResumeProjectReader = ResumeProjectCommand.ExecuteReaderAsync();
|
||||
|
||||
// Wait for all the commands to process
|
||||
await Task.WhenAll(ResumeReader, ResumeExperienceReader, ResumeExperienceBulletReader, ResumeMilitaryReader, ResumeMilitaryBulletReader,
|
||||
ResumeEducationReader, ResumeSkillReader, ResumeLanguageReader, ResumeCertificationReader, ResumeProjectReader);
|
||||
|
||||
// Get Resume
|
||||
Resume? resume = await GetResume( await ResumeReader );
|
||||
if (resume != null) {
|
||||
|
||||
// Get Resume Parts
|
||||
ResumeExperience[] experience = await GetResumeExperience(await ResumeExperienceReader);
|
||||
ResumeExperienceBullet[] experienceBullets = await GetResumeExperienceBullets(await ResumeExperienceBulletReader);
|
||||
ResumeMilitary? military = await GetResumeMilitary(await ResumeMilitaryReader);
|
||||
ResumeMilitaryBullet[] militaryBullets = await GetResumeMilitaryBullets(await ResumeMilitaryBulletReader);
|
||||
ResumeEducation[] education = await GetResumeEducation(await ResumeEducationReader);
|
||||
ResumeSkill[] skills = await GetResumeSkills(await ResumeSkillReader);
|
||||
ResumeLanguage[] languages = await GetResumeLanguages(await ResumeLanguageReader);
|
||||
ResumeCertification[] certs = await GetResumeCertification(await ResumeCertificationReader);
|
||||
ResumeProject[] projects = await GetResumeProjects(await ResumeProjectReader);
|
||||
|
||||
// Split into grouped lists and add to experience
|
||||
Dictionary<int, ResumeExperienceBullet[]> groupedExperienceBullets = experienceBullets.GroupBy(b => b.ResumeExperienceID).ToDictionary(g => g.Key, g => g.ToArray());
|
||||
foreach (ResumeExperience cur in experience) {
|
||||
cur.ExperienceBullets = groupedExperienceBullets[Convert.ToInt32(cur.ID)];
|
||||
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>();
|
||||
}
|
||||
|
||||
// Add the parts to the resume
|
||||
if (military != null) {
|
||||
military.MillitaryBullets = militaryBullets;
|
||||
resume.Millitary = military;
|
||||
}
|
||||
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.MilitaryBullets = militaryBullets;
|
||||
resume.Military = military;
|
||||
}
|
||||
|
||||
return resume;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public async Task SetResume(Resume resume) {
|
||||
|
||||
// Open connections for multi-threaded request
|
||||
MySqlConnection resumeConnection = GetConnection();
|
||||
MySqlConnection ResumeExperienceConnection = GetConnection();
|
||||
MySqlConnection ResumeExperienceBulletConnection = GetConnection();
|
||||
MySqlConnection ResumeMilitaryConnection = GetConnection();
|
||||
MySqlConnection ResumeMilitaryBulletConnection = GetConnection();
|
||||
MySqlConnection ResumeEducationConnection = GetConnection();
|
||||
MySqlConnection ResumeSkillConnection = GetConnection();
|
||||
MySqlConnection ResumeLanguageConnection = GetConnection();
|
||||
MySqlConnection ResumeCertificationConnection = GetConnection();
|
||||
MySqlConnection ResumeProjectConnection = GetConnection();
|
||||
|
||||
// Open the connections
|
||||
Task resumeopen = resumeConnection.OpenAsync();
|
||||
Task resumeexperienceopen = ResumeExperienceConnection.OpenAsync();
|
||||
Task resumeexperiencebulletopen = ResumeExperienceBulletConnection.OpenAsync();
|
||||
Task resumemilitaryopen = ResumeMilitaryConnection.OpenAsync();
|
||||
Task resumemilitarybulletopen = ResumeMilitaryBulletConnection.OpenAsync();
|
||||
Task resumeeducationopen = ResumeEducationConnection.OpenAsync();
|
||||
Task resumeskillopen = ResumeSkillConnection.OpenAsync();
|
||||
Task resumelanguageopen = ResumeLanguageConnection.OpenAsync();
|
||||
Task resumecertifcationopen = ResumeCertificationConnection.OpenAsync();
|
||||
Task resumeprojectopen = ResumeProjectConnection.OpenAsync();
|
||||
|
||||
// Wait for all the connections to open
|
||||
await Task.WhenAll(resumeopen, resumeexperienceopen, resumeexperiencebulletopen, resumemilitaryopen, resumemilitarybulletopen,
|
||||
resumeeducationopen, resumeskillopen, resumelanguageopen, resumecertifcationopen, resumeprojectopen);
|
||||
|
||||
// Get all the experience bullets and run all the updates
|
||||
List<ResumeExperienceBullet> bullets = new List<ResumeExperienceBullet>();
|
||||
foreach (ResumeExperience cur in resume.Experience) {
|
||||
foreach (ResumeExperienceBullet bullet in cur.ExperienceBullets) {
|
||||
bullets.Add(bullet);
|
||||
// Set ResumeID on all nodes
|
||||
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.Certifications) { cur.ResumeID = _ResumeID; }
|
||||
foreach (ResumeProject cur in resume.Projects) { cur.ResumeID = _ResumeID; }
|
||||
foreach (ResumeExperience cur in resume.Experiences) {
|
||||
cur.ResumeID = _ResumeID;
|
||||
foreach (ResumeExperienceBullet us in cur.ExperienceBullets) {
|
||||
us.ResumeID = _ResumeID;
|
||||
}
|
||||
}
|
||||
Task ResumeExperienceBulletTask = SetResumeExperienceBullets(ResumeExperienceBulletConnection, bullets.ToArray());
|
||||
Task ResumeTask = SetResume(resumeConnection, resume);
|
||||
Task ResumeExperienceTask = SetResumeExperience(ResumeExperienceConnection, resume.Experience);
|
||||
Task ResumeMilitaryTask = SetResumeMilitary(ResumeMilitaryConnection, resume.Millitary);
|
||||
Task ResumeMilitaryBulletTask = SetResumeMilitaryBullets(ResumeMilitaryBulletConnection, resume.Millitary.MillitaryBullets);
|
||||
Task ResumeEducationTask = SetResumeEducation(ResumeEducationConnection, resume.Educations);
|
||||
Task ResumeSkllTask = SetResumeSkills(ResumeSkillConnection, resume.Skills);
|
||||
Task ResumeLanguageTask = SetResumeLanguages(ResumeLanguageConnection, resume.Languages);
|
||||
Task ResumeCertTask = SetResumeCertification(ResumeCertificationConnection, resume.Certification);
|
||||
Task ResumeProjectTask = SetResumeProjects(ResumeProjectConnection, resume.Projects);
|
||||
|
||||
// Allow update to finish before closing process
|
||||
await Task.WhenAll(ResumeTask, ResumeExperienceTask, ResumeExperienceBulletTask, ResumeMilitaryTask, ResumeMilitaryBulletTask,
|
||||
ResumeEducationTask, ResumeSkllTask, ResumeLanguageTask, ResumeCertTask, ResumeProjectTask);
|
||||
// Async process all non child node SQL sets
|
||||
Task[] tasks = [
|
||||
SetResumeEducation(resume.Educations),
|
||||
SetResumeSkills(resume.Skills),
|
||||
SetResumeLanguages(resume.Languages),
|
||||
SetResumeCertification(resume.Certifications),
|
||||
SetResumeProjects(resume.Projects)
|
||||
];
|
||||
await Task.WhenAll(tasks);
|
||||
|
||||
// Setup military task
|
||||
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(resume.Military.MilitaryBullets);
|
||||
}
|
||||
|
||||
// Setup async process all experience tasks
|
||||
List<Task<ResumeExperience>> experienceTasks = new List<Task<ResumeExperience>>();
|
||||
foreach (ResumeExperience cur in resume.Experiences) {
|
||||
experienceTasks.Add(SetResumeExperience(cur));
|
||||
}
|
||||
await Task.WhenAll(experienceTasks);
|
||||
|
||||
// Assuming they are returned in the same order they are sent
|
||||
List<Task> experienceBulletTasks = new List<Task>();
|
||||
for (int i = 0; i < experienceTasks.Count; i++) {
|
||||
ResumeExperience self = await experienceTasks[i];
|
||||
foreach (ResumeExperienceBullet cur in resume.Experiences[i].ExperienceBullets) {
|
||||
cur.ResumeExperienceID = Convert.ToInt32(self.ID);
|
||||
experienceBulletTasks.Add(SetResumeExperienceBullets(cur));
|
||||
}
|
||||
}
|
||||
await Task.WhenAll(experienceBulletTasks);
|
||||
}
|
||||
|
||||
public async Task DeleteResume( int ResumeID ) {
|
||||
|
||||
@@ -1,24 +1,33 @@
|
||||
using BoredCareers.Entities;
|
||||
using MySql.Data.MySqlClient;
|
||||
using System.Data;
|
||||
using System.Data.Common;
|
||||
|
||||
namespace BoredCareers.Services.DatabaseService {
|
||||
public partial class DatabaseService {
|
||||
|
||||
public async Task<Resume?> GetResume(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()) {
|
||||
if (reader == null) { break; }
|
||||
int _id = reader.GetInt32("ID");
|
||||
int _accountid = reader.GetInt32("AccountID");
|
||||
string _title = reader.GetString("Title");
|
||||
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");
|
||||
string _title = GetString(reader, "Title");
|
||||
string _name = GetString(reader, "Name");
|
||||
string _field = GetString(reader, "Field");
|
||||
string _email = GetString(reader, "Email");
|
||||
string _phonenumber = GetString(reader, "PhoneNumber");
|
||||
string _postalcode = GetString(reader, "PostalCode");
|
||||
string _country = GetString(reader, "Country");
|
||||
string _state = GetString(reader, "StateOrRegion");
|
||||
string _city = GetString(reader, "City");
|
||||
bool _isactive = reader.GetBoolean("IsActive");
|
||||
return new Resume() {
|
||||
ID = _id,
|
||||
@@ -35,39 +44,27 @@ namespace BoredCareers.Services.DatabaseService {
|
||||
IsActive = _isactive
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public async Task<ResumeExperienceBullet[]> GetResumeExperienceBullets(DbDataReader reader) {
|
||||
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) {
|
||||
public async Task<ResumeExperience[]> GetResumeExperience(int resumeId) {
|
||||
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()) {
|
||||
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");
|
||||
string _jobtitle = GetString(reader, "JobTitle");
|
||||
string _company = GetString(reader, "Company");
|
||||
string _postalcode = GetString(reader, "PostalCode");
|
||||
string _country = GetString(reader, "Country");
|
||||
string _state = GetString(reader, "StateOrRegion");
|
||||
string _city = GetString(reader, "City");
|
||||
DateTime _datestarted = reader.GetDateTime("DateStarted");
|
||||
bool _stillempoyed = reader.GetBoolean("StillEmployed");
|
||||
DateTime _dateended = reader.GetDateTime("DateEnded");
|
||||
@@ -85,18 +82,48 @@ namespace BoredCareers.Services.DatabaseService {
|
||||
DateEnded = _dateended,
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
return experience.ToArray();
|
||||
}
|
||||
|
||||
public async Task<ResumeMilitaryBullet[]> GetResumeMilitaryBullets(DbDataReader reader) {
|
||||
List<ResumeMilitaryBullet> militaryBullets = new List<ResumeMilitaryBullet>();
|
||||
public async Task<ResumeExperienceBullet[]> GetResumeExperienceBullets(int resumeId) {
|
||||
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()) {
|
||||
if (reader == null) { break; }
|
||||
int _id = reader.GetInt32("ID");
|
||||
int _resumeid = reader.GetInt32("ResumeID");
|
||||
int _experienceid = reader.GetInt32("ResumeMilitaryID");
|
||||
string _achievement = reader.GetString("Achievement");
|
||||
string _description = reader.GetString("Description");
|
||||
string _achievement = GetString(reader, "Achievement");
|
||||
string _description = GetString(reader, "Description");
|
||||
militaryBullets.Add(new ResumeMilitaryBullet() {
|
||||
ID = _id,
|
||||
ResumeID = _resumeid,
|
||||
@@ -105,25 +132,29 @@ namespace BoredCareers.Services.DatabaseService {
|
||||
Description = _description
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
return militaryBullets.ToArray();
|
||||
}
|
||||
|
||||
public async Task<ResumeMilitary?> GetResumeMilitary(DbDataReader reader) {
|
||||
public async Task<ResumeMilitary?> GetResumeMilitary(int resumeId) {
|
||||
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()) {
|
||||
if (reader == null) { break; }
|
||||
int _id = reader.GetInt32("ID");
|
||||
int _resumeid = reader.GetInt32("ResumeID");
|
||||
bool _veteran = reader.GetBoolean("Veteran");
|
||||
string _country = reader.GetString("Country");
|
||||
string _rank = reader.GetString("Rank");
|
||||
string _country = GetString(reader, "Country");
|
||||
string _rank = GetString(reader, "Rank");
|
||||
DateTime _datestarted = reader.GetDateTime("DateStarted");
|
||||
bool _stillServing = reader.GetBoolean("StillServing");
|
||||
DateTime _dateended = reader.GetDateTime("DateEnded");
|
||||
military = new ResumeMilitary() {
|
||||
ID = _id,
|
||||
ResumeID = _resumeid,
|
||||
Veteran = _veteran,
|
||||
Country = _country,
|
||||
Rank = _rank,
|
||||
DateStarted = _datestarted,
|
||||
@@ -131,22 +162,28 @@ namespace BoredCareers.Services.DatabaseService {
|
||||
DateEnded = _dateended,
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
return military;
|
||||
}
|
||||
|
||||
public async Task<ResumeEducation[]> GetResumeEducation(DbDataReader reader) {
|
||||
public async Task<ResumeEducation[]> GetResumeEducation(int resumeId) {
|
||||
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()) {
|
||||
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");
|
||||
string _degreetype = GetString(reader, "DegreeType");
|
||||
string _degreefield = GetString(reader, "DegreeField");
|
||||
string _school = GetString(reader, "School");
|
||||
string _postalcode = GetString(reader, "PostalCode");
|
||||
string _country = GetString(reader, "Country");
|
||||
string _state = GetString(reader, "StateOrRegion");
|
||||
string _city = GetString(reader, "City");
|
||||
DateTime _datestarted = reader.GetDateTime("DateStarted");
|
||||
bool _stillstudying = reader.GetBoolean("StillStudying");
|
||||
DateTime _dateended = reader.GetDateTime("DateEnded");
|
||||
@@ -165,84 +202,109 @@ namespace BoredCareers.Services.DatabaseService {
|
||||
DateEnded = _dateended
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
return education.ToArray();
|
||||
}
|
||||
|
||||
public async Task<ResumeSkill[]> GetResumeSkills(DbDataReader reader) {
|
||||
public async Task<ResumeSkill[]> GetResumeSkills(int resumeId) {
|
||||
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()) {
|
||||
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 {
|
||||
string _name = GetString(reader, "Name");
|
||||
string _description = GetString(reader, "Description");
|
||||
skills.Add(new ResumeSkill {
|
||||
ID = _id,
|
||||
ResumeID = _resumeid,
|
||||
Name = _name,
|
||||
Description = _description
|
||||
} );
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
return skills.ToArray();
|
||||
}
|
||||
|
||||
public async Task<ResumeLanguage[]> GetResumeLanguages(DbDataReader reader) {
|
||||
public async Task<ResumeLanguage[]> GetResumeLanguages(int resumeId) {
|
||||
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()) {
|
||||
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 {
|
||||
string _language = GetString(reader, "Language");
|
||||
string _proficiency = GetString(reader, "Proficiency");
|
||||
languages.Add(new ResumeLanguage {
|
||||
ID = _id,
|
||||
ResumeID = _resumeid,
|
||||
Language = _language,
|
||||
Proficiency = _proficiency
|
||||
} );
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
return languages.ToArray();
|
||||
}
|
||||
|
||||
public async Task<ResumeCertification[]> GetResumeCertification(DbDataReader reader) {
|
||||
public async Task<ResumeCertification[]> GetResumeCertification(int resumeId) {
|
||||
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()) {
|
||||
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 {
|
||||
string _name = GetString(reader, "Name");
|
||||
string _url = GetString(reader, "VerificationURL");
|
||||
string _description = GetString(reader, "Description");
|
||||
certs.Add(new ResumeCertification {
|
||||
ID = _id,
|
||||
ResumeID = _resumeid,
|
||||
Name = _name,
|
||||
VerificationURL = _url,
|
||||
Description = _description
|
||||
} );
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
return certs.ToArray();
|
||||
}
|
||||
|
||||
public async Task<ResumeProject[]> GetResumeProjects(DbDataReader reader) {
|
||||
public async Task<ResumeProject[]> GetResumeProjects(int resumeId) {
|
||||
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()) {
|
||||
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 {
|
||||
string _name = GetString(reader, "Name");
|
||||
string _url = GetString(reader, "URL");
|
||||
string _description = GetString(reader, "Description");
|
||||
projects.Add(new ResumeProject {
|
||||
ID = _id,
|
||||
ResumeID = _resumeid,
|
||||
Name = _name,
|
||||
URL = _url,
|
||||
Description = _description
|
||||
} );
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
return projects.ToArray();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,7 +4,9 @@ using MySql.Data.MySqlClient;
|
||||
namespace BoredCareers.Services.DatabaseService {
|
||||
public partial class DatabaseService {
|
||||
|
||||
public async Task 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)
|
||||
@@ -22,9 +24,11 @@ namespace BoredCareers.Services.DatabaseService {
|
||||
StateOrRegion = @StateOrRegion,
|
||||
City = @City,
|
||||
IsActive = @IsActive;
|
||||
|
||||
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);
|
||||
@@ -37,14 +41,22 @@ namespace BoredCareers.Services.DatabaseService {
|
||||
cmd.Parameters.AddWithValue("@StateOrRegion", resume.StateOrRegion);
|
||||
cmd.Parameters.AddWithValue("@City", resume.City);
|
||||
cmd.Parameters.AddWithValue("@IsActive", resume.IsActive);
|
||||
object? result = await cmd.ExecuteScalarAsync();
|
||||
|
||||
await cmd.ExecuteNonQueryAsync();
|
||||
if (resume.ID != null && resume.ID != 0) {
|
||||
return Convert.ToInt32(resume.ID);
|
||||
} else {
|
||||
cmd.CommandText = "";
|
||||
return Convert.ToInt32(result);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public async Task SetResumeExperienceBullets(MySqlConnection connection, ResumeExperienceBullet[] bullets) {
|
||||
foreach (ResumeExperienceBullet cur in bullets) {
|
||||
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)
|
||||
@@ -54,20 +66,21 @@ namespace BoredCareers.Services.DatabaseService {
|
||||
JobFunction = @JobFunction;
|
||||
";
|
||||
|
||||
MySqlCommand cmd = new MySqlCommand(command, connection);
|
||||
cmd.Parameters.AddWithValue("@ID", cur.ID);
|
||||
cmd.Parameters.AddWithValue("@ResumeID", cur.ResumeID);
|
||||
cmd.Parameters.AddWithValue("@ResumeExperienceID", cur.ResumeExperienceID);
|
||||
cmd.Parameters.AddWithValue("@JobFunction", cur.JobFunction);
|
||||
MySqlCommand cmd = new MySqlCommand(command, conn);
|
||||
cmd.Parameters.AddWithValue("@ID", bullet.ID);
|
||||
cmd.Parameters.AddWithValue("@ResumeID", bullet.ResumeID);
|
||||
cmd.Parameters.AddWithValue("@ResumeExperienceID", bullet.ResumeExperienceID);
|
||||
cmd.Parameters.AddWithValue("@JobFunction", bullet.JobFunction);
|
||||
|
||||
await cmd.ExecuteNonQueryAsync();
|
||||
}
|
||||
}
|
||||
|
||||
public async Task SetResumeExperience(MySqlConnection connection, ResumeExperience[] experiences) {
|
||||
foreach (ResumeExperience cur in 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)
|
||||
@@ -82,26 +95,37 @@ namespace BoredCareers.Services.DatabaseService {
|
||||
DateStarted = @DateStarted,
|
||||
StillEmployed = @StillEmployed,
|
||||
DateEnded = @DateEnded;
|
||||
|
||||
SELECT LAST_INSERT_ID();
|
||||
";
|
||||
|
||||
MySqlCommand cmd = new MySqlCommand(command, connection);
|
||||
cmd.Parameters.AddWithValue("@ID", cur.ID);
|
||||
cmd.Parameters.AddWithValue("@ResumeID", cur.ResumeID);
|
||||
cmd.Parameters.AddWithValue("@JobTitle", cur.JobTitle);
|
||||
cmd.Parameters.AddWithValue("@Company", cur.Company);
|
||||
cmd.Parameters.AddWithValue("@PostalCode", cur.PostalCode);
|
||||
cmd.Parameters.AddWithValue("@DateStarted", cur.DateStarted.ToUniversalTime());
|
||||
cmd.Parameters.AddWithValue("@StillEmployed", cur.StillEmployed);
|
||||
cmd.Parameters.AddWithValue("@DateEnded", cur.DateEnded.ToUniversalTime());
|
||||
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);
|
||||
cmd.Parameters.AddWithValue("@DateEnded", experiences.DateEnded.ToUniversalTime());
|
||||
object? result = await cmd.ExecuteScalarAsync();
|
||||
|
||||
await cmd.ExecuteNonQueryAsync();
|
||||
if (experiences.ID == null) {
|
||||
experiences.ID = Convert.ToInt32(result);
|
||||
}
|
||||
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)
|
||||
@@ -112,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);
|
||||
@@ -122,40 +146,53 @@ namespace BoredCareers.Services.DatabaseService {
|
||||
await cmd.ExecuteNonQueryAsync();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public async Task 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,Veteran,Country,Rank,DateStarted,StillServing,DateEnded)
|
||||
INSERT INTO ResumeMilitary
|
||||
(ID,ResumeID,Country,`Rank`,DateStarted,StillServing,DateEnded)
|
||||
VALUES
|
||||
(@ID,@ResumeID,@Veteran,@Country,@Rank,@DateStarted,@StillServing,@DateEnded)
|
||||
(@ID,@ResumeID,@Country,@Rank,@DateStarted,@StillServing,@DateEnded)
|
||||
ON DUPLICATE KEY UPDATE
|
||||
ResumeID = @ResumeID,
|
||||
Veteran = @Veteran,
|
||||
Country = @Country,
|
||||
Rank = @Rank,
|
||||
`Rank` = @Rank,
|
||||
DateStarted = @DateStarted,
|
||||
StillServing = @StillServing,
|
||||
DateEnded = @DateEnded;
|
||||
|
||||
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("@Veteran", military.Veteran);
|
||||
cmd.Parameters.AddWithValue("@Country", military.Country);
|
||||
cmd.Parameters.AddWithValue("@Rank", military.Rank);
|
||||
cmd.Parameters.AddWithValue("@DateStarted", military.DateStarted.ToUniversalTime());
|
||||
cmd.Parameters.AddWithValue("@StillServing", military.StillServing);
|
||||
cmd.Parameters.AddWithValue("@DateEnded", military.DateEnded.ToUniversalTime());
|
||||
object? result = await cmd.ExecuteScalarAsync();
|
||||
|
||||
await cmd.ExecuteNonQueryAsync();
|
||||
if (military.ID == null) {
|
||||
military.ID = Convert.ToInt32(result);
|
||||
}
|
||||
return military;
|
||||
}
|
||||
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)
|
||||
@@ -173,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);
|
||||
@@ -190,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)
|
||||
@@ -204,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);
|
||||
@@ -213,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)
|
||||
@@ -227,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);
|
||||
@@ -236,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);
|
||||
@@ -261,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)
|
||||
@@ -276,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);
|
||||
@@ -286,6 +335,7 @@ namespace BoredCareers.Services.DatabaseService {
|
||||
await cmd.ExecuteNonQueryAsync();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user