From fef89ba4bdf06ef10a1109bf1b42fec3512e118f Mon Sep 17 00:00:00 2001 From: Ismail Date: Wed, 26 Jul 2017 18:18:37 +0200 Subject: [PATCH 1/4] Rebuild Application with a login gui --- .../db_AI-4_V3/db_AI-4/App.config | 10 + .../db_AI-4_V3/db_AI-4/Dashboard.Designer.cs | 186 ++++++++++++++++++ .../db_AI-4_V3/db_AI-4/Dashboard.cs | 65 ++++++ .../db_AI-4_V3/db_AI-4/Dashboard.resx | 120 +++++++++++ .../db_AI-4_V3/db_AI-4/DataAccess.cs | 98 +++++++++ .../db_AI-4_V3/db_AI-4/GetLocations.cs | 27 +++ .../db_AI-4_V3/db_AI-4/GetMembers.cs | 29 +++ .../db_AI-4_V3/db_AI-4/Helper.cs | 18 ++ .../db_AI-4_V3/db_AI-4/LoginForm.Designer.cs | 110 +++++++++++ .../db_AI-4_V3/db_AI-4/LoginForm.cs | 45 +++++ .../db_AI-4_V3/db_AI-4/LoginForm.resx | 120 +++++++++++ .../db_AI-4_V3/db_AI-4/Program.cs | 22 +++ .../db_AI-4/Properties/AssemblyInfo.cs | 36 ++++ .../db_AI-4/Properties/Resources.Designer.cs | 71 +++++++ .../db_AI-4/Properties/Resources.resx | 117 +++++++++++ .../db_AI-4/Properties/Settings.Designer.cs | 30 +++ .../db_AI-4/Properties/Settings.settings | 7 + .../db_AI-4_V3/db_AI-4/db_AI-4.csproj | 102 ++++++++++ .../db_AI-4_V3/db_AI-4/packages.config | 4 + .../db_AI-4_V3/db_AI-4_V3.sln | 22 +++ 20 files changed, 1239 insertions(+) create mode 100644 csharp/marketconnectionNET2.0/db_AI-4_V3/db_AI-4/App.config create mode 100644 csharp/marketconnectionNET2.0/db_AI-4_V3/db_AI-4/Dashboard.Designer.cs create mode 100644 csharp/marketconnectionNET2.0/db_AI-4_V3/db_AI-4/Dashboard.cs create mode 100644 csharp/marketconnectionNET2.0/db_AI-4_V3/db_AI-4/Dashboard.resx create mode 100644 csharp/marketconnectionNET2.0/db_AI-4_V3/db_AI-4/DataAccess.cs create mode 100644 csharp/marketconnectionNET2.0/db_AI-4_V3/db_AI-4/GetLocations.cs create mode 100644 csharp/marketconnectionNET2.0/db_AI-4_V3/db_AI-4/GetMembers.cs create mode 100644 csharp/marketconnectionNET2.0/db_AI-4_V3/db_AI-4/Helper.cs create mode 100644 csharp/marketconnectionNET2.0/db_AI-4_V3/db_AI-4/LoginForm.Designer.cs create mode 100644 csharp/marketconnectionNET2.0/db_AI-4_V3/db_AI-4/LoginForm.cs create mode 100644 csharp/marketconnectionNET2.0/db_AI-4_V3/db_AI-4/LoginForm.resx create mode 100644 csharp/marketconnectionNET2.0/db_AI-4_V3/db_AI-4/Program.cs create mode 100644 csharp/marketconnectionNET2.0/db_AI-4_V3/db_AI-4/Properties/AssemblyInfo.cs create mode 100644 csharp/marketconnectionNET2.0/db_AI-4_V3/db_AI-4/Properties/Resources.Designer.cs create mode 100644 csharp/marketconnectionNET2.0/db_AI-4_V3/db_AI-4/Properties/Resources.resx create mode 100644 csharp/marketconnectionNET2.0/db_AI-4_V3/db_AI-4/Properties/Settings.Designer.cs create mode 100644 csharp/marketconnectionNET2.0/db_AI-4_V3/db_AI-4/Properties/Settings.settings create mode 100644 csharp/marketconnectionNET2.0/db_AI-4_V3/db_AI-4/db_AI-4.csproj create mode 100644 csharp/marketconnectionNET2.0/db_AI-4_V3/db_AI-4/packages.config create mode 100644 csharp/marketconnectionNET2.0/db_AI-4_V3/db_AI-4_V3.sln diff --git a/csharp/marketconnectionNET2.0/db_AI-4_V3/db_AI-4/App.config b/csharp/marketconnectionNET2.0/db_AI-4_V3/db_AI-4/App.config new file mode 100644 index 0000000..9e12745 --- /dev/null +++ b/csharp/marketconnectionNET2.0/db_AI-4_V3/db_AI-4/App.config @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git a/csharp/marketconnectionNET2.0/db_AI-4_V3/db_AI-4/Dashboard.Designer.cs b/csharp/marketconnectionNET2.0/db_AI-4_V3/db_AI-4/Dashboard.Designer.cs new file mode 100644 index 0000000..1b8aab3 --- /dev/null +++ b/csharp/marketconnectionNET2.0/db_AI-4_V3/db_AI-4/Dashboard.Designer.cs @@ -0,0 +1,186 @@ +namespace db_AI_4 +{ + partial class Dashboard + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + this.LocationListBox = new System.Windows.Forms.ListBox(); + this.LocationTextBox = new System.Windows.Forms.TextBox(); + this.LocationLabel = new System.Windows.Forms.Label(); + this.LocationSearchButton = new System.Windows.Forms.Button(); + this.LocationInputLabel = new System.Windows.Forms.Label(); + this.StreetnameInsertBox = new System.Windows.Forms.TextBox(); + this.LocationCapacityInputBox = new System.Windows.Forms.TextBox(); + this.LocationNameInputBox = new System.Windows.Forms.TextBox(); + this.LocationInsertButton = new System.Windows.Forms.Button(); + this.NameLabel = new System.Windows.Forms.Label(); + this.CapacityLabel = new System.Windows.Forms.Label(); + this.StreetLabel = new System.Windows.Forms.Label(); + this.SuspendLayout(); + // + // LocationListBox + // + this.LocationListBox.FormattingEnabled = true; + this.LocationListBox.ItemHeight = 16; + this.LocationListBox.Location = new System.Drawing.Point(12, 91); + this.LocationListBox.Name = "LocationListBox"; + this.LocationListBox.Size = new System.Drawing.Size(196, 244); + this.LocationListBox.TabIndex = 0; + // + // LocationTextBox + // + this.LocationTextBox.Location = new System.Drawing.Point(12, 50); + this.LocationTextBox.Name = "LocationTextBox"; + this.LocationTextBox.Size = new System.Drawing.Size(100, 22); + this.LocationTextBox.TabIndex = 1; + // + // LocationLabel + // + this.LocationLabel.AutoSize = true; + this.LocationLabel.Location = new System.Drawing.Point(12, 13); + this.LocationLabel.Name = "LocationLabel"; + this.LocationLabel.Size = new System.Drawing.Size(112, 17); + this.LocationLabel.TabIndex = 2; + this.LocationLabel.Text = "Location-Search"; + // + // LocationSearchButton + // + this.LocationSearchButton.Location = new System.Drawing.Point(133, 50); + this.LocationSearchButton.Name = "LocationSearchButton"; + this.LocationSearchButton.Size = new System.Drawing.Size(75, 23); + this.LocationSearchButton.TabIndex = 3; + this.LocationSearchButton.Text = "Search"; + this.LocationSearchButton.UseVisualStyleBackColor = true; + this.LocationSearchButton.Click += new System.EventHandler(this.LocationSearchButton_Click); + // + // LocationInputLabel + // + this.LocationInputLabel.AutoSize = true; + this.LocationInputLabel.Location = new System.Drawing.Point(266, 13); + this.LocationInputLabel.Name = "LocationInputLabel"; + this.LocationInputLabel.Size = new System.Drawing.Size(98, 17); + this.LocationInputLabel.TabIndex = 4; + this.LocationInputLabel.Text = "Location-Input"; + // + // StreetnameInsertBox + // + this.StreetnameInsertBox.Location = new System.Drawing.Point(369, 53); + this.StreetnameInsertBox.Name = "StreetnameInsertBox"; + this.StreetnameInsertBox.Size = new System.Drawing.Size(100, 22); + this.StreetnameInsertBox.TabIndex = 5; + // + // LocationCapacityInputBox + // + this.LocationCapacityInputBox.Location = new System.Drawing.Point(369, 105); + this.LocationCapacityInputBox.Name = "LocationCapacityInputBox"; + this.LocationCapacityInputBox.Size = new System.Drawing.Size(100, 22); + this.LocationCapacityInputBox.TabIndex = 6; + // + // LocationNameInputBox + // + this.LocationNameInputBox.Location = new System.Drawing.Point(369, 158); + this.LocationNameInputBox.Name = "LocationNameInputBox"; + this.LocationNameInputBox.Size = new System.Drawing.Size(100, 22); + this.LocationNameInputBox.TabIndex = 7; + // + // LocationInsertButton + // + this.LocationInsertButton.Location = new System.Drawing.Point(369, 210); + this.LocationInsertButton.Name = "LocationInsertButton"; + this.LocationInsertButton.Size = new System.Drawing.Size(75, 23); + this.LocationInsertButton.TabIndex = 9; + this.LocationInsertButton.Text = "Insert"; + this.LocationInsertButton.UseVisualStyleBackColor = true; + this.LocationInsertButton.Click += new System.EventHandler(this.LocationInsertButton_Click); + // + // NameLabel + // + this.NameLabel.AutoSize = true; + this.NameLabel.Location = new System.Drawing.Point(266, 158); + this.NameLabel.Name = "NameLabel"; + this.NameLabel.Size = new System.Drawing.Size(97, 17); + this.NameLabel.TabIndex = 10; + this.NameLabel.Text = "Locationname"; + // + // CapacityLabel + // + this.CapacityLabel.AutoSize = true; + this.CapacityLabel.Location = new System.Drawing.Point(266, 105); + this.CapacityLabel.Name = "CapacityLabel"; + this.CapacityLabel.Size = new System.Drawing.Size(62, 17); + this.CapacityLabel.TabIndex = 11; + this.CapacityLabel.Text = "Capacity"; + // + // StreetLabel + // + this.StreetLabel.AutoSize = true; + this.StreetLabel.Location = new System.Drawing.Point(266, 53); + this.StreetLabel.Name = "StreetLabel"; + this.StreetLabel.Size = new System.Drawing.Size(81, 17); + this.StreetLabel.TabIndex = 12; + this.StreetLabel.Text = "Streetname"; + // + // Dashboard + // + this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 16F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.ClientSize = new System.Drawing.Size(656, 366); + this.Controls.Add(this.StreetLabel); + this.Controls.Add(this.CapacityLabel); + this.Controls.Add(this.NameLabel); + this.Controls.Add(this.LocationInsertButton); + this.Controls.Add(this.LocationNameInputBox); + this.Controls.Add(this.LocationCapacityInputBox); + this.Controls.Add(this.StreetnameInsertBox); + this.Controls.Add(this.LocationInputLabel); + this.Controls.Add(this.LocationSearchButton); + this.Controls.Add(this.LocationLabel); + this.Controls.Add(this.LocationTextBox); + this.Controls.Add(this.LocationListBox); + this.Name = "Dashboard"; + this.Text = "Dashboard"; + this.ResumeLayout(false); + this.PerformLayout(); + + } + + #endregion + + private System.Windows.Forms.ListBox LocationListBox; + private System.Windows.Forms.TextBox LocationTextBox; + private System.Windows.Forms.Label LocationLabel; + private System.Windows.Forms.Button LocationSearchButton; + private System.Windows.Forms.Label LocationInputLabel; + private System.Windows.Forms.TextBox StreetnameInsertBox; + private System.Windows.Forms.TextBox LocationCapacityInputBox; + private System.Windows.Forms.TextBox LocationNameInputBox; + private System.Windows.Forms.Button LocationInsertButton; + private System.Windows.Forms.Label NameLabel; + private System.Windows.Forms.Label CapacityLabel; + private System.Windows.Forms.Label StreetLabel; + } +} \ No newline at end of file diff --git a/csharp/marketconnectionNET2.0/db_AI-4_V3/db_AI-4/Dashboard.cs b/csharp/marketconnectionNET2.0/db_AI-4_V3/db_AI-4/Dashboard.cs new file mode 100644 index 0000000..345d7c1 --- /dev/null +++ b/csharp/marketconnectionNET2.0/db_AI-4_V3/db_AI-4/Dashboard.cs @@ -0,0 +1,65 @@ +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 db_AI_4 +{ + public partial class Dashboard : Form + { + + //Search Locations start + + List locations = new List(); + public Dashboard() + { + InitializeComponent(); + + UpdateBinding(); + + } + + private void UpdateBinding() + { + LocationListBox.DataSource = locations; + LocationListBox.DisplayMember = "LocationInfo"; + } + + + private void LocationSearchButton_Click(object sender, EventArgs e) + { + DataAccess db = new DataAccess(); + + locations = db.GetLocations(LocationTextBox.Text); + + UpdateBinding(); + + } + // Search Locations end + + //Insert Locations start + private void LocationInsertButton_Click(object sender, EventArgs e) + { + DataAccess db = new DataAccess(); + + int CapacityValue; + CapacityValue = Convert.ToInt32(LocationCapacityInputBox.Text); + CapacityValue = int.Parse(LocationCapacityInputBox.Text); + + db.InsertLocations(StreetnameInsertBox.Text, Convert.ToInt32(LocationCapacityInputBox.Text), LocationNameInputBox.Text); + + StreetnameInsertBox.Text = ""; + LocationCapacityInputBox.Text = ""; + LocationNameInputBox.Text = ""; + + + } + // Insert Locations end + + } +} diff --git a/csharp/marketconnectionNET2.0/db_AI-4_V3/db_AI-4/Dashboard.resx b/csharp/marketconnectionNET2.0/db_AI-4_V3/db_AI-4/Dashboard.resx new file mode 100644 index 0000000..1af7de1 --- /dev/null +++ b/csharp/marketconnectionNET2.0/db_AI-4_V3/db_AI-4/Dashboard.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/csharp/marketconnectionNET2.0/db_AI-4_V3/db_AI-4/DataAccess.cs b/csharp/marketconnectionNET2.0/db_AI-4_V3/db_AI-4/DataAccess.cs new file mode 100644 index 0000000..8eb30db --- /dev/null +++ b/csharp/marketconnectionNET2.0/db_AI-4_V3/db_AI-4/DataAccess.cs @@ -0,0 +1,98 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Dapper; +using System.Data; +using System.Windows.Forms; +using System.Data.SqlClient; + +namespace db_AI_4 +{ + public class DataAccess + { + public SqlConnection connection { get; private set; } + + //Read locations from the Database function start + public List GetLocations(string LocationName) + { + using (IDbConnection connection = new System.Data.SqlClient.SqlConnection(Helper.CnnVal("marketdb"))) + { + + var output = connection.Query($"SELECT * FROM locations WHERE location_name = '{ LocationName }'").ToList(); + return output; + + } + } + //Read locations from the Database function end + + //Registration function start + public void InsertMember(string Email_address, string Password) + { + using (IDbConnection connection = new System.Data.SqlClient.SqlConnection(Helper.CnnVal("marketdb"))) + { + + List members = new List(); + + members.Add(new GetMembers { email_address = Email_address, password = Password }); + + connection.Execute("INSERT INTO dbo.members ( email_address, password)" + + " VALUES (@Email_address, @Password) ", members); + + } + } + //Registration function end + + // Insert Locations into Database start + + internal void InsertLocations(string StreetName, int LocationCapacity, string LocationName) + { + using (IDbConnection connection = new System.Data.SqlClient.SqlConnection(Helper.CnnVal("marketdb"))) + { + List locations = new List(); + + locations.Add(new GetLocations { streetname = StreetName, location_capacity = LocationCapacity, location_name = LocationName }); + + connection.Execute("INSERT INTO dbo.locations (streetname, location_capacity, location_name)" + + " VALUES (@StreetName, @LocationCapacity, @LocationName)", locations); + } + } + + // Insert Locations into Database end + + //CheckLogin function start + public void CheckLogin(string Email_address, string Password) + { + SqlConnection con = new SqlConnection(Helper.CnnVal("marketdb")); + + con.Open(); + SqlCommand cmd = new SqlCommand($"SELECT * FROM dbo.members WHERE email_address = '{Email_address}' and password = '{Password}'",con); + SqlDataReader reader; + reader = cmd.ExecuteReader(); + + int count = 0; + while (reader.Read()) + { + count += 1; + } + + if (count == 1) + { + MessageBox.Show("It Worked"); + Dashboard dashboard = new Dashboard(); + dashboard.Show(); + } + else if (count > 0) + { + MessageBox.Show("Already existing"); + } + else + { + MessageBox.Show("username or passord not correct"); + + } + //CheckLogin function end + } + } +} \ No newline at end of file diff --git a/csharp/marketconnectionNET2.0/db_AI-4_V3/db_AI-4/GetLocations.cs b/csharp/marketconnectionNET2.0/db_AI-4_V3/db_AI-4/GetLocations.cs new file mode 100644 index 0000000..92c687d --- /dev/null +++ b/csharp/marketconnectionNET2.0/db_AI-4_V3/db_AI-4/GetLocations.cs @@ -0,0 +1,27 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace db_AI_4 +{ + public class GetLocations + { + public int location_id { get; set; } + public string streetname { get; set; } + public int location_capacity { get; set; } + public string location_name { get; set; } + + + + public string LocationInfo + { + get + { + return $"{ streetname } { location_capacity } {location_name} "; + } + + } + } +} \ No newline at end of file diff --git a/csharp/marketconnectionNET2.0/db_AI-4_V3/db_AI-4/GetMembers.cs b/csharp/marketconnectionNET2.0/db_AI-4_V3/db_AI-4/GetMembers.cs new file mode 100644 index 0000000..a4fa079 --- /dev/null +++ b/csharp/marketconnectionNET2.0/db_AI-4_V3/db_AI-4/GetMembers.cs @@ -0,0 +1,29 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace db_AI_4 +{ + public class GetMembers + { + public int member_id { get; set; } + public string email_address { get; set; } + public string password { get; set; } + public int member_status_id { get; set; } + + + + + public string MemberInfo + { + get + { + return $" ({email_address}) {password} "; + } + + } + } +} + diff --git a/csharp/marketconnectionNET2.0/db_AI-4_V3/db_AI-4/Helper.cs b/csharp/marketconnectionNET2.0/db_AI-4_V3/db_AI-4/Helper.cs new file mode 100644 index 0000000..d6cd628 --- /dev/null +++ b/csharp/marketconnectionNET2.0/db_AI-4_V3/db_AI-4/Helper.cs @@ -0,0 +1,18 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Configuration; + + +namespace db_AI_4 +{ + public static class Helper + { + public static string CnnVal(string marketdb) + { + return ConfigurationManager.ConnectionStrings[marketdb].ConnectionString; + } + } +} diff --git a/csharp/marketconnectionNET2.0/db_AI-4_V3/db_AI-4/LoginForm.Designer.cs b/csharp/marketconnectionNET2.0/db_AI-4_V3/db_AI-4/LoginForm.Designer.cs new file mode 100644 index 0000000..89955cf --- /dev/null +++ b/csharp/marketconnectionNET2.0/db_AI-4_V3/db_AI-4/LoginForm.Designer.cs @@ -0,0 +1,110 @@ +namespace db_AI_4 +{ + partial class LoginForm + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + this.RegistrationButton = new System.Windows.Forms.Button(); + this.EmailLoginBox = new System.Windows.Forms.TextBox(); + this.PasswordLoginBox = new System.Windows.Forms.TextBox(); + this.LoginLabel = new System.Windows.Forms.Label(); + this.LoginButton = new System.Windows.Forms.Button(); + this.SuspendLayout(); + // + // RegistrationButton + // + this.RegistrationButton.Location = new System.Drawing.Point(15, 145); + this.RegistrationButton.Name = "RegistrationButton"; + this.RegistrationButton.Size = new System.Drawing.Size(75, 23); + this.RegistrationButton.TabIndex = 0; + this.RegistrationButton.Text = "Register"; + this.RegistrationButton.UseVisualStyleBackColor = true; + this.RegistrationButton.Click += new System.EventHandler(this.RegistrationButton_Click); + // + // EmailLoginBox + // + this.EmailLoginBox.Location = new System.Drawing.Point(15, 50); + this.EmailLoginBox.Name = "EmailLoginBox"; + this.EmailLoginBox.Size = new System.Drawing.Size(174, 22); + this.EmailLoginBox.TabIndex = 1; + // + // PasswordLoginBox + // + this.PasswordLoginBox.Location = new System.Drawing.Point(15, 94); + this.PasswordLoginBox.Name = "PasswordLoginBox"; + this.PasswordLoginBox.PasswordChar = '*'; + this.PasswordLoginBox.Size = new System.Drawing.Size(174, 22); + this.PasswordLoginBox.TabIndex = 2; + // + // LoginLabel + // + this.LoginLabel.AutoSize = true; + this.LoginLabel.Location = new System.Drawing.Point(12, 9); + this.LoginLabel.Name = "LoginLabel"; + this.LoginLabel.Size = new System.Drawing.Size(43, 17); + this.LoginLabel.TabIndex = 4; + this.LoginLabel.Text = "Login"; + // + // LoginButton + // + this.LoginButton.Location = new System.Drawing.Point(114, 145); + this.LoginButton.Name = "LoginButton"; + this.LoginButton.Size = new System.Drawing.Size(75, 23); + this.LoginButton.TabIndex = 7; + this.LoginButton.Text = "Login"; + this.LoginButton.UseVisualStyleBackColor = true; + this.LoginButton.Click += new System.EventHandler(this.LoginButton_Click); + // + // LoginForm + // + this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 16F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.ClientSize = new System.Drawing.Size(373, 264); + this.Controls.Add(this.LoginButton); + this.Controls.Add(this.LoginLabel); + this.Controls.Add(this.PasswordLoginBox); + this.Controls.Add(this.EmailLoginBox); + this.Controls.Add(this.RegistrationButton); + this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedToolWindow; + this.Name = "LoginForm"; + this.Text = "Login"; + this.Load += new System.EventHandler(this.LoginForm_Load); + this.ResumeLayout(false); + this.PerformLayout(); + + } + + #endregion + + private System.Windows.Forms.Button RegistrationButton; + private System.Windows.Forms.TextBox EmailLoginBox; + private System.Windows.Forms.TextBox PasswordLoginBox; + private System.Windows.Forms.Label LoginLabel; + private System.Windows.Forms.Button LoginButton; + } +} + diff --git a/csharp/marketconnectionNET2.0/db_AI-4_V3/db_AI-4/LoginForm.cs b/csharp/marketconnectionNET2.0/db_AI-4_V3/db_AI-4/LoginForm.cs new file mode 100644 index 0000000..da9cd17 --- /dev/null +++ b/csharp/marketconnectionNET2.0/db_AI-4_V3/db_AI-4/LoginForm.cs @@ -0,0 +1,45 @@ +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 db_AI_4 +{ + public partial class LoginForm : Form + { + public LoginForm() + { + InitializeComponent(); + + } + + private void RegistrationButton_Click(object sender, EventArgs e) + { + DataAccess db = new DataAccess(); + + db.InsertMember(EmailLoginBox.Text, PasswordLoginBox.Text); + + EmailLoginBox.Text = ""; + PasswordLoginBox.Text = ""; + } + + private void LoginButton_Click(object sender, EventArgs e) + { + DataAccess db = new DataAccess(); + + db.CheckLogin(EmailLoginBox.Text, PasswordLoginBox.Text); + + } + + private void LoginForm_Load(object sender, EventArgs e) + { + + } + } + +} diff --git a/csharp/marketconnectionNET2.0/db_AI-4_V3/db_AI-4/LoginForm.resx b/csharp/marketconnectionNET2.0/db_AI-4_V3/db_AI-4/LoginForm.resx new file mode 100644 index 0000000..1af7de1 --- /dev/null +++ b/csharp/marketconnectionNET2.0/db_AI-4_V3/db_AI-4/LoginForm.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/csharp/marketconnectionNET2.0/db_AI-4_V3/db_AI-4/Program.cs b/csharp/marketconnectionNET2.0/db_AI-4_V3/db_AI-4/Program.cs new file mode 100644 index 0000000..48454d3 --- /dev/null +++ b/csharp/marketconnectionNET2.0/db_AI-4_V3/db_AI-4/Program.cs @@ -0,0 +1,22 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; +using System.Windows.Forms; + +namespace db_AI_4 +{ + static class Program + { + /// + /// The main entry point for the application. + /// + [STAThread] + static void Main() + { + Application.EnableVisualStyles(); + Application.SetCompatibleTextRenderingDefault(false); + Application.Run(new LoginForm()); + } + } +} diff --git a/csharp/marketconnectionNET2.0/db_AI-4_V3/db_AI-4/Properties/AssemblyInfo.cs b/csharp/marketconnectionNET2.0/db_AI-4_V3/db_AI-4/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..09c1e20 --- /dev/null +++ b/csharp/marketconnectionNET2.0/db_AI-4_V3/db_AI-4/Properties/AssemblyInfo.cs @@ -0,0 +1,36 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("db_AI-4")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("db_AI-4")] +[assembly: AssemblyCopyright("Copyright © 2017")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +// The following GUID is for the ID of the typelib if this project is exposed to COM +[assembly: Guid("b692de45-80b1-45ca-b519-81639ca9c0ba")] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Build and Revision Numbers +// by using the '*' as shown below: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/csharp/marketconnectionNET2.0/db_AI-4_V3/db_AI-4/Properties/Resources.Designer.cs b/csharp/marketconnectionNET2.0/db_AI-4_V3/db_AI-4/Properties/Resources.Designer.cs new file mode 100644 index 0000000..9bee56e --- /dev/null +++ b/csharp/marketconnectionNET2.0/db_AI-4_V3/db_AI-4/Properties/Resources.Designer.cs @@ -0,0 +1,71 @@ +//------------------------------------------------------------------------------ +// +// 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. +// +//------------------------------------------------------------------------------ + +namespace db_AI_4.Properties +{ + + + /// + /// A strongly-typed resource class, for looking up localized strings, etc. + /// + // 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", "4.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() + { + } + + /// + /// Returns the cached ResourceManager instance used by this class. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Resources.ResourceManager ResourceManager + { + get + { + if ((resourceMan == null)) + { + global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("db_AI_4.Properties.Resources", typeof(Resources).Assembly); + resourceMan = temp; + } + return resourceMan; + } + } + + /// + /// Overrides the current thread's CurrentUICulture property for all + /// resource lookups using this strongly typed resource class. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Globalization.CultureInfo Culture + { + get + { + return resourceCulture; + } + set + { + resourceCulture = value; + } + } + } +} diff --git a/csharp/marketconnectionNET2.0/db_AI-4_V3/db_AI-4/Properties/Resources.resx b/csharp/marketconnectionNET2.0/db_AI-4_V3/db_AI-4/Properties/Resources.resx new file mode 100644 index 0000000..af7dbeb --- /dev/null +++ b/csharp/marketconnectionNET2.0/db_AI-4_V3/db_AI-4/Properties/Resources.resx @@ -0,0 +1,117 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/csharp/marketconnectionNET2.0/db_AI-4_V3/db_AI-4/Properties/Settings.Designer.cs b/csharp/marketconnectionNET2.0/db_AI-4_V3/db_AI-4/Properties/Settings.Designer.cs new file mode 100644 index 0000000..1f0733e --- /dev/null +++ b/csharp/marketconnectionNET2.0/db_AI-4_V3/db_AI-4/Properties/Settings.Designer.cs @@ -0,0 +1,30 @@ +//------------------------------------------------------------------------------ +// +// 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. +// +//------------------------------------------------------------------------------ + +namespace db_AI_4.Properties +{ + + + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0")] + internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase + { + + private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); + + public static Settings Default + { + get + { + return defaultInstance; + } + } + } +} diff --git a/csharp/marketconnectionNET2.0/db_AI-4_V3/db_AI-4/Properties/Settings.settings b/csharp/marketconnectionNET2.0/db_AI-4_V3/db_AI-4/Properties/Settings.settings new file mode 100644 index 0000000..3964565 --- /dev/null +++ b/csharp/marketconnectionNET2.0/db_AI-4_V3/db_AI-4/Properties/Settings.settings @@ -0,0 +1,7 @@ + + + + + + + diff --git a/csharp/marketconnectionNET2.0/db_AI-4_V3/db_AI-4/db_AI-4.csproj b/csharp/marketconnectionNET2.0/db_AI-4_V3/db_AI-4/db_AI-4.csproj new file mode 100644 index 0000000..50dd1ee --- /dev/null +++ b/csharp/marketconnectionNET2.0/db_AI-4_V3/db_AI-4/db_AI-4.csproj @@ -0,0 +1,102 @@ + + + + + Debug + AnyCPU + {B692DE45-80B1-45CA-B519-81639CA9C0BA} + WinExe + db_AI_4 + db_AI-4 + v4.5.2 + 512 + true + + + AnyCPU + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + AnyCPU + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + + ..\packages\Dapper.1.50.2\lib\net451\Dapper.dll + + + + + + + + + + + + + + + + + Form + + + Dashboard.cs + + + + + + + Form + + + LoginForm.cs + + + + + Dashboard.cs + + + LoginForm.cs + + + ResXFileCodeGenerator + Resources.Designer.cs + Designer + + + True + Resources.resx + + + + SettingsSingleFileGenerator + Settings.Designer.cs + + + True + Settings.settings + True + + + + + Designer + + + + \ No newline at end of file diff --git a/csharp/marketconnectionNET2.0/db_AI-4_V3/db_AI-4/packages.config b/csharp/marketconnectionNET2.0/db_AI-4_V3/db_AI-4/packages.config new file mode 100644 index 0000000..cb48927 --- /dev/null +++ b/csharp/marketconnectionNET2.0/db_AI-4_V3/db_AI-4/packages.config @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/csharp/marketconnectionNET2.0/db_AI-4_V3/db_AI-4_V3.sln b/csharp/marketconnectionNET2.0/db_AI-4_V3/db_AI-4_V3.sln new file mode 100644 index 0000000..3330049 --- /dev/null +++ b/csharp/marketconnectionNET2.0/db_AI-4_V3/db_AI-4_V3.sln @@ -0,0 +1,22 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 15 +VisualStudioVersion = 15.0.26403.7 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "db_AI-4", "db_AI-4\db_AI-4.csproj", "{B692DE45-80B1-45CA-B519-81639CA9C0BA}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {B692DE45-80B1-45CA-B519-81639CA9C0BA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {B692DE45-80B1-45CA-B519-81639CA9C0BA}.Debug|Any CPU.Build.0 = Debug|Any CPU + {B692DE45-80B1-45CA-B519-81639CA9C0BA}.Release|Any CPU.ActiveCfg = Release|Any CPU + {B692DE45-80B1-45CA-B519-81639CA9C0BA}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal From 06d4e0afe2ff01b4d480a941e8bb2886154b0ef5 Mon Sep 17 00:00:00 2001 From: Ismail Date: Wed, 26 Jul 2017 20:20:14 +0200 Subject: [PATCH 2/4] Add rent function --- .../db_AI-4_V3/db_AI-4/Dashboard.Designer.cs | 71 ++++++++++++++++++- .../db_AI-4_V3/db_AI-4/Dashboard.cs | 20 ++++++ .../db_AI-4_V3/db_AI-4/DataAccess.cs | 21 +++++- .../db_AI-4_V3/db_AI-4/GetRents.cs | 31 ++++++++ .../db_AI-4_V3/db_AI-4/db_AI-4.csproj | 1 + 5 files changed, 140 insertions(+), 4 deletions(-) create mode 100644 csharp/marketconnectionNET2.0/db_AI-4_V3/db_AI-4/GetRents.cs diff --git a/csharp/marketconnectionNET2.0/db_AI-4_V3/db_AI-4/Dashboard.Designer.cs b/csharp/marketconnectionNET2.0/db_AI-4_V3/db_AI-4/Dashboard.Designer.cs index 1b8aab3..994cfe4 100644 --- a/csharp/marketconnectionNET2.0/db_AI-4_V3/db_AI-4/Dashboard.Designer.cs +++ b/csharp/marketconnectionNET2.0/db_AI-4_V3/db_AI-4/Dashboard.Designer.cs @@ -40,6 +40,12 @@ this.NameLabel = new System.Windows.Forms.Label(); this.CapacityLabel = new System.Windows.Forms.Label(); this.StreetLabel = new System.Windows.Forms.Label(); + this.RentDateLabel = new System.Windows.Forms.Label(); + this.PaymentDateLabel = new System.Windows.Forms.Label(); + this.RentInsertButton = new System.Windows.Forms.Button(); + this.RentInputLabel = new System.Windows.Forms.Label(); + this.RentDateTimePicker = new System.Windows.Forms.DateTimePicker(); + this.PaymentDateTimePicker2 = new System.Windows.Forms.DateTimePicker(); this.SuspendLayout(); // // LocationListBox @@ -144,11 +150,68 @@ this.StreetLabel.TabIndex = 12; this.StreetLabel.Text = "Streetname"; // + // RentDateLabel + // + this.RentDateLabel.AutoSize = true; + this.RentDateLabel.Location = new System.Drawing.Point(529, 56); + this.RentDateLabel.Name = "RentDateLabel"; + this.RentDateLabel.Size = new System.Drawing.Size(73, 17); + this.RentDateLabel.TabIndex = 20; + this.RentDateLabel.Text = "Rent-Date"; + // + // PaymentDateLabel + // + this.PaymentDateLabel.AutoSize = true; + this.PaymentDateLabel.Location = new System.Drawing.Point(528, 110); + this.PaymentDateLabel.Name = "PaymentDateLabel"; + this.PaymentDateLabel.Size = new System.Drawing.Size(101, 17); + this.PaymentDateLabel.TabIndex = 18; + this.PaymentDateLabel.Text = "Payment_Date"; + // + // RentInsertButton + // + this.RentInsertButton.Location = new System.Drawing.Point(649, 210); + this.RentInsertButton.Name = "RentInsertButton"; + this.RentInsertButton.Size = new System.Drawing.Size(75, 23); + this.RentInsertButton.TabIndex = 17; + this.RentInsertButton.Text = "Insert"; + this.RentInsertButton.UseVisualStyleBackColor = true; + this.RentInsertButton.Click += new System.EventHandler(this.RentInsertButton_Click); + // + // RentInputLabel + // + this.RentInputLabel.AutoSize = true; + this.RentInputLabel.Location = new System.Drawing.Point(528, 13); + this.RentInputLabel.Name = "RentInputLabel"; + this.RentInputLabel.Size = new System.Drawing.Size(74, 17); + this.RentInputLabel.TabIndex = 13; + this.RentInputLabel.Text = "Rent-Input"; + // + // RentDateTimePicker + // + this.RentDateTimePicker.Location = new System.Drawing.Point(649, 53); + this.RentDateTimePicker.Name = "RentDateTimePicker"; + this.RentDateTimePicker.Size = new System.Drawing.Size(200, 22); + this.RentDateTimePicker.TabIndex = 21; + // + // PaymentDateTimePicker2 + // + this.PaymentDateTimePicker2.Location = new System.Drawing.Point(649, 110); + this.PaymentDateTimePicker2.Name = "PaymentDateTimePicker2"; + this.PaymentDateTimePicker2.Size = new System.Drawing.Size(200, 22); + this.PaymentDateTimePicker2.TabIndex = 22; + // // Dashboard // this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 16F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.ClientSize = new System.Drawing.Size(656, 366); + this.ClientSize = new System.Drawing.Size(861, 366); + this.Controls.Add(this.PaymentDateTimePicker2); + this.Controls.Add(this.RentDateTimePicker); + this.Controls.Add(this.RentDateLabel); + this.Controls.Add(this.PaymentDateLabel); + this.Controls.Add(this.RentInsertButton); + this.Controls.Add(this.RentInputLabel); this.Controls.Add(this.StreetLabel); this.Controls.Add(this.CapacityLabel); this.Controls.Add(this.NameLabel); @@ -182,5 +245,11 @@ private System.Windows.Forms.Label NameLabel; private System.Windows.Forms.Label CapacityLabel; private System.Windows.Forms.Label StreetLabel; + private System.Windows.Forms.Label RentDateLabel; + private System.Windows.Forms.Label PaymentDateLabel; + private System.Windows.Forms.Button RentInsertButton; + private System.Windows.Forms.Label RentInputLabel; + private System.Windows.Forms.DateTimePicker RentDateTimePicker; + private System.Windows.Forms.DateTimePicker PaymentDateTimePicker2; } } \ No newline at end of file diff --git a/csharp/marketconnectionNET2.0/db_AI-4_V3/db_AI-4/Dashboard.cs b/csharp/marketconnectionNET2.0/db_AI-4_V3/db_AI-4/Dashboard.cs index 345d7c1..71f1f59 100644 --- a/csharp/marketconnectionNET2.0/db_AI-4_V3/db_AI-4/Dashboard.cs +++ b/csharp/marketconnectionNET2.0/db_AI-4_V3/db_AI-4/Dashboard.cs @@ -61,5 +61,25 @@ namespace db_AI_4 } // Insert Locations end + + // Insert Rent start + private void RentInsertButton_Click(object sender, EventArgs e) + { + DataAccess db = new DataAccess(); + + int RentPriceID; + RentPriceID = 1; + + int MemberID; + MemberID = 1; + + + db.InsertRent(RentDateTimePicker.Value.Date.ToString("yyyyMMdd"), PaymentDateTimePicker2.Value.Date.ToString("yyyyMMdd"), RentPriceID, MemberID); + + RentDateTimePicker.Text = ""; + PaymentDateTimePicker2.Text = ""; + } + // Insert Rent end + } } diff --git a/csharp/marketconnectionNET2.0/db_AI-4_V3/db_AI-4/DataAccess.cs b/csharp/marketconnectionNET2.0/db_AI-4_V3/db_AI-4/DataAccess.cs index 8eb30db..a5efacd 100644 --- a/csharp/marketconnectionNET2.0/db_AI-4_V3/db_AI-4/DataAccess.cs +++ b/csharp/marketconnectionNET2.0/db_AI-4_V3/db_AI-4/DataAccess.cs @@ -46,7 +46,7 @@ namespace db_AI_4 // Insert Locations into Database start - internal void InsertLocations(string StreetName, int LocationCapacity, string LocationName) + public void InsertLocations(string StreetName, int LocationCapacity, string LocationName) { using (IDbConnection connection = new System.Data.SqlClient.SqlConnection(Helper.CnnVal("marketdb"))) { @@ -55,11 +55,26 @@ namespace db_AI_4 locations.Add(new GetLocations { streetname = StreetName, location_capacity = LocationCapacity, location_name = LocationName }); connection.Execute("INSERT INTO dbo.locations (streetname, location_capacity, location_name)" + - " VALUES (@StreetName, @LocationCapacity, @LocationName)", locations); + " VALUES (@streetName, @location_capacity, @location_name)", locations); + } + } + // Insert Locations into Database end + + // Insert Rents into Database start + public void InsertRent(string RentDate, string PaymentDate, int MemberID, int RentPriceID ) + { + using (IDbConnection connection = new System.Data.SqlClient.SqlConnection(Helper.CnnVal("marketdb"))) + { + List rents = new List(); + + rents.Add(new GetRents { rent_date = RentDate, payment_date = PaymentDate, member_id = MemberID, rent_price_id = RentPriceID, }); + + connection.Execute("INSERT INTO dbo.rents (rent_date, payment_date, member_id, rent_price_id)" + + " VALUES (@rent_date, @payment_date, @member_id, @rent_price_id )", rents); } } - // Insert Locations into Database end + // Insert Rents into Database end //CheckLogin function start public void CheckLogin(string Email_address, string Password) diff --git a/csharp/marketconnectionNET2.0/db_AI-4_V3/db_AI-4/GetRents.cs b/csharp/marketconnectionNET2.0/db_AI-4_V3/db_AI-4/GetRents.cs new file mode 100644 index 0000000..1c3a675 --- /dev/null +++ b/csharp/marketconnectionNET2.0/db_AI-4_V3/db_AI-4/GetRents.cs @@ -0,0 +1,31 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace db_AI_4 +{ + public class GetRents + { + public int rent_id { get; set; } + public string rent_date { get; set; } + public string payment_date { get; set; } + public int member_id { get; set; } + public int rent_price_id { get; set; } + + + + + + + public string RentInfo + { + get + { + return $"{ rent_date } { payment_date } {member_id} {rent_price_id} "; + } + + } + } +} diff --git a/csharp/marketconnectionNET2.0/db_AI-4_V3/db_AI-4/db_AI-4.csproj b/csharp/marketconnectionNET2.0/db_AI-4_V3/db_AI-4/db_AI-4.csproj index 50dd1ee..e5a2f6d 100644 --- a/csharp/marketconnectionNET2.0/db_AI-4_V3/db_AI-4/db_AI-4.csproj +++ b/csharp/marketconnectionNET2.0/db_AI-4_V3/db_AI-4/db_AI-4.csproj @@ -58,6 +58,7 @@ + Form From 9151ec1c0c5b28076a0b9f24781362f00a35908e Mon Sep 17 00:00:00 2001 From: Ismail Date: Thu, 27 Jul 2017 12:09:53 +0200 Subject: [PATCH 3/4] additions to the documentation --- doku/content.tex | 64 ++++++++++++++++++++++++++++++++++++------------ 1 file changed, 48 insertions(+), 16 deletions(-) diff --git a/doku/content.tex b/doku/content.tex index 5d75cd2..6d75ebe 100644 --- a/doku/content.tex +++ b/doku/content.tex @@ -415,24 +415,56 @@ Sobald die gesuchten Daten in der «TextBox» eingegeben wurden, werden die Informationen aufgerufen und in der «ListBox» aufgezeigt. -\subsubsection{Datenverarbeitung} +\subsubsection{Definition der Klassen} -Um die benötigten Daten von der Datenbank hinzuzufügen oder -zurückzuschicken, brauchen wir ein Model, in welches Daten eingefügt -werden können. Hierfür erstellten wir eine neue Klasse, die wir -«cities» nennen und die Struktur dieser Tabelle aus der Datenbank -abbilden. In der Klasse « dataaccess» bauen wir eine Methode auf, mit -der wir die Daten als Liste mit einer neuen Verbindung abrufen(und -danach wieder schliessen) können und haben die «ListBox» in der -«Dashboard» Klasse damit verbunden. Um die Verbindung zur « listBox» -zu vervollständigen, haben wir in der «cities» Klasse die Lese- -Eigenschaft «Fullinfo» eingesetzt, um nur die gewollten Daten -abzurufen. +Hier werden alle eingesetzten Klassen der Applikation vorgestellt +und definiert. -Mit einem connection.Query Funktion, haben wir wie in einer SQL- -Datenbank Funktionk, danach die Daten in der Klasse «dataaccess» -abgefragt. +\textbf{Programm} +\newline +Dient grundsätzlich als Eintrittspunkt der Applikation und hat sonst keine grosse Funktion. +\textbf{Helper} +\newline +Helper.cs dient dem Zweck, den Pfad der Datenbank nicht in jeder +Methode eingeben zu müssen. +Daführ haben wir in dieser Klasse den Verbindungsaufbau durch den Configuration.Manager definiert. +Den Pfad zur Datenbank muss dadurch nur ein einziges Mal in App.config definiert werden und kann dann durch die Helper.cs Klasse simpel aufgerufen werden. + + +\textbf{LoginForm} +\newline +Diese Klasse wurde für das Registrieren und Einloggen des Benutzers +mit einem dazugehörigen GUI von uns erstellt. +Dadurch können sich Benutzer durch das Eingeben der Email-Adresse und des Passwortes mit dem "Register-Button" Registrieren und durch ein zweites eingeben der Daten und betätigen des "Login-Button" auch gleich einloggen. +Nach dem Login wird auch gleich eine Nachricht der Applikation dem Benutzer mit dem Text "It worked" aufgezeigt, um den erfolgreichen Login zu melden. +Dadurch möchten wir die Funktion des einfüllen und Lesen der Daten aus der Datenbank aufzeigen. +Den Verbindungsaufbau in die Datenbank mit allen nötigen Funktion(Schreiben / Lesen) haben wir in die Klasse "DataAccess" ausgelagert. + +\textbf{Dashboard} +\newline +Auf dem Dashboard haben wir unseren Kern was Informationen herauslesen und wieder Eingeben belangt, erstellt. +In dieser Klasse werden die aus der Datenbank herausgelesenen Daten der locations / (Standorte) und rents / (Mieten) Tabellen im GUI aufgezeigt und /oder eingefügt. +Damit möchten wir einen Teil unserer Applikation und Datenbank abbilden, mit der Benutzer Standort heraussuchen können, neue Standorte hinzugefügt werden können und den Mietbeginn/ das Zahlungsdatum eingegeben werden kann. +Den Verbindungsaufbau in die Datenbank mit allen nötigen +Funktion(Schreiben / Lesen) haben wir in die Klasse "DataAccess" ausgelagert und vom GUI aus verankert. + +\textbf{DataAccess} +\newline +Mit der DataAccess Klasse konnten wir nahezu alle Datenbank relevanten Funktionen, die sonst in unseren GUI ausgeführt werden, in einer einzigen Klasse abbilden. +Darin haben wir den Aufruf der Datenbanktabellen mit den dazu benötigten SQl - Befehlen ausgeführt. +Dadurch wird SQl- Code nur in dieser Klasse aufgerufen und verwendet. + +\textbf{GetRents} +\newline + + +\textbf{GetMembers} +\newline + + +\textbf{GetLocations} +\newline \subsubsection{Problematik} @@ -442,7 +474,7 @@ abgefragt. -Datenvormatierung (Geburtstag) -\subsubsection{Referenzen und Addons} +\subsubsection{Referenzen und Addons/ Packages} Mit Dapper \cite{dbcs6} entschieden wir uns, nachdem wir ein wenig nachgeforscht haben und wir auf Stack Overflow fündig wurden. Da auf dieser Webseite Dapper genutzt wird und wir bisher immer gute From 59863aa9379be3e254320dda1c5965ec50cf3f42 Mon Sep 17 00:00:00 2001 From: Ismail Date: Thu, 27 Jul 2017 14:23:02 +0200 Subject: [PATCH 4/4] Add doku elements --- .../db_AI-4_V3/db_AI-4/GetRents.cs | 2 +- doku/content.tex | 17 ++++++++++++----- 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/csharp/marketconnectionNET2.0/db_AI-4_V3/db_AI-4/GetRents.cs b/csharp/marketconnectionNET2.0/db_AI-4_V3/db_AI-4/GetRents.cs index 1c3a675..586d8a3 100644 --- a/csharp/marketconnectionNET2.0/db_AI-4_V3/db_AI-4/GetRents.cs +++ b/csharp/marketconnectionNET2.0/db_AI-4_V3/db_AI-4/GetRents.cs @@ -18,7 +18,7 @@ namespace db_AI_4 - + // Not in use until we want to read that data out public string RentInfo { get diff --git a/doku/content.tex b/doku/content.tex index 6d75ebe..0da2bdc 100644 --- a/doku/content.tex +++ b/doku/content.tex @@ -387,7 +387,7 @@ der Platz reserviert wurde. \newline Diese weisst jedem Standort einen Preis zu. Dies ermöglicht es die Preise für jeden Standort flexibel zu halten und den regionalen -Interessensgruppen anzupassen. +Interessengruppen anzupassen. \subsection{C\#} @@ -399,7 +399,7 @@ Verarbeitung unsere Datenbank auf. \subsubsection{Connection} Um die Verbindung ( connectionstring ) abrufen zu können, erstellen -wir eine « helper» Klasse. Darin haben wir den Verbindungspfad +wir eine « Helper» Klasse. Darin haben wir den Verbindungspfad definiert der beim Verbindungsaufbau in App.config aufgerufen wird. Den definitiven (connectionstring) haben wir in «App.config» bestimmt. @@ -457,15 +457,22 @@ Dadurch wird SQl- Code nur in dieser Klasse aufgerufen und verwendet. \textbf{GetRents} \newline - +Um Daten herauszulesen oder zur Datenbank zu schicken, haben wir in C# ein Model der "rents" Tabelle erstellt die sie abbildet. +Damit nehmen wir jede Spalte der Tabelle entgegen. +Danach werden mit der "RentInfo" Methode nur diejenigen Spalten der Tabelle für unser GUI abgerufen, die wir auch wirklich benötigen. +Jedoch wird die "RentInfo" Methode noch nicht benötigt, da wir Daten nur einfügen und nicht herauslesen möchten. \textbf{GetMembers} \newline - +Um Daten herauszulesen oder zur Datenbank zu schicken, haben wir in C# ein Model der "members" Tabelle erstellt die sie abbildet. +Damit nehmen wir jede Spalte der Tabelle entgegen. +Danach werden mit der "MemberInfo" Methode nur diejenigen Spalten der Tabelle für unser GUI abgerufen, die wir auch wirklich benötigen,um die Login Daten zu überprüfen. \textbf{GetLocations} \newline - +Um Daten herauszulesen oder zur Datenbank zu schicken, haben wir in C# ein Model der "locations" Tabelle erstellt die sie abbildet. +Damit nehmen wir jede Spalte der Tabelle entgegen. +Danach werden mit der "LocationInfo" Methode nur diejenigen Spalten der Tabelle für unser GUI abgerufen, die wir auch wirklich benötigen. \subsubsection{Problematik} -Verbindungsaufbau