public static List<P_DonDatHangCT> find(oDonDatHangCT obj) { using (var model = ModelConnector.Connector()) { var list = from lst in model.P_DonDatHangCT select lst; if (!string.IsNullOrEmpty(obj.SoDonDatHang)) list = list.Where(l => l.SoDonDatHang.Equals(obj.SoDonDatHang)); return list.ToList(); } }
void load_DonDatHang() { dateNgayGiaoDich.DateTime = objPDonDatHang.NgayDatHang.Value; gridlk_DanhMucPhapNhan.EditValue = objPDonDatHang.DonViGoi; gridlk_DanhMucPhapNhanDatHang.EditValue = objPDonDatHang.DonViDat; txtSoDonHang.Text = objPDonDatHang.SoDonDatHang; txtSoHoaDon.Text = objPDonDatHang.SoHoaDon; chkLenhXuatKho.Checked = objPDonDatHang.IsSoPhieu.Value; chkLenhXuatKho.Enabled = objPDonDatHang.IsSoPhieu.Value == true ? false : true; path_folder = objPDonDatHang.FileLuuTru; if(chkLenhXuatKho.Checked==true) { oDonDatHangCT_Phieu ophieu = new oDonDatHangCT_Phieu() { SoDonDatHang = objPDonDatHang.SoDonDatHang}; lstPDonDatHangCtPhieu = new List<P_DonDatHang_CT_Phieu>(); lstPDonDatHangCtPhieu = ADonDatHangCT_Phieu.find(ophieu); DataTable dtphieu = commons.ToDataTable(lstPDonDatHangCtPhieu); dtphieu.Columns.Add("DVT", typeof(string)); for (int i = 0; i < dtphieu.Rows.Count; i++) { dtphieu.Rows[i]["DVT"] = ((P_DanhMucHang)repoTenHangPhieu.GetDataSourceRowByKeyValue(dtphieu.Rows[i]["TenHang"])).DVT; } gridMainPhieu.DataSource = dtphieu; } oDonDatHangCT ct= new oDonDatHangCT(); ct.SoDonDatHang = objPDonDatHang.SoDonDatHang; DataTable dt = commons.ToDataTable(ADonDatHangCT.find(ct)); dt.Columns.Add("HinhThucThanhToan").DefaultValue = "CK"; gridMain.DataSource = dt; }