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 btnEdit_Click(object sender, EventArgs e) { Timekeeping timekeeping = new Timekeeping(); timekeeping.isDelete = false; timekeeping.MSNV = txtMSNV.Text; timekeeping.Id = Management.tempUpdate.Id; timekeeping.Date = Management.tempUpdate.Date; if (txtThoigianBD.Text.Equals("") || txtThoigianKT.Text.Equals("")) { timekeeping.TimeStart = ""; timekeeping.TimeEnd = ""; timekeeping.Time = 0; } else { timekeeping.TimeStart = txtThoigianBD.Text; timekeeping.TimeEnd = txtThoigianKT.Text; timekeeping.Time = Interval(txtThoigianBD.Text, txtThoigianKT.Text); } if (txtWeight.Text.Equals("")) { timekeeping.Weight = 0; timekeeping.TotalWeight = "0"; } else { timekeeping.Weight = int.Parse(txtWeight.Text); timekeeping.TotalWeight = (int.Parse(txtWeight.Text) * int.Parse(txtTypeWeight.Text)).ToString(); } timekeeping.Type = int.Parse(txtTypeWeight.Text); if (txtCashAdvance.Text.Equals("")) { timekeeping.AdvancePayment = 0; } else { string[] strCash = txtCashAdvance.Text.Split(','); string str = ""; foreach (var item in strCash) { str += item; } timekeeping.AdvancePayment = int.Parse(str); } timekeeping.Note = txtNote.Text; timekeepingBO.Update(timekeeping); this.Close(); }