public string InsertXuatKho(XuatKhoDTO dtoXuatKho)
 {
     string strError = "";
     if (dtoXuatKho.SoHoaDon == "")
     {
         strError += "Số hóa đơn không được để trống";
     }
     if (strError == "")
     {
         if (dalXuatKho.InsertXuatKho(dtoXuatKho) == true)
             return "ok";
     }
     return strError;
 }
 public bool UpdateXuatKho(XuatKhoDTO dtoXuatKho)
 {
     string strQuery = "Update XUATKHO Set ";
     strQuery += "MAKHACHHANG = N'" + dtoXuatKho.MaKhachHang + "',";
     strQuery += "MANHANVIEN = N'" + dtoXuatKho.MaNV + "',";
     strQuery += "NGAYXUAT = N'" + dtoXuatKho.NgayXuat + "',";
     strQuery += "GIAOHANG = N'" + dtoXuatKho.GiaoHang + "',";
     strQuery += "LYDOXUAT = N'" + dtoXuatKho.LyDoXuat + "',";
     strQuery += "SOHOADON = N'" + dtoXuatKho.SoHoaDon + "',";
     strQuery += "NGAYLAPHOADON = N'" + dtoXuatKho.NgayLapHD + "',";
     strQuery += "GHICHU = N'" + dtoXuatKho.GhiChu + "' ";
     strQuery += "Where MAXUATKHO = N'" + dtoXuatKho.MaXuatKho + "'";
     return dp.ExecuteNonQuery(strQuery);
 }
 public bool InsertXuatKho(XuatKhoDTO dtoXuatKho)
 {
     string strQuery = "Insert Into XUATKHO Values(";
     strQuery += "N'" + dtoXuatKho.MaXuatKho + "',";
     strQuery += "N'" + dtoXuatKho.MaKhachHang + "',";
     strQuery += "N'" + dtoXuatKho.MaNV + "',";
     strQuery += "N'" + dtoXuatKho.NgayXuat + "',";
     strQuery += "N'" + dtoXuatKho.GiaoHang + "',";
     strQuery += "N'" + dtoXuatKho.LyDoXuat + "',";
     strQuery += "N'" + dtoXuatKho.SoHoaDon + "',";
     strQuery += "N'" + dtoXuatKho.NgayLapHD + "',";
     strQuery += "N'" + dtoXuatKho.MaThue + "',";
     strQuery += dtoXuatKho.ThanhTien + ",";
     strQuery += "N'" + dtoXuatKho.GhiChu + "', 1)";
     return dp.ExecuteNonQuery(strQuery);
 }
 public bool UpdateXuatKho(XuatKhoDTO dtoXuatKho)
 {
     return dalXuatKho.UpdateXuatKho(dtoXuatKho);
 }
 private XuatKhoDTO LayThongTinXuatKho()
 {
     XuatKhoDTO dtoXuatKho = new XuatKhoDTO();
     dtoXuatKho.MaXuatKho = txtMaPhieuXuat.Text;
     dtoXuatKho.GhiChu = txtGhiChu.Text;
     dtoXuatKho.MaKhachHang = cmbMaKhachHang.Text;
     dtoXuatKho.MaNV = txtMaNhanVien.Text;
     dtoXuatKho.NgayLapHD = dtNgayLap.Value.ToShortDateString();
     dtoXuatKho.NgayXuat = dtNgayNhap.Value.ToShortDateString();
     dtoXuatKho.SoHoaDon = txtSoHoaDon.Text;
     dtoXuatKho.GiaoHang = txtNguoiNhan.Text;
     dtoXuatKho.LyDoXuat = txtLyDoNhap.Text;
     dtoXuatKho.MaThue = cmbMucThue.SelectedValue.ToString();
     dtoXuatKho.ThanhTien = txtTienSauThue.Value;
     return dtoXuatKho;
 }
 private CT_XuatKhoDTO LayThongTinChiTietXuatKho(XuatKhoDTO dtoNhapKho, int i)
 {
     CT_XuatKhoDTO dtoCTXuat = new CT_XuatKhoDTO();
     dtoCTXuat.MaCTXuatKho = cf.CreateId("CTX", "CT_XUATKHO");
     dtoCTXuat.MaXuatKho = dtoNhapKho.MaXuatKho;
     double dbGia = double.Parse(dgvMatHang.Rows[i].Cells["colGia"].Value.ToString());
     dtoCTXuat.GiaTien = dbGia;
     dtoCTXuat.MaMatHang = dgvMatHang.Rows[i].Cells["colMaMatHang"].Value.ToString();
     dtoCTXuat.SoLuongXuat = int.Parse(dgvMatHang.Rows[i].Cells["colSoLuong"].Value.ToString());
     dtoCTXuat.ThanhTien = double.Parse(dgvMatHang.Rows[i].Cells["colThanhTien"].Value.ToString());
     dtoCTXuat.TinhTrang = "1";
     return dtoCTXuat;
 }