This commit is contained in:
Ismail 2017-07-20 21:36:44 +02:00
commit f31eb0c921
8 changed files with 237 additions and 5 deletions

View File

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<connectionStrings>
<add name="marketdb" connectionString="Data Source=.\SQLEXPRESS;Initial Catalog=marketdb;Integrated Security=True" providerName="System.Data.SqlClient"/>
<add name="marketdb" connectionString="Data Source=.\SQL2016;Initial Catalog=marketdb;Integrated Security=True" providerName="System.Data.SqlClient"/>
</connectionStrings>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5.2" />

View File

@ -31,6 +31,19 @@
this.locationbox = new System.Windows.Forms.ListBox();
this.LocationName = new System.Windows.Forms.TextBox();
this.search = new System.Windows.Forms.Button();
this.firstnameInsText = new System.Windows.Forms.TextBox();
this.lastnameInsText = new System.Windows.Forms.TextBox();
this.firstnamelabel = new System.Windows.Forms.Label();
this.lastnamelabel = new System.Windows.Forms.Label();
this.date_of_birthinslabel = new System.Windows.Forms.Label();
this.streetnameInsText = new System.Windows.Forms.TextBox();
this.label1 = new System.Windows.Forms.Label();
this.label2 = new System.Windows.Forms.Label();
this.streetnumberInsText = new System.Windows.Forms.TextBox();
this.InsertData = new System.Windows.Forms.Label();
this.ReadInsetData = new System.Windows.Forms.Label();
this.insertRecordButton = new System.Windows.Forms.Button();
this.dateTimePicker = new System.Windows.Forms.DateTimePicker();
this.SuspendLayout();
//
// locationbox
@ -39,7 +52,7 @@
this.locationbox.ItemHeight = 16;
this.locationbox.Location = new System.Drawing.Point(12, 79);
this.locationbox.Name = "locationbox";
this.locationbox.Size = new System.Drawing.Size(120, 84);
this.locationbox.Size = new System.Drawing.Size(232, 340);
this.locationbox.TabIndex = 0;
//
// LocationName
@ -54,7 +67,7 @@
//
// search
//
this.search.Location = new System.Drawing.Point(139, 139);
this.search.Location = new System.Drawing.Point(169, 28);
this.search.Name = "search";
this.search.Size = new System.Drawing.Size(75, 23);
this.search.TabIndex = 2;
@ -62,11 +75,134 @@
this.search.UseVisualStyleBackColor = true;
this.search.Click += new System.EventHandler(this.search_Click);
//
// firstnameInsText
//
this.firstnameInsText.Location = new System.Drawing.Point(435, 81);
this.firstnameInsText.Name = "firstnameInsText";
this.firstnameInsText.Size = new System.Drawing.Size(100, 22);
this.firstnameInsText.TabIndex = 4;
//
// lastnameInsText
//
this.lastnameInsText.Location = new System.Drawing.Point(435, 131);
this.lastnameInsText.Name = "lastnameInsText";
this.lastnameInsText.Size = new System.Drawing.Size(100, 22);
this.lastnameInsText.TabIndex = 5;
//
// firstnamelabel
//
this.firstnamelabel.AutoSize = true;
this.firstnamelabel.Location = new System.Drawing.Point(323, 81);
this.firstnamelabel.Name = "firstnamelabel";
this.firstnamelabel.Size = new System.Drawing.Size(70, 17);
this.firstnamelabel.TabIndex = 7;
this.firstnamelabel.Text = "Firstname";
//
// lastnamelabel
//
this.lastnamelabel.AutoSize = true;
this.lastnamelabel.Location = new System.Drawing.Point(323, 131);
this.lastnamelabel.Name = "lastnamelabel";
this.lastnamelabel.Size = new System.Drawing.Size(70, 17);
this.lastnamelabel.TabIndex = 8;
this.lastnamelabel.Text = "Lastname";
//
// date_of_birthinslabel
//
this.date_of_birthinslabel.AutoSize = true;
this.date_of_birthinslabel.Location = new System.Drawing.Point(323, 186);
this.date_of_birthinslabel.Name = "date_of_birthinslabel";
this.date_of_birthinslabel.Size = new System.Drawing.Size(68, 17);
this.date_of_birthinslabel.TabIndex = 9;
this.date_of_birthinslabel.Text = "Birthdday";
//
// streetnameInsText
//
this.streetnameInsText.Location = new System.Drawing.Point(435, 236);
this.streetnameInsText.Name = "streetnameInsText";
this.streetnameInsText.Size = new System.Drawing.Size(100, 22);
this.streetnameInsText.TabIndex = 10;
//
// label1
//
this.label1.AutoSize = true;
this.label1.Location = new System.Drawing.Point(323, 236);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(81, 17);
this.label1.TabIndex = 12;
this.label1.Text = "Streetname";
//
// label2
//
this.label2.AutoSize = true;
this.label2.Location = new System.Drawing.Point(323, 289);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(94, 17);
this.label2.TabIndex = 13;
this.label2.Text = "Streetnumber";
this.label2.Click += new System.EventHandler(this.label2_Click);
//
// streetnumberInsText
//
this.streetnumberInsText.Location = new System.Drawing.Point(435, 289);
this.streetnumberInsText.Name = "streetnumberInsText";
this.streetnumberInsText.Size = new System.Drawing.Size(100, 22);
this.streetnumberInsText.TabIndex = 14;
//
// InsertData
//
this.InsertData.AutoSize = true;
this.InsertData.Location = new System.Drawing.Point(326, 28);
this.InsertData.Name = "InsertData";
this.InsertData.Size = new System.Drawing.Size(73, 17);
this.InsertData.TabIndex = 15;
this.InsertData.Text = "InsertData";
//
// ReadInsetData
//
this.ReadInsetData.AutoSize = true;
this.ReadInsetData.Location = new System.Drawing.Point(654, 28);
this.ReadInsetData.Name = "ReadInsetData";
this.ReadInsetData.Size = new System.Drawing.Size(107, 17);
this.ReadInsetData.TabIndex = 16;
this.ReadInsetData.Text = "ReadInsertData";
//
// insertRecordButton
//
this.insertRecordButton.Location = new System.Drawing.Point(435, 359);
this.insertRecordButton.Name = "insertRecordButton";
this.insertRecordButton.Size = new System.Drawing.Size(75, 23);
this.insertRecordButton.TabIndex = 17;
this.insertRecordButton.Text = "Insert";
this.insertRecordButton.UseVisualStyleBackColor = true;
this.insertRecordButton.Click += new System.EventHandler(this.insertRecordButton_Click);
//
// dateTimePicker
//
this.dateTimePicker.Location = new System.Drawing.Point(435, 186);
this.dateTimePicker.Name = "dateTimePicker";
this.dateTimePicker.Size = new System.Drawing.Size(200, 22);
this.dateTimePicker.TabIndex = 18;
this.dateTimePicker.ValueChanged += new System.EventHandler(this.dateTimePicker_ValueChanged);
//
// Dashboard
//
this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 16F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(506, 278);
this.ClientSize = new System.Drawing.Size(987, 479);
this.Controls.Add(this.dateTimePicker);
this.Controls.Add(this.insertRecordButton);
this.Controls.Add(this.ReadInsetData);
this.Controls.Add(this.InsertData);
this.Controls.Add(this.streetnumberInsText);
this.Controls.Add(this.label2);
this.Controls.Add(this.label1);
this.Controls.Add(this.streetnameInsText);
this.Controls.Add(this.date_of_birthinslabel);
this.Controls.Add(this.lastnamelabel);
this.Controls.Add(this.firstnamelabel);
this.Controls.Add(this.lastnameInsText);
this.Controls.Add(this.firstnameInsText);
this.Controls.Add(this.search);
this.Controls.Add(this.LocationName);
this.Controls.Add(this.locationbox);
@ -82,5 +218,18 @@
private System.Windows.Forms.ListBox locationbox;
private System.Windows.Forms.TextBox LocationName;
private System.Windows.Forms.Button search;
private System.Windows.Forms.TextBox firstnameInsText;
private System.Windows.Forms.TextBox lastnameInsText;
private System.Windows.Forms.Label firstnamelabel;
private System.Windows.Forms.Label lastnamelabel;
private System.Windows.Forms.Label date_of_birthinslabel;
private System.Windows.Forms.TextBox streetnameInsText;
private System.Windows.Forms.Label label1;
private System.Windows.Forms.Label label2;
private System.Windows.Forms.TextBox streetnumberInsText;
private System.Windows.Forms.Label InsertData;
private System.Windows.Forms.Label ReadInsetData;
private System.Windows.Forms.Button insertRecordButton;
private System.Windows.Forms.DateTimePicker dateTimePicker;
}
}

View File

@ -35,6 +35,29 @@ namespace marketconnectionNET
UpdateBinding();
}
private void label2_Click(object sender, EventArgs e)
{
}
private void insertRecordButton_Click(object sender, EventArgs e)
{
dataaccess db = new dataaccess();
db.InsertPerson(firstnameInsText.Text, lastnameInsText.Text, dateTimePicker.Text, streetnameInsText.Text, streetnumberInsText.Text);
firstnameInsText.Text = "";
lastnameInsText.Text = "";
dateTimePicker.Text = "";
streetnameInsText.Text = "";
streetnumberInsText.Text = "";
}
private void dateTimePicker_ValueChanged(object sender, EventArgs e)
{
}
}
}

View File

@ -6,6 +6,7 @@ using System.Threading.Tasks;
using Dapper;
using System.Data;
using System.Data.SqlClient;
using System.Windows.Forms;
namespace marketconnectionNET
{
@ -22,5 +23,20 @@ namespace marketconnectionNET
}
}
public void InsertPerson(string Firstname, string Lastname, string Date_of_birth, string Streetname, string Streetnumber)
{
using (IDbConnection connection = new System.Data.SqlClient.SqlConnection(helper.CnnVal("marketdb")))
{
//person newPerson = new person { firstname = Firstname, lastname = Lastname, date_of_birth = Date_of_birth, streetname = Streetname, streetnumber = Streetnumber };
List<person> people = new List<person>();
people.Add(new person { firstname = Firstname, lastname = Lastname, date_of_birth = Date_of_birth, streetname = Streetname, streetnumber = Streetnumber, });
connection.Execute("insert into dbo.persons (firstname, lastname, date_of_birth, streetname, streetnumber)" +
" values (@firstname, @lastname, @date_of_birth, @streetname, @streetnumber) ", people);
}
}
}
}

View File

@ -53,6 +53,8 @@
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="person.cs" />
<Compile Include="rentview.cs" />
<Compile Include="Dashboard.cs">
<SubType>Form</SubType>
</Compile>

View File

@ -0,0 +1,28 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace marketconnectionNET
{
public class person
{
public string firstname { get; set; }
public string lastname { get; set; }
public string date_of_birth { get; set; }
public string streetname { get; set; }
public string streetnumber { get; set; }
public string PersonInfo
{
get
{
return $"{ firstname } { lastname } {date_of_birth} {streetname} {streetnumber} ";
}
}
}
}

View File

@ -0,0 +1,14 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace marketconnectionNET
{
public class rentview
{
// IQueryable<string> query =
// from
}
}

View File

@ -78,7 +78,7 @@ if not exists (select * from sysobjects where name='persons')
lastname varchar(50) not null,
date_of_birth date not null,
streetname varchar(50) not null,
streetnumber int,
streetnumber varchar(4) not null,
city_id int not null,
country_id int not null,
constraint person_pk primary key (person_id),