WorkLog: Show times.

This commit is contained in:
2020-06-15 22:45:31 +02:00
parent 81210f77b1
commit 2059053a03
2 changed files with 49 additions and 10 deletions

View File

@@ -39,13 +39,15 @@
this.btnPreviousDay = new System.Windows.Forms.Button();
this.dtToday = new System.Windows.Forms.DateTimePicker();
this.lsbWorkLog = new System.Windows.Forms.ListBox();
this.btnRename = new System.Windows.Forms.Button();
this.dtEnd = new System.Windows.Forms.DateTimePicker();
this.dtStart = new System.Windows.Forms.DateTimePicker();
this.txtDescription = new System.Windows.Forms.TextBox();
this.txtActivity = new System.Windows.Forms.TextBox();
this.btnDelete = new System.Windows.Forms.Button();
this.btnAdd = new System.Windows.Forms.Button();
this.btnRename = new System.Windows.Forms.Button();
this.lblWorkLogItemTime = new System.Windows.Forms.Label();
this.lblWorkLogTime = new System.Windows.Forms.Label();
((System.ComponentModel.ISupportInitialize)(this.splitWindow)).BeginInit();
this.splitWindow.Panel1.SuspendLayout();
this.splitWindow.Panel2.SuspendLayout();
@@ -60,6 +62,7 @@
//
// splitWindow.Panel1
//
this.splitWindow.Panel1.Controls.Add(this.lblWorkLogTime);
this.splitWindow.Panel1.Controls.Add(this.btnExport);
this.splitWindow.Panel1.Controls.Add(this.btnImport);
this.splitWindow.Panel1.Controls.Add(this.cboImporters);
@@ -73,6 +76,7 @@
//
// splitWindow.Panel2
//
this.splitWindow.Panel2.Controls.Add(this.lblWorkLogItemTime);
this.splitWindow.Panel2.Controls.Add(this.btnRename);
this.splitWindow.Panel2.Controls.Add(this.dtEnd);
this.splitWindow.Panel2.Controls.Add(this.dtStart);
@@ -194,6 +198,17 @@
this.lsbWorkLog.DrawItem += new System.Windows.Forms.DrawItemEventHandler(this.lsbWorkLog_DrawItem);
this.lsbWorkLog.SelectedIndexChanged += new System.EventHandler(this.lsbWorkLog_SelectedIndexChanged);
//
// btnRename
//
this.btnRename.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.btnRename.Location = new System.Drawing.Point(207, 3);
this.btnRename.Name = "btnRename";
this.btnRename.Size = new System.Drawing.Size(56, 22);
this.btnRename.TabIndex = 6;
this.btnRename.Text = "Rename";
this.btnRename.UseVisualStyleBackColor = true;
this.btnRename.Click += new System.EventHandler(this.btnRename_Click);
//
// dtEnd
//
this.dtEnd.CustomFormat = "yyyy-MM-dd HH:mm:ss";
@@ -259,16 +274,27 @@
this.btnAdd.UseVisualStyleBackColor = true;
this.btnAdd.Click += new System.EventHandler(this.btnAdd_Click);
//
// btnRename
// lblWorkLogItemTime
//
this.btnRename.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.btnRename.Location = new System.Drawing.Point(207, 3);
this.btnRename.Name = "btnRename";
this.btnRename.Size = new System.Drawing.Size(56, 22);
this.btnRename.TabIndex = 6;
this.btnRename.Text = "Rename";
this.btnRename.UseVisualStyleBackColor = true;
this.btnRename.Click += new System.EventHandler(this.btnRename_Click);
this.lblWorkLogItemTime.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.lblWorkLogItemTime.Location = new System.Drawing.Point(136, 70);
this.lblWorkLogItemTime.Name = "lblWorkLogItemTime";
this.lblWorkLogItemTime.Size = new System.Drawing.Size(127, 20);
this.lblWorkLogItemTime.TabIndex = 7;
this.lblWorkLogItemTime.Text = "00:00:00";
this.lblWorkLogItemTime.TextAlign = System.Drawing.ContentAlignment.BottomRight;
//
// lblWorkLogTime
//
this.lblWorkLogTime.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.lblWorkLogTime.Location = new System.Drawing.Point(193, 36);
this.lblWorkLogTime.Name = "lblWorkLogTime";
this.lblWorkLogTime.Size = new System.Drawing.Size(246, 21);
this.lblWorkLogTime.TabIndex = 9;
this.lblWorkLogTime.Text = "00:00:00";
this.lblWorkLogTime.TextAlign = System.Drawing.ContentAlignment.BottomRight;
//
// FrmWorkLog
//
@@ -309,5 +335,7 @@
private System.Windows.Forms.Button btnExport;
private System.Windows.Forms.Button btnImport;
private System.Windows.Forms.Button btnRename;
private System.Windows.Forms.Label lblWorkLogItemTime;
private System.Windows.Forms.Label lblWorkLogTime;
}
}

View File

@@ -363,6 +363,7 @@ namespace VAR.Toolbox.UI.Tools.WorkLog
dtEnd.Value = DateTime.UtcNow.Date;
txtActivity.Text = string.Empty;
txtDescription.Text = string.Empty;
lblWorkLogItemTime.Text = string.Empty;
WorkLogItem_EnableButtons(false);
return;
}
@@ -371,6 +372,7 @@ namespace VAR.Toolbox.UI.Tools.WorkLog
dtEnd.Value = item.DateEnd;
txtActivity.Text = item.Activity;
txtDescription.Text = item.Description;
lblWorkLogItemTime.Text = (item.DateEnd - item.DateStart).ToString();
WorkLogItem_EnableButtons(true);
_currentWorkLogItem = item;
@@ -422,6 +424,15 @@ namespace VAR.Toolbox.UI.Tools.WorkLog
lsbWorkLog.Items.Clear();
lsbWorkLog.Items.AddRange(rows.ToArray());
lsbWorkLog.TopIndex = topIndex;
DateTime dateDay = new DateTime(year, month, day, 0, 0, 0);
TimeSpan tsTotalTime = new TimeSpan(0);
foreach (WorkLogItem item in items)
{
if (item.DateStart.Date != dateDay) { continue; }
tsTotalTime += (item.DateEnd - item.DateStart);
}
lblWorkLogTime.Text = tsTotalTime.ToString();
}
#endregion Private methods