public void Add(string col, string arg1, SearchCtrl.SearchMode mode = SearchCtrl.SearchMode.match) { Debug.Assert(m_dict.ContainsKey(col)); TableInfo.ColInfo colInfo = m_dict[col]; switch (colInfo.m_type) { case TableInfo.ColInfo.ColType.text: case TableInfo.ColInfo.ColType.num: case TableInfo.ColInfo.ColType.uniq: case TableInfo.ColInfo.ColType.map: break; default: Debug.Assert(false); break; } #if use_sqlite if (mode == SearchCtrl.SearchMode.like) { exprs.Add(string.Format("({0} like @{0})", colInfo.m_field)); srchParams.Add( new SearchParam() { key = string.Format("@{0}", colInfo.m_field), val = string.Format("%{0}%", arg1) } ); } else { exprs.Add(string.Format("({0}=@{0})", colInfo.m_field)); srchParams.Add( new SearchParam() { key = string.Format("@{0}", colInfo.m_field), val = arg1 } ); } #else //use sql server exprs.Add(string.Format("({0} like @{0})", m_fieldName)); srchParams.Add( new lSearchParam() { key = string.Format("@{0}", m_fieldName), val = string.Format("%{0}%", m_value), type = DbType.String } ); //exprs.Add(string.Format("({0} like @{0})", m_fieldName)); //srchParams.Add(string.Format("@{0}", m_fieldName), string.Format("%{0}%", m_value)); #endif }
public SearchCtrl CrtSearchCtrl(TableInfo tblInfo, int iCol, Point pos, Size size, SearchCtrl.SearchMode mode) { TableInfo.ColInfo col = tblInfo.m_cols[iCol]; switch (col.m_type) { case TableInfo.ColInfo.ColType.text: case TableInfo.ColInfo.ColType.uniq: SearchCtrlText textCtrl = new SearchCtrlText(col.m_field, col.m_alias, SearchCtrl.CtrlType.text, pos, size); textCtrl.m_mode = mode; textCtrl.m_colInfo = col; return(textCtrl); case TableInfo.ColInfo.ColType.dateTime: lSearchCtrlDate dateCtrl = new lSearchCtrlDate(col.m_field, col.m_alias, SearchCtrl.CtrlType.dateTime, pos, size); return(dateCtrl); case TableInfo.ColInfo.ColType.num: lSearchCtrlNum numCtrl = new lSearchCtrlNum(col.m_field, col.m_alias, SearchCtrl.CtrlType.num, pos, size); return(numCtrl); case TableInfo.ColInfo.ColType.currency: lSearchCtrlCurrency currencyCtrl = new lSearchCtrlCurrency(col.m_field, col.m_alias, SearchCtrl.CtrlType.currency, pos, size); return(currencyCtrl); case TableInfo.ColInfo.ColType.map: SearchCtrlEnum srchCtrl = new SearchCtrlEnum(col.m_field, col.m_alias, SearchCtrl.CtrlType.map, pos, size); srchCtrl.m_colInfo = col; return(srchCtrl); } return(null); }
public SearchCtrl CrtSearchCtrl(TableInfo tblInfo, string colName, Point pos, Size size, SearchCtrl.SearchMode mode) { int iCol = tblInfo.getColIndex(colName); if (iCol != -1) { return(CrtSearchCtrl(tblInfo, iCol, pos, size, mode)); } return(null); }