add initial appointmentsmanager

This commit is contained in:
2023-01-10 06:33:15 +01:00
parent 3af79affe4
commit 17a4c4edb0
24 changed files with 1737 additions and 0 deletions

View File

@@ -0,0 +1,93 @@
namespace AppointmentsUi.Views
{
partial class CompanyList
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.tableLayoutPanelCompanies = new System.Windows.Forms.TableLayoutPanel();
this.labelCompaniesHeader = new System.Windows.Forms.Label();
this.buttonAddNewCompany = new System.Windows.Forms.Button();
this.SuspendLayout();
//
// tableLayoutPanelCompanies
//
this.tableLayoutPanelCompanies.BackColor = System.Drawing.SystemColors.ControlDark;
this.tableLayoutPanelCompanies.ColumnCount = 4;
this.tableLayoutPanelCompanies.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle());
this.tableLayoutPanelCompanies.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle());
this.tableLayoutPanelCompanies.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle());
this.tableLayoutPanelCompanies.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle());
this.tableLayoutPanelCompanies.Location = new System.Drawing.Point(-1, 29);
this.tableLayoutPanelCompanies.Name = "tableLayoutPanelCompanies";
this.tableLayoutPanelCompanies.RowCount = 1;
this.tableLayoutPanelCompanies.RowStyles.Add(new System.Windows.Forms.RowStyle());
this.tableLayoutPanelCompanies.Size = new System.Drawing.Size(802, 423);
this.tableLayoutPanelCompanies.TabIndex = 0;
//
// labelCompaniesHeader
//
this.labelCompaniesHeader.AutoSize = true;
this.labelCompaniesHeader.Location = new System.Drawing.Point(-1, 4);
this.labelCompaniesHeader.Name = "labelCompaniesHeader";
this.labelCompaniesHeader.Size = new System.Drawing.Size(67, 15);
this.labelCompaniesHeader.TabIndex = 1;
this.labelCompaniesHeader.Text = "Companies";
//
// buttonAddNewCompany
//
this.buttonAddNewCompany.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.buttonAddNewCompany.Location = new System.Drawing.Point(725, 0);
this.buttonAddNewCompany.Name = "buttonAddNewCompany";
this.buttonAddNewCompany.Size = new System.Drawing.Size(75, 23);
this.buttonAddNewCompany.TabIndex = 2;
this.buttonAddNewCompany.Text = "Add new";
this.buttonAddNewCompany.UseVisualStyleBackColor = true;
this.buttonAddNewCompany.Click += new System.EventHandler(this.buttonAddNewCompany_Click);
//
// CompanyList
//
this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(800, 450);
this.Controls.Add(this.buttonAddNewCompany);
this.Controls.Add(this.labelCompaniesHeader);
this.Controls.Add(this.tableLayoutPanelCompanies);
this.Name = "CompanyList";
this.Text = "CompanyList";
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private System.Windows.Forms.TableLayoutPanel tableLayoutPanelCompanies;
private System.Windows.Forms.Label labelCompaniesHeader;
private System.Windows.Forms.Button buttonAddNewCompany;
}
}

View File

@@ -0,0 +1,59 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace AppointmentsUi.Views
{
public partial class CompanyList : Form
{
public CompanyList()
{
InitializeComponent();
var companies = AppointmentsLib.Models.Company.GetCompanies();
for(int i = 0; i < companies.Count(); i++)
{
var company = companies.ElementAt(i);
var labelCompanyId = new Label() { Text = company.CompanyId.ToString(), AutoSize = true, TextAlign = ContentAlignment.MiddleCenter };
var textboxCompanyName = new TextBox() { Text = company.Label, AutoSize = true };
var buttonApplyChanges = new Button() { Text = "Apply" };
var buttonDelete = new Button() { Text = "Delete" };
buttonApplyChanges.Click += new EventHandler(delegate (object sender, EventArgs e) {
company.Save();
Program.mainForm.EmbedForm<CompanyList>();
});
buttonDelete.Click += new EventHandler(delegate (object sender, EventArgs e) {
var res = MessageBox.Show($"Are you sure to delete the company\n{company.Label}\n?", "Delete company?", MessageBoxButtons.YesNo);
if (res == DialogResult.Yes)
{
company.Delete();
Program.mainForm.EmbedForm<CompanyList>();
}
});
textboxCompanyName.TextChanged += new EventHandler(delegate (object sender, EventArgs e) {
company.Label = textboxCompanyName.Text;
});
tableLayoutPanelCompanies.Controls.Add(labelCompanyId, 0, 1 + i);
tableLayoutPanelCompanies.Controls.Add(textboxCompanyName, 1, 1 + i);
tableLayoutPanelCompanies.Controls.Add(buttonApplyChanges, 2, 1 + i);
tableLayoutPanelCompanies.Controls.Add(buttonDelete, 3, 1 + i);
}
}
private void buttonAddNewCompany_Click(object sender, EventArgs e)
{
AppointmentsLib.Models.Company.Create("New company");
Program.mainForm.EmbedForm<CompanyList>();
}
}
}

View 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>

View 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;
}
}

View 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();
}
}
}

View 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>