public CDTData GetDataForDetailReport(string linkfield, string linkitem) { string s = "select * from sysReport where sysReportParentID = " + _drTable["SysReportID"].ToString(); DataTable dt = _dbStruct.GetDataTable(s); if (dt == null || dt.Rows.Count == 0) { return(null); } CDTData data = CusData.Create(DataType.Report, dt.Rows[0]); data.GetData(); //Chuyển data cha qua data con DataRow dr = data.DsData.Tables[0].NewRow(); foreach (DataColumn dc in DsData.Tables[0].Columns) { if (data.DsData.Tables[0].Columns[dc.ColumnName] == null) { continue; } dr[dc.ColumnName] = DsData.Tables[0].Rows[0][dc.ColumnName]; } if (!(data.DsData.Tables[0].Columns[linkfield] == null)) { dr[linkfield] = linkitem.Trim(); } data.DsData.Tables[0].Rows.Add(dr); //this.GenFilterString(); return(data); }
public CDTData GetDataForVoucher(string maCT, string linkItem) { string sysReportID = _drTable["sysReportID"].ToString(); string sysPackageID = Config.GetValue("sysPackageID").ToString(); string s = "select * from sysTable where MaCT = '" + maCT + "' and sysPackageID = " + sysPackageID; DataTable dt = _dbStruct.GetDataTable(s); if (dt == null || dt.Rows.Count == 0) { return(null); } CDTData data = CusData.Create(DataType.MasterDetail, dt.Rows[0]); data.ConditionMaster = data.DrTableMaster["Pk"].ToString() + " = '" + linkItem + "'"; data.GetData(); return(data); }
private void refreshLookup() { for (int i = 0; i < _gv.Columns.Count; i++) { GridColumn g = _gv.Columns[i]; CDTRepGridLookup r = (g.ColumnEdit as CDTRepGridLookup); if (r != null) { if (r.Tag != null) { if (r.Tag.ToString() != string.Empty) { BindingSource bstmp = r.DataSource as BindingSource; CDTData rdatatmp = r.Buttons[1].Tag as CDTData; if (!rdatatmp.FullData) { rdatatmp.GetData(); bstmp.DataSource = rdatatmp.DsData.Tables[0]; r.DataSource = bstmp; rdatatmp.FullData = true; for (int j = i + 1; j < _gv.Columns.Count; j++) { if (_gv.Columns[j].FieldName.ToLower() == g.FieldName.ToLower()) { CDTRepGridLookup rj = (_gv.Columns[j].ColumnEdit as CDTRepGridLookup); BindingSource bsj = rj.DataSource as BindingSource; bsj.DataSource = rdatatmp.DsData.Tables[0]; } } } } } } } }