public void AddRow() { if (_dataItemBienBanChamThi == null) _dataItemBienBanChamThi = new ObservableExpandCollection(); var newRow = new BIEN_BAN_CHAM_THI_EX(); newRow.ChangeTesterId += (s, e) => { if (DataItemNhanSu.Count > 0) newRow.ItemContent.tenGiamKhao = DataItemNhanSu.Where(p => p.maNhanSu == newRow.MaGiamKhao).FirstOrDefault().hoVaTen; }; if (_dataItemBienBanChamThi.Count > 0) newRow.ItemContent.maXBienBanChamThi = Helper.GenerateCode((_dataItemBienBanChamThi[_dataItemBienBanChamThi.Count - 1] as BIEN_BAN_CHAM_THI_EX).ItemContent.maXBienBanChamThi); newRow.ItemContent.maNguoiLap = CurrentSystemInfo.CurrentUser.userID; newRow.ItemContent.thoiGianLap = DateTime.Now; newRow.ItemContent.maTrangThaiDuyet = "U"; newRow.ItemContent.trangThaiDuLieu = "1"; newRow.ItemContent.maKetQuaThi = CurrentSelectedItemKetQuaThi.ItemContent.maKetQuaThi; _dataItemBienBanChamThi.Add(newRow); _dataItemBienBanChamThi.Refesh(); OnPropertyChanged("DataItemBienBanChamThi"); }
private void _clientBienBanThi_BIEN_BAN_CHAM_THI_SearchCompleted(object sender, BIEN_BAN_CHAM_THI_SearchCompletedEventArgs e) { try { if (e.Result != null) { _dataItemBienBanChamThi.Clear(); foreach (var item in e.Result) { var newBBT = new BIEN_BAN_CHAM_THI_EX() { ItemContent = item }; newBBT.ChangeTesterId += (s, ex) => { if(DataItemNhanSu.Count>0) newBBT.ItemContent.tenGiamKhao = DataItemNhanSu.Where(p => p.maNhanSu == newBBT.MaGiamKhao).FirstOrDefault().hoVaTen; }; _dataItemBienBanChamThi.Add(newBBT); } OnPropertyChanged("DataItemBienBanChamThi"); } } catch (Exception ex) { MessagePop.SetError(ex.Message); } }