예제 #1
0
        private JsonData JngsSgyParser(JsonData jsobj)
        {
            JsonData jret = null;
            JsonBase jbr  = null;

            if (jsobj != null)
            {
                #region 统一代码
                try
                {
                    if (jsobj != null)
                    {
                        string optaction = "mobile_BLL.Interface." + jsobj["optstring"].ToString() + ",mobile_BLL";
                        Type   type      = Type.GetType(optaction);
                        jbr = (JsonBase)Activator.CreateInstance(type, jsobj["optdata"]);
                    }
                    if (jbr != null)
                    {
                        jbr.strBaseUrl  = HttpContext.Current.Request.Url.AbsoluteUri;
                        jbr.strBaseUrl  = jbr.strBaseUrl.Replace(HttpContext.Current.Request.Url.AbsolutePath, "");
                        jbr.strBaseUrl += HttpContext.Current.Request.ApplicationPath;
                        StringBuilder      sb = new StringBuilder();
                        LitJson.JsonWriter jw = new LitJson.JsonWriter(sb);
                        jw.WriteObjectStart();
                        jw.WritePropertyName("result");
                        jw.Write("");
                        jw.WriteObjectEnd();
                        jret           = JsonMapper.ToObject(sb.ToString());
                        jret["result"] = (JsonData)jbr.GetData();
                    }
                }
                catch (Exception ex)
                {
                    BaseDal.RecordError("json数据返回出错_get_data.ashx", ex.ToString());
                }
                #endregion
            }

            return(jret);
        }