private void btnluu_Click(object sender, EventArgs e) { string[] ds = lbltongiten.Text.Split(' '); PHIEUDAT pd = phieudat.getPD(int.Parse(gridPDFalse.CurrentRow.Cells[0].Value.ToString())); phieunhap.insert_PhieuNhap(pd.ID_PD, (int)pd.ID_NCC, ng.ID_DN, dateTimePicker1.Value.Date, int.Parse(ds[0])); int idpn = phieunhap.countpn(); for (int i = 0; i < gridCTNH.Rows.Count; i++) { int idsp = int.Parse(gridCTNH.Rows[i].Cells[0].Value.ToString()); int sld = int.Parse(gridCTNH.Rows[i].Cells[2].Value.ToString()); int dongia = int.Parse(gridCTNH.Rows[i].Cells[3].Value.ToString()); int thanhtien = int.Parse(gridCTNH.Rows[i].Cells[4].Value.ToString()); if (!ctpn.insert_CTPN(ng.ID_KHO, idpn, idsp, sld, dongia, thanhtien)) { this.Alert("Lỗi nhập chi tiết phiếu nhập!", frmNotificationCustom.enmType.Warning); } } phieudat.update_TrangThai_PD(pd.ID_PD); this.Alert("Nhập hàng thành công!", frmNotificationCustom.enmType.Success); gridCTNH.Rows.Clear(); gridCTNH.Refresh(); Load_PD(phieudat.get_PD_false(ng.ID_KHO)); gridPDFalse.Enabled = true; }
//public void load_cbbsp(int idncc) //{ // cbbsp.DataSource = hanghoa.get_sp_ncc(idncc); // cbbsp.DisplayMember = "tensp"; // cbbsp.ValueMember = "idsp"; //} //public void load_cbbspcl() //{ // IQueryable dsspcl = ctpd.get_SPCL(ctpd.get_CTPD(phieudat.ID_PD),ctpd.get_SP_NCC((int)phieudat.ID_NCC)); // cbbsp.DataSource = null; // cbbsp.DataSource = dsspcl; // cbbsp.DisplayMember = "TENSP"; // cbbsp.ValueMember = "ID_SP"; //} private void gridPDat_CellClick(object sender, DataGridViewCellEventArgs e) { phieudat = phieudat_bll.getPD(int.Parse(gridPDat.CurrentRow.Cells[0].Value.ToString())); Load_CTPD(ctpd.get_CTPD(phieudat.ID_PD)); lblmapd.Text = phieudat.ID_PD.ToString(); lblngaylap.Text = phieudat.NGAYLAP.Value.Date.ToShortDateString(); lblnv.Text = phieudat.NGUOIDUNG.TEN; }
public void update_TrangThai_PD(int idpd) { PHIEUDAT pd = getPD(idpd); if (kt_trangthai_PD(idpd)) { pd.TINHTRANG = true; } quanLyKho.SubmitChanges(); }
public bool insert_PhieuDat(int idncc, string idnv, DateTime ngaynhap, int tongtien) { try { PHIEUDAT insert = new PHIEUDAT(); insert.ID_NCC = idncc; insert.ID_DN = idnv; insert.NGAYLAP = ngaynhap; insert.TONGTIEN = tongtien; insert.TINHTRANG = false; quanLyKho.PHIEUDATs.InsertOnSubmit(insert); quanLyKho.SubmitChanges(); return(true); } catch (Exception) { return(false); throw; } }