void LoadTabThongTinChung(DataSet ds) { DataTable dt = ds.Tables["TTIN_CTIET"]; if (dt != null) { txtSoGD.Text = TDVMDUTHU.MA_GIAO_DICH; teldtNgayGD.Value = LDateTime.StringToDate(dt.Rows[0]["NGAY_GIAO_DICH"].ToString(), ApplicationConstant.defaultDateTimeFormat); teldtDuThuDenNgay.Value = LDateTime.StringToDate(dt.Rows[0]["DTHU_DEN_NGAY"].ToString(), ApplicationConstant.defaultDateTimeFormat); numTyLe.Value = Convert.ToDouble(dt.Rows[0]["TY_LE"]); txtDienGiai.Text = dt.Rows[0]["DIEN_GIAI"].ToString(); lblTrangThai.Content = BusinessConstant.layNgonNguNghiepVu(dt.Rows[0]["TTHAI_NVU"].ToString()); iDGiaoDich = Convert.ToInt32(dt.Rows[0]["ID"]); } dt = ds.Tables["KHE_UOC"]; if (dt != null && dt.Rows.Count > 0) { lstDuThu = new List <DANH_SACH_KHE_UOC_DU_THU>(); foreach (DataRow dr in dt.Rows) { DANH_SACH_KHE_UOC_DU_THU objDSKUoc = new DANH_SACH_KHE_UOC_DU_THU(); foreach (DataColumn dc in dt.Columns) { PropertyInfo proper = objDSKUoc.GetType().GetProperty(dc.ColumnName); if (proper != null) { if (proper.PropertyType == typeof(decimal)) { proper.SetValue(objDSKUoc, Convert.ToDecimal(dr[dc.ColumnName]), null); } else if (proper.PropertyType == typeof(int)) { proper.SetValue(objDSKUoc, Convert.ToInt32(dr[dc.ColumnName]), null); } else if (proper.PropertyType == typeof(string)) { proper.SetValue(objDSKUoc, Convert.ToString(dr[dc.ColumnName]), null); } } } lstDuThu.Add(objDSKUoc); } LoadGridKheUoc(); } }
private void tlbTinhLai_Click(object sender, RoutedEventArgs e) { Cursor = Cursors.Wait; string sidKheUoc = ""; foreach (DANH_SACH_KHE_UOC_DU_THU objDSKUOC in lstDuThu) { sidKheUoc += "," + objDSKUOC.ID_KHE_UOC.ToString(); } if (sidKheUoc.Length > 0) { sidKheUoc = sidKheUoc.Substring(1); } else { sidKheUoc = "0"; } List <string> lstDieuKien = new List <string>(); lstDieuKien.Add(sidKheUoc); lstDieuKien.Add(ClientInformation.MaDonViGiaoDich); lstDieuKien.Add("KUOCDUTHU"); lstDieuKien.Add(LDateTime.DateToString(teldtDuThuDenNgay.Value.Value, ApplicationConstant.defaultDateTimeFormat)); lstDieuKien.Add("%"); lstPopupKU = new List <DataRow>(); PopupProcess popupProcess = new PopupProcess(); popupProcess.getPopupInformation("POPUP_DS_KHEUOC", lstDieuKien); SimplePopupResponse simplePopupResponse = ClientInformation.SimplePopup; ucPopupKheUocViMo popup = new ucPopupKheUocViMo(true, simplePopupResponse, true); popup.LayGiaTriListDataRow = new ucPopupKheUocViMo.LayListDataRow(LayDuLieuTuPopup); Window win = new Window(); win.Content = popup; win.WindowStartupLocation = WindowStartupLocation.CenterScreen; win.ShowDialog(); if (lstPopupKU.Count > 0) { foreach (DataRow drv in lstPopupKU) { DANH_SACH_KHE_UOC_DU_THU objKUOC = new DANH_SACH_KHE_UOC_DU_THU(); foreach (DataColumn dtl in drv.Table.Columns) { PropertyInfo proper = objKUOC.GetType().GetProperty(dtl.ColumnName); if (proper != null) { if (proper.PropertyType == typeof(int)) { proper.SetValue(objKUOC, Convert.ToInt32(drv[dtl.ColumnName]), null); } else if (proper.PropertyType == typeof(decimal)) { proper.SetValue(objKUOC, Convert.ToDecimal(drv[dtl.ColumnName]), null); } else if (proper.PropertyType == typeof(string)) { proper.SetValue(objKUOC, Convert.ToString(drv[dtl.ColumnName]), null); } } } lstDuThu.Add(objKUOC); } LoadGridKheUoc(); } Cursor = Cursors.Arrow; }