예제 #1
0
        public JObject GetQueryFilter(string helpid, string ocode, string logid)
        {
            JObject obj = new JObject();

            JObject jo  = null;
            string  str = richDac.GetQueryFilter(helpid);

            if (!string.IsNullOrWhiteSpace(str))
            {
                jo = JsonConvert.DeserializeObject <JObject>(str);
                return(jo);
            }
            else
            {
                DataTable dt = richDac.GetRichQueryUIInfo(helpid, ocode, logid);
                foreach (DataRow dr in dt.Rows)
                {
                    string field = dr["tablename"].ToString() + "." + dr["field"].ToString();
                    object val   = jo[field];
                    if (jo != null && val != null && !string.IsNullOrWhiteSpace(val.ToString()))
                    {
                        obj[field] = val.ToString();
                    }
                    else
                    {
                        obj[field] = (dr["defaultdata"] == null || dr["defaultdata"] == DBNull.Value) ? string.Empty : dr["defaultdata"].ToString();
                    }
                }

                return(obj);
            }
        }