private void btnSua_Click(object sender, EventArgs e) { if (string.Compare(documentStatus, "Đã đóng") == 0) { MessageBox.Show(this, "Chứng từ đã đóng, không thể xóa.", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Error); } else { int[] selectedRows = gridView.GetSelectedRows(); foreach (int rowHandle in selectedRows) { if (rowHandle >= 0) { _inoutline_id = gridView.GetRowCellValue(rowHandle, m_inoutline_id).ToString(); bool flag = BUS_SanXuat.RemoveLine(_inoutline_id); if (!flag) { MessageBox.Show("Reomve không thành công.", "Không thành công", MessageBoxButtons.OK, MessageBoxIcon.Error); } else { dtInoutLine = BUS_SanXuat.GetInoutLine(m_inout_id); grdInoutLine.DataSource = dtInoutLine; } } } } }
private void btnSave_Click(object sender, EventArgs e) { if (string.Compare(documentStatus, "Đã đóng") == 0) { MessageBox.Show(this, "Chứng từ đã đóng, không thể thêm mới.", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Error); } else { string headCount = txtHeadcount.Text; string outPut = txtOutput.Text; if (!string.IsNullOrEmpty(headCount) && !string.IsNullOrEmpty(outPut)) { bool flag = BUS_SanXuat.InputLine(m_inout_id, lkInput.EditValue.ToString(), txtHeadcount.Text, txtOutput.Text, txtNote.Text); if (!flag) { MessageBox.Show("Dữ liệu đã tồn tại.\n Vui lòng loại bỏ dữ liệu đã có trước khi tạo mới.", "Không thành công", MessageBoxButtons.OK, MessageBoxIcon.Error); } else { dtInoutLine = BUS_SanXuat.GetInoutLine(m_inout_id); grdInoutLine.DataSource = dtInoutLine; } } else { MessageBox.Show("Vui lòng nhập các dữ liệu cần thiết!", "Không thành công", MessageBoxButtons.OK, MessageBoxIcon.Error); } } }
private void frmInoutLine_Load(object sender, EventArgs e) { if (string.Compare(document_type_code, "ITG") == 0) { lkInputProcess(false); } else { lkInputProcess(false); } dtInoutLine = BUS_SanXuat.GetInoutLine(m_inout_id); grdInoutLine.DataSource = dtInoutLine; groupControl3.Text = "Headcount ngày " + DateTime.Now.Date.ToString("dd/MM/yyyy"); dtAttendance = BUS_BaoCom.LoadAttendance(ad_org_id); txtTotal.Text = dtAttendance.Rows[0][1].ToString(); txtAttendance.Text = dtAttendance.Rows[0][2].ToString(); txtAbsent.Text = dtAttendance.Rows[0][3].ToString(); }