public static TConfig Deserialize <TConfig>(string config)
     where TConfig : Config
 {
     return(JSON.Deserialize <TConfig>(config) as TConfig);
 }
示例#2
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="json"></param>
 /// <param name="mapping"></param>
 /// <returns></returns>
 public static EventModelCollection Deserialize(string json, bool mapping)
 {
     return(JSON.Deserialize <EventModelCollection>(json, mapping ? new EventMappingsContractResolver() : null));
 }
 public static Config Deserialize(string config)
 {
     return(JSON.Deserialize <Config>(config));
 }
示例#4
0
 public static T Deserialize <T>(string value, List <JsonConverter> converters, IContractResolver resolver)
 {
     return((T)JSON.Deserialize(value, typeof(T), converters, resolver));
 }
示例#5
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="json"></param>
 /// <returns></returns>
 public static List <ListItem> ParseSelectedItems(string json)
 {
     return(JSON.Deserialize <List <ListItem> >(json, new Newtonsoft.Json.Serialization.CamelCasePropertyNamesContractResolver()));
 }
示例#6
0
 public static T Deserialize <T>(string value, List <JsonConverter> converters)
 {
     return((T)JSON.Deserialize(value, typeof(T), converters, null));
 }
示例#7
0
 public static T Deserialize <T>(string value, IContractResolver resolver)
 {
     return((T)JSON.Deserialize(value, typeof(T), resolver));
 }
示例#8
0
 public static T Deserialize <T>(string value)
 {
     return((T)JSON.Deserialize(value, typeof(T), null, null));
 }
示例#9
0
 public static object Deserialize(string value, Type type, IContractResolver resolver)
 {
     return(JSON.Deserialize(value, type, null, resolver));
 }
示例#10
0
 public static object Deserialize(string value, Type type)
 {
     return(JSON.Deserialize(value, type, null, null));
 }
示例#11
0
        public void RaiseAjaxPostBackEvent(string eventArgument, ParameterCollection extraParams)
        {
            bool   success = true;
            string msg     = null;

            Response response = new Response();

            try
            {
                if (eventArgument.IsEmpty())
                {
                    throw new ArgumentNullException("eventArgument");
                }

                string data = null;

                if (this.DirectConfig != null)
                {
                    JToken serviceToken = this.DirectConfig.SelectToken("config.serviceParams", false);

                    if (serviceToken != null)
                    {
                        data = JSON.ToString(serviceToken);
                    }
                }

                switch (eventArgument)
                {
                case "nodeload":
                    //NodeLoadEventArgs e = new NodeLoadEventArgs(extraParams);
                    //PageTreeLoader loader = (PageTreeLoader) this.Loader.Primary;
                    //loader.OnNodeLoad(e);
                    //TreeNodeCollection nodes = e.Nodes;
                    //success = e.Success;
                    //msg = e.ErrorMessage;
                    //response.Data = nodes != null ? nodes.ToJson() : null;
                    break;

                case "submit":
                    SubmitEventArgs se = new SubmitEventArgs(extraParams, JSON.Deserialize <SubmittedNode>(data, new CamelCasePropertyNamesContractResolver()));
                    this.OnSubmit(se);
                    break;

                case "raEdit":
                    RemoteEditEventArgs rr = new RemoteEditEventArgs(data, extraParams);
                    this.OnRemoteEdit(rr);
                    success = rr.Accept;
                    msg     = rr.RefusalMessage;
                    break;

                case "raRemove":
                    RemoteActionEventArgs rrm = new RemoteActionEventArgs(data, extraParams);
                    this.OnRemoteRemove(rrm);
                    success = rrm.Accept;
                    msg     = rrm.RefusalMessage;
                    break;

                case "raInsert":
                case "raAppend":
                    RemoteAppendEventArgs ra = new RemoteAppendEventArgs(eventArgument == "raInsert", data, extraParams);
                    this.OnRemoteAppend(ra);
                    success = ra.Accept;
                    msg     = ra.RefusalMessage;
                    break;

                case "raMove":
                    RemoteMoveEventArgs rm = new RemoteMoveEventArgs(data, extraParams);
                    this.OnRemoteMove(rm);
                    success = rm.Accept;
                    msg     = rm.RefusalMessage;
                    break;
                }
            }
            catch (Exception ex)
            {
                success = false;
                msg     = this.IsDebugging ? ex.ToString() : ex.Message;

                if (this.ResourceManager.RethrowAjaxExceptions)
                {
                    throw;
                }
            }

            response.Success = success;
            response.Message = msg;

            ResourceManager.ServiceResponse = response;
        }
示例#12
0
 public StoreRequestParameters(string extraParams)
 {
     this.extraParams = JSON.Deserialize <Dictionary <string, object> >(extraParams);
 }