private void btnCapNhat_Click(object sender, EventArgs e) { ChiTietTamUngDTO chiTietTamUngDTO = new ChiTietTamUngDTO(); chiTietTamUngDTO.MaPhieuTamUng = txtMaPhieu.Text; chiTietTamUngDTO.ThangTamUng = dtpThang.Value.ToString("yyyyMM"); chiTietTamUngDTO.TamUngID = int.Parse(cmbLoaiTamUng.SelectedValue.ToString()); chiTietTamUngDTO.NhanVienID = int.Parse(cmbNhanVien.SelectedValue.ToString()); chiTietTamUngDTO.NgayLap = dtpNgayLap.Value; chiTietTamUngDTO.TamUng = float.Parse(txtSoTienTamUng.Text.ToString()); chiTietTamUngDTO.GhiChu = txtGhiChu.Text; if (kt == 1) { if (validateHieuSuat()) { if (ChiTietTamUngBUS.Instance.Add_ChiTietTamUng(chiTietTamUngDTO) == -1) { MessageBox.Show("Lỗi khi thêm mới"); } else { Load_DL(); } } else { MessageBox.Show("Đã tồn tại bản ghi nhân viên cùng tháng!"); } } else { ChiTietTamUngBUS.Instance.Update_ChiTietTamUng(chiTietTamUngDTO, PhieuTamUngID); Load_DL(); } Reset(); }
public void Update_ChiTietTamUng(ChiTietTamUngDTO chiTietTamUngDTO, int PhieuTamUngID) { Core.RunSql(ChiTietTamUngDAO.Instance.Update_ChiTietTamUng(chiTietTamUngDTO, PhieuTamUngID)); }
public int Add_ChiTietTamUng(ChiTietTamUngDTO chiTietTamUngDTO) { return(Core.RunSql(ChiTietTamUngDAO.Instance.Add_ChiTietTamUng(chiTietTamUngDTO))); }
public string Update_ChiTietTamUng(ChiTietTamUngDTO chiTietTamUngDTO, int PhieuTamUngID) { string sql = "Update ChiTietTamUng set MaPhieuTamUng ='" + chiTietTamUngDTO.MaPhieuTamUng + "', ThangTamUng = '" + chiTietTamUngDTO.ThangTamUng + "', TamUngID = '" + chiTietTamUngDTO.TamUngID + "', NhanVienID = '" + chiTietTamUngDTO.NhanVienID + "', NgayLap = '" + chiTietTamUngDTO.NgayLap + "', TamUng = '" + chiTietTamUngDTO.TamUng + "', GhiChu ='" + chiTietTamUngDTO.GhiChu + "' where PhieuTamUngID = '" + PhieuTamUngID + "'"; return(sql); }
public string Add_ChiTietTamUng(ChiTietTamUngDTO chiTietTamUngDTO) { string sql = "Insert into ChiTietTamUng(MaPhieuTamUng, " + "ThangTamUng, " + "TamUngID," + " NhanVienID, " + "NgayLap, " + "TamUng, " + "GhiChu, " + "TrangThaiID) " + "values ('" + chiTietTamUngDTO.MaPhieuTamUng + "', '" + chiTietTamUngDTO.ThangTamUng + "', '" + chiTietTamUngDTO.TamUngID + "', '" + chiTietTamUngDTO.NhanVienID + "', '" + chiTietTamUngDTO.NgayLap + "','" + chiTietTamUngDTO.TamUng + "','" + chiTietTamUngDTO.GhiChu + "', '1')"; return(sql); }