Browse Source

增加刪除功能

master
nelson.kai 2 years ago
parent
commit
f7e2403da9
  1. 34
      ManagementSystem/HRDataCorrect.Designer.cs
  2. 29
      ManagementSystem/HRDataCorrect.cs
  3. 63
      ManagementSystem/HRDataCorrect.resx

34
ManagementSystem/HRDataCorrect.Designer.cs

@ -48,6 +48,7 @@
this.dpEnd = new System.Windows.Forms.DateTimePicker(); this.dpEnd = new System.Windows.Forms.DateTimePicker();
this.tbPage = new System.Windows.Forms.TabControl(); this.tbPage = new System.Windows.Forms.TabControl();
this.tbPage1 = new System.Windows.Forms.TabPage(); this.tbPage1 = new System.Windows.Forms.TabPage();
this.dtPickStart = new System.Windows.Forms.DateTimePicker();
this.btnPickProject = new System.Windows.Forms.Button(); this.btnPickProject = new System.Windows.Forms.Button();
this.txtEventID = new System.Windows.Forms.TextBox(); this.txtEventID = new System.Windows.Forms.TextBox();
this.label4 = new System.Windows.Forms.Label(); this.label4 = new System.Windows.Forms.Label();
@ -76,7 +77,7 @@
this.cMemberIDDetail = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.cMemberIDDetail = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.cSignTime = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.cSignTime = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.cSignOutTime = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.cSignOutTime = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.dtPickStart = new System.Windows.Forms.DateTimePicker();
this.btnDEL = new System.Windows.Forms.Button();
((System.ComponentModel.ISupportInitialize)(this.dgvHRItem)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.dgvHRItem)).BeginInit();
this.tsButtons.SuspendLayout(); this.tsButtons.SuspendLayout();
this.tbPage.SuspendLayout(); this.tbPage.SuspendLayout();
@ -289,6 +290,7 @@
// //
// tbPage1 // tbPage1
// //
this.tbPage1.Controls.Add(this.btnDEL);
this.tbPage1.Controls.Add(this.dtPickStart); this.tbPage1.Controls.Add(this.dtPickStart);
this.tbPage1.Controls.Add(this.btnPickProject); this.tbPage1.Controls.Add(this.btnPickProject);
this.tbPage1.Controls.Add(this.txtEventID); this.tbPage1.Controls.Add(this.txtEventID);
@ -312,6 +314,16 @@
this.tbPage1.Text = "更新工作資料及狀態"; this.tbPage1.Text = "更新工作資料及狀態";
this.tbPage1.UseVisualStyleBackColor = true; this.tbPage1.UseVisualStyleBackColor = true;
// //
// dtPickStart
//
this.dtPickStart.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
this.dtPickStart.CustomFormat = "yyyy-MM-dd HH:mm:ss";
this.dtPickStart.Format = System.Windows.Forms.DateTimePickerFormat.Custom;
this.dtPickStart.Location = new System.Drawing.Point(142, 558);
this.dtPickStart.Name = "dtPickStart";
this.dtPickStart.Size = new System.Drawing.Size(192, 29);
this.dtPickStart.TabIndex = 13;
//
// btnPickProject // btnPickProject
// //
this.btnPickProject.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); this.btnPickProject.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
@ -363,7 +375,7 @@
// btnUpdate // btnUpdate
// //
this.btnUpdate.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); this.btnUpdate.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
this.btnUpdate.Location = new System.Drawing.Point(1274, 599);
this.btnUpdate.Location = new System.Drawing.Point(1276, 557);
this.btnUpdate.Name = "btnUpdate"; this.btnUpdate.Name = "btnUpdate";
this.btnUpdate.Size = new System.Drawing.Size(75, 29); this.btnUpdate.Size = new System.Drawing.Size(75, 29);
this.btnUpdate.TabIndex = 8; this.btnUpdate.TabIndex = 8;
@ -592,15 +604,16 @@
this.cSignOutTime.ReadOnly = true; this.cSignOutTime.ReadOnly = true;
this.cSignOutTime.Width = 250; this.cSignOutTime.Width = 250;
// //
// dtPickStart
// btnDEL
// //
this.dtPickStart.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
this.dtPickStart.CustomFormat = "yyyy-MM-dd HH:mm:ss";
this.dtPickStart.Format = System.Windows.Forms.DateTimePickerFormat.Custom;
this.dtPickStart.Location = new System.Drawing.Point(142, 558);
this.dtPickStart.Name = "dtPickStart";
this.dtPickStart.Size = new System.Drawing.Size(192, 29);
this.dtPickStart.TabIndex = 13;
this.btnDEL.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
this.btnDEL.Location = new System.Drawing.Point(1276, 599);
this.btnDEL.Name = "btnDEL";
this.btnDEL.Size = new System.Drawing.Size(75, 30);
this.btnDEL.TabIndex = 14;
this.btnDEL.Text = "刪除";
this.btnDEL.UseVisualStyleBackColor = true;
this.btnDEL.Click += new System.EventHandler(this.btnDEL_Click);
// //
// HRDataCorrect // HRDataCorrect
// //
@ -683,5 +696,6 @@
private System.Windows.Forms.DataGridViewTextBoxColumn cEventID; private System.Windows.Forms.DataGridViewTextBoxColumn cEventID;
private System.Windows.Forms.Button btnPickProject; private System.Windows.Forms.Button btnPickProject;
private System.Windows.Forms.DateTimePicker dtPickStart; private System.Windows.Forms.DateTimePicker dtPickStart;
private System.Windows.Forms.Button btnDEL;
} }
} }

29
ManagementSystem/HRDataCorrect.cs

@ -248,8 +248,25 @@ namespace ManagementSystem
StringBuilder sbSQL = new StringBuilder(); StringBuilder sbSQL = new StringBuilder();
try try
{ {
string strEventID = txtEventID.Text.Trim();
//執行Delete命令 //執行Delete命令
sbSQL.Append("Delete From OTB_MNG_DayWork Where EventID = '" + strEventID + "'");
using (SqlDataAdapter sqlAdapter = new SqlDataAdapter())
{
sqlAdapter.DeleteCommand = new SqlCommand();
sqlAdapter.DeleteCommand.Connection = sqlConn;
sqlAdapter.DeleteCommand.CommandText = sbSQL.ToString();
if (sqlConn.State == ConnectionState.Closed) //判斷連線狀態
{
sqlConn.Open();
}
sqlAdapter.DeleteCommand.ExecuteNonQuery();
}
//執行命令 //執行命令
MessageBox.Show("刪除成功", "提示");
StatusChange("None"); StatusChange("None");
LockForm(); LockForm();
@ -511,5 +528,17 @@ namespace ManagementSystem
{ {
txtProjectNumber.Text = strProjectInfo[0].ToString(); txtProjectNumber.Text = strProjectInfo[0].ToString();
} }
private void btnDEL_Click(object sender, EventArgs e)
{
if (MessageBox.Show("請問是否確認刪除資料?","確認",MessageBoxButtons.YesNo) == DialogResult.Yes)
{
DelEven();
int intNowRow = dgvDetail.Rows.IndexOf(dgvDetail.CurrentRow);
CleanForm();
GetCurrentData();
dgvDetail.Rows[intNowRow].Selected = true;
}
}
} }
} }

63
ManagementSystem/HRDataCorrect.resx

@ -123,6 +123,12 @@
<metadata name="cMemberName.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> <metadata name="cMemberName.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value> <value>True</value>
</metadata> </metadata>
<metadata name="cMemberID.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="cMemberName.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="tsButtons.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"> <metadata name="tsButtons.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value> <value>17, 17</value>
</metadata> </metadata>
@ -151,12 +157,12 @@
<data name="tsbEdit.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64"> <data name="tsbEdit.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value> <value>
iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8 iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8
YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAE1SURBVDhPrZI/SgQxFMYjVspisTNZBL2I2qgXsBBrxRus
LLKum8TG/4h4EgvvYCWyeAErS5vRQSYPM77El2U0yVb7wSMzyff75iUTNhUtHhmeS33MBZw0K1Ow3h6Y
JbKl5WAJdVA2SMIzV3WLrE5tZRbo8VdkTAXgWD2wnXqWsXqGC32IH1Q49ghPB+QCzrgsC3q/w7rNJVw6
RsLpctfMTQzg/a93BM7tei70fUfoFT6s9nDtBrvoOtgqGTCusrCw9eLBbtrOHOg1OQC3oPSq9WUCNhC+
cFBT6QCEhV6zHoKvHPBfsYD53ufHGMb70DooSmeOKQjYHn37Vj1s5505pkgHT/mw2sc/cO1hW2QPFQQM
9Fsm4YXLkWnOkz1U+hD/FtlDdQRs8d1XiEG+cDuPZJ+mGPsBHf5aX6kHo7gAAAAASUVORK5CYII=
YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAE1SURBVDhPrZJPSgMxFMYjrpTiojMpgl5E3agXEATXijeo
FKm1Sdz4HxFP4sI7uBILXsCVSzejg0weZnyJL2U0SVf94JGZ5Pt985IJm4oWjwzPpT7mAk6alSlYbw/M
EtnScrCEOigbJOGZq7pFVqe2Mgv0+CsypgJwrB7YTj3LWD3DhT7EDyoce4SnA3IBZ1yWBb3fYd3mEi4d
I+F0uWvmJgbw/tc7Aud2PRf6viP0Ch9We7h2g110HWyVDBhXWVjYevFgN21nDvSaHIBbUHrV+jIBGwhf
OKipdADCQq9ZD8FXDvivWMB87/NjDON9aB0UpTPHFARsj759qx62884cU6SDp3xY7eMfuPawLbKHCgIG
+i2T8MLlyDTnyR4qfYh/i+yhOgK2+O4rxCBfuJ1Hsk9TjP0AGjpaXGZrpVwAAAAASUVORK5CYII=
</value> </value>
</data> </data>
<data name="tsbDelete.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64"> <data name="tsbDelete.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
@ -176,11 +182,11 @@
<data name="tsbSave.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64"> <data name="tsbSave.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value> <value>
iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8 iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8
YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAD6SURBVDhPYxg8wGTGrYUm9av+5Sw/8//MpSv/D588A8Zv
YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAD6SURBVDhPYxg8wGTGrYUm9Sv/5Sw/8//MpSv/D588A8Zv
PnyE48ylp/8bT7/dANWCCkCaTWbc/g8yYNPeff+nLl0GxugGgNRgNQQkAcKB04/8P3vt+v/N+/f/33Ps PnyE48ylp/8bT7/dANWCCkCaTWbc/g8yYNPeff+nLl0GxugGgNRgNQQkAcKB04/8P3vt+v/N+/f/33Ps
OFzzq/cf/vtOPQxWA8JQbQgAk9DtPPbfD6gQZBsyBmnW7TpG2ABiMVQbAmBThA9DtSEATMJ94b3/xdse OFzzq/cf/vtOPQxWA8JQbQgAk9DtPPbfD6gQZBsyBmnW7TpG2ABiMVQbAmBThA9DtSEATMJ94b3/xdse
/S/ejoqLgGJuQDmCBlx5+g4l5JHxpcfvCBsAUnj9zr3/5y5dRcHX794HyxFtACgxIWOQGF4DjKdcgxuA /S/ejoqLgGJuQDmCBlx5+g4l5JHxpcfvCBsAUnj9zr3/5y5dRcHX794HyxFtACgxIWOQGF4DjKdcgxuA
D4PUGE25immATsveFbr1k/4t2n3qPz4MUqPRtGcJVNuAAwYGAIjDrsepvrgRAAAAAElFTkSuQmCC
D4PUGE25immATsveFbr1E/8t2n3qPz4MUqPRtGcJVNuAAwYGAIC+rsOwIQUzAAAAAElFTkSuQmCC
</value> </value>
</data> </data>
<data name="tsbOK.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64"> <data name="tsbOK.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
@ -215,15 +221,15 @@
<value> <value>
iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8 iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8
YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAIwSURBVDhPYwCBbbkM7Msy2OYvz+AoBwuQChalsyccnBH2 YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAIwSURBVDhPYwCBbbkM7Msy2OYvz+AoBwuQChalsyccnBH2
f1m97b81hRLBUGHiwfQYVv3d9RqvDjdJ/N9ULb+rPpSBDSpFPFhbLF24L0P27/p8/u/T41msT63mN/z/
f2m97b81hRLBUGHiwfQYVv3d9RqvDjdJ/N9ULb+rP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gfz4uRkcgfJ6QIxhAAiA8oAoECuI 2AHVyQMxPxDDAcwALSC2PLBc5czNg4b/9++3/LlvseSdKTU8Kzg5Gfz4uRkcgfJ6QIxhAAiA8oAoECuI
iTHoTatlqEoOYohSkADbaATEoFhQBmIJIOYCYryACYhZgZgDikGGMwMxEmBgAAADtd9XSchRAAAAAABJ
iTHoTatlqEoOYohSkADbaATEoFhQBmIJIOYCYryACYhZgZgDikGGMwMxEmBgAAD1DN9QHrkBaAAAAABJ
RU5ErkJggg== RU5ErkJggg==
</value> </value>
</data> </data>
@ -258,6 +264,39 @@
<metadata name="cEventID.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> <metadata name="cEventID.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value> <value>True</value>
</metadata> </metadata>
<metadata name="cSubject.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="cDescription.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="cStartDate.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="cEndDate.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="cProjectNumber.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="cWorkType.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="cEventID.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="cSelected.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="cMemberIDDetail.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="cSignTime.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="cSignOutTime.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="cSelected.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> <metadata name="cSelected.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value> <value>True</value>
</metadata> </metadata>

Loading…
Cancel
Save