增加加班信息
This commit is contained in:
parent
715b90972d
commit
3dc4df4e5b
|
@ -24,5 +24,9 @@ namespace CalendarNotepad.Models
|
|||
/// 工作类型。如正常上班,休假,加班等
|
||||
/// </summary>
|
||||
public string? WorkType { get; set; }
|
||||
/// <summary>
|
||||
/// 加班信息
|
||||
/// </summary>
|
||||
public string? Workout { get; set; }
|
||||
}
|
||||
}
|
||||
|
|
106
CalendarNotepad/WorkMain.Designer.cs
generated
106
CalendarNotepad/WorkMain.Designer.cs
generated
|
@ -28,6 +28,12 @@
|
|||
tabControl1 = new TabControl();
|
||||
tpWorkManage = new TabPage();
|
||||
splitContainer1 = new SplitContainer();
|
||||
groupBox1 = new GroupBox();
|
||||
C_WorkOut = new FlowLayoutPanel();
|
||||
radioButton9 = new RadioButton();
|
||||
radioButton6 = new RadioButton();
|
||||
radioButton8 = new RadioButton();
|
||||
radioButton7 = new RadioButton();
|
||||
flowLayoutPanel1 = new FlowLayoutPanel();
|
||||
btSave = new Button();
|
||||
btReset = new Button();
|
||||
|
@ -46,6 +52,8 @@
|
|||
splitContainer1.Panel1.SuspendLayout();
|
||||
splitContainer1.Panel2.SuspendLayout();
|
||||
splitContainer1.SuspendLayout();
|
||||
groupBox1.SuspendLayout();
|
||||
C_WorkOut.SuspendLayout();
|
||||
flowLayoutPanel1.SuspendLayout();
|
||||
gbWorkTypes.SuspendLayout();
|
||||
C_WorkTypes.SuspendLayout();
|
||||
|
@ -58,7 +66,7 @@
|
|||
tabControl1.Location = new Point(0,0);
|
||||
tabControl1.Name = "tabControl1";
|
||||
tabControl1.SelectedIndex = 0;
|
||||
tabControl1.Size = new Size(740,435);
|
||||
tabControl1.Size = new Size(695,490);
|
||||
tabControl1.TabIndex = 0;
|
||||
//
|
||||
// tpWorkManage
|
||||
|
@ -67,7 +75,7 @@
|
|||
tpWorkManage.Location = new Point(4,26);
|
||||
tpWorkManage.Name = "tpWorkManage";
|
||||
tpWorkManage.Padding = new Padding(3);
|
||||
tpWorkManage.Size = new Size(732,405);
|
||||
tpWorkManage.Size = new Size(687,460);
|
||||
tpWorkManage.TabIndex = 1;
|
||||
tpWorkManage.Text = "录入记录";
|
||||
tpWorkManage.UseVisualStyleBackColor = true;
|
||||
|
@ -81,6 +89,7 @@
|
|||
//
|
||||
// splitContainer1.Panel1
|
||||
//
|
||||
splitContainer1.Panel1.Controls.Add(groupBox1);
|
||||
splitContainer1.Panel1.Controls.Add(flowLayoutPanel1);
|
||||
splitContainer1.Panel1.Controls.Add(gbWorkTypes);
|
||||
splitContainer1.Panel1.Controls.Add(mcWorkDay);
|
||||
|
@ -88,18 +97,84 @@
|
|||
// splitContainer1.Panel2
|
||||
//
|
||||
splitContainer1.Panel2.Controls.Add(rtbMsg);
|
||||
splitContainer1.Size = new Size(726,399);
|
||||
splitContainer1.Size = new Size(681,454);
|
||||
splitContainer1.SplitterDistance = 236;
|
||||
splitContainer1.TabIndex = 9;
|
||||
//
|
||||
// groupBox1
|
||||
//
|
||||
groupBox1.AutoSize = true;
|
||||
groupBox1.Controls.Add(C_WorkOut);
|
||||
groupBox1.Location = new Point(6,273);
|
||||
groupBox1.Name = "groupBox1";
|
||||
groupBox1.Size = new Size(220,82);
|
||||
groupBox1.TabIndex = 9;
|
||||
groupBox1.TabStop = false;
|
||||
groupBox1.Text = "加班";
|
||||
//
|
||||
// C_WorkOut
|
||||
//
|
||||
C_WorkOut.Controls.Add(radioButton9);
|
||||
C_WorkOut.Controls.Add(radioButton6);
|
||||
C_WorkOut.Controls.Add(radioButton8);
|
||||
C_WorkOut.Controls.Add(radioButton7);
|
||||
C_WorkOut.Dock = DockStyle.Fill;
|
||||
C_WorkOut.Location = new Point(3,19);
|
||||
C_WorkOut.Name = "C_WorkOut";
|
||||
C_WorkOut.Size = new Size(214,60);
|
||||
C_WorkOut.TabIndex = 0;
|
||||
//
|
||||
// radioButton9
|
||||
//
|
||||
radioButton9.AutoSize = true;
|
||||
radioButton9.Checked = true;
|
||||
radioButton9.Location = new Point(3,3);
|
||||
radioButton9.Name = "radioButton9";
|
||||
radioButton9.Size = new Size(38,21);
|
||||
radioButton9.TabIndex = 0;
|
||||
radioButton9.TabStop = true;
|
||||
radioButton9.Text = "无";
|
||||
radioButton9.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// radioButton6
|
||||
//
|
||||
radioButton6.AutoSize = true;
|
||||
radioButton6.Location = new Point(47,3);
|
||||
radioButton6.Name = "radioButton6";
|
||||
radioButton6.Size = new Size(86,21);
|
||||
radioButton6.TabIndex = 4;
|
||||
radioButton6.Text = "工作日加班";
|
||||
radioButton6.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// radioButton8
|
||||
//
|
||||
radioButton8.AutoSize = true;
|
||||
radioButton8.Location = new Point(3,30);
|
||||
radioButton8.Name = "radioButton8";
|
||||
radioButton8.Size = new Size(110,21);
|
||||
radioButton8.TabIndex = 6;
|
||||
radioButton8.Text = "法定节假日加班";
|
||||
radioButton8.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// radioButton7
|
||||
//
|
||||
radioButton7.AutoSize = true;
|
||||
radioButton7.Location = new Point(119,30);
|
||||
radioButton7.Name = "radioButton7";
|
||||
radioButton7.Size = new Size(86,21);
|
||||
radioButton7.TabIndex = 5;
|
||||
radioButton7.Text = "休息日加班";
|
||||
radioButton7.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// flowLayoutPanel1
|
||||
//
|
||||
flowLayoutPanel1.Anchor = AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right;
|
||||
flowLayoutPanel1.AutoSize = true;
|
||||
flowLayoutPanel1.Controls.Add(btSave);
|
||||
flowLayoutPanel1.Controls.Add(btReset);
|
||||
flowLayoutPanel1.Location = new Point(9,296);
|
||||
flowLayoutPanel1.Location = new Point(6,420);
|
||||
flowLayoutPanel1.Name = "flowLayoutPanel1";
|
||||
flowLayoutPanel1.Size = new Size(214,29);
|
||||
flowLayoutPanel1.Size = new Size(220,29);
|
||||
flowLayoutPanel1.TabIndex = 8;
|
||||
//
|
||||
// btSave
|
||||
|
@ -125,9 +200,9 @@
|
|||
// gbWorkTypes
|
||||
//
|
||||
gbWorkTypes.Controls.Add(C_WorkTypes);
|
||||
gbWorkTypes.Location = new Point(6,198);
|
||||
gbWorkTypes.Location = new Point(6,189);
|
||||
gbWorkTypes.Name = "gbWorkTypes";
|
||||
gbWorkTypes.Size = new Size(220,92);
|
||||
gbWorkTypes.Size = new Size(220,84);
|
||||
gbWorkTypes.TabIndex = 7;
|
||||
gbWorkTypes.TabStop = false;
|
||||
gbWorkTypes.Text = "类型";
|
||||
|
@ -142,7 +217,7 @@
|
|||
C_WorkTypes.Dock = DockStyle.Fill;
|
||||
C_WorkTypes.Location = new Point(3,19);
|
||||
C_WorkTypes.Name = "C_WorkTypes";
|
||||
C_WorkTypes.Size = new Size(214,70);
|
||||
C_WorkTypes.Size = new Size(214,62);
|
||||
C_WorkTypes.TabIndex = 2;
|
||||
//
|
||||
// radioButton1
|
||||
|
@ -216,18 +291,18 @@
|
|||
rtbMsg.EnableAutoDragDrop = true;
|
||||
rtbMsg.Location = new Point(0,0);
|
||||
rtbMsg.Name = "rtbMsg";
|
||||
rtbMsg.Size = new Size(486,399);
|
||||
rtbMsg.Size = new Size(441,454);
|
||||
rtbMsg.TabIndex = 7;
|
||||
rtbMsg.Text = "";
|
||||
//
|
||||
// WorkMain
|
||||
//
|
||||
AcceptButton = btSave;
|
||||
AutoScaleDimensions = new SizeF(7F,17F);
|
||||
AutoScaleMode = AutoScaleMode.Font;
|
||||
ClientSize = new Size(740,435);
|
||||
ClientSize = new Size(695,490);
|
||||
Controls.Add(tabControl1);
|
||||
Name = "WorkMain";
|
||||
StartPosition = FormStartPosition.CenterScreen;
|
||||
Text = "工作记录";
|
||||
FormClosing += WorkMain_FormClosing;
|
||||
Load += WorkMain_Load;
|
||||
|
@ -238,6 +313,9 @@
|
|||
splitContainer1.Panel2.ResumeLayout(false);
|
||||
((System.ComponentModel.ISupportInitialize)splitContainer1).EndInit();
|
||||
splitContainer1.ResumeLayout(false);
|
||||
groupBox1.ResumeLayout(false);
|
||||
C_WorkOut.ResumeLayout(false);
|
||||
C_WorkOut.PerformLayout();
|
||||
flowLayoutPanel1.ResumeLayout(false);
|
||||
gbWorkTypes.ResumeLayout(false);
|
||||
C_WorkTypes.ResumeLayout(false);
|
||||
|
@ -262,5 +340,11 @@
|
|||
private Button btSave;
|
||||
private FlowLayoutPanel flowLayoutPanel1;
|
||||
private Button btReset;
|
||||
private RadioButton radioButton6;
|
||||
private RadioButton radioButton7;
|
||||
private RadioButton radioButton8;
|
||||
private GroupBox groupBox1;
|
||||
private FlowLayoutPanel C_WorkOut;
|
||||
private RadioButton radioButton9;
|
||||
}
|
||||
}
|
|
@ -19,6 +19,12 @@ namespace CalendarNotepad
|
|||
rab.CheckedChanged += Rab_CheckedChanged;
|
||||
}
|
||||
}
|
||||
foreach(var c in this.C_WorkOut.Controls) {
|
||||
var rab = c as RadioButton;
|
||||
if(rab != null) {
|
||||
rab.CheckedChanged += Rab_CheckedChanged;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void Rab_CheckedChanged(object? sender,EventArgs e) {
|
||||
|
@ -44,10 +50,12 @@ namespace CalendarNotepad
|
|||
var fir = qu.First();
|
||||
this.rtbMsg.Text = fir.WorkMessage;
|
||||
this.SetWorkType(fir.WorkType);
|
||||
this.SetWorkOut(fir.Workout ?? "无");
|
||||
}
|
||||
else {
|
||||
this.rtbMsg.Text = "";
|
||||
this.SetWorkType("休假");
|
||||
this.SetWorkOut("无");
|
||||
}
|
||||
this.DataReset();
|
||||
Task.Factory.StartNew(() => {
|
||||
|
@ -111,6 +119,7 @@ namespace CalendarNotepad
|
|||
var dr = "全天";
|
||||
var msg = this.rtbMsg.Text;
|
||||
var wt = GetWorkType();
|
||||
var wo = this.GetWorkOut();
|
||||
var exp = Expressionable.Create<WorkUnit>().And(a => a.DayRange == dr && a.WorkDay == wd).ToExpression();
|
||||
var qu = this.Db.Queryable<WorkUnit>().Where(exp).ToList();
|
||||
if(qu.Any() && msg.IsNullOrEmpty()) {
|
||||
|
@ -122,13 +131,15 @@ namespace CalendarNotepad
|
|||
this.Db.Updateable<WorkUnit>().Where(exp)
|
||||
.SetColumns(a => a.WorkMessage == msg)
|
||||
.SetColumns(a => a.WorkType == wt)
|
||||
.SetColumns(a => a.Workout == wo)
|
||||
.ExecuteCommand();
|
||||
this.DataReset();
|
||||
return;
|
||||
}
|
||||
if(!qu.Any() && msg.IsNotNullOrEmpty()) {
|
||||
this.Db.Insertable<WorkUnit>(new WorkUnit {
|
||||
DayRange = dr,WorkDay = wd,WorkMessage = msg,WorkType = wt,
|
||||
DayRange = dr,WorkDay = wd,
|
||||
WorkMessage = msg,WorkType = wt,Workout = wo,
|
||||
}).ExecuteCommand();
|
||||
this.DataReset();
|
||||
return;
|
||||
|
@ -148,5 +159,35 @@ namespace CalendarNotepad
|
|||
this.btSave.Enabled = false;
|
||||
this.btReset.Enabled = false;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 设置加班信息
|
||||
/// </summary>
|
||||
/// <param name="wo"></param>
|
||||
private void SetWorkOut(string wo) {
|
||||
if(wo.IsNullOrEmpty()) {
|
||||
return;
|
||||
}
|
||||
foreach(var c in this.C_WorkOut.Controls) {
|
||||
var ra = c as RadioButton;
|
||||
if(ra != null && ra.Text == wo) {
|
||||
ra.Checked = true;
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// 获取加班信息
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
private string GetWorkOut() {
|
||||
foreach(var c in this.C_WorkOut.Controls) {
|
||||
var ra = c as RadioButton;
|
||||
if(ra != null && ra.Checked) {
|
||||
return ra.Text;
|
||||
}
|
||||
}
|
||||
return "";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -117,52 +117,4 @@
|
|||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<metadata name="tabControl1.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
<metadata name="tpWorkManage.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
<metadata name="splitContainer1.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
<metadata name="flowLayoutPanel1.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
<metadata name="btSave.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
<metadata name="btReset.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
<metadata name="gbWorkTypes.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
<metadata name="C_WorkTypes.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
<metadata name="radioButton1.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
<metadata name="radioButton3.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
<metadata name="radioButton2.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
<metadata name="radioButton4.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
<metadata name="radioButton5.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
<metadata name="mcWorkDay.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
<metadata name="rtbMsg.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
<metadata name="$this.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
</root>
|
Loading…
Reference in New Issue
Block a user