add initial appointmentsmanager
This commit is contained in:
51
AppointmentsManager/Appointments.sql
Normal file
51
AppointmentsManager/Appointments.sql
Normal file
@@ -0,0 +1,51 @@
|
||||
-- create table for Salutation
|
||||
create table Salutation (
|
||||
salutationId int NOT NULL auto_increment PRIMARY KEY,
|
||||
label varchar(255)
|
||||
);
|
||||
|
||||
-- create table for Postal
|
||||
create table Postal (
|
||||
postalId int NOT NULL auto_increment PRIMARY KEY,
|
||||
label varchar(255)
|
||||
);
|
||||
|
||||
-- create table for PhoneType
|
||||
create table PhoneType (
|
||||
phoneTypeId int NOT NULL auto_increment PRIMARY KEY,
|
||||
label varchar(255)
|
||||
);
|
||||
|
||||
-- create table for Company
|
||||
create table Company (
|
||||
companyId int NOT NULL auto_increment PRIMARY KEY,
|
||||
label varchar(255)
|
||||
);
|
||||
|
||||
-- Contact Table
|
||||
create table Contact (
|
||||
contactId int NOT NULL auto_increment PRIMARY KEY,
|
||||
salutationId int,
|
||||
firstname varchar(255),
|
||||
surname varchar(255),
|
||||
street varchar(255),
|
||||
postalId int,
|
||||
phone varchar(255),
|
||||
phoneTypeId int,
|
||||
mobil varchar(255),
|
||||
companyId int,
|
||||
department varchar(255),
|
||||
CONSTRAINT FK_Contact_Salutation FOREIGN KEY (salutationId) REFERENCES Salutation(salutationId),
|
||||
CONSTRAINT FK_Contact_Postal FOREIGN KEY (postalId) REFERENCES Postal(postalId),
|
||||
CONSTRAINT FK_Contact_PhoneType FOREIGN KEY (phoneTypeId) REFERENCES PhoneType(phoneTypeId),
|
||||
CONSTRAINT FK_Contact_Company FOREIGN KEY (companyId) REFERENCES Company(companyId)
|
||||
);
|
||||
|
||||
-- Appointments Table
|
||||
create table Appointment (
|
||||
appointmentId int NOT NULL auto_increment PRIMARY KEY,
|
||||
contactId int,
|
||||
time date,
|
||||
description varchar(255),
|
||||
FOREIGN KEY (contactId) REFERENCES Contact(contactId)
|
||||
);
|
||||
11
AppointmentsManager/AppointmentsLib/AppointmentsLib.csproj
Normal file
11
AppointmentsManager/AppointmentsLib/AppointmentsLib.csproj
Normal file
@@ -0,0 +1,11 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net5.0</TargetFramework>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="MySqlConnector" Version="2.2.5" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
41
AppointmentsManager/AppointmentsLib/Database.cs
Normal file
41
AppointmentsManager/AppointmentsLib/Database.cs
Normal file
@@ -0,0 +1,41 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
using MySqlConnector;
|
||||
|
||||
namespace AppointmentsLib
|
||||
{
|
||||
public static class Database
|
||||
{
|
||||
private static MySqlConnection mysqlConnection;
|
||||
|
||||
public static bool Connect(string server, int port, string database, string username, string password)
|
||||
{
|
||||
string connectionString = $"Server={server};Port={port};User id={username};Password={password};Database={database}";
|
||||
|
||||
mysqlConnection = new MySqlConnection(connectionString);
|
||||
|
||||
try {
|
||||
mysqlConnection.Open();
|
||||
|
||||
Console.WriteLine("db connected");
|
||||
|
||||
return true;
|
||||
} catch(Exception e) {
|
||||
Console.WriteLine("db connection failed");
|
||||
|
||||
Console.WriteLine(e);
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
internal static MySqlCommand Execute(string command)
|
||||
{
|
||||
return new MySqlCommand(command, mysqlConnection);
|
||||
}
|
||||
}
|
||||
}
|
||||
94
AppointmentsManager/AppointmentsLib/Models/Appointment.cs
Normal file
94
AppointmentsManager/AppointmentsLib/Models/Appointment.cs
Normal file
@@ -0,0 +1,94 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace AppointmentsLib.Models
|
||||
{
|
||||
public class Appointment
|
||||
{
|
||||
public readonly int AppointmentId;
|
||||
public Contact Contact;
|
||||
public DateTime Time;
|
||||
public string Description;
|
||||
|
||||
internal Appointment(int appointmentId, int contactId, string time, string description)
|
||||
{
|
||||
AppointmentId = appointmentId;
|
||||
Contact = Contact.GetContactById(contactId);
|
||||
Time = DateTime.Parse(time);
|
||||
Description = description;
|
||||
}
|
||||
|
||||
public static IEnumerable<Appointment> GetAppointments()
|
||||
{
|
||||
var reader = Database.Execute("SELECT appointmentId, contactId, time, description FROM Appointment;").ExecuteReader();
|
||||
|
||||
List<Appointment> appointments = new();
|
||||
|
||||
while (reader.Read())
|
||||
{
|
||||
appointments.Add(new Appointment(reader.GetInt32(0), reader.GetInt32(1), reader.GetString(2), reader.GetString(3)));
|
||||
}
|
||||
|
||||
reader.Close();
|
||||
return appointments;
|
||||
}
|
||||
|
||||
public static Appointment GetAppointmentById(int appointmentId)
|
||||
{
|
||||
var cmd = Database.Execute($"SELECT appointmentId, contactId, time, description FROM Appointment WHERE appointmentId = @id;");
|
||||
|
||||
cmd.Parameters.AddWithValue("id", appointmentId);
|
||||
|
||||
var reader = cmd.ExecuteReader();
|
||||
|
||||
while (reader.Read())
|
||||
{
|
||||
var appointment = new Appointment(reader.GetInt32(0), reader.GetInt32(1), reader.GetString(2), reader.GetString(3));
|
||||
reader.Close();
|
||||
return appointment;
|
||||
}
|
||||
|
||||
throw new Exception("salutation does not exist");
|
||||
}
|
||||
|
||||
public static Appointment Create(int contactId, DateTime time, string description)
|
||||
{
|
||||
var cmd = Database.Execute($"INSERT INTO Appointment (contactId, time, description) VALUES (@contact, @time, @description)");
|
||||
|
||||
cmd.Parameters.AddWithValue("contact", contactId);
|
||||
cmd.Parameters.AddWithValue("time", time);
|
||||
cmd.Parameters.AddWithValue("description", description);
|
||||
|
||||
cmd.ExecuteNonQuery();
|
||||
|
||||
int appointmentId = (int)cmd.LastInsertedId;
|
||||
|
||||
return new Appointment(appointmentId, contactId, time.ToString(), description);
|
||||
}
|
||||
|
||||
public void Save()
|
||||
{
|
||||
var cmd = Database.Execute("UPDATE Appointment SET contactId = @contact, time = @time, description = @description WHERE appointmentId = @id");
|
||||
|
||||
cmd.Parameters.AddWithValue("contact", Contact.ContactId);
|
||||
cmd.Parameters.AddWithValue("time", Time);
|
||||
cmd.Parameters.AddWithValue("description", Description);
|
||||
|
||||
cmd.Parameters.AddWithValue("id", AppointmentId);
|
||||
|
||||
cmd.ExecuteNonQuery();
|
||||
}
|
||||
|
||||
public void Delete()
|
||||
{
|
||||
var cmd = Database.Execute("DELETE FROM Appointment WHERE appointmentId = @id");
|
||||
|
||||
cmd.Parameters.AddWithValue("id", AppointmentId);
|
||||
|
||||
cmd.ExecuteNonQuery();
|
||||
}
|
||||
}
|
||||
}
|
||||
87
AppointmentsManager/AppointmentsLib/Models/Company.cs
Normal file
87
AppointmentsManager/AppointmentsLib/Models/Company.cs
Normal file
@@ -0,0 +1,87 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
using MySqlConnector;
|
||||
|
||||
namespace AppointmentsLib.Models
|
||||
{
|
||||
public class Company
|
||||
{
|
||||
public readonly int CompanyId;
|
||||
public string Label;
|
||||
|
||||
internal Company(int companyId, string label)
|
||||
{
|
||||
CompanyId = companyId;
|
||||
Label = label;
|
||||
}
|
||||
|
||||
public static IEnumerable<Company> GetCompanies()
|
||||
{
|
||||
var reader = Database.Execute("SELECT companyId, label FROM Company;").ExecuteReader();
|
||||
|
||||
List<Company> companies = new();
|
||||
|
||||
while (reader.Read())
|
||||
{
|
||||
companies.Add(new Company(reader.GetInt32(0), reader.GetString(1)));
|
||||
}
|
||||
|
||||
reader.Close();
|
||||
return companies;
|
||||
}
|
||||
|
||||
public static Company GetCompanyById(int companyId)
|
||||
{
|
||||
var cmd = Database.Execute($"SELECT companyId, label FROM Company WHERE companyId = @id;");
|
||||
|
||||
cmd.Parameters.AddWithValue("id", companyId);
|
||||
|
||||
var reader = cmd.ExecuteReader();
|
||||
|
||||
while (reader.Read())
|
||||
{
|
||||
var company = new Company(reader.GetInt32(0), reader.GetString(1));
|
||||
reader.Close();
|
||||
return company;
|
||||
}
|
||||
|
||||
throw new Exception("company does not exist");
|
||||
}
|
||||
|
||||
public static Company Create(string label)
|
||||
{
|
||||
var cmd = Database.Execute($"INSERT INTO Company (label) VALUES (@label)");
|
||||
|
||||
cmd.Parameters.AddWithValue("label", label);
|
||||
|
||||
cmd.ExecuteNonQuery();
|
||||
|
||||
int companyId = (int)cmd.LastInsertedId;
|
||||
|
||||
return new Company(companyId, label);
|
||||
}
|
||||
|
||||
public void Save()
|
||||
{
|
||||
var cmd = Database.Execute("UPDATE Company SET label = @label WHERE companyId = @companyId");
|
||||
|
||||
cmd.Parameters.AddWithValue("label", Label);
|
||||
cmd.Parameters.AddWithValue("companyId", CompanyId);
|
||||
|
||||
cmd.ExecuteNonQuery();
|
||||
}
|
||||
|
||||
public void Delete()
|
||||
{
|
||||
var cmd = Database.Execute("DELETE FROM Company WHERE companyId = @companyId");
|
||||
|
||||
cmd.Parameters.AddWithValue("companyId", CompanyId);
|
||||
|
||||
cmd.ExecuteNonQuery();
|
||||
}
|
||||
}
|
||||
}
|
||||
134
AppointmentsManager/AppointmentsLib/Models/Contact.cs
Normal file
134
AppointmentsManager/AppointmentsLib/Models/Contact.cs
Normal file
@@ -0,0 +1,134 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace AppointmentsLib.Models
|
||||
{
|
||||
public class Contact
|
||||
{
|
||||
private static string primaryKey = "contactId";
|
||||
private static List<string> fields = new()
|
||||
{
|
||||
"salutationId",
|
||||
"firstname",
|
||||
"surname",
|
||||
"street",
|
||||
"postalId",
|
||||
"phone",
|
||||
"phoneTypeId",
|
||||
"mobil",
|
||||
"companyId",
|
||||
"department"
|
||||
};
|
||||
|
||||
public readonly int ContactId;
|
||||
public Salutation Salutation;
|
||||
public string FirstName;
|
||||
public string LastName;
|
||||
public string Street;
|
||||
public Postal Postal;
|
||||
public string Phone;
|
||||
public PhoneType PhoneType;
|
||||
public string Mobil;
|
||||
public Company Company;
|
||||
public string Department;
|
||||
|
||||
internal Contact(int contactId, int salutationId, string firstName, string lastName, string street, int postalId, string phone, int phoneTypeId, string mobil, int companyId, string department)
|
||||
{
|
||||
ContactId = contactId;
|
||||
FirstName = firstName;
|
||||
LastName = lastName;
|
||||
Street = street;
|
||||
Phone = phone;
|
||||
Mobil = mobil;
|
||||
Department = department;
|
||||
|
||||
Company = Company.GetCompanyById(companyId);
|
||||
}
|
||||
|
||||
public static IEnumerable<Contact> GetContacts()
|
||||
{
|
||||
var reader = Database.Execute($"SELECT {primaryKey}, {string.Join(", ", fields.ToArray())} FROM Contact;").ExecuteReader();
|
||||
|
||||
List<Contact> contacts = new();
|
||||
|
||||
while (reader.Read())
|
||||
{
|
||||
contacts.Add(new Contact(reader.GetInt32(0), reader.GetInt32(1), reader.GetString(2), reader.GetString(3), reader.GetString(4), reader.GetInt32(4), reader.GetString(5), reader.GetInt32(6), reader.GetString(7), reader.GetInt32(8), reader.GetString(9)));
|
||||
}
|
||||
|
||||
reader.Close();
|
||||
return contacts;
|
||||
}
|
||||
|
||||
public static Contact GetContactById(int contactId)
|
||||
{
|
||||
var cmd = Database.Execute($"SELECT {primaryKey}, {string.Join(", ", fields.ToArray())} FROM Contact WHERE {primaryKey} = @id;");
|
||||
|
||||
cmd.Parameters.AddWithValue("id", contactId);
|
||||
|
||||
var reader = cmd.ExecuteReader();
|
||||
|
||||
while (reader.Read())
|
||||
{
|
||||
var contact = new Contact(reader.GetInt32(0), reader.GetInt32(1), reader.GetString(2), reader.GetString(3), reader.GetString(4), reader.GetInt32(4), reader.GetString(5), reader.GetInt32(6), reader.GetString(7), reader.GetInt32(8), reader.GetString(9));
|
||||
reader.Close();
|
||||
return contact;
|
||||
}
|
||||
|
||||
throw new Exception("contact does not exist");
|
||||
}
|
||||
|
||||
public static Contact Create(int salutationId, string firstName, string lastName, string street, int postalId, string phone, int phoneTypeId, string mobil, int companyId, string department)
|
||||
{
|
||||
var cmd = Database.Execute($"INSERT INTO Contact ({string.Join(", ", fields.ToArray())}) VALUES ({string.Join(", ", fields.Select(delegate(string name) { return $"@{name}"; }).ToArray())})");
|
||||
|
||||
cmd.Parameters.AddWithValue("salutationId", salutationId);
|
||||
cmd.Parameters.AddWithValue("firstname", firstName);
|
||||
cmd.Parameters.AddWithValue("surname", lastName);
|
||||
cmd.Parameters.AddWithValue("street", street);
|
||||
cmd.Parameters.AddWithValue("postalId", postalId);
|
||||
cmd.Parameters.AddWithValue("phone", phone);
|
||||
cmd.Parameters.AddWithValue("phoneTypeId", phoneTypeId);
|
||||
cmd.Parameters.AddWithValue("mobil", mobil);
|
||||
cmd.Parameters.AddWithValue("companyId", companyId);
|
||||
cmd.Parameters.AddWithValue("department", department);
|
||||
|
||||
cmd.ExecuteNonQuery();
|
||||
|
||||
int contactId = (int)cmd.LastInsertedId;
|
||||
|
||||
return new Contact(contactId, salutationId, firstName, lastName, street, postalId, phone, phoneTypeId, mobil, companyId, department);
|
||||
}
|
||||
|
||||
public void Save()
|
||||
{
|
||||
var cmd = Database.Execute($"UPDATE Company SET {string.Join(", ", fields.Select(delegate(string name) { return $"@{name}"; }).ToArray())} WHERE {primaryKey} = @id");
|
||||
|
||||
cmd.Parameters.AddWithValue("id", ContactId);
|
||||
cmd.Parameters.AddWithValue("salutationId", Salutation.SalutationId); // Salutation.salutationId
|
||||
cmd.Parameters.AddWithValue("firstname", FirstName);
|
||||
cmd.Parameters.AddWithValue("surname", LastName);
|
||||
cmd.Parameters.AddWithValue("street", Street);
|
||||
cmd.Parameters.AddWithValue("postalId", Postal.PostalId); // Postal.postalId
|
||||
cmd.Parameters.AddWithValue("phone", Phone);
|
||||
cmd.Parameters.AddWithValue("phoneTypeId", PhoneType.PhoneTypeId); // PhoneType.phoneTypeId
|
||||
cmd.Parameters.AddWithValue("mobil", Mobil);
|
||||
cmd.Parameters.AddWithValue("companyId", Company.CompanyId);
|
||||
cmd.Parameters.AddWithValue("department", Department);
|
||||
|
||||
cmd.ExecuteNonQuery();
|
||||
}
|
||||
|
||||
public void Delete()
|
||||
{
|
||||
var cmd = Database.Execute($"DELETE FROM Contact WHERE {primaryKey} = @id");
|
||||
|
||||
cmd.Parameters.AddWithValue("id", ContactId);
|
||||
|
||||
cmd.ExecuteNonQuery();
|
||||
}
|
||||
}
|
||||
}
|
||||
85
AppointmentsManager/AppointmentsLib/Models/PhoneType.cs
Normal file
85
AppointmentsManager/AppointmentsLib/Models/PhoneType.cs
Normal file
@@ -0,0 +1,85 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace AppointmentsLib.Models
|
||||
{
|
||||
public class PhoneType
|
||||
{
|
||||
public readonly int PhoneTypeId;
|
||||
public string Label;
|
||||
|
||||
internal PhoneType(int phoneTypeId, string label)
|
||||
{
|
||||
PhoneTypeId = phoneTypeId;
|
||||
Label = label;
|
||||
}
|
||||
|
||||
public static IEnumerable<PhoneType> GetPhoneTypes()
|
||||
{
|
||||
var reader = Database.Execute("SELECT phoneTypeId, label FROM PhoneType;").ExecuteReader();
|
||||
|
||||
List<PhoneType> phoneTypes = new();
|
||||
|
||||
while (reader.Read())
|
||||
{
|
||||
phoneTypes.Add(new PhoneType(reader.GetInt32(0), reader.GetString(1)));
|
||||
}
|
||||
|
||||
reader.Close();
|
||||
return phoneTypes;
|
||||
}
|
||||
|
||||
public static PhoneType GetPhoneTypeById(int companyId)
|
||||
{
|
||||
var cmd = Database.Execute($"SELECT phoneTypeId, label FROM PhoneType WHERE phoneTypeId = @id;");
|
||||
|
||||
cmd.Parameters.AddWithValue("id", companyId);
|
||||
|
||||
var reader = cmd.ExecuteReader();
|
||||
|
||||
while (reader.Read())
|
||||
{
|
||||
var phoneType = new PhoneType(reader.GetInt32(0), reader.GetString(1));
|
||||
reader.Close();
|
||||
return phoneType;
|
||||
}
|
||||
|
||||
throw new Exception("phonetype does not exist");
|
||||
}
|
||||
|
||||
public static PhoneType Create(string label)
|
||||
{
|
||||
var cmd = Database.Execute($"INSERT INTO PhoneType (label) VALUES (@label)");
|
||||
|
||||
cmd.Parameters.AddWithValue("label", label);
|
||||
|
||||
cmd.ExecuteNonQuery();
|
||||
|
||||
int phoneTypeId = (int)cmd.LastInsertedId;
|
||||
|
||||
return new PhoneType(phoneTypeId, label);
|
||||
}
|
||||
|
||||
public void Save()
|
||||
{
|
||||
var cmd = Database.Execute("UPDATE PhoneType SET label = @label WHERE phoneTypeId = @id");
|
||||
|
||||
cmd.Parameters.AddWithValue("label", Label);
|
||||
cmd.Parameters.AddWithValue("id", PhoneTypeId);
|
||||
|
||||
cmd.ExecuteNonQuery();
|
||||
}
|
||||
|
||||
public void Delete()
|
||||
{
|
||||
var cmd = Database.Execute("DELETE FROM PhoneType WHERE phoneTypeId = @id");
|
||||
|
||||
cmd.Parameters.AddWithValue("id", PhoneTypeId);
|
||||
|
||||
cmd.ExecuteNonQuery();
|
||||
}
|
||||
}
|
||||
}
|
||||
85
AppointmentsManager/AppointmentsLib/Models/Postal.cs
Normal file
85
AppointmentsManager/AppointmentsLib/Models/Postal.cs
Normal file
@@ -0,0 +1,85 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace AppointmentsLib.Models
|
||||
{
|
||||
public class Postal
|
||||
{
|
||||
public readonly int PostalId;
|
||||
public string Label;
|
||||
|
||||
internal Postal(int postalId, string label)
|
||||
{
|
||||
PostalId = postalId;
|
||||
Label = label;
|
||||
}
|
||||
|
||||
public static IEnumerable<Postal> GetPostals()
|
||||
{
|
||||
var reader = Database.Execute("SELECT postalId, label FROM Postal;").ExecuteReader();
|
||||
|
||||
List<Postal> postals = new();
|
||||
|
||||
while (reader.Read())
|
||||
{
|
||||
postals.Add(new Postal(reader.GetInt32(0), reader.GetString(1)));
|
||||
}
|
||||
|
||||
reader.Close();
|
||||
return postals;
|
||||
}
|
||||
|
||||
public static Postal GetPostalById(int postalId)
|
||||
{
|
||||
var cmd = Database.Execute($"SELECT postalId, label FROM Postal WHERE postalId = @id;");
|
||||
|
||||
cmd.Parameters.AddWithValue("id", postalId);
|
||||
|
||||
var reader = cmd.ExecuteReader();
|
||||
|
||||
while (reader.Read())
|
||||
{
|
||||
var postal = new Postal(reader.GetInt32(0), reader.GetString(1));
|
||||
reader.Close();
|
||||
return postal;
|
||||
}
|
||||
|
||||
throw new Exception("postal does not exist");
|
||||
}
|
||||
|
||||
public static Postal Create(string label)
|
||||
{
|
||||
var cmd = Database.Execute($"INSERT INTO Postal (label) VALUES (@label)");
|
||||
|
||||
cmd.Parameters.AddWithValue("label", label);
|
||||
|
||||
cmd.ExecuteNonQuery();
|
||||
|
||||
int postalId = (int)cmd.LastInsertedId;
|
||||
|
||||
return new Postal(postalId, label);
|
||||
}
|
||||
|
||||
public void Save()
|
||||
{
|
||||
var cmd = Database.Execute("UPDATE Postal SET label = @label WHERE postalId = @id");
|
||||
|
||||
cmd.Parameters.AddWithValue("label", Label);
|
||||
cmd.Parameters.AddWithValue("id", PostalId);
|
||||
|
||||
cmd.ExecuteNonQuery();
|
||||
}
|
||||
|
||||
public void Delete()
|
||||
{
|
||||
var cmd = Database.Execute("DELETE FROM Postal WHERE postalId = @id");
|
||||
|
||||
cmd.Parameters.AddWithValue("id", PostalId);
|
||||
|
||||
cmd.ExecuteNonQuery();
|
||||
}
|
||||
}
|
||||
}
|
||||
85
AppointmentsManager/AppointmentsLib/Models/Salutation.cs
Normal file
85
AppointmentsManager/AppointmentsLib/Models/Salutation.cs
Normal file
@@ -0,0 +1,85 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace AppointmentsLib.Models
|
||||
{
|
||||
public class Salutation
|
||||
{
|
||||
public readonly int SalutationId;
|
||||
public string Label;
|
||||
|
||||
internal Salutation(int salutationId, string label)
|
||||
{
|
||||
SalutationId = salutationId;
|
||||
Label = label;
|
||||
}
|
||||
|
||||
public static IEnumerable<Salutation> GetSalutations()
|
||||
{
|
||||
var reader = Database.Execute("SELECT salutationId, label FROM Salutation;").ExecuteReader();
|
||||
|
||||
List<Salutation> salutations = new();
|
||||
|
||||
while (reader.Read())
|
||||
{
|
||||
salutations.Add(new Salutation(reader.GetInt32(0), reader.GetString(1)));
|
||||
}
|
||||
|
||||
reader.Close();
|
||||
return salutations;
|
||||
}
|
||||
|
||||
public static Salutation GetSalutationById(int salutationId)
|
||||
{
|
||||
var cmd = Database.Execute($"SELECT salutationId, label FROM Salutation WHERE salutationId = @id;");
|
||||
|
||||
cmd.Parameters.AddWithValue("id", salutationId);
|
||||
|
||||
var reader = cmd.ExecuteReader();
|
||||
|
||||
while (reader.Read())
|
||||
{
|
||||
var salutation = new Salutation(reader.GetInt32(0), reader.GetString(1));
|
||||
reader.Close();
|
||||
return salutation;
|
||||
}
|
||||
|
||||
throw new Exception("salutation does not exist");
|
||||
}
|
||||
|
||||
public static Salutation Create(string label)
|
||||
{
|
||||
var cmd = Database.Execute($"INSERT INTO Salutation (label) VALUES (@label)");
|
||||
|
||||
cmd.Parameters.AddWithValue("label", label);
|
||||
|
||||
cmd.ExecuteNonQuery();
|
||||
|
||||
int salutationId = (int)cmd.LastInsertedId;
|
||||
|
||||
return new Salutation(salutationId, label);
|
||||
}
|
||||
|
||||
public void Save()
|
||||
{
|
||||
var cmd = Database.Execute("UPDATE Salutation SET label = @label WHERE salutationId = @id");
|
||||
|
||||
cmd.Parameters.AddWithValue("label", Label);
|
||||
cmd.Parameters.AddWithValue("id", SalutationId);
|
||||
|
||||
cmd.ExecuteNonQuery();
|
||||
}
|
||||
|
||||
public void Delete()
|
||||
{
|
||||
var cmd = Database.Execute("DELETE FROM Salutation WHERE salutationId = @id");
|
||||
|
||||
cmd.Parameters.AddWithValue("id", SalutationId);
|
||||
|
||||
cmd.ExecuteNonQuery();
|
||||
}
|
||||
}
|
||||
}
|
||||
12
AppointmentsManager/AppointmentsLib/Test.cs
Normal file
12
AppointmentsManager/AppointmentsLib/Test.cs
Normal file
@@ -0,0 +1,12 @@
|
||||
using System;
|
||||
|
||||
namespace AppointmentsLib
|
||||
{
|
||||
public class Test
|
||||
{
|
||||
public static int TestFunction()
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
31
AppointmentsManager/AppointmentsManager.sln
Normal file
31
AppointmentsManager/AppointmentsManager.sln
Normal file
@@ -0,0 +1,31 @@
|
||||
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio Version 16
|
||||
VisualStudioVersion = 16.0.32413.511
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AppointmentsUi", "AppointmentsUi\AppointmentsUi.csproj", "{7C572F8A-D342-4741-9021-C849546F1F72}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AppointmentsLib", "AppointmentsLib\AppointmentsLib.csproj", "{4763CEC7-B805-4699-B635-481112F2E2BC}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
Release|Any CPU = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{7C572F8A-D342-4741-9021-C849546F1F72}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{7C572F8A-D342-4741-9021-C849546F1F72}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{7C572F8A-D342-4741-9021-C849546F1F72}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{7C572F8A-D342-4741-9021-C849546F1F72}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{4763CEC7-B805-4699-B635-481112F2E2BC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{4763CEC7-B805-4699-B635-481112F2E2BC}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{4763CEC7-B805-4699-B635-481112F2E2BC}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{4763CEC7-B805-4699-B635-481112F2E2BC}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||
SolutionGuid = {2E10E48F-FBF3-4049-9CBA-F5F10D7F3992}
|
||||
EndGlobalSection
|
||||
EndGlobal
|
||||
29
AppointmentsManager/AppointmentsUi/AppointmentsUi.csproj
Normal file
29
AppointmentsManager/AppointmentsUi/AppointmentsUi.csproj
Normal file
@@ -0,0 +1,29 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<OutputType>WinExe</OutputType>
|
||||
<TargetFramework>net5.0-windows</TargetFramework>
|
||||
<Nullable>enable</Nullable>
|
||||
<UseWindowsForms>true</UseWindowsForms>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\AppointmentsLib\AppointmentsLib.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Compile Update="Properties\Resources.Designer.cs">
|
||||
<DesignTime>True</DesignTime>
|
||||
<AutoGen>True</AutoGen>
|
||||
<DependentUpon>Resources.resx</DependentUpon>
|
||||
</Compile>
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<EmbeddedResource Update="Properties\Resources.resx">
|
||||
<Generator>ResXFileCodeGenerator</Generator>
|
||||
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
|
||||
</EmbeddedResource>
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
230
AppointmentsManager/AppointmentsUi/MainForm.Designer.cs
generated
Normal file
230
AppointmentsManager/AppointmentsUi/MainForm.Designer.cs
generated
Normal file
@@ -0,0 +1,230 @@
|
||||
|
||||
namespace AppointmentsUi
|
||||
{
|
||||
partial class MainForm
|
||||
{
|
||||
/// <summary>
|
||||
/// Required designer variable.
|
||||
/// </summary>
|
||||
private System.ComponentModel.IContainer components = null;
|
||||
|
||||
/// <summary>
|
||||
/// Clean up any resources being used.
|
||||
/// </summary>
|
||||
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing && (components != null))
|
||||
{
|
||||
components.Dispose();
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
#region Windows Form Designer generated code
|
||||
|
||||
/// <summary>
|
||||
/// Required method for Designer support - do not modify
|
||||
/// the contents of this method with the code editor.
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(MainForm));
|
||||
this.toolstrip = new System.Windows.Forms.ToolStrip();
|
||||
this.tooltipAppointsmentsButton = new System.Windows.Forms.ToolStripSplitButton();
|
||||
this.toolstripAppointsmentsAddNewButton = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.toolstripContactsButton = new System.Windows.Forms.ToolStripSplitButton();
|
||||
this.toolstripContactsAddNewButton = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.toolstripCompaniesButton = new System.Windows.Forms.ToolStripSplitButton();
|
||||
this.toolstripCompaniesAddNewButton = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.toolStripSplitButton1 = new System.Windows.Forms.ToolStripSplitButton();
|
||||
this.toolStripMenuItem1 = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.toolstripSalutationsButton = new System.Windows.Forms.ToolStripSplitButton();
|
||||
this.toolstripSalutationsAddNewButton = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.toolstripPostalsButton = new System.Windows.Forms.ToolStripSplitButton();
|
||||
this.toolstripPostalsAddNewButton = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.toolstripAboutButton = new System.Windows.Forms.ToolStripButton();
|
||||
this.embeddingContainer = new System.Windows.Forms.Panel();
|
||||
this.toolstrip.SuspendLayout();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// toolstrip
|
||||
//
|
||||
this.toolstrip.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
||||
this.tooltipAppointsmentsButton,
|
||||
this.toolstripContactsButton,
|
||||
this.toolstripCompaniesButton,
|
||||
this.toolStripSplitButton1,
|
||||
this.toolstripSalutationsButton,
|
||||
this.toolstripPostalsButton,
|
||||
this.toolstripAboutButton});
|
||||
this.toolstrip.Location = new System.Drawing.Point(0, 0);
|
||||
this.toolstrip.Name = "toolstrip";
|
||||
this.toolstrip.Size = new System.Drawing.Size(800, 25);
|
||||
this.toolstrip.TabIndex = 0;
|
||||
this.toolstrip.Text = "toolstrip";
|
||||
//
|
||||
// tooltipAppointsmentsButton
|
||||
//
|
||||
this.tooltipAppointsmentsButton.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Text;
|
||||
this.tooltipAppointsmentsButton.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
||||
this.toolstripAppointsmentsAddNewButton});
|
||||
this.tooltipAppointsmentsButton.Image = ((System.Drawing.Image)(resources.GetObject("tooltipAppointsmentsButton.Image")));
|
||||
this.tooltipAppointsmentsButton.ImageTransparentColor = System.Drawing.Color.Magenta;
|
||||
this.tooltipAppointsmentsButton.Name = "tooltipAppointsmentsButton";
|
||||
this.tooltipAppointsmentsButton.Size = new System.Drawing.Size(99, 22);
|
||||
this.tooltipAppointsmentsButton.Text = "Appointments";
|
||||
this.tooltipAppointsmentsButton.ButtonClick += new System.EventHandler(this.tooltipAppointsmentsButton_ButtonClick);
|
||||
//
|
||||
// toolstripAppointsmentsAddNewButton
|
||||
//
|
||||
this.toolstripAppointsmentsAddNewButton.Name = "toolstripAppointsmentsAddNewButton";
|
||||
this.toolstripAppointsmentsAddNewButton.Size = new System.Drawing.Size(121, 22);
|
||||
this.toolstripAppointsmentsAddNewButton.Text = "Add new";
|
||||
this.toolstripAppointsmentsAddNewButton.Click += new System.EventHandler(this.toolstripAppointsmentsAddNewButton_Click);
|
||||
//
|
||||
// toolstripContactsButton
|
||||
//
|
||||
this.toolstripContactsButton.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Text;
|
||||
this.toolstripContactsButton.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
||||
this.toolstripContactsAddNewButton});
|
||||
this.toolstripContactsButton.Image = ((System.Drawing.Image)(resources.GetObject("toolstripContactsButton.Image")));
|
||||
this.toolstripContactsButton.ImageTransparentColor = System.Drawing.Color.Magenta;
|
||||
this.toolstripContactsButton.Name = "toolstripContactsButton";
|
||||
this.toolstripContactsButton.Size = new System.Drawing.Size(70, 22);
|
||||
this.toolstripContactsButton.Text = "Contacts";
|
||||
this.toolstripContactsButton.ButtonClick += new System.EventHandler(this.toolstripContactsButton_ButtonClick);
|
||||
//
|
||||
// toolstripContactsAddNewButton
|
||||
//
|
||||
this.toolstripContactsAddNewButton.Name = "toolstripContactsAddNewButton";
|
||||
this.toolstripContactsAddNewButton.Size = new System.Drawing.Size(121, 22);
|
||||
this.toolstripContactsAddNewButton.Text = "Add new";
|
||||
this.toolstripContactsAddNewButton.Click += new System.EventHandler(this.toolstripContactsAddNewButton_Click);
|
||||
//
|
||||
// toolstripCompaniesButton
|
||||
//
|
||||
this.toolstripCompaniesButton.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Text;
|
||||
this.toolstripCompaniesButton.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
||||
this.toolstripCompaniesAddNewButton});
|
||||
this.toolstripCompaniesButton.Image = ((System.Drawing.Image)(resources.GetObject("toolstripCompaniesButton.Image")));
|
||||
this.toolstripCompaniesButton.ImageTransparentColor = System.Drawing.Color.Magenta;
|
||||
this.toolstripCompaniesButton.Name = "toolstripCompaniesButton";
|
||||
this.toolstripCompaniesButton.Size = new System.Drawing.Size(83, 22);
|
||||
this.toolstripCompaniesButton.Text = "Companies";
|
||||
this.toolstripCompaniesButton.ButtonClick += new System.EventHandler(this.toolstripCompaniesButton_ButtonClick);
|
||||
//
|
||||
// toolstripCompaniesAddNewButton
|
||||
//
|
||||
this.toolstripCompaniesAddNewButton.Name = "toolstripCompaniesAddNewButton";
|
||||
this.toolstripCompaniesAddNewButton.Size = new System.Drawing.Size(180, 22);
|
||||
this.toolstripCompaniesAddNewButton.Text = "Add new";
|
||||
//
|
||||
// toolStripSplitButton1
|
||||
//
|
||||
this.toolStripSplitButton1.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Text;
|
||||
this.toolStripSplitButton1.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
||||
this.toolStripMenuItem1});
|
||||
this.toolStripSplitButton1.Image = ((System.Drawing.Image)(resources.GetObject("toolStripSplitButton1.Image")));
|
||||
this.toolStripSplitButton1.ImageTransparentColor = System.Drawing.Color.Magenta;
|
||||
this.toolStripSplitButton1.Name = "toolStripSplitButton1";
|
||||
this.toolStripSplitButton1.Size = new System.Drawing.Size(86, 22);
|
||||
this.toolStripSplitButton1.Text = "PhoneTypes";
|
||||
//
|
||||
// toolStripMenuItem1
|
||||
//
|
||||
this.toolStripMenuItem1.Name = "toolStripMenuItem1";
|
||||
this.toolStripMenuItem1.Size = new System.Drawing.Size(121, 22);
|
||||
this.toolStripMenuItem1.Text = "Add new";
|
||||
//
|
||||
// toolstripSalutationsButton
|
||||
//
|
||||
this.toolstripSalutationsButton.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Text;
|
||||
this.toolstripSalutationsButton.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
||||
this.toolstripSalutationsAddNewButton});
|
||||
this.toolstripSalutationsButton.Image = ((System.Drawing.Image)(resources.GetObject("toolstripSalutationsButton.Image")));
|
||||
this.toolstripSalutationsButton.ImageTransparentColor = System.Drawing.Color.Magenta;
|
||||
this.toolstripSalutationsButton.Name = "toolstripSalutationsButton";
|
||||
this.toolstripSalutationsButton.Size = new System.Drawing.Size(81, 22);
|
||||
this.toolstripSalutationsButton.Text = "Salutations";
|
||||
//
|
||||
// toolstripSalutationsAddNewButton
|
||||
//
|
||||
this.toolstripSalutationsAddNewButton.Name = "toolstripSalutationsAddNewButton";
|
||||
this.toolstripSalutationsAddNewButton.Size = new System.Drawing.Size(121, 22);
|
||||
this.toolstripSalutationsAddNewButton.Text = "Add new";
|
||||
//
|
||||
// toolstripPostalsButton
|
||||
//
|
||||
this.toolstripPostalsButton.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Text;
|
||||
this.toolstripPostalsButton.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
||||
this.toolstripPostalsAddNewButton});
|
||||
this.toolstripPostalsButton.Image = ((System.Drawing.Image)(resources.GetObject("toolstripPostalsButton.Image")));
|
||||
this.toolstripPostalsButton.ImageTransparentColor = System.Drawing.Color.Magenta;
|
||||
this.toolstripPostalsButton.Name = "toolstripPostalsButton";
|
||||
this.toolstripPostalsButton.Size = new System.Drawing.Size(60, 22);
|
||||
this.toolstripPostalsButton.Text = "Postals";
|
||||
//
|
||||
// toolstripPostalsAddNewButton
|
||||
//
|
||||
this.toolstripPostalsAddNewButton.Name = "toolstripPostalsAddNewButton";
|
||||
this.toolstripPostalsAddNewButton.Size = new System.Drawing.Size(121, 22);
|
||||
this.toolstripPostalsAddNewButton.Text = "Add new";
|
||||
//
|
||||
// toolstripAboutButton
|
||||
//
|
||||
this.toolstripAboutButton.Alignment = System.Windows.Forms.ToolStripItemAlignment.Right;
|
||||
this.toolstripAboutButton.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Text;
|
||||
this.toolstripAboutButton.Image = ((System.Drawing.Image)(resources.GetObject("toolstripAboutButton.Image")));
|
||||
this.toolstripAboutButton.ImageTransparentColor = System.Drawing.Color.Magenta;
|
||||
this.toolstripAboutButton.Name = "toolstripAboutButton";
|
||||
this.toolstripAboutButton.Size = new System.Drawing.Size(44, 22);
|
||||
this.toolstripAboutButton.Text = "About";
|
||||
this.toolstripAboutButton.Click += new System.EventHandler(this.toolstripAboutButton_Click);
|
||||
//
|
||||
// embeddingContainer
|
||||
//
|
||||
this.embeddingContainer.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
|
||||
| System.Windows.Forms.AnchorStyles.Left)
|
||||
| System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.embeddingContainer.BackColor = System.Drawing.SystemColors.Control;
|
||||
this.embeddingContainer.Location = new System.Drawing.Point(12, 28);
|
||||
this.embeddingContainer.Name = "embeddingContainer";
|
||||
this.embeddingContainer.Size = new System.Drawing.Size(776, 410);
|
||||
this.embeddingContainer.TabIndex = 1;
|
||||
//
|
||||
// MainForm
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.ClientSize = new System.Drawing.Size(800, 450);
|
||||
this.Controls.Add(this.embeddingContainer);
|
||||
this.Controls.Add(this.toolstrip);
|
||||
this.Name = "MainForm";
|
||||
this.Text = "AppointmentsUi";
|
||||
this.toolstrip.ResumeLayout(false);
|
||||
this.toolstrip.PerformLayout();
|
||||
this.ResumeLayout(false);
|
||||
this.PerformLayout();
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private System.Windows.Forms.ToolStrip toolstrip;
|
||||
private System.Windows.Forms.ToolStripSplitButton tooltipAppointsmentsButton;
|
||||
private System.Windows.Forms.ToolStripMenuItem toolstripAppointsmentsAddNewButton;
|
||||
private System.Windows.Forms.ToolStripSplitButton toolstripContactsButton;
|
||||
private System.Windows.Forms.ToolStripMenuItem toolstripContactsAddNewButton;
|
||||
private System.Windows.Forms.ToolStripSplitButton toolstripCompaniesButton;
|
||||
private System.Windows.Forms.ToolStripMenuItem toolstripCompaniesAddNewButton;
|
||||
private System.Windows.Forms.ToolStripSplitButton toolStripSplitButton1;
|
||||
private System.Windows.Forms.ToolStripMenuItem toolStripMenuItem1;
|
||||
private System.Windows.Forms.ToolStripSplitButton toolstripSalutationsButton;
|
||||
private System.Windows.Forms.ToolStripMenuItem toolstripSalutationsAddNewButton;
|
||||
private System.Windows.Forms.ToolStripSplitButton toolstripPostalsButton;
|
||||
private System.Windows.Forms.ToolStripMenuItem toolstripPostalsAddNewButton;
|
||||
private System.Windows.Forms.ToolStripButton toolstripAboutButton;
|
||||
private System.Windows.Forms.Panel embeddingContainer;
|
||||
}
|
||||
}
|
||||
60
AppointmentsManager/AppointmentsUi/MainForm.cs
Normal file
60
AppointmentsManager/AppointmentsUi/MainForm.cs
Normal file
@@ -0,0 +1,60 @@
|
||||
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 AppointmentsUi
|
||||
{
|
||||
public partial class MainForm : Form
|
||||
{
|
||||
public MainForm()
|
||||
{
|
||||
InitializeComponent();
|
||||
|
||||
EmbedForm<Views.EmptyPage>();
|
||||
}
|
||||
|
||||
internal void EmbedForm<T>() where T : Form, new()
|
||||
{
|
||||
T embedded = new T() { TopLevel = false, TopMost = true, FormBorderStyle = FormBorderStyle.None, Dock = DockStyle.Fill, AutoSize = false, Parent = this };
|
||||
embeddingContainer.Controls.Clear();
|
||||
embeddingContainer.Controls.Add(embedded);
|
||||
embedded.Show();
|
||||
}
|
||||
|
||||
private void toolstripAboutButton_Click(object sender, EventArgs e)
|
||||
{
|
||||
MessageBox.Show("vewry guud program mehd by finno");
|
||||
}
|
||||
|
||||
private void tooltipAppointsmentsButton_ButtonClick(object sender, EventArgs e)
|
||||
{
|
||||
MessageBox.Show("appointments button click");
|
||||
}
|
||||
|
||||
private void toolstripAppointsmentsAddNewButton_Click(object sender, EventArgs e)
|
||||
{
|
||||
MessageBox.Show("appointments add button click");
|
||||
}
|
||||
|
||||
private void toolstripContactsButton_ButtonClick(object sender, EventArgs e)
|
||||
{
|
||||
MessageBox.Show("contacts button click");
|
||||
}
|
||||
|
||||
private void toolstripContactsAddNewButton_Click(object sender, EventArgs e)
|
||||
{
|
||||
MessageBox.Show("contacts add button click");
|
||||
}
|
||||
|
||||
private void toolstripCompaniesButton_ButtonClick(object sender, EventArgs e)
|
||||
{
|
||||
EmbedForm<Views.CompanyList>();
|
||||
}
|
||||
}
|
||||
}
|
||||
127
AppointmentsManager/AppointmentsUi/MainForm.resx
Normal file
127
AppointmentsManager/AppointmentsUi/MainForm.resx
Normal file
@@ -0,0 +1,127 @@
|
||||
<root>
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<metadata name="toolstrip.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>17, 17</value>
|
||||
</metadata>
|
||||
<assembly alias="System.Drawing" name="System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
|
||||
<data name="tooltipAppointsmentsButton.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>
|
||||
iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8
|
||||
YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAACRSURBVDhPY/j27dt/SjDYACcnJ7IwigEf3n8kCZNswPNb
|
||||
J/+f6DYF0yA+yQac6Db5f6hWCmwIiE+mC0wIu2DS2Vf/F1x6DefjwlgNyNr34r/0wkdgTMgQDAOQNRNj
|
||||
CIoBOg0rMTTDMLIhIHbriZeYBmDTiIxBGkEYxge5liQDsGGQqykyAISpZwAlmIEywMAAAAc1/Jwvt6sN
|
||||
AAAAAElFTkSuQmCC
|
||||
</value>
|
||||
</data>
|
||||
<data name="toolstripContactsButton.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>
|
||||
iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8
|
||||
YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAACRSURBVDhPY/j27dt/SjDYACcnJ7IwigEf3n8kCZNswPNb
|
||||
J/+f6DYF0yA+yQac6Db5f6hWCmwIiE+mC0wIu2DS2Vf/F1x6DefjwlgNyNr34r/0wkdgTMgQDAOQNRNj
|
||||
CIoBOg0rMTTDMLIhIHbriZeYBmDTiIxBGkEYxge5liQDsGGQqykyAISpZwAlmIEywMAAAAc1/Jwvt6sN
|
||||
AAAAAElFTkSuQmCC
|
||||
</value>
|
||||
</data>
|
||||
<data name="toolstripCompaniesButton.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>
|
||||
iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8
|
||||
YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAACRSURBVDhPY/j27dt/SjDYACcnJ7IwigEf3n8kCZNswPNb
|
||||
J/+f6DYF0yA+yQac6Db5f6hWCmwIiE+mC0wIu2DS2Vf/F1x6DefjwlgNyNr34r/0wkdgTMgQDAOQNRNj
|
||||
CIoBOg0rMTTDMLIhIHbriZeYBmDTiIxBGkEYxge5liQDsGGQqykyAISpZwAlmIEywMAAAAc1/Jwvt6sN
|
||||
AAAAAElFTkSuQmCC
|
||||
</value>
|
||||
</data>
|
||||
<data name="toolStripSplitButton1.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>
|
||||
iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8
|
||||
YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAACRSURBVDhPY/j27dt/SjDYACcnJ7IwigEf3n8kCZNswPNb
|
||||
J/+f6DYF0yA+yQac6Db5f6hWCmwIiE+mC0wIu2DS2Vf/F1x6DefjwlgNyNr34r/0wkdgTMgQDAOQNRNj
|
||||
CIoBOg0rMTTDMLIhIHbriZeYBmDTiIxBGkEYxge5liQDsGGQqykyAISpZwAlmIEywMAAAAc1/Jwvt6sN
|
||||
AAAAAElFTkSuQmCC
|
||||
</value>
|
||||
</data>
|
||||
<data name="toolstripSalutationsButton.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>
|
||||
iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8
|
||||
YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAACRSURBVDhPY/j27dt/SjDYACcnJ7IwigEf3n8kCZNswPNb
|
||||
J/+f6DYF0yA+yQac6Db5f6hWCmwIiE+mC0wIu2DS2Vf/F1x6DefjwlgNyNr34r/0wkdgTMgQDAOQNRNj
|
||||
CIoBOg0rMTTDMLIhIHbriZeYBmDTiIxBGkEYxge5liQDsGGQqykyAISpZwAlmIEywMAAAAc1/Jwvt6sN
|
||||
AAAAAElFTkSuQmCC
|
||||
</value>
|
||||
</data>
|
||||
<data name="toolstripPostalsButton.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>
|
||||
iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8
|
||||
YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAACRSURBVDhPY/j27dt/SjDYACcnJ7IwigEf3n8kCZNswPNb
|
||||
J/+f6DYF0yA+yQac6Db5f6hWCmwIiE+mC0wIu2DS2Vf/F1x6DefjwlgNyNr34r/0wkdgTMgQDAOQNRNj
|
||||
CIoBOg0rMTTDMLIhIHbriZeYBmDTiIxBGkEYxge5liQDsGGQqykyAISpZwAlmIEywMAAAAc1/Jwvt6sN
|
||||
AAAAAElFTkSuQmCC
|
||||
</value>
|
||||
</data>
|
||||
<data name="toolstripAboutButton.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>
|
||||
iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8
|
||||
YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAACRSURBVDhPY/j27dt/SjDYACcnJ7IwigEf3n8kCZNswPNb
|
||||
J/+f6DYF0yA+yQac6Db5f6hWCmwIiE+mC0wIu2DS2Vf/F1x6DefjwlgNyNr34r/0wkdgTMgQDAOQNRNj
|
||||
CIoBOg0rMTTDMLIhIHbriZeYBmDTiIxBGkEYxge5liQDsGGQqykyAISpZwAlmIEywMAAAAc1/Jwvt6sN
|
||||
AAAAAElFTkSuQmCC
|
||||
</value>
|
||||
</data>
|
||||
</root>
|
||||
39
AppointmentsManager/AppointmentsUi/Program.cs
Normal file
39
AppointmentsManager/AppointmentsUi/Program.cs
Normal file
@@ -0,0 +1,39 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace AppointmentsUi
|
||||
{
|
||||
static class Program
|
||||
{
|
||||
public static MainForm mainForm = new();
|
||||
|
||||
/// <summary>
|
||||
/// The main entry point for the application.
|
||||
/// </summary>
|
||||
[STAThread]
|
||||
static void Main()
|
||||
{
|
||||
|
||||
Application.SetHighDpiMode(HighDpiMode.SystemAware);
|
||||
Application.EnableVisualStyles();
|
||||
Application.SetCompatibleTextRenderingDefault(false);
|
||||
|
||||
bool dbConnectionSuccessful = AppointmentsLib.Database.Connect("docker01.solidstage.icu", 3306, "school", "school", "aaa");
|
||||
|
||||
if(!dbConnectionSuccessful)
|
||||
{
|
||||
MessageBox.Show("Database connection failed, exiting...");
|
||||
|
||||
return;
|
||||
} else
|
||||
{
|
||||
//MessageBox.Show("Database connected successfully");
|
||||
}
|
||||
|
||||
Application.Run(mainForm);
|
||||
}
|
||||
}
|
||||
}
|
||||
63
AppointmentsManager/AppointmentsUi/Properties/Resources.Designer.cs
generated
Normal file
63
AppointmentsManager/AppointmentsUi/Properties/Resources.Designer.cs
generated
Normal file
@@ -0,0 +1,63 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// This code was generated by a tool.
|
||||
// Runtime Version:4.0.30319.42000
|
||||
//
|
||||
// Changes to this file may cause incorrect behavior and will be lost if
|
||||
// the code is regenerated.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace AppointmentsUi.Properties {
|
||||
using System;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// A strongly-typed resource class, for looking up localized strings, etc.
|
||||
/// </summary>
|
||||
// This class was auto-generated by the StronglyTypedResourceBuilder
|
||||
// class via a tool like ResGen or Visual Studio.
|
||||
// To add or remove a member, edit your .ResX file then rerun ResGen
|
||||
// with the /str option, or rebuild your VS project.
|
||||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "16.0.0.0")]
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
|
||||
internal class Resources {
|
||||
|
||||
private static global::System.Resources.ResourceManager resourceMan;
|
||||
|
||||
private static global::System.Globalization.CultureInfo resourceCulture;
|
||||
|
||||
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
|
||||
internal Resources() {
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns the cached ResourceManager instance used by this class.
|
||||
/// </summary>
|
||||
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
|
||||
internal static global::System.Resources.ResourceManager ResourceManager {
|
||||
get {
|
||||
if (object.ReferenceEquals(resourceMan, null)) {
|
||||
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("AppointmentsUi.Properties.Resources", typeof(Resources).Assembly);
|
||||
resourceMan = temp;
|
||||
}
|
||||
return resourceMan;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Overrides the current thread's CurrentUICulture property for all
|
||||
/// resource lookups using this strongly typed resource class.
|
||||
/// </summary>
|
||||
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
|
||||
internal static global::System.Globalization.CultureInfo Culture {
|
||||
get {
|
||||
return resourceCulture;
|
||||
}
|
||||
set {
|
||||
resourceCulture = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
120
AppointmentsManager/AppointmentsUi/Properties/Resources.resx
Normal file
120
AppointmentsManager/AppointmentsUi/Properties/Resources.resx
Normal file
@@ -0,0 +1,120 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
</root>
|
||||
93
AppointmentsManager/AppointmentsUi/Views/CompanyList.Designer.cs
generated
Normal file
93
AppointmentsManager/AppointmentsUi/Views/CompanyList.Designer.cs
generated
Normal file
@@ -0,0 +1,93 @@
|
||||
|
||||
namespace AppointmentsUi.Views
|
||||
{
|
||||
partial class CompanyList
|
||||
{
|
||||
/// <summary>
|
||||
/// Required designer variable.
|
||||
/// </summary>
|
||||
private System.ComponentModel.IContainer components = null;
|
||||
|
||||
/// <summary>
|
||||
/// Clean up any resources being used.
|
||||
/// </summary>
|
||||
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing && (components != null))
|
||||
{
|
||||
components.Dispose();
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
#region Windows Form Designer generated code
|
||||
|
||||
/// <summary>
|
||||
/// Required method for Designer support - do not modify
|
||||
/// the contents of this method with the code editor.
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
this.tableLayoutPanelCompanies = new System.Windows.Forms.TableLayoutPanel();
|
||||
this.labelCompaniesHeader = new System.Windows.Forms.Label();
|
||||
this.buttonAddNewCompany = new System.Windows.Forms.Button();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// tableLayoutPanelCompanies
|
||||
//
|
||||
this.tableLayoutPanelCompanies.BackColor = System.Drawing.SystemColors.ControlDark;
|
||||
this.tableLayoutPanelCompanies.ColumnCount = 4;
|
||||
this.tableLayoutPanelCompanies.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle());
|
||||
this.tableLayoutPanelCompanies.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle());
|
||||
this.tableLayoutPanelCompanies.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle());
|
||||
this.tableLayoutPanelCompanies.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle());
|
||||
this.tableLayoutPanelCompanies.Location = new System.Drawing.Point(-1, 29);
|
||||
this.tableLayoutPanelCompanies.Name = "tableLayoutPanelCompanies";
|
||||
this.tableLayoutPanelCompanies.RowCount = 1;
|
||||
this.tableLayoutPanelCompanies.RowStyles.Add(new System.Windows.Forms.RowStyle());
|
||||
this.tableLayoutPanelCompanies.Size = new System.Drawing.Size(802, 423);
|
||||
this.tableLayoutPanelCompanies.TabIndex = 0;
|
||||
//
|
||||
// labelCompaniesHeader
|
||||
//
|
||||
this.labelCompaniesHeader.AutoSize = true;
|
||||
this.labelCompaniesHeader.Location = new System.Drawing.Point(-1, 4);
|
||||
this.labelCompaniesHeader.Name = "labelCompaniesHeader";
|
||||
this.labelCompaniesHeader.Size = new System.Drawing.Size(67, 15);
|
||||
this.labelCompaniesHeader.TabIndex = 1;
|
||||
this.labelCompaniesHeader.Text = "Companies";
|
||||
//
|
||||
// buttonAddNewCompany
|
||||
//
|
||||
this.buttonAddNewCompany.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.buttonAddNewCompany.Location = new System.Drawing.Point(725, 0);
|
||||
this.buttonAddNewCompany.Name = "buttonAddNewCompany";
|
||||
this.buttonAddNewCompany.Size = new System.Drawing.Size(75, 23);
|
||||
this.buttonAddNewCompany.TabIndex = 2;
|
||||
this.buttonAddNewCompany.Text = "Add new";
|
||||
this.buttonAddNewCompany.UseVisualStyleBackColor = true;
|
||||
this.buttonAddNewCompany.Click += new System.EventHandler(this.buttonAddNewCompany_Click);
|
||||
//
|
||||
// CompanyList
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.ClientSize = new System.Drawing.Size(800, 450);
|
||||
this.Controls.Add(this.buttonAddNewCompany);
|
||||
this.Controls.Add(this.labelCompaniesHeader);
|
||||
this.Controls.Add(this.tableLayoutPanelCompanies);
|
||||
this.Name = "CompanyList";
|
||||
this.Text = "CompanyList";
|
||||
this.ResumeLayout(false);
|
||||
this.PerformLayout();
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private System.Windows.Forms.TableLayoutPanel tableLayoutPanelCompanies;
|
||||
private System.Windows.Forms.Label labelCompaniesHeader;
|
||||
private System.Windows.Forms.Button buttonAddNewCompany;
|
||||
}
|
||||
}
|
||||
59
AppointmentsManager/AppointmentsUi/Views/CompanyList.cs
Normal file
59
AppointmentsManager/AppointmentsUi/Views/CompanyList.cs
Normal file
@@ -0,0 +1,59 @@
|
||||
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 AppointmentsUi.Views
|
||||
{
|
||||
public partial class CompanyList : Form
|
||||
{
|
||||
public CompanyList()
|
||||
{
|
||||
InitializeComponent();
|
||||
|
||||
var companies = AppointmentsLib.Models.Company.GetCompanies();
|
||||
|
||||
for(int i = 0; i < companies.Count(); i++)
|
||||
{
|
||||
var company = companies.ElementAt(i);
|
||||
|
||||
var labelCompanyId = new Label() { Text = company.CompanyId.ToString(), AutoSize = true, TextAlign = ContentAlignment.MiddleCenter };
|
||||
var textboxCompanyName = new TextBox() { Text = company.Label, AutoSize = true };
|
||||
var buttonApplyChanges = new Button() { Text = "Apply" };
|
||||
var buttonDelete = new Button() { Text = "Delete" };
|
||||
|
||||
buttonApplyChanges.Click += new EventHandler(delegate (object sender, EventArgs e) {
|
||||
company.Save();
|
||||
Program.mainForm.EmbedForm<CompanyList>();
|
||||
});
|
||||
buttonDelete.Click += new EventHandler(delegate (object sender, EventArgs e) {
|
||||
var res = MessageBox.Show($"Are you sure to delete the company\n{company.Label}\n?", "Delete company?", MessageBoxButtons.YesNo);
|
||||
if (res == DialogResult.Yes)
|
||||
{
|
||||
company.Delete();
|
||||
Program.mainForm.EmbedForm<CompanyList>();
|
||||
}
|
||||
});
|
||||
textboxCompanyName.TextChanged += new EventHandler(delegate (object sender, EventArgs e) {
|
||||
company.Label = textboxCompanyName.Text;
|
||||
});
|
||||
|
||||
tableLayoutPanelCompanies.Controls.Add(labelCompanyId, 0, 1 + i);
|
||||
tableLayoutPanelCompanies.Controls.Add(textboxCompanyName, 1, 1 + i);
|
||||
tableLayoutPanelCompanies.Controls.Add(buttonApplyChanges, 2, 1 + i);
|
||||
tableLayoutPanelCompanies.Controls.Add(buttonDelete, 3, 1 + i);
|
||||
}
|
||||
}
|
||||
|
||||
private void buttonAddNewCompany_Click(object sender, EventArgs e)
|
||||
{
|
||||
AppointmentsLib.Models.Company.Create("New company");
|
||||
Program.mainForm.EmbedForm<CompanyList>();
|
||||
}
|
||||
}
|
||||
}
|
||||
60
AppointmentsManager/AppointmentsUi/Views/CompanyList.resx
Normal file
60
AppointmentsManager/AppointmentsUi/Views/CompanyList.resx
Normal file
@@ -0,0 +1,60 @@
|
||||
<root>
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
</root>
|
||||
61
AppointmentsManager/AppointmentsUi/Views/EmptyPage.Designer.cs
generated
Normal file
61
AppointmentsManager/AppointmentsUi/Views/EmptyPage.Designer.cs
generated
Normal file
@@ -0,0 +1,61 @@
|
||||
|
||||
namespace AppointmentsUi.Views
|
||||
{
|
||||
partial class EmptyPage
|
||||
{
|
||||
/// <summary>
|
||||
/// Required designer variable.
|
||||
/// </summary>
|
||||
private System.ComponentModel.IContainer components = null;
|
||||
|
||||
/// <summary>
|
||||
/// Clean up any resources being used.
|
||||
/// </summary>
|
||||
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing && (components != null))
|
||||
{
|
||||
components.Dispose();
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
#region Windows Form Designer generated code
|
||||
|
||||
/// <summary>
|
||||
/// Required method for Designer support - do not modify
|
||||
/// the contents of this method with the code editor.
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
this.noPageSelectedLabel = new System.Windows.Forms.Label();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// noPageSelectedLabel
|
||||
//
|
||||
this.noPageSelectedLabel.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.noPageSelectedLabel.Location = new System.Drawing.Point(0, 0);
|
||||
this.noPageSelectedLabel.Name = "noPageSelectedLabel";
|
||||
this.noPageSelectedLabel.Size = new System.Drawing.Size(800, 450);
|
||||
this.noPageSelectedLabel.TabIndex = 0;
|
||||
this.noPageSelectedLabel.Text = "No Page selected...";
|
||||
this.noPageSelectedLabel.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
|
||||
//
|
||||
// EmptyPage
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.ClientSize = new System.Drawing.Size(800, 450);
|
||||
this.Controls.Add(this.noPageSelectedLabel);
|
||||
this.Name = "EmptyPage";
|
||||
this.Text = "EmptyPage";
|
||||
this.ResumeLayout(false);
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private System.Windows.Forms.Label noPageSelectedLabel;
|
||||
}
|
||||
}
|
||||
20
AppointmentsManager/AppointmentsUi/Views/EmptyPage.cs
Normal file
20
AppointmentsManager/AppointmentsUi/Views/EmptyPage.cs
Normal file
@@ -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 AppointmentsUi.Views
|
||||
{
|
||||
public partial class EmptyPage : Form
|
||||
{
|
||||
public EmptyPage()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
}
|
||||
}
|
||||
60
AppointmentsManager/AppointmentsUi/Views/EmptyPage.resx
Normal file
60
AppointmentsManager/AppointmentsUi/Views/EmptyPage.resx
Normal file
@@ -0,0 +1,60 @@
|
||||
<root>
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
</root>
|
||||
Reference in New Issue
Block a user