diff --git a/TimeTable/TimeTable.csproj b/TimeTable/TimeTable.csproj
index ceb5a96..c0a046f 100644
--- a/TimeTable/TimeTable.csproj
+++ b/TimeTable/TimeTable.csproj
@@ -11,6 +11,7 @@
+
diff --git a/TimeTable/controll/SqliteCommands.cs b/TimeTable/controll/SqliteCommands.cs
index 91d245f..8068cba 100644
--- a/TimeTable/controll/SqliteCommands.cs
+++ b/TimeTable/controll/SqliteCommands.cs
@@ -17,7 +17,7 @@ namespace TimeTable.controll {
public static UidCommand InsertCmd(DateTime start) {
string uid = Guid.NewGuid().ToString();
- return BuildInsertCommand(uid, "uid, start", uid + "," + start.ToString());
+ return BuildInsertCommand(uid, "uid, start", "'" + uid + "','" + start.ToString() + "'");
}
private static UidCommand BuildInsertCommand(string uid, string fields, string values) {
@@ -47,7 +47,7 @@ namespace TimeTable.controll {
string fieldValues = "";
for (int i = 0; i < keys.Length; i++) {
- fieldValues += keys[i] + " = " + values[i] + ",";
+ fieldValues += "'" + keys[i] + "' = '" + values[i] + "',";
}
fieldValues = fieldValues.TrimEnd(',');
diff --git a/TimeTable/view/Main.Designer.cs b/TimeTable/view/Main.Designer.cs
index 339ada0..e1385d4 100644
--- a/TimeTable/view/Main.Designer.cs
+++ b/TimeTable/view/Main.Designer.cs
@@ -1,30 +1,21 @@
using Microsoft.Data.SqlClient;
using Microsoft.Data.Sqlite;
+using System.Data;
+using System.Data.Common;
+using System.Data.SQLite;
using System.Drawing;
+using System.Windows.Forms;
using TimeTable.controll;
using TimeTable.model;
-namespace TimeTable
-{
+namespace TimeTable {
partial class Main
{
///
/// Required designer variable.
///
- private System.ComponentModel.IContainer components = null;
+ private string sqlConnectionString = "Data Source=" + Directory.GetCurrentDirectory() + "\\sqllite.db";
- ///
- /// 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
@@ -33,6 +24,7 @@ namespace TimeTable
/// the contents of this method with the code editor.
///
private void InitializeComponent() {
+ components = new System.ComponentModel.Container();
btnPanel = new Panel();
btnTaskStop = new Button();
btnTaskStart = new Button();
@@ -40,16 +32,14 @@ namespace TimeTable
btnStart = new Button();
tableView = new Panel();
taskTimeGridView = new DataGridView();
+ bindingSource = new BindingSource(components);
+ con = new SQLiteConnection();
+ dataAdapter = new SQLiteDataAdapter();
btnPanel.SuspendLayout();
tableView.SuspendLayout();
((System.ComponentModel.ISupportInitialize)taskTimeGridView).BeginInit();
+ ((System.ComponentModel.ISupportInitialize)bindingSource).BeginInit();
SuspendLayout();
-
-
- sqlConnectionString = "Data Source=" + Directory.GetCurrentDirectory() + "\\sqllite.db";
- SqliteCommands.CreateTableIfNotExists(sqlConnectionString);
- dataAdapter = new SqlDataAdapter("SELECT * from timetable", sqlConnectionString);
-
//
// btnPanel
//
@@ -61,7 +51,7 @@ namespace TimeTable
btnPanel.Dock = DockStyle.Left;
btnPanel.Location = new Point(0, 0);
btnPanel.Name = "btnPanel";
- btnPanel.Size = new Size(233, 171);
+ btnPanel.Size = new Size(233, 378);
btnPanel.TabIndex = 0;
//
// btnTaskStop
@@ -72,8 +62,6 @@ namespace TimeTable
btnTaskStop.TabIndex = 3;
btnTaskStop.Text = "Task Stop";
btnTaskStop.UseVisualStyleBackColor = true;
- btnTaskStart.Click += this.btnTaskStopClick;
-
//
// btnTaskStart
//
@@ -83,7 +71,7 @@ namespace TimeTable
btnTaskStart.TabIndex = 2;
btnTaskStart.Text = "Task Start";
btnTaskStart.UseVisualStyleBackColor = true;
- btnTaskStart.Click += this.btnTaskStartClick;
+ btnTaskStart.Click += btnStopResumeClick;
//
// btnStopResume
//
@@ -93,7 +81,6 @@ namespace TimeTable
btnStopResume.TabIndex = 1;
btnStopResume.Text = "Stop/Resume";
btnStopResume.UseVisualStyleBackColor = true;
- btnTaskStart.Click += this.btnStopResumeClick;
//
// btnStart
//
@@ -103,34 +90,59 @@ namespace TimeTable
btnStart.TabIndex = 0;
btnStart.Text = "Start";
btnStart.UseVisualStyleBackColor = true;
- btnStart.Click += this.btnStartClick;
+ btnStart.Click += btnStartClick;
//
// tableView
//
tableView.AutoSizeMode = AutoSizeMode.GrowAndShrink;
tableView.Controls.Add(taskTimeGridView);
- tableView.Dock = DockStyle.Right;
- tableView.Location = new Point(239, 0);
+ tableView.Dock = DockStyle.Fill;
+ tableView.Location = new Point(233, 0);
tableView.Name = "tableView";
- tableView.Size = new Size(477, 171);
+ tableView.Size = new Size(631, 378);
tableView.TabIndex = 1;
+
//
// taskTimeGridView
//
+ taskTimeGridView.AutoGenerateColumns = true;
taskTimeGridView.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize;
+ taskTimeGridView.DataSource = bindingSource;
taskTimeGridView.Dock = DockStyle.Fill;
taskTimeGridView.Location = new Point(0, 0);
taskTimeGridView.Name = "taskTimeGridView";
taskTimeGridView.RowHeadersWidth = 51;
- taskTimeGridView.Size = new Size(477, 171);
+ taskTimeGridView.Size = new Size(631, 378);
taskTimeGridView.TabIndex = 0;
- taskTimeGridView.DataSource = dataAdapter;
+ taskTimeGridView.CellContentDoubleClick += timetableEditDoubleClick;
+ //
+ // con
+ //
+ con.BusyTimeout = 0;
+ //con.ConnectionString = sqlConnectionString;
+ con.ConnectionString = sqlConnectionString;
+ con.DefaultDbType = null;
+ con.DefaultMaximumSleepTime = 150;
+ con.DefaultTimeout = 30;
+ con.DefaultTypeName = null;
+ con.Flags = SQLiteConnectionFlags.LogCallbackException | SQLiteConnectionFlags.LogModuleException | SQLiteConnectionFlags.BindInvariantDecimal | SQLiteConnectionFlags.GetInvariantDecimal | SQLiteConnectionFlags.AggressiveDisposal;
+ con.GetPasswordCallback = null;
+ con.ParseViaFramework = false;
+ con.PrepareRetries = 3;
+ con.ProgressOps = 0;
+ con.StepRetries = 40;
+ con.Tag = null;
+ con.TraceFlags = SQLiteTraceFlags.SQLITE_TRACE_NONE;
+ con.VfsName = null;
+ con.WaitTimeout = 30000;
+ // bindingSource.DataSource = createDataTable();
+ bindingSource.DataSource = createDataTable();
//
// Main
//
AutoScaleDimensions = new SizeF(8F, 20F);
AutoScaleMode = AutoScaleMode.Font;
- ClientSize = new Size(716, 171);
+ ClientSize = new Size(864, 378);
Controls.Add(tableView);
Controls.Add(btnPanel);
Name = "Main";
@@ -138,9 +150,24 @@ namespace TimeTable
btnPanel.ResumeLayout(false);
tableView.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)taskTimeGridView).EndInit();
+ ((System.ComponentModel.ISupportInitialize)bindingSource).EndInit();
ResumeLayout(false);
}
+ private DataTable createDataTable() {
+ DataTable table = new DataTable();
+ table.Locale = new System.Globalization.CultureInfo("de-de");
+ SQLiteCommand sqlCommand = new SQLiteCommand("select * from timetable;", con);
+ dataAdapter.SelectCommand = sqlCommand;
+ dataAdapter.Fill(table);
+ return table;
+ }
+
+ private void timetableEditDoubleClick(object sender, DataGridViewCellEventArgs e) {
+ DataGridViewRow row = taskTimeGridView.Rows[0];
+ string uid = row.Cells[0].Value();
+ }
+
private void executeSql(string command) {
SqliteConnection con = new SqliteConnection(sqlConnectionString);
SqliteCommand sqliteCmd = con.CreateCommand();
@@ -151,6 +178,8 @@ namespace TimeTable
}
+
+
private void btnStartClick(object sender, EventArgs e) {
UidCommand uidCmd = SqliteCommands.InsertCmd(DateTime.Now);
uid = uidCmd.uid;
@@ -164,7 +193,6 @@ namespace TimeTable
private void btnStopResumeClick(object sender, EventArgs e) {
String cmd = SqliteCommands.UpdateEndCmd(uid, DateTime.Now);
executeSql(cmd);
- taskTimeGridView.DataSource = dataAdapter;
}
private void btnTaskStopClick(object sender, EventArgs e) {
@@ -183,7 +211,9 @@ namespace TimeTable
private Panel tableView;
private DataGridView taskTimeGridView;
private string uid;
- string sqlConnectionString;
- private SqlDataAdapter dataAdapter;
+ private BindingSource bindingSource;
+ private SQLiteConnection con;
+ private SQLiteDataAdapter dataAdapter;
+ private System.ComponentModel.IContainer components;
}
}
diff --git a/TimeTable/view/Main.resx b/TimeTable/view/Main.resx
index 8b2ff64..d3f3187 100644
--- a/TimeTable/view/Main.resx
+++ b/TimeTable/view/Main.resx
@@ -117,4 +117,13 @@
System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+ 381, 17
+
+
+ 161, 17
+
+
+ 241, 17
+
\ No newline at end of file
diff --git a/TimeTable/view/RowEdit.Designer.cs b/TimeTable/view/RowEdit.Designer.cs
new file mode 100644
index 0000000..891ffd6
--- /dev/null
+++ b/TimeTable/view/RowEdit.Designer.cs
@@ -0,0 +1,167 @@
+namespace TimeTable.view {
+ partial class RowEdit {
+ ///
+ /// 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() {
+ uidTxt = new Label();
+ startTxt = new Label();
+ EndTxt = new Label();
+ textTxt = new Label();
+ uidLbl = new Label();
+ startTimePicker = new DateTimePicker();
+ endTimePicker = new DateTimePicker();
+ textBox = new TextBox();
+ btnSave = new Button();
+ btnCancel = new Button();
+ SuspendLayout();
+ //
+ // uidTxt
+ //
+ uidTxt.AutoSize = true;
+ uidTxt.Location = new Point(12, 20);
+ uidTxt.Name = "uidTxt";
+ uidTxt.Size = new Size(34, 20);
+ uidTxt.TabIndex = 0;
+ uidTxt.Text = "UID";
+ //
+ // startTxt
+ //
+ startTxt.AutoSize = true;
+ startTxt.Location = new Point(12, 54);
+ startTxt.Name = "startTxt";
+ startTxt.Size = new Size(40, 20);
+ startTxt.TabIndex = 1;
+ startTxt.Text = "Start";
+ //
+ // EndTxt
+ //
+ EndTxt.AutoSize = true;
+ EndTxt.Location = new Point(12, 88);
+ EndTxt.Name = "EndTxt";
+ EndTxt.Size = new Size(34, 20);
+ EndTxt.TabIndex = 2;
+ EndTxt.Text = "End";
+ //
+ // textTxt
+ //
+ textTxt.AutoSize = true;
+ textTxt.Location = new Point(12, 126);
+ textTxt.Name = "textTxt";
+ textTxt.Size = new Size(36, 20);
+ textTxt.TabIndex = 3;
+ textTxt.Text = "Text";
+ //
+ // uidLbl
+ //
+ uidLbl.AutoSize = true;
+ uidLbl.Location = new Point(71, 20);
+ uidLbl.Name = "uidLbl";
+ uidLbl.Size = new Size(34, 20);
+ uidLbl.TabIndex = 4;
+ uidLbl.Text = "UID";
+ //
+ // startTimePicker
+ //
+ startTimePicker.Location = new Point(71, 49);
+ startTimePicker.Name = "startTimePicker";
+ startTimePicker.Size = new Size(250, 27);
+ startTimePicker.TabIndex = 5;
+ //
+ // endTimePicker
+ //
+ endTimePicker.Location = new Point(71, 88);
+ endTimePicker.Name = "endTimePicker";
+ endTimePicker.Size = new Size(250, 27);
+ endTimePicker.TabIndex = 6;
+ //
+ // textBox
+ //
+ textBox.Location = new Point(71, 126);
+ textBox.Name = "textBox";
+ textBox.Size = new Size(250, 27);
+ textBox.TabIndex = 7;
+ //
+ // btnSave
+ //
+ btnSave.Location = new Point(134, 173);
+ btnSave.Name = "btnSave";
+ btnSave.Size = new Size(101, 30);
+ btnSave.TabIndex = 8;
+ btnSave.Text = "Save";
+ btnSave.UseVisualStyleBackColor = true;
+ btnSave.Click += button1_Click;
+ //
+ // btnCancel
+ //
+ btnCancel.Location = new Point(241, 173);
+ btnCancel.Name = "btnCancel";
+ btnCancel.Size = new Size(101, 30);
+ btnCancel.TabIndex = 9;
+ btnCancel.Text = "Cancel";
+ btnCancel.UseVisualStyleBackColor = true;
+ //
+ // RowEdit
+ //
+ AutoScaleDimensions = new SizeF(8F, 20F);
+ AutoScaleMode = AutoScaleMode.Font;
+ ClientSize = new Size(354, 215);
+ Controls.Add(btnCancel);
+ Controls.Add(btnSave);
+ Controls.Add(textBox);
+ Controls.Add(endTimePicker);
+ Controls.Add(startTimePicker);
+ Controls.Add(uidLbl);
+ Controls.Add(textTxt);
+ Controls.Add(EndTxt);
+ Controls.Add(startTxt);
+ Controls.Add(uidTxt);
+ FormBorderStyle = FormBorderStyle.FixedSingle;
+ Name = "RowEdit";
+ Text = "RowEdit";
+ ResumeLayout(false);
+ PerformLayout();
+ }
+
+ #endregion
+
+ public void setData(string uid, string start, string end, string text) {
+ uidLbl.Text = uid;
+ startTimePicker.Text = start;
+ endTimePicker.Text = end;
+ textBox.Text = text;
+ }
+
+ private Label uidTxt;
+ private Label startTxt;
+ private Label EndTxt;
+ private Label textTxt;
+ private Label uidLbl;
+ private DateTimePicker startTimePicker;
+ private DateTimePicker endTimePicker;
+ private TextBox textBox;
+ private Button btnSave;
+ private Button btnCancel;
+ }
+
+
+}
\ No newline at end of file
diff --git a/TimeTable/view/RowEdit.cs b/TimeTable/view/RowEdit.cs
new file mode 100644
index 0000000..d66da88
--- /dev/null
+++ b/TimeTable/view/RowEdit.cs
@@ -0,0 +1,11 @@
+namespace TimeTable.view {
+ public partial class RowEdit : Form {
+ public RowEdit() {
+ InitializeComponent();
+ }
+
+ private void button1_Click(object sender, EventArgs e) {
+
+ }
+ }
+}
diff --git a/TimeTable/view/RowEdit.resx b/TimeTable/view/RowEdit.resx
new file mode 100644
index 0000000..8b2ff64
--- /dev/null
+++ b/TimeTable/view/RowEdit.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