diff --git a/ManagementSystem/HRDataCorrect.Designer.cs b/ManagementSystem/HRDataCorrect.Designer.cs index a4d31e9..c8be8e8 100644 --- a/ManagementSystem/HRDataCorrect.Designer.cs +++ b/ManagementSystem/HRDataCorrect.Designer.cs @@ -48,6 +48,7 @@ this.dpEnd = new System.Windows.Forms.DateTimePicker(); this.tbPage = new System.Windows.Forms.TabControl(); this.tbPage1 = new System.Windows.Forms.TabPage(); + this.dtPickStart = new System.Windows.Forms.DateTimePicker(); this.btnPickProject = new System.Windows.Forms.Button(); this.txtEventID = new System.Windows.Forms.TextBox(); this.label4 = new System.Windows.Forms.Label(); @@ -76,7 +77,7 @@ this.cMemberIDDetail = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.cSignTime = 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(); this.tsButtons.SuspendLayout(); this.tbPage.SuspendLayout(); @@ -289,6 +290,7 @@ // // tbPage1 // + this.tbPage1.Controls.Add(this.btnDEL); this.tbPage1.Controls.Add(this.dtPickStart); this.tbPage1.Controls.Add(this.btnPickProject); this.tbPage1.Controls.Add(this.txtEventID); @@ -312,6 +314,16 @@ this.tbPage1.Text = "更新工作資料及狀態"; 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 // this.btnPickProject.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); @@ -363,7 +375,7 @@ // btnUpdate // 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.Size = new System.Drawing.Size(75, 29); this.btnUpdate.TabIndex = 8; @@ -592,15 +604,16 @@ this.cSignOutTime.ReadOnly = true; 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 // @@ -683,5 +696,6 @@ private System.Windows.Forms.DataGridViewTextBoxColumn cEventID; private System.Windows.Forms.Button btnPickProject; private System.Windows.Forms.DateTimePicker dtPickStart; + private System.Windows.Forms.Button btnDEL; } } \ No newline at end of file diff --git a/ManagementSystem/HRDataCorrect.cs b/ManagementSystem/HRDataCorrect.cs index b0b1db7..fbb32fc 100644 --- a/ManagementSystem/HRDataCorrect.cs +++ b/ManagementSystem/HRDataCorrect.cs @@ -182,7 +182,7 @@ namespace ManagementSystem { case "tbPage1": //更正工作資料及狀態 - string strEventID = txtEventID.Text.Trim(); + string strEventID = txtEventID.Text.Trim(); if (cbProjectNumber.Checked) sbSQL.AppendLine("Update OTB_MNG_DayWork Set ProjectNumber = '" + txtProjectNumber.Text.Trim() + "', Worktype = 'Prj' Where EventID = '" + strEventID + "';"); @@ -248,8 +248,25 @@ namespace ManagementSystem StringBuilder sbSQL = new StringBuilder(); try { + string strEventID = txtEventID.Text.Trim(); //執行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"); LockForm(); @@ -511,5 +528,17 @@ namespace ManagementSystem { 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; + } + } } } diff --git a/ManagementSystem/HRDataCorrect.resx b/ManagementSystem/HRDataCorrect.resx index f21381b..25f382e 100644 --- a/ManagementSystem/HRDataCorrect.resx +++ b/ManagementSystem/HRDataCorrect.resx @@ -123,6 +123,12 @@ True + + True + + + True + 17, 17 @@ -151,12 +157,12 @@ 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= @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L+j5tr/zxpq/VmTqPTuxgG1+VdWMfBAleEHjUwMWfNZGX6v9eD//vxM9v/fz/z+ + BsdWMggdXym4aVaM+L+j5tr/zxpo/VmTqPTuxgG1+VdWMfBAleEHjUwMWfNZGX6v9eD//vxM9v/fz/z+ v7qm+//6fqUTh1cxyEGV4QahDAzMK7OZ8j/cdgNqDv3/+bbL//fXNf7fPCz0/9YZt5sXNovrQJXiBmfX Mxg/OWf0/8ttg/+/Hjv8f3RS9v+9k2L/bx6S/v/wXNCzSzs1Y6BKsYOD8xhkrxzRevXsrOT/D9c0/j8/ o/b/zmHZ/3ePyf+/dVjt/6Nz/t8vbhFfCFWOAThEuBgkT21WOn7nsMz/B8fk/r+4ZPb/3lGV/1d38/9/ - dN7h/8X95h/XTBNMA6rFCFhuIJYGYu2p9fwNh9ca/rt9WPX/3SPS/+8eN/1/bL/934OLhe64WjKEWOoy + dN7h/8X95h/XTBNMA6rFCFhuIJYGYu2p9fwNh9YY/rt9WPX/3SPS/+8eN/1/dL/934OLhe64WjKEWOoy 2AHVyQMxPxDDAcwALSC2PLBc5czNg4b/9++3/LlvseSdKTU8Kzg5Gfz4uRkcgfJ6QIxhAAiA8oAoECuI - iTHoTatlqEoOYohSkADbaATEoFhQBmIJIOYCYryACYhZgZgDikGGMwMxEmBgAAADtd9XSchRAAAAAABJ + iTHoTatlqEoOYohSkADbaATEoFhQBmIJIOYCYryACYhZgZgDikGGMwMxEmBgAAD1DN9QHrkBaAAAAABJ RU5ErkJggg== @@ -258,6 +264,39 @@ True + + True + + + True + + + True + + + True + + + True + + + True + + + True + + + True + + + True + + + True + + + True + True