Merge pull request 'UI' (#5) from UI into main
Docker Build and Release Upload / build (push) Successful in 1m21s
Docker Build and Release Upload / build (push) Successful in 1m21s
Reviewed-on: #5
This commit was merged in pull request #5.
This commit is contained in:
@@ -44,7 +44,7 @@
|
||||
|
||||
.active {
|
||||
background-color: #00000010;
|
||||
color: var(--Mistox-Bright);
|
||||
color: var(--Mistox-Frame);
|
||||
}
|
||||
|
||||
.nav-button-login {
|
||||
|
||||
+11
-11
@@ -1,19 +1,19 @@
|
||||
<div class="top-bar">
|
||||
<div class="top-bar-buttons">
|
||||
<a #homeLink class="nav-button" href="">HOME</a>
|
||||
<a #jobsLink class="nav-button" href="/jobs">JOB BOARD</a>
|
||||
<a #resumesLink class="nav-button" href="/resumes">RESUMES</a>
|
||||
<a #homeLink class="nav-button" routerLink="">HOME</a>
|
||||
<a #jobsLink class="nav-button" routerLink="/jobs">JOB BOARD</a>
|
||||
<a #resumesLink class="nav-button" routerLink="/resumes">RESUMES</a>
|
||||
</div>
|
||||
<a class="top-bar-logo" href="">
|
||||
<a class="top-bar-logo" routerLink="">
|
||||
<img class="top-bar-logo" style="margin: 0;" src="img/logo-full.png" />
|
||||
</a>
|
||||
<div *ngIf="auth.isLoggedIn" class="top-bar-buttons flex-right">
|
||||
<a class="nav-button nav-button-login" href="/account/settings"><span>{{ auth.loggedInUser.userName.toUpperCase() }}</span></a>
|
||||
<a class="nav-button nav-button-login" href="/account/logout"><span>LOGOUT</span></a>
|
||||
<a class="nav-button nav-button-login" routerLink="/account/settings"><span>{{ auth.loggedInUser.userName.toUpperCase() }}</span></a>
|
||||
<a class="nav-button nav-button-login" routerLink="/account/logout"><span>LOGOUT</span></a>
|
||||
</div>
|
||||
<div *ngIf="!auth.isLoggedIn" class="top-bar-buttons flex-right">
|
||||
<a class="nav-button nav-button-login" href="/account/login"><span>LOGIN</span></a>
|
||||
<a class="nav-button nav-button-login" href="/account/register"><span>REGISTER</span></a>
|
||||
<a class="nav-button nav-button-login" routerLink="/account/login"><span>LOGIN</span></a>
|
||||
<a class="nav-button nav-button-login" routerLink="/account/register"><span>REGISTER</span></a>
|
||||
</div>
|
||||
</div>
|
||||
<div class="content">
|
||||
@@ -21,9 +21,9 @@
|
||||
</div>
|
||||
<div class="bottom-bar">
|
||||
<div class="bottom-bar-buttons bottom-bar-float">
|
||||
<a class="nav-button-bottom bottom-bar-padding" href="/contact">CONTACT</a>
|
||||
<a class="nav-button-bottom bottom-bar-padding" href="/privacy">PRIVACY</a>
|
||||
<a class="nav-button-bottom bottom-bar-padding" href="/about">ABOUT</a>
|
||||
<a class="nav-button-bottom bottom-bar-padding" routerLink="/contact">CONTACT</a>
|
||||
<a class="nav-button-bottom bottom-bar-padding" routerLink="/privacy">PRIVACY</a>
|
||||
<a class="nav-button-bottom bottom-bar-padding" routerLink="/about">ABOUT</a>
|
||||
</div>
|
||||
<a class="bottom-bar-logo" href="https://mistox.com">
|
||||
<img src="img/mistox-logo.png" />
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
import { Component, ElementRef, ViewChild } from '@angular/core';
|
||||
import { Router, RouterOutlet } from '@angular/router';
|
||||
import { Router, RouterModule, RouterOutlet } from '@angular/router';
|
||||
import { Authentication } from './services/Authentication';
|
||||
import { CommonModule } from '@angular/common';
|
||||
|
||||
@Component({
|
||||
selector: 'app-root',
|
||||
imports: [RouterOutlet, CommonModule],
|
||||
imports: [RouterOutlet, CommonModule, RouterModule],
|
||||
templateUrl: './app.html',
|
||||
styleUrl: './app.css'
|
||||
})
|
||||
|
||||
@@ -16,5 +16,5 @@ export class Company {
|
||||
export class Employee {
|
||||
public id: number = 0;
|
||||
public accountID: number = 0;
|
||||
public companyID: number = 0;
|
||||
public company: Company = new Company;
|
||||
}
|
||||
@@ -69,7 +69,7 @@ export class CompanyConnectComponent {
|
||||
this.router.navigate([""]);
|
||||
},
|
||||
error: err => {
|
||||
alert("Failed to create the job listing. Err: " + err.error);
|
||||
this.ErrorMsg = err.error;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -0,0 +1,48 @@
|
||||
.center-frame {
|
||||
margin: 0 200px;
|
||||
width: calc(100% - 400px);
|
||||
}
|
||||
|
||||
.content-frame {
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
justify-content: space-between;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.content-frame:nth-child(even) {
|
||||
flex-direction: row-reverse;
|
||||
}
|
||||
|
||||
.floating-frame {
|
||||
width: 450px;
|
||||
background-color: var(--Mistox-Frame);
|
||||
padding: 20px;
|
||||
margin: 20px 0;
|
||||
border: 1px solid #000;
|
||||
border-radius: 10px;
|
||||
}
|
||||
|
||||
.title-block {
|
||||
margin: 0;
|
||||
margin-bottom: 20px;
|
||||
white-space: nowrap;
|
||||
text-align: center;
|
||||
font-size: 0.8rem;
|
||||
}
|
||||
|
||||
.title-block h1 {
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
hr {
|
||||
width: 90%;
|
||||
margin: 20px 5%;
|
||||
}
|
||||
|
||||
.solution-frame {
|
||||
height: 200px;
|
||||
background-color: blueviolet;
|
||||
width: calc(100% - 515px);
|
||||
margin: 20px 0;
|
||||
}
|
||||
@@ -0,0 +1,81 @@
|
||||
<div class="center-frame">
|
||||
<div class="content-frame">
|
||||
<div class="floating-frame">
|
||||
<div class="title-block">
|
||||
<h1>death by a thousand applicants</h1>
|
||||
</div>
|
||||
<div class="content-block">
|
||||
<p><strong>Everyone’s applying to everything.</strong> With automation tools, job seekers blast out hundreds of applications in minutes.</p>
|
||||
<p>It’s turned the job market into noise — a flood of résumés that no recruiter can realistically sift through.</p>
|
||||
<p><em>Volume wins the race, but nobody’s really being heard.</em></p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="solution-frame">
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="content-frame">
|
||||
<div class="floating-frame">
|
||||
<div class="title-block">
|
||||
<h1>keyword frenzie</h1>
|
||||
</div>
|
||||
<div class="content-block">
|
||||
<p><strong>AI is scanning your resume,</strong> not a human. And it’s not looking for personality — it’s hunting for keywords.</p>
|
||||
<p>In today’s job market, crafting a resume isn’t about telling your story. It’s about guessing the right terms an algorithm wants to see.</p>
|
||||
<p><em>It’s no longer about standing out — it’s about fitting the filter.</em></p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="solution-frame">
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="content-frame">
|
||||
<div class="floating-frame">
|
||||
<div class="title-block">
|
||||
<h1>response black-hole</h1>
|
||||
</div>
|
||||
<div class="content-block">
|
||||
<p><strong>Companies are overwhelmed,</strong> and most simply don’t have the time to respond to every application.</p>
|
||||
<p>With hundreds — sometimes thousands — of resumes coming in for a single role, even automated responses fall short.</p>
|
||||
<p><em>Silence isn't personal. It’s just capacity.</em></p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="solution-frame">
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="content-frame">
|
||||
<div class="floating-frame">
|
||||
<div class="title-block">
|
||||
<h1>zombie postings</h1>
|
||||
</div>
|
||||
<div class="content-block">
|
||||
<p><strong>Not every job posting is real.</strong> Some listings stay up long after the role is filled — or worse, never existed in the first place.</p>
|
||||
<p>These "zombie listings" inflate the perception of a healthy job market or act as bait to collect resumes and personal data.</p>
|
||||
<p><em>You're not always applying — sometimes you're just feeding the machine.</em></p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="solution-frame">
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="content-frame">
|
||||
<div class="floating-frame">
|
||||
<div class="title-block">
|
||||
<h1>caveman tools</h1>
|
||||
</div>
|
||||
<div class="content-block">
|
||||
<p><strong>Hiring tools haven't kept up.</strong> Most companies still rely on outdated systems to manage a flood of modern, automated applications.</p>
|
||||
<p>What should be a streamlined process turns into digital clutter — messy dashboards, keyword roulette, and missed talent.</p>
|
||||
<p><em>The tools are broken, but the workload keeps growing.</em></p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="solution-frame">
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -45,7 +45,7 @@ export class JobEditComponent {
|
||||
window.location.reload();
|
||||
},
|
||||
error: err => {
|
||||
alert("Failed to delete the job listing. Try again");
|
||||
this.ErrorMsg = err.error;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -1,3 +1,9 @@
|
||||
.full-width {
|
||||
display: block;
|
||||
width: 100%;
|
||||
column-count: 2;
|
||||
}
|
||||
|
||||
.tile-frame {
|
||||
column-count: 4;
|
||||
column-gap: 20px;
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
<button (click)="RemoveJobListing(cur.id)">DELETE</button>
|
||||
</div>
|
||||
<div>
|
||||
<button [routerLink]="['/jobs/new']">NEW</button>
|
||||
<button [routerLink]="['/jobs/new']">POST JOB</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
@@ -45,7 +45,7 @@ export class JobsComponent {
|
||||
window.location.reload();
|
||||
},
|
||||
error: err => {
|
||||
alert("Failed to delete the job listing. Try again");
|
||||
this.ErrorMsg = err.error;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -2,12 +2,28 @@
|
||||
<h1>POST A NEW JOB</h1>
|
||||
</div>
|
||||
<form (ngSubmit)="PostJobListing(newListing)">
|
||||
|
||||
<!-- Attach To Company -->
|
||||
<div #step class="sub-frame">
|
||||
<div class="center">
|
||||
<div class="content-frame">
|
||||
<label>For What Company</label>
|
||||
<select name="company" [(ngModel)]="selectedCompany">
|
||||
<option value="">-- Select Company --</option>
|
||||
<option *ngFor="let cur of employeeOfList" [ngValue]="cur.company">{{ cur.company.name }}</option>
|
||||
</select>
|
||||
<button type="button" (click)="nextStep()">Next</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Title -->
|
||||
<div #step class="sub-frame">
|
||||
<div class="center">
|
||||
<div class="content-frame">
|
||||
<label>Job Title</label>
|
||||
<input name="title" [(ngModel)]="newListing.title" type="text" />
|
||||
<button type="button" (click)="prevStep()">Back</button>
|
||||
<button type="button" (click)="nextStep()">Next</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -6,6 +6,7 @@ import { Title } from '@angular/platform-browser';
|
||||
import { CommonModule } from '@angular/common';
|
||||
import { JobListing } from 'app/models/JobListing';
|
||||
import { Authentication } from 'app/services/Authentication';
|
||||
import { Company, Employee } from 'app/models/Company';
|
||||
|
||||
@Component({
|
||||
selector: 'main-jobs-new',
|
||||
@@ -18,11 +19,26 @@ export class JobNewComponent {
|
||||
@ViewChildren('step') formSteps!: QueryList<ElementRef<HTMLDivElement>>;
|
||||
currentStep: number = 0;
|
||||
|
||||
public employeeOfList: Employee[] = [];
|
||||
public selectedCompany: Company = new Company;
|
||||
|
||||
public newListing: JobListing = new JobListing();
|
||||
public ErrorMsg: string = "";
|
||||
|
||||
constructor( private http: HttpClient, private router: Router, private route: ActivatedRoute, private title: Title, public auth: Authentication ) {
|
||||
this.title.setTitle("Jobs - new | BoredCareers");
|
||||
|
||||
this.http.get<Employee[]>("api/employee").subscribe({
|
||||
next: empOf => {
|
||||
if (empOf.length === 0){
|
||||
router.navigate(["company/connect"]);
|
||||
}
|
||||
this.employeeOfList = empOf;
|
||||
},
|
||||
error: err => {
|
||||
this.ErrorMsg = err.error;
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
ngAfterViewInit(){
|
||||
@@ -64,12 +80,13 @@ export class JobNewComponent {
|
||||
}
|
||||
|
||||
PostJobListing(jobListing: JobListing){
|
||||
jobListing.companyID = this.selectedCompany.id;
|
||||
this.http.post("api/joblisting", jobListing).subscribe({
|
||||
next: data => {
|
||||
|
||||
this.router.navigate([""]);
|
||||
},
|
||||
error: err => {
|
||||
alert("Failed to create the job listing. Try again");
|
||||
this.ErrorMsg = err.error;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
--Mistox-Medium: #890620;
|
||||
--Mistox-Light: #B6465F;
|
||||
--Mistox-Bright: #FC440F;
|
||||
--Mistox-Frame: #ff000078;
|
||||
--Mistox-Frame: #FF5A00CC;
|
||||
--Mistox-Button: #ff9999;
|
||||
--Mistox-Button-Hover: #ff999977;
|
||||
--Mistox-White: #FFF;
|
||||
|
||||
@@ -28,7 +28,11 @@ namespace BoredCareers.Controllers {
|
||||
if (newCompany) {
|
||||
Company? test = await _databaseService.GetCompany(company.ID);
|
||||
if (test == null) {
|
||||
await _databaseService.SetCompany(company);
|
||||
company.ID = await _databaseService.SetCompany(company);
|
||||
await _databaseService.SetEmployee(new Employee() {
|
||||
AccountID = getLoggedInUserID(),
|
||||
Company = company
|
||||
});
|
||||
return Ok();
|
||||
}
|
||||
return NotFound("The company already exists");
|
||||
|
||||
@@ -0,0 +1,64 @@
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using BoredCareers.Services.DatabaseService;
|
||||
using BoredCareers.Entities;
|
||||
using System.Web.Http;
|
||||
|
||||
namespace BoredCareers.Controllers {
|
||||
[ApiController]
|
||||
[Route("api/employee")]
|
||||
public class EmployeeController : MistoxControllerBase {
|
||||
|
||||
public EmployeeController(DatabaseService db) : base(db) {}
|
||||
|
||||
[HttpGet("{CompanyID}")]
|
||||
public async Task<IActionResult> GetEmployees([FromRoute] int CompanyID) {
|
||||
if (isLoggedIn()) {
|
||||
if (await isLoggedInUserEmployeeOf(CompanyID)) {
|
||||
Employee[] employees = await _databaseService.GetEmployeesFromCompany(CompanyID);
|
||||
return Ok(employees);
|
||||
}
|
||||
return NotFound("You are not an employee of company");
|
||||
}
|
||||
return NotFound("Not logged in");
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
public async Task<IActionResult> GetEmployee() {
|
||||
if (isLoggedIn()) {
|
||||
Employee[] employees = await _databaseService.GetEmployeesFromAccount(getLoggedInUserID());
|
||||
return Ok(employees);
|
||||
}
|
||||
return NotFound("Not logged in");
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
public async Task<IActionResult> SetEmployee([FromBody] Employee employee) {
|
||||
if (isLoggedIn()) {
|
||||
if (await isLoggedInUserEmployeeOf(employee.Company.ID)) {
|
||||
await _databaseService.SetEmployee(employee);
|
||||
return Ok();
|
||||
}
|
||||
return NotFound("You are not an employee of company");
|
||||
}
|
||||
return NotFound("Not logged in");
|
||||
}
|
||||
|
||||
[HttpDelete]
|
||||
public async Task<IActionResult> DeleteEmployee(int EmployeeID) {
|
||||
if (isLoggedIn()) {
|
||||
Employee? employee = await _databaseService.GetEmployee(EmployeeID);
|
||||
if (employee != null) {
|
||||
if (await isLoggedInUserEmployeeOf(employee.Company.ID)) {
|
||||
await _databaseService.DeleteEmployee(EmployeeID);
|
||||
return Ok();
|
||||
}
|
||||
return NotFound("You are not an employee of company");
|
||||
}
|
||||
return NotFound("Employee not found");
|
||||
}
|
||||
return NotFound("Not logged in");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -36,7 +36,7 @@ namespace BoredCareers.Controllers {
|
||||
}
|
||||
|
||||
public async Task<bool> isLoggedInUserEmployeeOf(int CompanyID) {
|
||||
Employee[] employees = await _databaseService.GetEmployees(CompanyID);
|
||||
Employee[] employees = await _databaseService.GetEmployeesFromCompany(CompanyID);
|
||||
foreach (Employee cur in employees) {
|
||||
if (getLoggedInUserID() == cur.AccountID) {
|
||||
return true;
|
||||
|
||||
@@ -18,7 +18,7 @@ namespace BoredCareers.Entities {
|
||||
public class Employee {
|
||||
public int ID { get; set; } // PK
|
||||
public int AccountID { get; set; } // FK
|
||||
public int CompanyID { get; set; } // FK
|
||||
public Company Company { get; set; } = new Company(); // FK
|
||||
}
|
||||
|
||||
}
|
||||
@@ -55,8 +55,8 @@ namespace BoredCareers.Services.DatabaseService {
|
||||
return company;
|
||||
}
|
||||
|
||||
public async Task SetCompany( Company company ) {
|
||||
using( MySqlConnection connection = GetConnection() ) {
|
||||
public async Task<int> SetCompany( Company company ) {
|
||||
using (MySqlConnection connection = GetConnection()) {
|
||||
connection.Open();
|
||||
|
||||
string command = @"
|
||||
@@ -76,9 +76,11 @@ namespace BoredCareers.Services.DatabaseService {
|
||||
StateOrRegion = @StateOrRegion,
|
||||
City = @City,
|
||||
Description = @Description;
|
||||
|
||||
Select LAST_INSERT_ID();
|
||||
";
|
||||
|
||||
MySqlCommand cmd = new MySqlCommand( command , connection);
|
||||
MySqlCommand cmd = new MySqlCommand(command, connection);
|
||||
cmd.Parameters.AddWithValue("@ID", company.ID);
|
||||
cmd.Parameters.AddWithValue("@Name", company.Name);
|
||||
cmd.Parameters.AddWithValue("@Email", company.Email);
|
||||
@@ -92,7 +94,9 @@ namespace BoredCareers.Services.DatabaseService {
|
||||
cmd.Parameters.AddWithValue("@City", company.City);
|
||||
cmd.Parameters.AddWithValue("@Description", company.Description);
|
||||
|
||||
await cmd.ExecuteNonQueryAsync();
|
||||
object? result = await cmd.ExecuteScalarAsync();
|
||||
int insertedId = result != null ? Convert.ToInt32(result) : 0;
|
||||
return insertedId;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -6,18 +6,19 @@ using System.Data.Common;
|
||||
namespace BoredCareers.Services.DatabaseService {
|
||||
public partial class DatabaseService {
|
||||
|
||||
public async Task<Employee[]> GetEmployees( int CompanyID ) {
|
||||
List<Employee> employees = new List<Employee>();
|
||||
public async Task<Employee?> GetEmployee( int EmployeeID ) {
|
||||
Employee? employee = null;
|
||||
using( MySqlConnection connection = GetConnection() ) {
|
||||
connection.Open();
|
||||
string command = @"
|
||||
SELECT *
|
||||
FROM Employee
|
||||
WHERE ID = @ID;
|
||||
LEFT JOIN Company ON Employee.CompanyID = Company.ID
|
||||
WHERE Employee.ID = @ID;
|
||||
";
|
||||
|
||||
MySqlCommand cmd = new MySqlCommand(command, connection);
|
||||
cmd.Parameters.AddWithValue("@ID", CompanyID);
|
||||
cmd.Parameters.AddWithValue("@ID", EmployeeID);
|
||||
|
||||
using( DbDataReader reader = await cmd.ExecuteReaderAsync() ) {
|
||||
while( await reader.ReadAsync() ) {
|
||||
@@ -25,11 +26,91 @@ namespace BoredCareers.Services.DatabaseService {
|
||||
int _id = reader.GetInt32("ID");
|
||||
int _accountid = reader.GetInt32("AccountID");
|
||||
int _companyid = reader.GetInt32("CompanyID");
|
||||
string _name = reader.GetString("Name");
|
||||
string _email = reader.GetString("Email");
|
||||
bool _emailVerified = reader.GetBoolean("EmailVerified");
|
||||
string _websiteurl = reader.GetString("WebsiteURL");
|
||||
string _logourl = reader.GetString( "LogoURL" );
|
||||
string _phone = reader.GetString( "Phone" );
|
||||
string _postalcode = reader.GetString( "PostalCode" );
|
||||
string _country = reader.GetString( "Country" );
|
||||
string _state = reader.GetString( "StateOrRegion" );
|
||||
string _city = reader.GetString( "City" );
|
||||
string _description = reader.GetString( "Description" );
|
||||
|
||||
employee = new Employee() {
|
||||
ID = _id,
|
||||
AccountID = _accountid,
|
||||
Company = new Company {
|
||||
ID = _companyid,
|
||||
Name = _name,
|
||||
Email = _email,
|
||||
EmailVerified = _emailVerified,
|
||||
WebsiteURL = _websiteurl,
|
||||
LogoURL = _logourl,
|
||||
Phone = _phone,
|
||||
PostalCode = _postalcode,
|
||||
Country = _country,
|
||||
StateOrRegion = _state,
|
||||
City = _city,
|
||||
Description = _description
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
return employee;
|
||||
}
|
||||
|
||||
public async Task<Employee[]> GetEmployeesFromCompany(int CompanyID) {
|
||||
List<Employee> employees = new List<Employee>();
|
||||
using (MySqlConnection connection = GetConnection()) {
|
||||
connection.Open();
|
||||
string command = @"
|
||||
SELECT *
|
||||
FROM Employee
|
||||
LEFT JOIN Company ON Employee.CompanyID = Company.ID
|
||||
WHERE Employee.CompanyID = @CompanyID;
|
||||
";
|
||||
|
||||
MySqlCommand cmd = new MySqlCommand(command, connection);
|
||||
cmd.Parameters.AddWithValue("@CompanyID", CompanyID);
|
||||
|
||||
using (DbDataReader reader = await cmd.ExecuteReaderAsync()) {
|
||||
while (await reader.ReadAsync()) {
|
||||
if (reader == null) { break; }
|
||||
int _id = reader.GetInt32("ID");
|
||||
int _accountid = reader.GetInt32("AccountID");
|
||||
int _companyid = reader.GetInt32("CompanyID");
|
||||
string _name = reader.GetString("Name");
|
||||
string _email = reader.GetString("Email");
|
||||
bool _emailVerified = reader.GetBoolean("EmailVerified");
|
||||
string _websiteurl = reader.GetString("WebsiteURL");
|
||||
string _logourl = reader.GetString( "LogoURL" );
|
||||
string _phone = reader.GetString( "Phone" );
|
||||
string _postalcode = reader.GetString( "PostalCode" );
|
||||
string _country = reader.GetString( "Country" );
|
||||
string _state = reader.GetString( "StateOrRegion" );
|
||||
string _city = reader.GetString( "City" );
|
||||
string _description = reader.GetString( "Description" );
|
||||
|
||||
employees.Add(new Employee() {
|
||||
ID = _id,
|
||||
AccountID = _accountid,
|
||||
CompanyID = _companyid
|
||||
Company = new Company {
|
||||
ID = _companyid,
|
||||
Name = _name,
|
||||
Email = _email,
|
||||
EmailVerified = _emailVerified,
|
||||
WebsiteURL = _websiteurl,
|
||||
LogoURL = _logourl,
|
||||
Phone = _phone,
|
||||
PostalCode = _postalcode,
|
||||
Country = _country,
|
||||
StateOrRegion = _state,
|
||||
City = _city,
|
||||
Description = _description
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -37,8 +118,64 @@ namespace BoredCareers.Services.DatabaseService {
|
||||
return employees.ToArray();
|
||||
}
|
||||
|
||||
public async Task SetEmployee( Employee employee ) {
|
||||
using( MySqlConnection connection = GetConnection() ) {
|
||||
public async Task<Employee[]> GetEmployeesFromAccount(int AccountID) {
|
||||
List<Employee> employees = new List<Employee>();
|
||||
using (MySqlConnection connection = GetConnection()) {
|
||||
connection.Open();
|
||||
string command = @"
|
||||
SELECT *
|
||||
FROM Employee
|
||||
LEFT JOIN Company ON Employee.CompanyID = Company.ID
|
||||
WHERE Employee.AccountID = @AccountID;
|
||||
";
|
||||
|
||||
MySqlCommand cmd = new MySqlCommand(command, connection);
|
||||
cmd.Parameters.AddWithValue("@AccountID", AccountID);
|
||||
|
||||
using (DbDataReader reader = await cmd.ExecuteReaderAsync()) {
|
||||
while (await reader.ReadAsync()) {
|
||||
if (reader == null) { break; }
|
||||
int _id = reader.GetInt32("ID");
|
||||
int _accountid = reader.GetInt32("AccountID");
|
||||
int _companyid = reader.GetInt32("CompanyID");
|
||||
string _name = reader.GetString("Name");
|
||||
string _email = reader.GetString("Email");
|
||||
bool _emailVerified = reader.GetBoolean("EmailVerified");
|
||||
string _websiteurl = reader.GetString("WebsiteURL");
|
||||
string _logourl = reader.GetString( "LogoURL" );
|
||||
string _phone = reader.GetString( "Phone" );
|
||||
string _postalcode = reader.GetString( "PostalCode" );
|
||||
string _country = reader.GetString( "Country" );
|
||||
string _state = reader.GetString( "StateOrRegion" );
|
||||
string _city = reader.GetString( "City" );
|
||||
string _description = reader.GetString( "Description" );
|
||||
|
||||
employees.Add(new Employee() {
|
||||
ID = _id,
|
||||
AccountID = _accountid,
|
||||
Company = new Company {
|
||||
ID = _companyid,
|
||||
Name = _name,
|
||||
Email = _email,
|
||||
EmailVerified = _emailVerified,
|
||||
WebsiteURL = _websiteurl,
|
||||
LogoURL = _logourl,
|
||||
Phone = _phone,
|
||||
PostalCode = _postalcode,
|
||||
Country = _country,
|
||||
StateOrRegion = _state,
|
||||
City = _city,
|
||||
Description = _description
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
return employees.ToArray();
|
||||
}
|
||||
|
||||
public async Task SetEmployee(Employee employee) {
|
||||
using (MySqlConnection connection = GetConnection()) {
|
||||
connection.Open();
|
||||
|
||||
string command = @"
|
||||
@@ -51,10 +188,10 @@ namespace BoredCareers.Services.DatabaseService {
|
||||
CompanyID = @CompanyID;
|
||||
";
|
||||
|
||||
MySqlCommand cmd = new MySqlCommand( command , connection);
|
||||
MySqlCommand cmd = new MySqlCommand(command, connection);
|
||||
cmd.Parameters.AddWithValue("@ID", employee.ID);
|
||||
cmd.Parameters.AddWithValue("@AccountID", employee.AccountID);
|
||||
cmd.Parameters.AddWithValue("@CompanyID", employee.CompanyID);
|
||||
cmd.Parameters.AddWithValue("@CompanyID", employee.Company.ID);
|
||||
|
||||
await cmd.ExecuteNonQueryAsync();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user