private string GetAllSql(string CompanyID) { DataSet ds = BLL.CompanyBLL.GetCacheFields(CompanyID, Common.Tools.CaseTableType); string rtn = ""; string fieldtype; foreach (DataRow dr in ds.Tables[0].Rows) { fieldtype = dr["FieldType"].ToString().ToLower(); if (fieldtype == "datetime" || fieldtype == "money") { continue; } if (SearchKey.Contains(",")) { string[] keys = SearchKey.Split(','); foreach (string key in keys) { if (key != "") { rtn += " OR " + dr["FieldName"].ToString() + " like N'%" + key + "%'"; } } } else { rtn += " OR " + dr["FieldName"].ToString() + " like N'%" + SearchKey + "%'"; } } return(rtn.Substring(3)); }
private string GetNameandTbKeySql(string CompanyID) { string rtn = ""; if (SearchKey.Contains(",")) { string[] keys = SearchKey.Split(','); foreach (string key in keys) { if (key != "") { rtn += " OR tbName like N'%" + key + "%' or tbKey like N'%" + key + "%'"; } } return(rtn.Substring(3)); } else { return(" tbName like N'%" + SearchKey + "%' or tbKey like N'%" + SearchKey + "%'"); } }
private string GetTelephoneSql(string CompanyID) { DataSet ds = BLL.CompanyBLL.GetCacheFields(CompanyID, Common.Tools.CaseTableType); DataRow[] drs = ds.Tables[0].Select("FieldType='telephone'"); string rtn = ""; if (SearchKey.Contains(",")) { string [] keys = SearchKey.Split(','); foreach (string key in keys) { if (key != "") { foreach (DataRow dr in drs) { rtn += " OR " + dr["FieldName"].ToString() + " like N'%" + key + "%'"; } } } } else { foreach (DataRow dr in drs) { rtn += " OR " + dr["FieldName"].ToString() + " like N'%" + SearchKey + "%'"; } } if (rtn == "") { return(""); } else { return(rtn.Substring(3)); } }