private void btnLuu_Click(object sender, EventArgs e) { //try //{ // ePhieuXK newpXk = new ePhieuXK(); // newpXk._maNV = cbbMaNV.Text; // newpXk._maPhieuXuat = txtMaPhieuXuat.Text; // newpXk._maKho = cbbMaKho.Text; // newpXk._tinhTrang = cbbTinhTrang.Text; // newpXk._ngayLapXuat = dtpNgayLapPhieu.Value; // int kq = bllpXK.ThemPhieuXuatKho(newpXk); // if (kq == 1) // MessageBox.Show("Thêm thành công!!!"); // else // MessageBox.Show("Trùng mã phiếu!!"); // listpXK = bllpXK.laydanhsachphieuXuatKho(); // //listtp = blltp.getthuephongbymaphong(txtmaphong.Text); // LoaddulieulendatagridviewPhieuXuatKho(dgvXuatKho, listpXK); // CheDoButton(true); // CheDoComboBox(false); // btnThem.Text = "Thêm"; //} //catch (Exception ex) //{ // MessageBox.Show(ex.Message); //} //listpDNXK = bllNDLTPKH.laydanhsachPhieuDNXK(); //LoaddulieulendatagridviewPhieuDeNghiXuatKho(dgvPhieuDNChuaLap, listpDNXK); try { ePhieuXK newpXk = new ePhieuXK(); newpXk._maNV = cbbMaNV.Text; newpXk._maPhieuXuat = txtMaPhieuXuat.Text; newpXk._maKho = cbbMaKho.Text; newpXk._tinhTrang = cbbTinhTrang.Text; newpXk._ngayLapXuat = dtpNgayLapPhieu.Value; int kq = bllpXK.ThemPhieuXuatKho(newpXk); if (kq == 1) { MessageBox.Show("Thêm thành công!!!"); } else { MessageBox.Show("Trùng mã phiếu!!"); } listpXK = bllpXK.laydanhsachphieuXuatKho(); //listtp = blltp.getthuephongbymaphong(txtmaphong.Text); LoaddulieulendatagridviewPhieuXuatKho(dgvXuatKho, listpXK); CheDoButton(true); CheDoComboBox(false); btnThem.Text = "Thêm"; } catch (Exception ex) { MessageBox.Show(ex.Message); } listpDNXK = bllNDLTPKH.laydanhsachPhieuDNXK(); LoaddulieulendatagridviewPhieuDeNghiXuatKho(dgvPhieuDNChuaLap, listpDNXK); }
public bool UpDatePhieuNK(ePhieuXK updatepxk) { try { Tbl_PhieuXK pxk = DB.Tbl_PhieuXKs.Single(x => x.maPhieuXuat == updatepxk._maPhieuXuat); pxk.maPhieuXuat = updatepxk._maPhieuXuat; pxk.ngayLapXuat = Convert.ToDateTime(updatepxk._ngayLapXuat); pxk.maNV = updatepxk._maNV; pxk.tinhTrang = updatepxk._tinhTrang; DB.SubmitChanges(); return(true); } catch { return(false); } }
public int ThemPhieuXuatKho(ePhieuXK newpxk) { if (Kiemtrasutontai(newpxk._maPhieuXuat)) { return(0); } Tbl_PhieuXK pxkTmp = new Tbl_PhieuXK(); pxkTmp.maPhieuXuat = newpxk._maPhieuXuat; pxkTmp.ngayLapXuat = newpxk._ngayLapXuat; pxkTmp.maNV = newpxk._maNV; pxkTmp.maKho = newpxk._maKho; pxkTmp.tinhTrang = newpxk._tinhTrang; DB.Tbl_PhieuXKs.InsertOnSubmit(pxkTmp); DB.SubmitChanges(); return(1); }
public List <ePhieuXK> laydanhsachphieuXuatKho() { var listXK = DB.Tbl_PhieuXKs.ToList(); List <ePhieuXK> ls = new List <ePhieuXK>(); foreach (Tbl_PhieuXK newXK in listXK) { ePhieuXK exk = new ePhieuXK(); exk._maNV = newXK.maNV; exk._maPhieuXuat = newXK.maPhieuXuat; exk._maKho = newXK.maKho; exk._ngayLapXuat = newXK.ngayLapXuat.Value; exk._tinhTrang = newXK.tinhTrang; ls.Add(exk); } return(ls); }
public bool AddAllPhieuNK(ePhieuXK newpxk) { try { Tbl_PhieuXK pxk = DB.Tbl_PhieuXKs.Single(x => x.maPhieuXuat == newpxk._maPhieuXuat); pxk.maPhieuXuat = newpxk._maPhieuXuat; pxk.ngayLapXuat = Convert.ToDateTime(newpxk._ngayLapXuat); pxk.maNV = newpxk._maNV; pxk.tinhTrang = newpxk._tinhTrang; DB.Tbl_PhieuXKs.InsertOnSubmit(pxk); DB.SubmitChanges(); return(true); } catch { return(false); } }