public static string GetChildTableData(MDModel_QueryModel model, MDModel_Table childTable, string MainKey, SinoRequestUser RequestUser) { StringBuilder _sql = new StringBuilder(); _sql.Append("select "); _sql.Append(childTable.TableName); _sql.Append("."); _sql.Append(childTable.MainKey); _sql.Append(" MAINKEY"); foreach (MDModel_Table_Column _tc in childTable.Columns) { if (_tc.CanDisplay && _tc.CanResultShow) { _sql.Append(","); _sql.Append(OraResultItemBuilder.BuildItem(_tc, RequestUser)); } } _sql.Append(" from "); _sql.Append(string.Format(" {0},{1} ", model.MainTable.TableName, childTable.TableName)); _sql.Append(" where "); _sql.Append(string.Format(" {0}.{1} ", model.MainTable.TableName, model.MainTable.MainKey)); _sql.Append(" = '"); _sql.Append(MainKey); _sql.Append("' and "); _sql.Append(childTable.TableRelation); _sql.Append(string.Format(" order by {0}.{1} ", childTable.TableName, childTable.MainKey)); return(_sql.ToString()); }
private static string CreateDisplayString(MDModel_QueryModel _qv, MDQuery_ResultTable _ResultTable, SinoRequestUser RequestUser) { StringBuilder _sql = new StringBuilder(); _sql.Append(string.Format("{0}.{1} MAINID", _qv.MainTable.TableName, _qv.MainTable.MainKey)); foreach (MDQuery_TableColumn _rc in _ResultTable.Columns) { _sql.Append(OraResultItemBuilder.BuildItem(_rc, _qv, RequestUser)); } return(_sql.ToString()); }
public static string GetMainTableData(MDModel_Table maintable, string mainKey, SinoRequestUser requestUser) { StringBuilder sql = new StringBuilder(); sql.Append("select "); sql.Append(maintable.MainKey); sql.Append(" MAINKEY"); foreach (MDModel_Table_Column _tc in maintable.Columns) { if (_tc.CanDisplay && _tc.CanResultShow) { sql.Append(","); sql.Append(OraResultItemBuilder.BuildItem(_tc, requestUser)); } } sql.Append(" from "); sql.Append(maintable.TableName); sql.Append(" where "); sql.Append(maintable.MainKey); sql.Append(" = '"); sql.Append(mainKey); sql.Append("' "); return(sql.ToString()); }