Пример #1
0
    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));
    }
Пример #2
0
    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 + "%'");
        }
    }
Пример #3
0
    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));
        }
    }