//private void btnRemove_Click(object sender, EventArgs e) //{ // if (tempMSNV != "") // { // string masseage = "Bạn có muốn xóa chấm công nhân viên " + tempMSNV.Trim() + "không ?"; // string Title = "Chú ý"; // DialogResult result = MessageBox.Show(masseage, Title, MessageBoxButtons.YesNo, MessageBoxIcon.Warning, MessageBoxDefaultButton.Button2); // if (result == DialogResult.Yes) // { // timekeepingBO.Update(tempDelete); // loadRefreshUpdateRemove(); // } // } //} private void dataDS_CellEnter(object sender, DataGridViewCellEventArgs e) { try { tempMSNV = dataDS.Rows[e.RowIndex].Cells[0].Value.ToString(); DateTime date = DateTime.Parse(dataDS.Rows[e.RowIndex].Cells[2].Value.ToString()); tempDelete.Id = timekeepingBO.GetIdByMSNVDate(tempMSNV, date); tempDelete.MSNV = dataDS.Rows[e.RowIndex].Cells[0].Value.ToString(); tempDelete.Date = DateTime.Parse(dataDS.Rows[e.RowIndex].Cells[2].Value.ToString()).Date; tempDelete.TimeStart = dataDS.Rows[e.RowIndex].Cells[3].Value.ToString(); tempDelete.TimeEnd = dataDS.Rows[e.RowIndex].Cells[4].Value.ToString(); tempDelete.Time = float.Parse(dataDS.Rows[e.RowIndex].Cells[5].Value.ToString()); tempDelete.Weight = int.Parse(dataDS.Rows[e.RowIndex].Cells[6].Value.ToString()); tempDelete.Type = int.Parse(dataDS.Rows[e.RowIndex].Cells[7].Value.ToString()); tempDelete.TotalWeight = int.Parse(dataDS.Rows[e.RowIndex].Cells[8].Value.ToString()); tempDelete.AdvancePayment = int.Parse(dataDS.Rows[e.RowIndex].Cells[9].Value.ToString()); tempDelete.Note = dataDS.Rows[e.RowIndex].Cells[10].Value.ToString(); tempDelete.isDelete = true; } catch { //Khi dòng cuối thì gán để không bị lỗi tempMSNV = ""; } }
private void dataDS_CellDoubleClick(object sender, DataGridViewCellEventArgs e) { if (e.RowIndex != dataDS.RowCount - 1) { string msnv = dataDS.Rows[e.RowIndex].Cells[0].Value.ToString(); DateTime date = DateTime.Parse(dataDS.Rows[e.RowIndex].Cells[2].Value.ToString()); tempUpdate.Id = timekeepingBO.GetIdByMSNVDate(msnv, date); tempUpdate.Date = date; tempUpdate.MSNV = dataDS.Rows[e.RowIndex].Cells[0].Value.ToString(); tempUpdate.TimeStart = dataDS.Rows[e.RowIndex].Cells[3].Value.ToString(); tempUpdate.TimeEnd = dataDS.Rows[e.RowIndex].Cells[4].Value.ToString(); tempUpdate.Weight = int.Parse(dataDS.Rows[e.RowIndex].Cells[6].Value.ToString()); tempUpdate.Type = int.Parse(dataDS.Rows[e.RowIndex].Cells[7].Value.ToString()); tempUpdate.AdvancePayment = int.Parse(dataDS.Rows[e.RowIndex].Cells[9].Value.ToString()); tempUpdate.Note = dataDS.Rows[e.RowIndex].Cells[10].Value.ToString(); frmEdit frmEdit = new frmEdit(); frmEdit.ShowDialog(); loadRefreshUpdateRemove(); } }