private void btnTimKiemGiaoDich_Click(object sender, EventArgs e) { if (txtDieuKienTimKiem.Text.Length > 3) { List <NVGDQUAY_ASYNCCLIENT_DTO> dataReturn = new List <NVGDQUAY_ASYNCCLIENT_DTO>(); string msg = Config.CheckConnectToServer(out bool result); if (msg.Length > 0) { MessageBox.Show(msg); return; } if (result) { dataReturn = TIMKIEM_GIAODICHQUAY(txtDieuKienTimKiem.Text.Trim(), dateTimeTuNgay.Value, dateTimeDenNgay.Value, VALUE_SELECTED_CHANGE); } else { dataReturn = UC_Frame_TraLai.TIMKIEM_GIAODICHQUAY_FROM_SQL(txtDieuKienTimKiem.Text.Trim(), dateTimeTuNgay.Value, dateTimeDenNgay.Value, VALUE_SELECTED_CHANGE); } if (dataReturn.Count > 0) { dgvDanhSachGiaoDichChiTiet.Rows.Clear(); dgvDanhSachGiaoDichChiTiet.Refresh(); foreach (NVGDQUAY_ASYNCCLIENT_DTO dataRow in dataReturn) { int LOAIGIADICH = 0; decimal TIENKHACHDUA, TIENTRALAI, TTIENCOVAT = 0; int idx = dgvDanhSachGiaoDichChiTiet.Rows.Add(); DataGridViewRow rowData = dgvDanhSachGiaoDichChiTiet.Rows[idx]; rowData.Cells["MAGIAODICH"].Value = dataRow.MAGIAODICH; int.TryParse(dataRow.LOAIGIAODICH.ToString(), out LOAIGIADICH); rowData.Cells["LOAIGIAODICH"].Value = LOAIGIADICH == 1 ? "XBLE" : "TRL"; rowData.Cells["NGAYPHATSINH"].Value = dataRow.NGAYPHATSINH.ToString("dd/MM/yyyy"); rowData.Cells["MANGUOITAO"].Value = dataRow.MANGUOITAO; rowData.Cells["NGUOITAO"].Value = dataRow.NGUOITAO; rowData.Cells["MAQUAYBAN"].Value = dataRow.MAQUAYBAN; rowData.Cells["HINHTHUCTHANHTOAN"].Value = dataRow.HINHTHUCTHANHTOAN; decimal.TryParse(dataRow.TIENKHACHDUA.ToString(), out TIENKHACHDUA); rowData.Cells["TIENKHACHDUA"].Value = FormatCurrency.FormatMoney(TIENKHACHDUA); decimal.TryParse(dataRow.TIENTRALAI.ToString(), out TIENTRALAI); rowData.Cells["TIENTRALAI"].Value = FormatCurrency.FormatMoney(TIENTRALAI); decimal.TryParse(dataRow.TTIENCOVAT.ToString(), out TTIENCOVAT); rowData.Cells["TTIENCOVAT"].Value = FormatCurrency.FormatMoney(TTIENCOVAT); rowData.Cells["THOIGIAN"].Value = dataRow.THOIGIAN; } } } }
private void btnTimKiemGiaoDich_Click(object sender, EventArgs e) { if (txtDieuKienTimKiem.Text.Length > 3) { List <GIAODICH_DTO> dataReturn = new List <GIAODICH_DTO>(); if (Config.CheckConnectToServer()) { dataReturn = TIMKIEM_GIAODICHQUAY(txtDieuKienTimKiem.Text.Trim(), dateTimeTuNgay.Value, dateTimeDenNgay.Value, VALUE_SELECTED_CHANGE); } else { dataReturn = UC_Frame_TraLai.TIMKIEM_GIAODICHQUAY_FROM_SQL(txtDieuKienTimKiem.Text.Trim(), dateTimeTuNgay.Value, dateTimeDenNgay.Value, VALUE_SELECTED_CHANGE); } if (dataReturn.Count > 0) { dgvDanhSachGiaoDichChiTiet.Rows.Clear(); dgvDanhSachGiaoDichChiTiet.Refresh(); foreach (GIAODICH_DTO dataRow in dataReturn) { decimal TIENKHACH_TRA, TIEN_TRALAI_KHACH, THANHTIEN = 0; int idx = dgvDanhSachGiaoDichChiTiet.Rows.Add(); DataGridViewRow rowData = dgvDanhSachGiaoDichChiTiet.Rows[idx]; rowData.Cells["MA_GIAODICH"].Value = dataRow.MA_GIAODICH; rowData.Cells["LOAI_GIAODICH"].Value = dataRow.LOAI_GIAODICH.ToString(); rowData.Cells["NGAY_GIAODICH"].Value = dataRow.NGAY_GIAODICH.ToString("dd/MM/yyyy"); rowData.Cells["I_CREATE_BY"].Value = dataRow.I_CREATE_BY; decimal.TryParse(dataRow.TIENKHACH_TRA.ToString(), out TIENKHACH_TRA); rowData.Cells["TIENKHACH_TRA"].Value = FormatCurrency.FormatMoney(TIENKHACH_TRA); decimal.TryParse(dataRow.TIEN_TRALAI_KHACH.ToString(), out TIEN_TRALAI_KHACH); rowData.Cells["TIEN_TRALAI_KHACH"].Value = FormatCurrency.FormatMoney(TIEN_TRALAI_KHACH); decimal.TryParse(dataRow.THANHTIEN.ToString(), out THANHTIEN); rowData.Cells["THANHTIEN"].Value = FormatCurrency.FormatMoney(THANHTIEN); rowData.Cells["THOIGIAN_TAO"].Value = dataRow.THOIGIAN_TAO; } } } }