Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added .vs/JobFairApp/v15/.suo
Binary file not shown.
4 changes: 3 additions & 1 deletion .vs/VSWorkspaceState.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@
"ExpandedNodes": [
"",
"\\JobFairApp",
"\\JobFairApp\\JobFairApp"
"\\JobFairApp\\JobFairApp",
"\\JobFairApp\\JobFairApp\\Classes",
"\\JobFairApp\\JobFairApp\\Forms"
],
"SelectedNode": "\\JobFairApp\\JobFairApp.sln",
"PreviewInSolutionExplorer": false
Expand Down
Binary file modified .vs/slnx.sqlite
Binary file not shown.
Binary file modified JobFairApp/.vs/JobFairApp/v15/.suo
Binary file not shown.
Binary file modified JobFairApp/.vs/JobFairApp/v15/sqlite3/storage.ide
Binary file not shown.
127 changes: 127 additions & 0 deletions JobFairApp/JobFairApp/Classes/Company.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,127 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Data.SqlClient;
using System.Data.Sql;
using System.Data;

namespace JobFairApp.Classes
{
class Company : ISQLObject<Company>
{
public int ID = MySQLUtils.NullID;
public String name;
public String email;
public String phone;
public String description;



public Company FromID(int ID)
{
String query = "SELECT * FROM Companies WHERE ID = \"" + ID + "\"";

SqlConnection connection = new SqlConnection(MySQLUtils.ConnectionString);

connection.Open();

SqlCommand cmd = new SqlCommand();
cmd.CommandText = query;
cmd.CommandType = CommandType.Text;
cmd.Connection = connection;

SqlDataReader reader = cmd.ExecuteReader();
connection.Close();

return FromDataReader(reader);
}
public Company FromDataReader(SqlDataReader reader)
{
ID = reader.GetInt32(reader.GetOrdinal("ID"));
name = reader.GetString(reader.GetOrdinal("Name"));
description = reader.GetString(reader.GetOrdinal("Description"));
phone = reader.GetString(reader.GetOrdinal("Phone"));
email = reader.GetString(reader.GetOrdinal("Email"));

reader.Read();//advance reader because it may have other records

return this;
}

public Company FromDataRow(DataRow row)
{
ID = (int)row["ID"];
name = (String)row["Name"];
email = (String)row["Email"];
phone = (String)row["Phone"];
description = (String)row["Description"];


return this;
}

public int Insert()
{
String statement;
if (ID == -1)
{
statement = "INSERT INTO Venues (Name, Description, Phone, Email ) VALUES" +
"(" +
"'" + name + "'," +
"'" + description + "'," +
"'" + phone + " ', " +
" ' " + email + "')";
}
else
{
statement = "UPDATE People SET " +
"Name = '" + name + "'" +
"Description = '" + description + "'" +
"Phone = '" + phone + "'" +
"Email = '" + email + "'";
}

SqlConnection connection = new SqlConnection(MySQLUtils.ConnectionString);

connection.Open();

SqlCommand command = new SqlCommand();
command.CommandText = statement;
command.CommandType = CommandType.Text;
command.Connection = connection;
int retValue = command.ExecuteNonQuery();

connection.Close();

return retValue;
}

public int Set()
{
if (ID == MySQLUtils.NullID) return 0;

String statement;
statement = "UPDATE People SET " +
"Name = '" + name + "'" +
" Description = '" + description + "'" +
" Phone = '" + phone + "'"+
" Email = '" + email + "'";

SqlConnection connection = new SqlConnection(MySQLUtils.ConnectionString);

connection.Open();

SqlCommand command = new SqlCommand();
command.CommandText = statement;
command.CommandType = CommandType.Text;

int retValue = command.ExecuteNonQuery();

connection.Close();

return retValue;
}
}
}
149 changes: 149 additions & 0 deletions JobFairApp/JobFairApp/Forms/AddCompanyForm.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

20 changes: 20 additions & 0 deletions JobFairApp/JobFairApp/Forms/AddCompanyForm.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace JobFairApp.Forms
{
public partial class AddCompanyForm : Form
{
public AddCompanyForm()
{
InitializeComponent();
}
}
}
Loading