当前位置:
首页 > Python基础教程 >
-
C#教程之智能提示含查询多列(html+JS+handler+ Htt(2)
176 sb.AppendFormat(@" AND T.V_STATION_NAME={0}", intellCustomer.SendSiteName.StringParseDBNULL());
177 }
178 if (!string.IsNullOrEmpty(intellCustomer.ArriveSiteName))
179 {
180 sb.AppendFormat(@" AND T2.V_STATION_NAME={0}", intellCustomer.ArriveSiteName.StringParseDBNULL());
181 }
182 }
183 }
184 }
185 break;
186 case QueryType.LKUserInfo:
187 {
188
189 }
190 break;
191 }
192 if (!string.IsNullOrEmpty(qc.ParamType))
193 {
194 sb.AppendFormat(" AND T.N_PARAM_TYPE={0} ", qc.ParamType.StringParseDBNULL());
195 }
196 if (!string.IsNullOrEmpty(qc.StationCode))
197 {
198 sb.AppendFormat(" AND T.N_STATION_CODE={0} ", qc.StationCode.StringParseDBNULL());
199 }
200 if (!string.IsNullOrEmpty(qc.StationName))
201 {
202 sb.AppendFormat(" AND T.V_STATION_Name={0} ", qc.StationName.StringParseDBNULL());
203 }
204 if (!string.IsNullOrEmpty(qc.Province))
205 {
206 sb.AppendFormat(" AND {0}={1} ", EnumHelper.GetAttribute(queryType).AttachedCondition, qc.Province.Substring(0, 2).StringParseDBNULL());
207 }
208 if (!cropFilterList.Contains(qc.QueryType))
209 {
210 if (!string.IsNullOrEmpty(qc.CorpId))
211 {
212 sb.AppendFormat(" AND T.C_CORP_ID={0} ", qc.CorpId.StringParseDBNULL());
213 }
214 }
215 //TC-优化一下
216 if (!string.IsNullOrEmpty(sortKey.ToString()) && sortKey.ToString() != "0")
217 {
218 if (qtks.All(qs => sortKey.ToString() != qs))
219 return sb.ToString();
220 var at = EnumHelper.GetAttribute(sortKey);
221 sb.AppendFormat("ORDER BY {0} ", at.Name);
222 }
223 return sb.ToString();
224 }
225 private DataTable GetInterQuery(QueryCondition qc, int type)
226 {
227 var sbCropInfo = new StringBuilder();
228 sbCropInfo.AppendFormat(@"select V_CORP_NAME,V_CORP_MOBILE,'' AS V_STATION_TEL,'' AS V_STATION_NAME,1 AS cType, c_corp_id ID
229 from T_CORP_INFO");
230 if (!string.IsNullOrEmpty(qc.SearchContext))
231 {
232 sbCropInfo.AppendFormat(@" WHERE V_CORP_NAME like '%{0}%'", qc.SearchContext.Filter());
233 }
234 var dtCropInfo = Singleton.OracleOperation.GetDataTableBySql(sbCropInfo.ToString());
235 if (null == dtCropInfo)
236 dtCropInfo = new DataTable();
237
238 var sbParamCropInfo = new StringBuilder();
239 sbParamCropInfo.AppendFormat(@"select T.V_UNIT_NAME AS V_CORP_NAME,T.V_UNIT_TEL,T2.V_STATION_NAME,T2.V_STATION_TEL, 2 cType, T.c_param_id ID
240 from T_PARAM_CORP_INFO T
241 LEFT JOIN T_PARAM_CORP_STATION_INFO T2
242 ON T.C_PARAM_ID = T2.C_PARAM_ID");
243
244 if (!string.IsNullOrEmpty(qc.SearchContext))
245 {
246 sbParamCropInfo.AppendFormat(@" WHERE (T.V_UNIT_MNEM like '%{0}%' OR T.V_UNIT_NAME like '%{0}%') ", qc.SearchContext.Filter());
247 }
248 if (!string.IsNullOrEmpty(qc.StationCode))
249 {
250 sbParamCropInfo.AppendFormat(@" AND T2.V_STATION_NAME = {0}", qc.StationName.Filter().StringParseDBNULL());
251 }
252 if (!string.IsNullOrEmpty(qc.CorpId))
253 {
254 sbParamCropInfo.AppendFormat(@" AND T.C_CORP_ID={0}", qc.CorpId.StringParseDBNULL());
255 }
256 var dtParamCropInfo = Singleton.OracleOperation.GetDataTableBySql(sbParamCropInfo.ToString());
257 if (null == dtParamCropInfo)
258 dtParamCropInfo = new DataTable();
259 DataTable dt = new DataTable();
260 dt.Columns.Add("V_CORP_NAME");
261 dt.Columns.Add("V_UNIT_TEL");
262 dt.Columns.Add("V_STATION_NAME");
263 dt.Columns.Add("V_STATION_TEL");
264 dt.Columns.Add("cType");
265 dt.Columns.Add("Id");
266 //TC-优化一下
267 dt = FillTableData(dt, dtCropInfo.Rows);
268 return FillTableData(dt, dtParamCropInfo.Rows);
269 }
270
271 /// <summary>
272 /// 填充表数据
273 /// </summary>
274 /// <param name="fillDataTable"></param>
275 /// <param name="dataRow"></param>
276 private DataTable FillTableData(DataTable fillDataTable, DataRowCollection dataRow)
277 {
278 foreach (DataRow dr in dataRow)
279 {
280 DataRow drNew = fillDataTable.NewRow();
281 drNew["V_CORP_NAME"] = dr[0];
282 drNew["V_UNIT_TEL"] = dr[1];
283 drNew["V_STATION_NAME"] = dr[2];
284 drNew["V_STATION_TEL"] = dr[3];
285 drNew["cType"] = dr[4];
286 drNew["Id"] = dr[5];
287 fillDataTable.Rows.Add(drNew);
288 }
289 return fillDataTable;
290 }
291 }
此时,智能提示已正常结束