Compare commits
7 Commits
cf1a23341a
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
| a3b41bd0cc | |||
| 95c7fd25ee | |||
| 17a4c4edb0 | |||
| 3af79affe4 | |||
| 96f7ed0c27 | |||
| e57145483b | |||
| 3b65c4b8cc |
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
120
AppointmentsManager/AppointmentsLib/Models/Appointment.cs
Normal file
120
AppointmentsManager/AppointmentsLib/Models/Appointment.cs
Normal file
@@ -0,0 +1,120 @@
|
||||
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<AppointmentData> data = new();
|
||||
List<Appointment> appointments = new();
|
||||
|
||||
while (reader.Read())
|
||||
{
|
||||
data.Add(new AppointmentData()
|
||||
{
|
||||
AppointmentId = reader.GetInt32(0),
|
||||
ContactId = reader.GetInt32(1),
|
||||
Time = reader.GetString(2),
|
||||
Description = reader.GetString(3)
|
||||
});
|
||||
}
|
||||
|
||||
reader.Close();
|
||||
|
||||
foreach (AppointmentData ad in data)
|
||||
{
|
||||
appointments.Add(ad.Finalize());
|
||||
}
|
||||
|
||||
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();
|
||||
}
|
||||
}
|
||||
|
||||
internal class AppointmentData
|
||||
{
|
||||
public int AppointmentId;
|
||||
public int ContactId;
|
||||
public string Time;
|
||||
public string Description;
|
||||
|
||||
public Appointment Finalize()
|
||||
{
|
||||
return new Appointment(AppointmentId, ContactId, Time.ToString(), Description);
|
||||
}
|
||||
}
|
||||
}
|
||||
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();
|
||||
}
|
||||
}
|
||||
}
|
||||
189
AppointmentsManager/AppointmentsLib/Models/Contact.cs
Normal file
189
AppointmentsManager/AppointmentsLib/Models/Contact.cs
Normal file
@@ -0,0 +1,189 @@
|
||||
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<ContactData> data = new();
|
||||
List<Contact> contacts = new();
|
||||
|
||||
while(reader.Read())
|
||||
{
|
||||
data.Add(new ContactData()
|
||||
{
|
||||
ContactId = reader.GetInt32(0),
|
||||
SalutationId = reader.GetInt32(1),
|
||||
FirstName = reader.GetString(2),
|
||||
LastName = reader.GetString(3),
|
||||
Street = reader.GetString(4),
|
||||
PostalId = reader.GetInt32(5),
|
||||
Phone = reader.GetString(6),
|
||||
PhoneTypeId = reader.GetInt32(7),
|
||||
Mobil = reader.GetString(8),
|
||||
CompanyId = reader.GetInt32(9),
|
||||
Department = reader.GetString(10)
|
||||
});
|
||||
}
|
||||
|
||||
reader.Close();
|
||||
|
||||
foreach (ContactData cd in data)
|
||||
{
|
||||
contacts.Add(cd.Finalize());
|
||||
}
|
||||
|
||||
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 data = new ContactData()
|
||||
{
|
||||
ContactId = reader.GetInt32(0),
|
||||
SalutationId = reader.GetInt32(1),
|
||||
FirstName = reader.GetString(2),
|
||||
LastName = reader.GetString(3),
|
||||
Street = reader.GetString(4),
|
||||
PostalId = reader.GetInt32(5),
|
||||
Phone = reader.GetString(6),
|
||||
PhoneTypeId = reader.GetInt32(7),
|
||||
Mobil = reader.GetString(8),
|
||||
CompanyId = reader.GetInt32(9),
|
||||
Department = reader.GetString(10)
|
||||
};
|
||||
|
||||
reader.Close();
|
||||
|
||||
return data.Finalize();
|
||||
}
|
||||
|
||||
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();
|
||||
}
|
||||
}
|
||||
|
||||
internal class ContactData
|
||||
{
|
||||
public int ContactId;
|
||||
public int SalutationId;
|
||||
public string FirstName;
|
||||
public string LastName;
|
||||
public string Street;
|
||||
public int PostalId;
|
||||
public string Phone;
|
||||
public int PhoneTypeId;
|
||||
public string Mobil;
|
||||
public int CompanyId;
|
||||
public string Department;
|
||||
|
||||
public Contact Finalize()
|
||||
{
|
||||
return new Contact(ContactId, SalutationId, FirstName, LastName, Street, PostalId, Phone, PhoneTypeId, Mobil, CompanyId, Department);
|
||||
}
|
||||
}
|
||||
}
|
||||
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>
|
||||
237
AppointmentsManager/AppointmentsUi/MainForm.Designer.cs
generated
Normal file
237
AppointmentsManager/AppointmentsUi/MainForm.Designer.cs
generated
Normal file
@@ -0,0 +1,237 @@
|
||||
|
||||
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(121, 22);
|
||||
this.toolstripCompaniesAddNewButton.Text = "Add new";
|
||||
this.toolstripCompaniesAddNewButton.Click += new System.EventHandler(this.toolstripCompaniesAddNewButton_Click);
|
||||
//
|
||||
// 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";
|
||||
this.toolStripSplitButton1.ButtonClick += new System.EventHandler(this.toolStripSplitButton1_ButtonClick);
|
||||
//
|
||||
// toolStripMenuItem1
|
||||
//
|
||||
this.toolStripMenuItem1.Name = "toolStripMenuItem1";
|
||||
this.toolStripMenuItem1.Size = new System.Drawing.Size(121, 22);
|
||||
this.toolStripMenuItem1.Text = "Add new";
|
||||
this.toolStripMenuItem1.Click += new System.EventHandler(this.toolStripMenuItem1_Click);
|
||||
//
|
||||
// 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";
|
||||
this.toolstripSalutationsButton.ButtonClick += new System.EventHandler(this.toolstripSalutationsButton_ButtonClick);
|
||||
//
|
||||
// toolstripSalutationsAddNewButton
|
||||
//
|
||||
this.toolstripSalutationsAddNewButton.Name = "toolstripSalutationsAddNewButton";
|
||||
this.toolstripSalutationsAddNewButton.Size = new System.Drawing.Size(180, 22);
|
||||
this.toolstripSalutationsAddNewButton.Text = "Add new";
|
||||
this.toolstripSalutationsAddNewButton.Click += new System.EventHandler(this.toolstripSalutationsAddNewButton_Click);
|
||||
//
|
||||
// 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";
|
||||
this.toolstripPostalsButton.ButtonClick += new System.EventHandler(this.toolstripPostalsButton_ButtonClick);
|
||||
//
|
||||
// toolstripPostalsAddNewButton
|
||||
//
|
||||
this.toolstripPostalsAddNewButton.Name = "toolstripPostalsAddNewButton";
|
||||
this.toolstripPostalsAddNewButton.Size = new System.Drawing.Size(180, 22);
|
||||
this.toolstripPostalsAddNewButton.Text = "Add new";
|
||||
this.toolstripPostalsAddNewButton.Click += new System.EventHandler(this.toolstripPostalsAddNewButton_Click);
|
||||
//
|
||||
// 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;
|
||||
}
|
||||
}
|
||||
97
AppointmentsManager/AppointmentsUi/MainForm.cs
Normal file
97
AppointmentsManager/AppointmentsUi/MainForm.cs
Normal file
@@ -0,0 +1,97 @@
|
||||
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 T 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();
|
||||
|
||||
return embedded;
|
||||
}
|
||||
|
||||
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)
|
||||
{
|
||||
EmbedForm<Views.ContactsList>();
|
||||
}
|
||||
|
||||
private void toolstripContactsAddNewButton_Click(object sender, EventArgs e)
|
||||
{
|
||||
EmbedForm<Views.ContactsList>().addContact();
|
||||
}
|
||||
|
||||
private void toolstripCompaniesButton_ButtonClick(object sender, EventArgs e)
|
||||
{
|
||||
EmbedForm<Views.CompanyList>();
|
||||
}
|
||||
|
||||
private void toolstripCompaniesAddNewButton_Click(object sender, EventArgs e)
|
||||
{
|
||||
EmbedForm<Views.CompanyList>().addCompany();
|
||||
}
|
||||
|
||||
private void toolStripSplitButton1_ButtonClick(object sender, EventArgs e)
|
||||
{
|
||||
EmbedForm<Views.PhoneTypesList>();
|
||||
}
|
||||
|
||||
private void toolStripMenuItem1_Click(object sender, EventArgs e)
|
||||
{
|
||||
EmbedForm<Views.PhoneTypesList>().addPhoneType();
|
||||
}
|
||||
|
||||
private void toolstripSalutationsButton_ButtonClick(object sender, EventArgs e)
|
||||
{
|
||||
EmbedForm<Views.SalutationsList>();
|
||||
}
|
||||
|
||||
private void toolstripSalutationsAddNewButton_Click(object sender, EventArgs e)
|
||||
{
|
||||
EmbedForm<Views.SalutationsList>().addSalutation();
|
||||
}
|
||||
|
||||
private void toolstripPostalsButton_ButtonClick(object sender, EventArgs e)
|
||||
{
|
||||
EmbedForm<Views.PostalsList>();
|
||||
}
|
||||
|
||||
private void toolstripPostalsAddNewButton_Click(object sender, EventArgs e)
|
||||
{
|
||||
EmbedForm<Views.PostalsList>().addPostal();
|
||||
}
|
||||
}
|
||||
}
|
||||
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>
|
||||
96
AppointmentsManager/AppointmentsUi/Views/CompanyList.Designer.cs
generated
Normal file
96
AppointmentsManager/AppointmentsUi/Views/CompanyList.Designer.cs
generated
Normal file
@@ -0,0 +1,96 @@
|
||||
|
||||
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.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.tableLayoutPanelCompanies.BackColor = System.Drawing.SystemColors.Control;
|
||||
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;
|
||||
}
|
||||
}
|
||||
64
AppointmentsManager/AppointmentsUi/Views/CompanyList.cs
Normal file
64
AppointmentsManager/AppointmentsUi/Views/CompanyList.cs
Normal file
@@ -0,0 +1,64 @@
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
internal void addCompany()
|
||||
{
|
||||
AppointmentsLib.Models.Company.Create("New company");
|
||||
Program.mainForm.EmbedForm<CompanyList>();
|
||||
}
|
||||
|
||||
private void buttonAddNewCompany_Click(object sender, EventArgs e)
|
||||
{
|
||||
addCompany();
|
||||
}
|
||||
}
|
||||
}
|
||||
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>
|
||||
299
AppointmentsManager/AppointmentsUi/Views/ContactView.Designer.cs
generated
Normal file
299
AppointmentsManager/AppointmentsUi/Views/ContactView.Designer.cs
generated
Normal file
@@ -0,0 +1,299 @@
|
||||
namespace AppointmentsUi.Views
|
||||
{
|
||||
partial class ContactView
|
||||
{
|
||||
/// <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.buttonApplyCreate = new System.Windows.Forms.Button();
|
||||
this.buttonDelete = new System.Windows.Forms.Button();
|
||||
this.labelFirstName = new System.Windows.Forms.Label();
|
||||
this.textBoxFirstName = new System.Windows.Forms.TextBox();
|
||||
this.textBoxLastName = new System.Windows.Forms.TextBox();
|
||||
this.labelLastName = new System.Windows.Forms.Label();
|
||||
this.textBoxStreet = new System.Windows.Forms.TextBox();
|
||||
this.labelStreet = new System.Windows.Forms.Label();
|
||||
this.textBoxDepartment = new System.Windows.Forms.TextBox();
|
||||
this.labelDepartment = new System.Windows.Forms.Label();
|
||||
this.textBoxMobil = new System.Windows.Forms.TextBox();
|
||||
this.labelMobil = new System.Windows.Forms.Label();
|
||||
this.textBoxPhone = new System.Windows.Forms.TextBox();
|
||||
this.labelPhone = new System.Windows.Forms.Label();
|
||||
this.labelSalutation = new System.Windows.Forms.Label();
|
||||
this.comboBoxSalutation = new System.Windows.Forms.ComboBox();
|
||||
this.comboBoxPostal = new System.Windows.Forms.ComboBox();
|
||||
this.labelPostal = new System.Windows.Forms.Label();
|
||||
this.comboBoxPhoneType = new System.Windows.Forms.ComboBox();
|
||||
this.labelPhoneType = new System.Windows.Forms.Label();
|
||||
this.comboBoxCompany = new System.Windows.Forms.ComboBox();
|
||||
this.labelCompany = new System.Windows.Forms.Label();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// buttonApplyCreate
|
||||
//
|
||||
this.buttonApplyCreate.Location = new System.Drawing.Point(12, 314);
|
||||
this.buttonApplyCreate.Name = "buttonApplyCreate";
|
||||
this.buttonApplyCreate.Size = new System.Drawing.Size(164, 23);
|
||||
this.buttonApplyCreate.TabIndex = 0;
|
||||
this.buttonApplyCreate.Text = "Apply";
|
||||
this.buttonApplyCreate.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// buttonDelete
|
||||
//
|
||||
this.buttonDelete.Location = new System.Drawing.Point(190, 314);
|
||||
this.buttonDelete.Name = "buttonDelete";
|
||||
this.buttonDelete.Size = new System.Drawing.Size(164, 23);
|
||||
this.buttonDelete.TabIndex = 1;
|
||||
this.buttonDelete.Text = "Delete";
|
||||
this.buttonDelete.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// labelFirstName
|
||||
//
|
||||
this.labelFirstName.AutoSize = true;
|
||||
this.labelFirstName.Location = new System.Drawing.Point(12, 44);
|
||||
this.labelFirstName.Name = "labelFirstName";
|
||||
this.labelFirstName.Size = new System.Drawing.Size(62, 15);
|
||||
this.labelFirstName.TabIndex = 2;
|
||||
this.labelFirstName.Text = "First name";
|
||||
//
|
||||
// textBoxFirstName
|
||||
//
|
||||
this.textBoxFirstName.Location = new System.Drawing.Point(142, 41);
|
||||
this.textBoxFirstName.Name = "textBoxFirstName";
|
||||
this.textBoxFirstName.Size = new System.Drawing.Size(212, 23);
|
||||
this.textBoxFirstName.TabIndex = 3;
|
||||
//
|
||||
// textBoxLastName
|
||||
//
|
||||
this.textBoxLastName.Location = new System.Drawing.Point(142, 70);
|
||||
this.textBoxLastName.Name = "textBoxLastName";
|
||||
this.textBoxLastName.Size = new System.Drawing.Size(212, 23);
|
||||
this.textBoxLastName.TabIndex = 5;
|
||||
//
|
||||
// labelLastName
|
||||
//
|
||||
this.labelLastName.AutoSize = true;
|
||||
this.labelLastName.Location = new System.Drawing.Point(12, 73);
|
||||
this.labelLastName.Name = "labelLastName";
|
||||
this.labelLastName.Size = new System.Drawing.Size(61, 15);
|
||||
this.labelLastName.TabIndex = 4;
|
||||
this.labelLastName.Text = "Last name";
|
||||
//
|
||||
// textBoxStreet
|
||||
//
|
||||
this.textBoxStreet.Location = new System.Drawing.Point(142, 99);
|
||||
this.textBoxStreet.Name = "textBoxStreet";
|
||||
this.textBoxStreet.Size = new System.Drawing.Size(212, 23);
|
||||
this.textBoxStreet.TabIndex = 7;
|
||||
//
|
||||
// labelStreet
|
||||
//
|
||||
this.labelStreet.AutoSize = true;
|
||||
this.labelStreet.Location = new System.Drawing.Point(12, 102);
|
||||
this.labelStreet.Name = "labelStreet";
|
||||
this.labelStreet.Size = new System.Drawing.Size(37, 15);
|
||||
this.labelStreet.TabIndex = 6;
|
||||
this.labelStreet.Text = "Street";
|
||||
//
|
||||
// textBoxDepartment
|
||||
//
|
||||
this.textBoxDepartment.Location = new System.Drawing.Point(142, 244);
|
||||
this.textBoxDepartment.Name = "textBoxDepartment";
|
||||
this.textBoxDepartment.Size = new System.Drawing.Size(212, 23);
|
||||
this.textBoxDepartment.TabIndex = 13;
|
||||
//
|
||||
// labelDepartment
|
||||
//
|
||||
this.labelDepartment.AutoSize = true;
|
||||
this.labelDepartment.Location = new System.Drawing.Point(12, 247);
|
||||
this.labelDepartment.Name = "labelDepartment";
|
||||
this.labelDepartment.Size = new System.Drawing.Size(70, 15);
|
||||
this.labelDepartment.TabIndex = 12;
|
||||
this.labelDepartment.Text = "Department";
|
||||
//
|
||||
// textBoxMobil
|
||||
//
|
||||
this.textBoxMobil.Location = new System.Drawing.Point(142, 215);
|
||||
this.textBoxMobil.Name = "textBoxMobil";
|
||||
this.textBoxMobil.Size = new System.Drawing.Size(212, 23);
|
||||
this.textBoxMobil.TabIndex = 11;
|
||||
//
|
||||
// labelMobil
|
||||
//
|
||||
this.labelMobil.AutoSize = true;
|
||||
this.labelMobil.Location = new System.Drawing.Point(12, 218);
|
||||
this.labelMobil.Name = "labelMobil";
|
||||
this.labelMobil.Size = new System.Drawing.Size(38, 15);
|
||||
this.labelMobil.TabIndex = 10;
|
||||
this.labelMobil.Text = "Mobil";
|
||||
//
|
||||
// textBoxPhone
|
||||
//
|
||||
this.textBoxPhone.Location = new System.Drawing.Point(142, 157);
|
||||
this.textBoxPhone.Name = "textBoxPhone";
|
||||
this.textBoxPhone.Size = new System.Drawing.Size(212, 23);
|
||||
this.textBoxPhone.TabIndex = 9;
|
||||
//
|
||||
// labelPhone
|
||||
//
|
||||
this.labelPhone.AutoSize = true;
|
||||
this.labelPhone.Location = new System.Drawing.Point(12, 160);
|
||||
this.labelPhone.Name = "labelPhone";
|
||||
this.labelPhone.Size = new System.Drawing.Size(41, 15);
|
||||
this.labelPhone.TabIndex = 8;
|
||||
this.labelPhone.Text = "Phone";
|
||||
//
|
||||
// labelSalutation
|
||||
//
|
||||
this.labelSalutation.AutoSize = true;
|
||||
this.labelSalutation.Location = new System.Drawing.Point(12, 15);
|
||||
this.labelSalutation.Name = "labelSalutation";
|
||||
this.labelSalutation.Size = new System.Drawing.Size(60, 15);
|
||||
this.labelSalutation.TabIndex = 14;
|
||||
this.labelSalutation.Text = "Salutation";
|
||||
//
|
||||
// comboBoxSalutation
|
||||
//
|
||||
this.comboBoxSalutation.FormattingEnabled = true;
|
||||
this.comboBoxSalutation.Location = new System.Drawing.Point(142, 12);
|
||||
this.comboBoxSalutation.Name = "comboBoxSalutation";
|
||||
this.comboBoxSalutation.Size = new System.Drawing.Size(212, 23);
|
||||
this.comboBoxSalutation.TabIndex = 15;
|
||||
//
|
||||
// comboBoxPostal
|
||||
//
|
||||
this.comboBoxPostal.FormattingEnabled = true;
|
||||
this.comboBoxPostal.Location = new System.Drawing.Point(142, 128);
|
||||
this.comboBoxPostal.Name = "comboBoxPostal";
|
||||
this.comboBoxPostal.Size = new System.Drawing.Size(212, 23);
|
||||
this.comboBoxPostal.TabIndex = 17;
|
||||
//
|
||||
// labelPostal
|
||||
//
|
||||
this.labelPostal.AutoSize = true;
|
||||
this.labelPostal.Location = new System.Drawing.Point(12, 131);
|
||||
this.labelPostal.Name = "labelPostal";
|
||||
this.labelPostal.Size = new System.Drawing.Size(39, 15);
|
||||
this.labelPostal.TabIndex = 16;
|
||||
this.labelPostal.Text = "Postal";
|
||||
//
|
||||
// comboBoxPhoneType
|
||||
//
|
||||
this.comboBoxPhoneType.FormattingEnabled = true;
|
||||
this.comboBoxPhoneType.Location = new System.Drawing.Point(142, 186);
|
||||
this.comboBoxPhoneType.Name = "comboBoxPhoneType";
|
||||
this.comboBoxPhoneType.Size = new System.Drawing.Size(212, 23);
|
||||
this.comboBoxPhoneType.TabIndex = 19;
|
||||
//
|
||||
// labelPhoneType
|
||||
//
|
||||
this.labelPhoneType.AutoSize = true;
|
||||
this.labelPhoneType.Location = new System.Drawing.Point(12, 189);
|
||||
this.labelPhoneType.Name = "labelPhoneType";
|
||||
this.labelPhoneType.Size = new System.Drawing.Size(65, 15);
|
||||
this.labelPhoneType.TabIndex = 18;
|
||||
this.labelPhoneType.Text = "PhoneType";
|
||||
//
|
||||
// comboBoxCompany
|
||||
//
|
||||
this.comboBoxCompany.FormattingEnabled = true;
|
||||
this.comboBoxCompany.Location = new System.Drawing.Point(142, 273);
|
||||
this.comboBoxCompany.Name = "comboBoxCompany";
|
||||
this.comboBoxCompany.Size = new System.Drawing.Size(212, 23);
|
||||
this.comboBoxCompany.TabIndex = 21;
|
||||
//
|
||||
// labelCompany
|
||||
//
|
||||
this.labelCompany.AutoSize = true;
|
||||
this.labelCompany.Location = new System.Drawing.Point(12, 276);
|
||||
this.labelCompany.Name = "labelCompany";
|
||||
this.labelCompany.Size = new System.Drawing.Size(59, 15);
|
||||
this.labelCompany.TabIndex = 20;
|
||||
this.labelCompany.Text = "Company";
|
||||
//
|
||||
// ContactView
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.ClientSize = new System.Drawing.Size(366, 349);
|
||||
this.Controls.Add(this.comboBoxCompany);
|
||||
this.Controls.Add(this.labelCompany);
|
||||
this.Controls.Add(this.comboBoxPhoneType);
|
||||
this.Controls.Add(this.labelPhoneType);
|
||||
this.Controls.Add(this.comboBoxPostal);
|
||||
this.Controls.Add(this.labelPostal);
|
||||
this.Controls.Add(this.comboBoxSalutation);
|
||||
this.Controls.Add(this.labelSalutation);
|
||||
this.Controls.Add(this.textBoxDepartment);
|
||||
this.Controls.Add(this.labelDepartment);
|
||||
this.Controls.Add(this.textBoxMobil);
|
||||
this.Controls.Add(this.labelMobil);
|
||||
this.Controls.Add(this.textBoxPhone);
|
||||
this.Controls.Add(this.labelPhone);
|
||||
this.Controls.Add(this.textBoxStreet);
|
||||
this.Controls.Add(this.labelStreet);
|
||||
this.Controls.Add(this.textBoxLastName);
|
||||
this.Controls.Add(this.labelLastName);
|
||||
this.Controls.Add(this.textBoxFirstName);
|
||||
this.Controls.Add(this.labelFirstName);
|
||||
this.Controls.Add(this.buttonDelete);
|
||||
this.Controls.Add(this.buttonApplyCreate);
|
||||
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
|
||||
this.MaximizeBox = false;
|
||||
this.MinimizeBox = false;
|
||||
this.Name = "ContactView";
|
||||
this.Text = "ContactView";
|
||||
this.ResumeLayout(false);
|
||||
this.PerformLayout();
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private System.Windows.Forms.Button buttonApplyCreate;
|
||||
private System.Windows.Forms.Button buttonDelete;
|
||||
private System.Windows.Forms.Label labelFirstName;
|
||||
private System.Windows.Forms.TextBox textBoxFirstName;
|
||||
private System.Windows.Forms.TextBox textBoxLastName;
|
||||
private System.Windows.Forms.Label labelLastName;
|
||||
private System.Windows.Forms.TextBox textBoxStreet;
|
||||
private System.Windows.Forms.Label labelStreet;
|
||||
private System.Windows.Forms.TextBox textBoxDepartment;
|
||||
private System.Windows.Forms.Label labelDepartment;
|
||||
private System.Windows.Forms.TextBox textBoxMobil;
|
||||
private System.Windows.Forms.Label labelMobil;
|
||||
private System.Windows.Forms.TextBox textBoxPhone;
|
||||
private System.Windows.Forms.Label labelPhone;
|
||||
private System.Windows.Forms.Label labelSalutation;
|
||||
private System.Windows.Forms.ComboBox comboBoxSalutation;
|
||||
private System.Windows.Forms.ComboBox comboBoxPostal;
|
||||
private System.Windows.Forms.Label labelPostal;
|
||||
private System.Windows.Forms.ComboBox comboBoxPhoneType;
|
||||
private System.Windows.Forms.Label labelPhoneType;
|
||||
private System.Windows.Forms.ComboBox comboBoxCompany;
|
||||
private System.Windows.Forms.Label labelCompany;
|
||||
}
|
||||
}
|
||||
96
AppointmentsManager/AppointmentsUi/Views/ContactView.cs
Normal file
96
AppointmentsManager/AppointmentsUi/Views/ContactView.cs
Normal file
@@ -0,0 +1,96 @@
|
||||
using AppointmentsLib.Models;
|
||||
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 ContactView : Form
|
||||
{
|
||||
Contact? contact;
|
||||
|
||||
IEnumerable<Salutation> salutations;
|
||||
IEnumerable<Postal> postals;
|
||||
IEnumerable<PhoneType> phoneTypes;
|
||||
IEnumerable<Company> companies;
|
||||
|
||||
public ContactView(Contact? contact)
|
||||
{
|
||||
InitializeComponent();
|
||||
|
||||
this.contact = contact;
|
||||
|
||||
salutations = Salutation.GetSalutations();
|
||||
postals = Postal.GetPostals();
|
||||
phoneTypes = PhoneType.GetPhoneTypes();
|
||||
companies = Company.GetCompanies();
|
||||
|
||||
comboBoxSalutation.Items.AddRange(salutations.Select(sal => $"{sal.SalutationId}: {sal.Label}").ToArray());
|
||||
comboBoxPostal.Items.AddRange(postals.Select(sal => $"{sal.PostalId}: {sal.Label}").ToArray());
|
||||
comboBoxPhoneType.Items.AddRange(phoneTypes.Select(sal => $"{sal.PhoneTypeId}: {sal.Label}").ToArray());
|
||||
comboBoxCompany.Items.AddRange(companies.Select(sal => $"{sal.CompanyId}: {sal.Label}").ToArray());
|
||||
|
||||
if (contact == null)
|
||||
{
|
||||
// create new contact
|
||||
buttonApplyCreate.Text = "Create";
|
||||
|
||||
buttonApplyCreate.Click += new EventHandler(delegate (object sender, EventArgs e)
|
||||
{
|
||||
var salutationId = Int32.Parse(comboBoxSalutation.SelectedItem.ToString().Split(":").First());
|
||||
var postalId = Int32.Parse(comboBoxPostal.SelectedItem.ToString().Split(":").First());
|
||||
var phoneTypeId = Int32.Parse(comboBoxPhoneType.SelectedItem.ToString().Split(":").First());
|
||||
var companyId = Int32.Parse(comboBoxCompany.SelectedItem.ToString().Split(":").First());
|
||||
|
||||
Contact.Create(salutationId, textBoxFirstName.Text, textBoxLastName.Text, textBoxStreet.Text, postalId, textBoxPhone.Text, phoneTypeId, textBoxMobil.Text, companyId, textBoxDepartment.Text);
|
||||
this.Close();
|
||||
});
|
||||
|
||||
buttonDelete.Enabled = false;
|
||||
} else
|
||||
{
|
||||
textBoxFirstName.Text = contact.FirstName;
|
||||
textBoxLastName.Text = contact.LastName;
|
||||
textBoxStreet.Text = contact.Street;
|
||||
textBoxDepartment.Text = contact.Department;
|
||||
textBoxPhone.Text = contact.Phone;
|
||||
textBoxMobil.Text = contact.Mobil;
|
||||
|
||||
buttonApplyCreate.Click += new EventHandler(delegate (object sender, EventArgs e)
|
||||
{
|
||||
var salutationId = Int32.Parse(comboBoxSalutation.SelectedItem.ToString().Split(":").First());
|
||||
var postalId = Int32.Parse(comboBoxPostal.SelectedItem.ToString().Split(":").First());
|
||||
var phoneTypeId = Int32.Parse(comboBoxPhoneType.SelectedItem.ToString().Split(":").First());
|
||||
var companyId = Int32.Parse(comboBoxCompany.SelectedItem.ToString().Split(":").First());
|
||||
|
||||
contact.FirstName = textBoxFirstName.Text;
|
||||
contact.LastName = textBoxLastName.Text;
|
||||
contact.Street = textBoxStreet.Text;
|
||||
contact.Phone = textBoxPhone.Text;
|
||||
contact.Mobil = textBoxMobil.Text;
|
||||
contact.Department = textBoxDepartment.Text;
|
||||
|
||||
contact.Salutation = Salutation.GetSalutationById(salutationId);
|
||||
contact.Postal = Postal.GetPostalById(postalId);
|
||||
contact.PhoneType = PhoneType.GetPhoneTypeById(phoneTypeId);
|
||||
contact.Company = Company.GetCompanyById(companyId);
|
||||
|
||||
contact.Save();
|
||||
|
||||
this.Close();
|
||||
});
|
||||
|
||||
comboBoxSalutation.SelectedItem = $"{contact.Salutation.SalutationId}: {contact.Salutation.Label}";
|
||||
comboBoxPostal.SelectedItem = $"{contact.Postal.PostalId}: {contact.Postal.Label}";
|
||||
comboBoxPhoneType.SelectedItem = $"{contact.PhoneType.PhoneTypeId}: {contact.PhoneType.Label}";
|
||||
comboBoxCompany.SelectedItem = $"{contact.Company.CompanyId}: {contact.Company.Label}";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
60
AppointmentsManager/AppointmentsUi/Views/ContactView.resx
Normal file
60
AppointmentsManager/AppointmentsUi/Views/ContactView.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>
|
||||
95
AppointmentsManager/AppointmentsUi/Views/ContactsList.Designer.cs
generated
Normal file
95
AppointmentsManager/AppointmentsUi/Views/ContactsList.Designer.cs
generated
Normal file
@@ -0,0 +1,95 @@
|
||||
namespace AppointmentsUi.Views
|
||||
{
|
||||
partial class ContactsList
|
||||
{
|
||||
/// <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.buttonAddNewContact = new System.Windows.Forms.Button();
|
||||
this.labelContactsHeader = new System.Windows.Forms.Label();
|
||||
this.tableLayoutPanelContacts = new System.Windows.Forms.TableLayoutPanel();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// buttonAddNewContact
|
||||
//
|
||||
this.buttonAddNewContact.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.buttonAddNewContact.Location = new System.Drawing.Point(725, -1);
|
||||
this.buttonAddNewContact.Name = "buttonAddNewContact";
|
||||
this.buttonAddNewContact.Size = new System.Drawing.Size(75, 23);
|
||||
this.buttonAddNewContact.TabIndex = 11;
|
||||
this.buttonAddNewContact.Text = "Add new";
|
||||
this.buttonAddNewContact.UseVisualStyleBackColor = true;
|
||||
this.buttonAddNewContact.Click += new System.EventHandler(this.buttonAddNewContact_Click);
|
||||
//
|
||||
// labelContactsHeader
|
||||
//
|
||||
this.labelContactsHeader.AutoSize = true;
|
||||
this.labelContactsHeader.Location = new System.Drawing.Point(-1, 3);
|
||||
this.labelContactsHeader.Name = "labelContactsHeader";
|
||||
this.labelContactsHeader.Size = new System.Drawing.Size(54, 15);
|
||||
this.labelContactsHeader.TabIndex = 10;
|
||||
this.labelContactsHeader.Text = "Contacts";
|
||||
//
|
||||
// tableLayoutPanelContacts
|
||||
//
|
||||
this.tableLayoutPanelContacts.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.tableLayoutPanelContacts.BackColor = System.Drawing.SystemColors.Control;
|
||||
this.tableLayoutPanelContacts.ColumnCount = 4;
|
||||
this.tableLayoutPanelContacts.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle());
|
||||
this.tableLayoutPanelContacts.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle());
|
||||
this.tableLayoutPanelContacts.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle());
|
||||
this.tableLayoutPanelContacts.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle());
|
||||
this.tableLayoutPanelContacts.Location = new System.Drawing.Point(-1, 28);
|
||||
this.tableLayoutPanelContacts.Name = "tableLayoutPanelContacts";
|
||||
this.tableLayoutPanelContacts.RowCount = 1;
|
||||
this.tableLayoutPanelContacts.RowStyles.Add(new System.Windows.Forms.RowStyle());
|
||||
this.tableLayoutPanelContacts.Size = new System.Drawing.Size(802, 423);
|
||||
this.tableLayoutPanelContacts.TabIndex = 9;
|
||||
//
|
||||
// ContactsList
|
||||
//
|
||||
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.buttonAddNewContact);
|
||||
this.Controls.Add(this.labelContactsHeader);
|
||||
this.Controls.Add(this.tableLayoutPanelContacts);
|
||||
this.Name = "ContactsList";
|
||||
this.Text = "ContactsList";
|
||||
this.ResumeLayout(false);
|
||||
this.PerformLayout();
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private System.Windows.Forms.Button buttonAddNewContact;
|
||||
private System.Windows.Forms.Label labelContactsHeader;
|
||||
private System.Windows.Forms.TableLayoutPanel tableLayoutPanelContacts;
|
||||
}
|
||||
}
|
||||
56
AppointmentsManager/AppointmentsUi/Views/ContactsList.cs
Normal file
56
AppointmentsManager/AppointmentsUi/Views/ContactsList.cs
Normal file
@@ -0,0 +1,56 @@
|
||||
using AppointmentsLib.Models;
|
||||
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 ContactsList : Form
|
||||
{
|
||||
public ContactsList()
|
||||
{
|
||||
InitializeComponent();
|
||||
|
||||
var contacts = Contact.GetContacts();
|
||||
|
||||
for (int i = 0; i < contacts.Count(); i++)
|
||||
{
|
||||
var contact = contacts.ElementAt(i);
|
||||
|
||||
var labelId = new Label() { Text = contact.ContactId.ToString(), AutoSize = true, TextAlign = ContentAlignment.MiddleCenter };
|
||||
var labelBriefOverview = new Label() { Text = $"{contact.LastName}, {contact.FirstName}", AutoSize = true };
|
||||
var buttonEdit = new Button() { Text = "View" };
|
||||
|
||||
buttonEdit.Click += new EventHandler(delegate (object sender, EventArgs e) {
|
||||
openAddContactForm(contact);
|
||||
});
|
||||
|
||||
tableLayoutPanelContacts.Controls.Add(labelId, 0, 1 + i);
|
||||
tableLayoutPanelContacts.Controls.Add(labelBriefOverview, 1, 1 + i);
|
||||
tableLayoutPanelContacts.Controls.Add(buttonEdit, 2, 1 + i);
|
||||
}
|
||||
}
|
||||
|
||||
private void openAddContactForm(Contact? contact)
|
||||
{
|
||||
new ContactView(contact).ShowDialog();
|
||||
}
|
||||
|
||||
internal void addContact()
|
||||
{
|
||||
Program.mainForm.EmbedForm<ContactsList>();
|
||||
openAddContactForm(null);
|
||||
}
|
||||
|
||||
private void buttonAddNewContact_Click(object sender, EventArgs e)
|
||||
{
|
||||
openAddContactForm(null);
|
||||
}
|
||||
}
|
||||
}
|
||||
60
AppointmentsManager/AppointmentsUi/Views/ContactsList.resx
Normal file
60
AppointmentsManager/AppointmentsUi/Views/ContactsList.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>
|
||||
95
AppointmentsManager/AppointmentsUi/Views/PhoneTypesList.Designer.cs
generated
Normal file
95
AppointmentsManager/AppointmentsUi/Views/PhoneTypesList.Designer.cs
generated
Normal file
@@ -0,0 +1,95 @@
|
||||
namespace AppointmentsUi.Views
|
||||
{
|
||||
partial class PhoneTypesList
|
||||
{
|
||||
/// <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.buttonAddNewPhoneTypes = new System.Windows.Forms.Button();
|
||||
this.labelPhoneTypesHeader = new System.Windows.Forms.Label();
|
||||
this.tableLayoutPanelPhoneTypes = new System.Windows.Forms.TableLayoutPanel();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// buttonAddNewPhoneTypes
|
||||
//
|
||||
this.buttonAddNewPhoneTypes.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.buttonAddNewPhoneTypes.Location = new System.Drawing.Point(725, -1);
|
||||
this.buttonAddNewPhoneTypes.Name = "buttonAddNewPhoneTypes";
|
||||
this.buttonAddNewPhoneTypes.Size = new System.Drawing.Size(75, 23);
|
||||
this.buttonAddNewPhoneTypes.TabIndex = 5;
|
||||
this.buttonAddNewPhoneTypes.Text = "Add new";
|
||||
this.buttonAddNewPhoneTypes.UseVisualStyleBackColor = true;
|
||||
this.buttonAddNewPhoneTypes.Click += new System.EventHandler(this.buttonAddNewPhoneTypes_Click);
|
||||
//
|
||||
// labelPhoneTypesHeader
|
||||
//
|
||||
this.labelPhoneTypesHeader.AutoSize = true;
|
||||
this.labelPhoneTypesHeader.Location = new System.Drawing.Point(-1, 3);
|
||||
this.labelPhoneTypesHeader.Name = "labelPhoneTypesHeader";
|
||||
this.labelPhoneTypesHeader.Size = new System.Drawing.Size(70, 15);
|
||||
this.labelPhoneTypesHeader.TabIndex = 4;
|
||||
this.labelPhoneTypesHeader.Text = "PhoneTypes";
|
||||
//
|
||||
// tableLayoutPanelPhoneTypes
|
||||
//
|
||||
this.tableLayoutPanelPhoneTypes.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.tableLayoutPanelPhoneTypes.BackColor = System.Drawing.SystemColors.Control;
|
||||
this.tableLayoutPanelPhoneTypes.ColumnCount = 4;
|
||||
this.tableLayoutPanelPhoneTypes.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle());
|
||||
this.tableLayoutPanelPhoneTypes.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle());
|
||||
this.tableLayoutPanelPhoneTypes.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle());
|
||||
this.tableLayoutPanelPhoneTypes.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle());
|
||||
this.tableLayoutPanelPhoneTypes.Location = new System.Drawing.Point(-1, 28);
|
||||
this.tableLayoutPanelPhoneTypes.Name = "tableLayoutPanelPhoneTypes";
|
||||
this.tableLayoutPanelPhoneTypes.RowCount = 1;
|
||||
this.tableLayoutPanelPhoneTypes.RowStyles.Add(new System.Windows.Forms.RowStyle());
|
||||
this.tableLayoutPanelPhoneTypes.Size = new System.Drawing.Size(802, 423);
|
||||
this.tableLayoutPanelPhoneTypes.TabIndex = 3;
|
||||
//
|
||||
// PhoneTypesList
|
||||
//
|
||||
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.buttonAddNewPhoneTypes);
|
||||
this.Controls.Add(this.labelPhoneTypesHeader);
|
||||
this.Controls.Add(this.tableLayoutPanelPhoneTypes);
|
||||
this.Name = "PhoneTypesList";
|
||||
this.Text = "PhoneTypesList";
|
||||
this.ResumeLayout(false);
|
||||
this.PerformLayout();
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private System.Windows.Forms.Button buttonAddNewPhoneTypes;
|
||||
private System.Windows.Forms.Label labelPhoneTypesHeader;
|
||||
private System.Windows.Forms.TableLayoutPanel tableLayoutPanelPhoneTypes;
|
||||
}
|
||||
}
|
||||
64
AppointmentsManager/AppointmentsUi/Views/PhoneTypesList.cs
Normal file
64
AppointmentsManager/AppointmentsUi/Views/PhoneTypesList.cs
Normal file
@@ -0,0 +1,64 @@
|
||||
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 PhoneTypesList : Form
|
||||
{
|
||||
public PhoneTypesList()
|
||||
{
|
||||
InitializeComponent();
|
||||
|
||||
var phoneTypes = AppointmentsLib.Models.PhoneType.GetPhoneTypes();
|
||||
|
||||
for (int i = 0; i < phoneTypes.Count(); i++)
|
||||
{
|
||||
var phoneType = phoneTypes.ElementAt(i);
|
||||
|
||||
var labelPhoneTypeId = new Label() { Text = phoneType.PhoneTypeId.ToString(), AutoSize = true, TextAlign = ContentAlignment.MiddleCenter };
|
||||
var textboxPhoneTypeName = new TextBox() { Text = phoneType.Label, AutoSize = true };
|
||||
var buttonApplyChanges = new Button() { Text = "Apply" };
|
||||
var buttonDelete = new Button() { Text = "Delete" };
|
||||
|
||||
buttonApplyChanges.Click += new EventHandler(delegate (object sender, EventArgs e) {
|
||||
phoneType.Save();
|
||||
Program.mainForm.EmbedForm<PhoneTypesList>();
|
||||
});
|
||||
buttonDelete.Click += new EventHandler(delegate (object sender, EventArgs e) {
|
||||
var res = MessageBox.Show($"Are you sure to delete the phone type\n{phoneType.Label}\n?", "Delete phone type?", MessageBoxButtons.YesNo);
|
||||
if (res == DialogResult.Yes)
|
||||
{
|
||||
phoneType.Delete();
|
||||
Program.mainForm.EmbedForm<PhoneTypesList>();
|
||||
}
|
||||
});
|
||||
textboxPhoneTypeName.TextChanged += new EventHandler(delegate (object sender, EventArgs e) {
|
||||
phoneType.Label = textboxPhoneTypeName.Text;
|
||||
});
|
||||
|
||||
tableLayoutPanelPhoneTypes.Controls.Add(labelPhoneTypeId, 0, 1 + i);
|
||||
tableLayoutPanelPhoneTypes.Controls.Add(textboxPhoneTypeName, 1, 1 + i);
|
||||
tableLayoutPanelPhoneTypes.Controls.Add(buttonApplyChanges, 2, 1 + i);
|
||||
tableLayoutPanelPhoneTypes.Controls.Add(buttonDelete, 3, 1 + i);
|
||||
}
|
||||
}
|
||||
|
||||
internal void addPhoneType()
|
||||
{
|
||||
AppointmentsLib.Models.PhoneType.Create("New phone type");
|
||||
Program.mainForm.EmbedForm<PhoneTypesList>();
|
||||
}
|
||||
|
||||
private void buttonAddNewPhoneTypes_Click(object sender, EventArgs e)
|
||||
{
|
||||
addPhoneType();
|
||||
}
|
||||
}
|
||||
}
|
||||
60
AppointmentsManager/AppointmentsUi/Views/PhoneTypesList.resx
Normal file
60
AppointmentsManager/AppointmentsUi/Views/PhoneTypesList.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>
|
||||
95
AppointmentsManager/AppointmentsUi/Views/PostalsList.Designer.cs
generated
Normal file
95
AppointmentsManager/AppointmentsUi/Views/PostalsList.Designer.cs
generated
Normal file
@@ -0,0 +1,95 @@
|
||||
namespace AppointmentsUi.Views
|
||||
{
|
||||
partial class PostalsList
|
||||
{
|
||||
/// <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.buttonAddNewPostals = new System.Windows.Forms.Button();
|
||||
this.labelPostalsHeader = new System.Windows.Forms.Label();
|
||||
this.tableLayoutPanelPostals = new System.Windows.Forms.TableLayoutPanel();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// buttonAddNewPostals
|
||||
//
|
||||
this.buttonAddNewPostals.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.buttonAddNewPostals.Location = new System.Drawing.Point(725, -1);
|
||||
this.buttonAddNewPostals.Name = "buttonAddNewPostals";
|
||||
this.buttonAddNewPostals.Size = new System.Drawing.Size(75, 23);
|
||||
this.buttonAddNewPostals.TabIndex = 8;
|
||||
this.buttonAddNewPostals.Text = "Add new";
|
||||
this.buttonAddNewPostals.UseVisualStyleBackColor = true;
|
||||
this.buttonAddNewPostals.Click += new System.EventHandler(this.buttonAddNewPostals_Click);
|
||||
//
|
||||
// labelPostalsHeader
|
||||
//
|
||||
this.labelPostalsHeader.AutoSize = true;
|
||||
this.labelPostalsHeader.Location = new System.Drawing.Point(-1, 3);
|
||||
this.labelPostalsHeader.Name = "labelPostalsHeader";
|
||||
this.labelPostalsHeader.Size = new System.Drawing.Size(44, 15);
|
||||
this.labelPostalsHeader.TabIndex = 7;
|
||||
this.labelPostalsHeader.Text = "Postals";
|
||||
//
|
||||
// tableLayoutPanelPostals
|
||||
//
|
||||
this.tableLayoutPanelPostals.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.tableLayoutPanelPostals.BackColor = System.Drawing.SystemColors.Control;
|
||||
this.tableLayoutPanelPostals.ColumnCount = 4;
|
||||
this.tableLayoutPanelPostals.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle());
|
||||
this.tableLayoutPanelPostals.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle());
|
||||
this.tableLayoutPanelPostals.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle());
|
||||
this.tableLayoutPanelPostals.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle());
|
||||
this.tableLayoutPanelPostals.Location = new System.Drawing.Point(-1, 28);
|
||||
this.tableLayoutPanelPostals.Name = "tableLayoutPanelPostals";
|
||||
this.tableLayoutPanelPostals.RowCount = 1;
|
||||
this.tableLayoutPanelPostals.RowStyles.Add(new System.Windows.Forms.RowStyle());
|
||||
this.tableLayoutPanelPostals.Size = new System.Drawing.Size(802, 423);
|
||||
this.tableLayoutPanelPostals.TabIndex = 6;
|
||||
//
|
||||
// PostalsList
|
||||
//
|
||||
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.buttonAddNewPostals);
|
||||
this.Controls.Add(this.labelPostalsHeader);
|
||||
this.Controls.Add(this.tableLayoutPanelPostals);
|
||||
this.Name = "PostalsList";
|
||||
this.Text = "PostalsList";
|
||||
this.ResumeLayout(false);
|
||||
this.PerformLayout();
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private System.Windows.Forms.Button buttonAddNewPostals;
|
||||
private System.Windows.Forms.Label labelPostalsHeader;
|
||||
private System.Windows.Forms.TableLayoutPanel tableLayoutPanelPostals;
|
||||
}
|
||||
}
|
||||
64
AppointmentsManager/AppointmentsUi/Views/PostalsList.cs
Normal file
64
AppointmentsManager/AppointmentsUi/Views/PostalsList.cs
Normal file
@@ -0,0 +1,64 @@
|
||||
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 PostalsList : Form
|
||||
{
|
||||
public PostalsList()
|
||||
{
|
||||
InitializeComponent();
|
||||
|
||||
var postals = AppointmentsLib.Models.Postal.GetPostals();
|
||||
|
||||
for (int i = 0; i < postals.Count(); i++)
|
||||
{
|
||||
var postal = postals.ElementAt(i);
|
||||
|
||||
var labelPostalId = new Label() { Text = postal.PostalId.ToString(), AutoSize = true, TextAlign = ContentAlignment.MiddleCenter };
|
||||
var textboxPostalLabel = new TextBox() { Text = postal.Label, AutoSize = true };
|
||||
var buttonApplyChanges = new Button() { Text = "Apply" };
|
||||
var buttonDelete = new Button() { Text = "Delete" };
|
||||
|
||||
buttonApplyChanges.Click += new EventHandler(delegate (object sender, EventArgs e) {
|
||||
postal.Save();
|
||||
Program.mainForm.EmbedForm<PostalsList>();
|
||||
});
|
||||
buttonDelete.Click += new EventHandler(delegate (object sender, EventArgs e) {
|
||||
var res = MessageBox.Show($"Are you sure to delete the postal\n{postal.Label}\n?", "Delete postal?", MessageBoxButtons.YesNo);
|
||||
if (res == DialogResult.Yes)
|
||||
{
|
||||
postal.Delete();
|
||||
Program.mainForm.EmbedForm<PostalsList>();
|
||||
}
|
||||
});
|
||||
textboxPostalLabel.TextChanged += new EventHandler(delegate (object sender, EventArgs e) {
|
||||
postal.Label = textboxPostalLabel.Text;
|
||||
});
|
||||
|
||||
tableLayoutPanelPostals.Controls.Add(labelPostalId, 0, 1 + i);
|
||||
tableLayoutPanelPostals.Controls.Add(textboxPostalLabel, 1, 1 + i);
|
||||
tableLayoutPanelPostals.Controls.Add(buttonApplyChanges, 2, 1 + i);
|
||||
tableLayoutPanelPostals.Controls.Add(buttonDelete, 3, 1 + i);
|
||||
}
|
||||
}
|
||||
|
||||
internal void addPostal()
|
||||
{
|
||||
AppointmentsLib.Models.Postal.Create("New postal");
|
||||
Program.mainForm.EmbedForm<PostalsList>();
|
||||
}
|
||||
|
||||
private void buttonAddNewPostals_Click(object sender, EventArgs e)
|
||||
{
|
||||
addPostal();
|
||||
}
|
||||
}
|
||||
}
|
||||
60
AppointmentsManager/AppointmentsUi/Views/PostalsList.resx
Normal file
60
AppointmentsManager/AppointmentsUi/Views/PostalsList.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>
|
||||
95
AppointmentsManager/AppointmentsUi/Views/SalutationsList.Designer.cs
generated
Normal file
95
AppointmentsManager/AppointmentsUi/Views/SalutationsList.Designer.cs
generated
Normal file
@@ -0,0 +1,95 @@
|
||||
namespace AppointmentsUi.Views
|
||||
{
|
||||
partial class SalutationsList
|
||||
{
|
||||
/// <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.buttonAddNewSalutation = new System.Windows.Forms.Button();
|
||||
this.labelSalutationsHeader = new System.Windows.Forms.Label();
|
||||
this.tableLayoutPanelSalutations = new System.Windows.Forms.TableLayoutPanel();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// buttonAddNewSalutation
|
||||
//
|
||||
this.buttonAddNewSalutation.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.buttonAddNewSalutation.Location = new System.Drawing.Point(725, -1);
|
||||
this.buttonAddNewSalutation.Name = "buttonAddNewSalutation";
|
||||
this.buttonAddNewSalutation.Size = new System.Drawing.Size(75, 23);
|
||||
this.buttonAddNewSalutation.TabIndex = 5;
|
||||
this.buttonAddNewSalutation.Text = "Add new";
|
||||
this.buttonAddNewSalutation.UseVisualStyleBackColor = true;
|
||||
this.buttonAddNewSalutation.Click += new System.EventHandler(this.buttonAddNewSalutation_Click);
|
||||
//
|
||||
// labelSalutationsHeader
|
||||
//
|
||||
this.labelSalutationsHeader.AutoSize = true;
|
||||
this.labelSalutationsHeader.Location = new System.Drawing.Point(-1, 3);
|
||||
this.labelSalutationsHeader.Name = "labelSalutationsHeader";
|
||||
this.labelSalutationsHeader.Size = new System.Drawing.Size(65, 15);
|
||||
this.labelSalutationsHeader.TabIndex = 4;
|
||||
this.labelSalutationsHeader.Text = "Salutations";
|
||||
//
|
||||
// tableLayoutPanelSalutations
|
||||
//
|
||||
this.tableLayoutPanelSalutations.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.tableLayoutPanelSalutations.BackColor = System.Drawing.SystemColors.Control;
|
||||
this.tableLayoutPanelSalutations.ColumnCount = 4;
|
||||
this.tableLayoutPanelSalutations.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle());
|
||||
this.tableLayoutPanelSalutations.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle());
|
||||
this.tableLayoutPanelSalutations.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle());
|
||||
this.tableLayoutPanelSalutations.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle());
|
||||
this.tableLayoutPanelSalutations.Location = new System.Drawing.Point(-1, 28);
|
||||
this.tableLayoutPanelSalutations.Name = "tableLayoutPanelSalutations";
|
||||
this.tableLayoutPanelSalutations.RowCount = 1;
|
||||
this.tableLayoutPanelSalutations.RowStyles.Add(new System.Windows.Forms.RowStyle());
|
||||
this.tableLayoutPanelSalutations.Size = new System.Drawing.Size(802, 423);
|
||||
this.tableLayoutPanelSalutations.TabIndex = 3;
|
||||
//
|
||||
// SalutationsList
|
||||
//
|
||||
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.buttonAddNewSalutation);
|
||||
this.Controls.Add(this.labelSalutationsHeader);
|
||||
this.Controls.Add(this.tableLayoutPanelSalutations);
|
||||
this.Name = "SalutationsList";
|
||||
this.Text = "SalutationsList";
|
||||
this.ResumeLayout(false);
|
||||
this.PerformLayout();
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private System.Windows.Forms.Button buttonAddNewSalutation;
|
||||
private System.Windows.Forms.Label labelSalutationsHeader;
|
||||
private System.Windows.Forms.TableLayoutPanel tableLayoutPanelSalutations;
|
||||
}
|
||||
}
|
||||
64
AppointmentsManager/AppointmentsUi/Views/SalutationsList.cs
Normal file
64
AppointmentsManager/AppointmentsUi/Views/SalutationsList.cs
Normal file
@@ -0,0 +1,64 @@
|
||||
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 SalutationsList : Form
|
||||
{
|
||||
public SalutationsList()
|
||||
{
|
||||
InitializeComponent();
|
||||
|
||||
var salutations = AppointmentsLib.Models.Salutation.GetSalutations();
|
||||
|
||||
for (int i = 0; i < salutations.Count(); i++)
|
||||
{
|
||||
var salutation = salutations.ElementAt(i);
|
||||
|
||||
var labelSalutationId = new Label() { Text = salutation.SalutationId.ToString(), AutoSize = true, TextAlign = ContentAlignment.MiddleCenter };
|
||||
var textboxSalutationLabel = new TextBox() { Text = salutation.Label, AutoSize = true };
|
||||
var buttonApplyChanges = new Button() { Text = "Apply" };
|
||||
var buttonDelete = new Button() { Text = "Delete" };
|
||||
|
||||
buttonApplyChanges.Click += new EventHandler(delegate (object sender, EventArgs e) {
|
||||
salutation.Save();
|
||||
Program.mainForm.EmbedForm<SalutationsList>();
|
||||
});
|
||||
buttonDelete.Click += new EventHandler(delegate (object sender, EventArgs e) {
|
||||
var res = MessageBox.Show($"Are you sure to delete the salutation\n{salutation.Label}\n?", "Delete salutation?", MessageBoxButtons.YesNo);
|
||||
if (res == DialogResult.Yes)
|
||||
{
|
||||
salutation.Delete();
|
||||
Program.mainForm.EmbedForm<SalutationsList>();
|
||||
}
|
||||
});
|
||||
textboxSalutationLabel.TextChanged += new EventHandler(delegate (object sender, EventArgs e) {
|
||||
salutation.Label = textboxSalutationLabel.Text;
|
||||
});
|
||||
|
||||
tableLayoutPanelSalutations.Controls.Add(labelSalutationId, 0, 1 + i);
|
||||
tableLayoutPanelSalutations.Controls.Add(textboxSalutationLabel, 1, 1 + i);
|
||||
tableLayoutPanelSalutations.Controls.Add(buttonApplyChanges, 2, 1 + i);
|
||||
tableLayoutPanelSalutations.Controls.Add(buttonDelete, 3, 1 + i);
|
||||
}
|
||||
}
|
||||
|
||||
internal void addSalutation()
|
||||
{
|
||||
AppointmentsLib.Models.Salutation.Create("New salutation");
|
||||
Program.mainForm.EmbedForm<SalutationsList>();
|
||||
}
|
||||
|
||||
private void buttonAddNewSalutation_Click(object sender, EventArgs e)
|
||||
{
|
||||
addSalutation();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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>
|
||||
@@ -14,6 +14,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "test", "test\test.csproj",
|
||||
{B8ED20C2-C851-47B8-8509-12E4A3D2F18C} = {B8ED20C2-C851-47B8-8509-12E4A3D2F18C}
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "GLS", "GLS\GLS.csproj", "{707F2AC0-9F42-41A0-8932-2923CAC49701}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
@@ -36,6 +38,10 @@ Global
|
||||
{DAE25550-52A1-440A-B6B9-C588357620D4}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{DAE25550-52A1-440A-B6B9-C588357620D4}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{DAE25550-52A1-440A-B6B9-C588357620D4}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{707F2AC0-9F42-41A0-8932-2923CAC49701}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{707F2AC0-9F42-41A0-8932-2923CAC49701}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{707F2AC0-9F42-41A0-8932-2923CAC49701}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{707F2AC0-9F42-41A0-8932-2923CAC49701}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
|
||||
8
Checksums/GLS/GLS.csproj
Normal file
8
Checksums/GLS/GLS.csproj
Normal file
@@ -0,0 +1,8 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<OutputType>Exe</OutputType>
|
||||
<TargetFramework>net5.0</TargetFramework>
|
||||
</PropertyGroup>
|
||||
|
||||
</Project>
|
||||
146
Checksums/GLS/Program.cs
Normal file
146
Checksums/GLS/Program.cs
Normal file
@@ -0,0 +1,146 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
||||
namespace GLS
|
||||
{
|
||||
internal class Program
|
||||
{
|
||||
static void Main(string[] args)
|
||||
{
|
||||
Console.WriteLine("Hello World!");
|
||||
Console.WriteLine("This Utility calculates GLS Parcel numbers.");
|
||||
while (true)
|
||||
{
|
||||
Console.WriteLine("Please press:\n- (n) to enter a new Number to generate\n- (c) to clear the console\n- (q) to quit the application");
|
||||
|
||||
// read key from console
|
||||
ConsoleKeyInfo cki = Console.ReadKey();
|
||||
|
||||
string action = "NULL";
|
||||
switch (cki.Key)
|
||||
{
|
||||
case ConsoleKey.N:
|
||||
{
|
||||
// N was pressed, set action to new
|
||||
action = "NEW";
|
||||
break;
|
||||
}
|
||||
case ConsoleKey.Q:
|
||||
{
|
||||
// return from Main Method, effectively exiting from application
|
||||
return;
|
||||
}
|
||||
case ConsoleKey.C:
|
||||
{
|
||||
// return from Main Method, effectively exiting from application
|
||||
action = "CLEAR";
|
||||
break;
|
||||
}
|
||||
default:
|
||||
{
|
||||
// something wrong was pressed
|
||||
action = "NULL";
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (action == "NULL")
|
||||
{
|
||||
// continue in loop, effectively giving user prompt again
|
||||
Console.WriteLine("The key pressed is not accepted, try again.");
|
||||
continue;
|
||||
}
|
||||
|
||||
if (action == "CLEAR")
|
||||
{
|
||||
// optionally clear console
|
||||
Console.Clear();
|
||||
}
|
||||
|
||||
// create List to hold numbers that were put in
|
||||
List<int> parsedNumbers = new();
|
||||
|
||||
while (true)
|
||||
{
|
||||
Console.WriteLine("\rPlease type the GLS parcel number without the checksum (or press q and enter to quit):");
|
||||
|
||||
// get input from user
|
||||
string input = Console.ReadLine();
|
||||
|
||||
if (input == "q")
|
||||
{
|
||||
// user pressed q, exit
|
||||
return;
|
||||
}
|
||||
|
||||
if (input == null || input == "")
|
||||
{
|
||||
// nothing was put in, rerun loop and let user retry
|
||||
continue;
|
||||
}
|
||||
|
||||
// clear number list to make sure the numbers don't overlap from previous attempt
|
||||
parsedNumbers.Clear();
|
||||
|
||||
// split all characters into individual strings
|
||||
string[] splitCharacters = input.Select(x => x.ToString()).ToArray();
|
||||
|
||||
// do more validation
|
||||
foreach (string character in splitCharacters)
|
||||
{
|
||||
int parsedNum;
|
||||
|
||||
if (int.TryParse(character, out parsedNum))
|
||||
{
|
||||
// number is valid, add to parsednumbers list
|
||||
parsedNumbers.Add(parsedNum);
|
||||
}
|
||||
}
|
||||
|
||||
// ensure we got 11 digits, because that is the length of the GLS number without checksum
|
||||
if (parsedNumbers.Count != 11 || parsedNumbers.Count != splitCharacters.Length)
|
||||
{
|
||||
// number of digits is not correct, let the user retry
|
||||
continue;
|
||||
}
|
||||
|
||||
// add variable to hold sum of result of multiplication
|
||||
// initial value is 1 because then we can skip adding 1 later on
|
||||
int tempSum = 1;
|
||||
|
||||
// we now know we have exactly 11 digits
|
||||
for (int i = 0; i < parsedNumbers.Count; i++)
|
||||
{
|
||||
int thisNumber = parsedNumbers[i];
|
||||
|
||||
if (i % 2 == 0)
|
||||
{
|
||||
// if index is even, multiply with 3
|
||||
thisNumber *= 3;
|
||||
}
|
||||
|
||||
// add maybe multiplied number to temporary sum variable
|
||||
tempSum += thisNumber;
|
||||
}
|
||||
|
||||
// modulo 10 the sum
|
||||
int tempSumMod10 = tempSum % 10;
|
||||
|
||||
// subtract mod 10 from 10, mod 10 again to remove 10 if the initial mod 10 result is 0
|
||||
int checksum = (10 - tempSumMod10) % 10;
|
||||
|
||||
// write results to console
|
||||
Console.WriteLine("The calculated checksum is: -----------" + checksum);
|
||||
Console.WriteLine("The entire parcel number should be: " + input + checksum);
|
||||
|
||||
// print newlines to console for some space
|
||||
Console.WriteLine("\n\n");
|
||||
|
||||
// calculation is done, break out of loop, go back to initial new/clear/quit prompt
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,10 +1,11 @@
|
||||
using System;
|
||||
using System.Linq;
|
||||
|
||||
namespace dotFionn.Checksum.Utils
|
||||
{
|
||||
public static class Extensions
|
||||
{
|
||||
public static int digitSum(this int inInt)
|
||||
public static int DigitSum(this int inInt)
|
||||
{
|
||||
int digitSum = 0;
|
||||
|
||||
@@ -15,5 +16,10 @@ namespace dotFionn.Checksum.Utils
|
||||
|
||||
return digitSum;
|
||||
}
|
||||
|
||||
public static string[] SplitAllDigits(this string inString)
|
||||
{
|
||||
return inString.Select(x => x.ToString()).ToArray();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,7 +8,7 @@ namespace test
|
||||
static void Main(string[] args)
|
||||
{
|
||||
Console.WriteLine("Hello World!");
|
||||
Console.WriteLine(123.digitSum());
|
||||
Console.WriteLine(123.DigitSum());
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user