Add fields to Employee SQL
This commit is contained in:
@@ -25,6 +25,8 @@ namespace BoredCareers.Services.DatabaseService {
|
||||
while( await reader.ReadAsync() ) {
|
||||
int _id = reader.GetInt32("ID");
|
||||
int _accountid = reader.GetInt32("AccountID");
|
||||
string _accountname = reader.GetString("AccountName");
|
||||
string _accountemail = reader.GetString("AccountEmail");
|
||||
int _companyid = reader.GetInt32("CompanyID");
|
||||
string _name = reader.GetString("Name");
|
||||
string _email = reader.GetString("Email");
|
||||
@@ -42,6 +44,8 @@ namespace BoredCareers.Services.DatabaseService {
|
||||
employee = new Employee() {
|
||||
ID = _id,
|
||||
AccountID = _accountid,
|
||||
AccountName = _accountname,
|
||||
AccountEmail = _accountemail,
|
||||
Company = new Company {
|
||||
ID = _companyid,
|
||||
Name = _name,
|
||||
@@ -82,6 +86,8 @@ namespace BoredCareers.Services.DatabaseService {
|
||||
while (await reader.ReadAsync()) {
|
||||
int _id = reader.GetInt32("ID");
|
||||
int _accountid = reader.GetInt32("AccountID");
|
||||
string _accountname = reader.GetString("AccountName");
|
||||
string _accountemail = reader.GetString("AccountEmail");
|
||||
int _companyid = reader.GetInt32("CompanyID");
|
||||
string _name = reader.GetString("Name");
|
||||
string _email = reader.GetString("Email");
|
||||
@@ -99,6 +105,8 @@ namespace BoredCareers.Services.DatabaseService {
|
||||
employees.Add(new Employee() {
|
||||
ID = _id,
|
||||
AccountID = _accountid,
|
||||
AccountName = _accountname,
|
||||
AccountEmail = _accountemail,
|
||||
Company = new Company {
|
||||
ID = _companyid,
|
||||
Name = _name,
|
||||
@@ -139,6 +147,8 @@ namespace BoredCareers.Services.DatabaseService {
|
||||
while (await reader.ReadAsync()) {
|
||||
int _id = reader.GetInt32("ID");
|
||||
int _accountid = reader.GetInt32("AccountID");
|
||||
string _accountname = reader.GetString("AccountName");
|
||||
string _accountemail = reader.GetString("AccountEmail");
|
||||
int _companyid = reader.GetInt32("CompanyID");
|
||||
string _name = reader.GetString("Name");
|
||||
string _email = reader.GetString("Email");
|
||||
@@ -156,6 +166,8 @@ namespace BoredCareers.Services.DatabaseService {
|
||||
employees.Add(new Employee() {
|
||||
ID = _id,
|
||||
AccountID = _accountid,
|
||||
AccountName = _accountname,
|
||||
AccountEmail = _accountemail,
|
||||
Company = new Company {
|
||||
ID = _companyid,
|
||||
Name = _name,
|
||||
@@ -184,9 +196,9 @@ namespace BoredCareers.Services.DatabaseService {
|
||||
|
||||
string command = @"
|
||||
INSERT INTO Employee
|
||||
(ID,AccountID,CompanyID)
|
||||
(ID,AccountID,AccountName,AccountEmail,CompanyID)
|
||||
VALUES
|
||||
(@ID,@AccountID,@CompanyID)
|
||||
(@ID,@AccountID,@AccountName,@AccountEmail,@CompanyID)
|
||||
ON DUPLICATE KEY UPDATE
|
||||
AccountID = @AccountID,
|
||||
CompanyID = @CompanyID;
|
||||
@@ -195,6 +207,8 @@ namespace BoredCareers.Services.DatabaseService {
|
||||
MySqlCommand cmd = new MySqlCommand(command, connection);
|
||||
cmd.Parameters.AddWithValue("@ID", employee.ID);
|
||||
cmd.Parameters.AddWithValue("@AccountID", employee.AccountID);
|
||||
cmd.Parameters.AddWithValue("@AccountName", employee.AccountName);
|
||||
cmd.Parameters.AddWithValue("@AccountEmail", employee.AccountEmail);
|
||||
cmd.Parameters.AddWithValue("@CompanyID", employee.Company.ID);
|
||||
|
||||
await cmd.ExecuteNonQueryAsync();
|
||||
|
||||
Reference in New Issue
Block a user