Impliment file upload for company Logo

This commit is contained in:
2025-08-01 17:24:51 -07:00
parent 1904ccb37c
commit 5480af64f6
9 changed files with 52 additions and 20 deletions
@@ -2,6 +2,7 @@ using BoredCareers.Entities;
using MySql.Data.MySqlClient;
using System.Data;
using System.Data.Common;
using System.Text;
namespace BoredCareers.Services.DatabaseService {
public partial class DatabaseService {
@@ -27,7 +28,7 @@ namespace BoredCareers.Services.DatabaseService {
string _email = reader.GetString("Email");
bool _emailVerified = reader.GetBoolean("EmailVerified");
string _websiteurl = reader.GetString("WebsiteURL");
string _logourl = reader.GetString( "LogoURL" );
string _logo = Encoding.UTF8.GetString((byte[])reader["Logo"]);
string _phone = reader.GetString( "Phone" );
string _postalcode = reader.GetString( "PostalCode" );
string _country = reader.GetString( "Country" );
@@ -41,7 +42,7 @@ namespace BoredCareers.Services.DatabaseService {
Email = _email,
EmailVerified = _emailVerified,
WebsiteURL = _websiteurl,
LogoURL = _logourl,
Logo = _logo,
Phone = _phone,
PostalCode = _postalcode,
Country = _country,
@@ -61,15 +62,15 @@ namespace BoredCareers.Services.DatabaseService {
string command = @"
INSERT INTO Company
(ID,Name,Email,EmailVerified,WebsiteURL,LogoURL,Phone,PostalCode,Country,StateOrRegion,City,Description)
(ID,Name,Email,EmailVerified,WebsiteURL,Logo,Phone,PostalCode,Country,StateOrRegion,City,Description)
VALUES
(@ID,@Name,@Email,@EmailVerified,@WebsiteURL,@LogoURL,@Phone,@PostalCode,@Country,@StateOrRegion,@City,@Description)
(@ID,@Name,@Email,@EmailVerified,@WebsiteURL,@Logo,@Phone,@PostalCode,@Country,@StateOrRegion,@City,@Description)
ON DUPLICATE KEY UPDATE
Name = @Name,
Email = @Email,
EmailVerified = @EmailVerified,
WebsiteURL = @WebsiteURL,
LogoURL = @LogoURL,
Logo = @Logo,
Phone = @Phone,
PostalCode = @PostalCode,
Country = @Country,
@@ -86,7 +87,7 @@ namespace BoredCareers.Services.DatabaseService {
cmd.Parameters.AddWithValue("@Email", company.Email);
cmd.Parameters.AddWithValue("@EmailVerified", company.EmailVerified);
cmd.Parameters.AddWithValue("@WebsiteURL", company.WebsiteURL);
cmd.Parameters.AddWithValue("@LogoURL", company.LogoURL);
cmd.Parameters.AddWithValue("@Logo", Encoding.UTF8.GetBytes(company.Logo));
cmd.Parameters.AddWithValue("@Phone", company.Phone);
cmd.Parameters.AddWithValue("@PostalCode", company.PostalCode);
cmd.Parameters.AddWithValue("@Country", company.Country);
@@ -2,6 +2,7 @@ using BoredCareers.Entities;
using MySql.Data.MySqlClient;
using System.Data;
using System.Data.Common;
using System.Text;
namespace BoredCareers.Services.DatabaseService {
public partial class DatabaseService {
@@ -30,7 +31,7 @@ namespace BoredCareers.Services.DatabaseService {
string _email = reader.GetString("Email");
bool _emailVerified = reader.GetBoolean("EmailVerified");
string _websiteurl = reader.GetString("WebsiteURL");
string _logourl = reader.GetString( "LogoURL" );
string _logo = Encoding.UTF8.GetString((byte[])reader["Logo"]);
string _phone = reader.GetString( "Phone" );
string _postalcode = reader.GetString( "PostalCode" );
string _country = reader.GetString( "Country" );
@@ -47,7 +48,7 @@ namespace BoredCareers.Services.DatabaseService {
Email = _email,
EmailVerified = _emailVerified,
WebsiteURL = _websiteurl,
LogoURL = _logourl,
Logo = _logo,
Phone = _phone,
PostalCode = _postalcode,
Country = _country,
@@ -86,7 +87,7 @@ namespace BoredCareers.Services.DatabaseService {
string _email = reader.GetString("Email");
bool _emailVerified = reader.GetBoolean("EmailVerified");
string _websiteurl = reader.GetString("WebsiteURL");
string _logourl = reader.GetString( "LogoURL" );
string _logo = Encoding.UTF8.GetString((byte[])reader["Logo"]);
string _phone = reader.GetString( "Phone" );
string _postalcode = reader.GetString( "PostalCode" );
string _country = reader.GetString( "Country" );
@@ -103,7 +104,7 @@ namespace BoredCareers.Services.DatabaseService {
Email = _email,
EmailVerified = _emailVerified,
WebsiteURL = _websiteurl,
LogoURL = _logourl,
Logo = _logo,
Phone = _phone,
PostalCode = _postalcode,
Country = _country,
@@ -142,7 +143,7 @@ namespace BoredCareers.Services.DatabaseService {
string _email = reader.GetString("Email");
bool _emailVerified = reader.GetBoolean("EmailVerified");
string _websiteurl = reader.GetString("WebsiteURL");
string _logourl = reader.GetString( "LogoURL" );
string _logo = Encoding.UTF8.GetString((byte[])reader["Logo"]);
string _phone = reader.GetString( "Phone" );
string _postalcode = reader.GetString( "PostalCode" );
string _country = reader.GetString( "Country" );
@@ -159,7 +160,7 @@ namespace BoredCareers.Services.DatabaseService {
Email = _email,
EmailVerified = _emailVerified,
WebsiteURL = _websiteurl,
LogoURL = _logourl,
Logo = _logo,
Phone = _phone,
PostalCode = _postalcode,
Country = _country,