protected void SaveHandler(ServiceCallOptions options, Action <ServiceResponse> callback) { Q.ServiceCall(options); }
public static void ServiceRequest <TResponse>(string service, ServiceRequest request, Action <TResponse> onSuccess, ServiceCallOptions options = null) where TResponse : ServiceResponse { ServiceCall(jQuery.ExtendObject(new ServiceCallOptions <TResponse> { Service = service, Request = request, OnSuccess = onSuccess }, options.As <ServiceCallOptions <TResponse> >())); }
public static jQueryXmlHttpRequest ServiceCall <TResponse>(ServiceCallOptions <TResponse> options) where TResponse : ServiceResponse { options = jQuery.ExtendObject(new ServiceCallOptions <TResponse> { DataType = "json", ContentType = "application/json", Type = "POST", Cache = false, BlockUI = true, Url = options.Service != null && !options.Service.StartsWith('~') && !options.Service.StartsWith('/') ? Q.ResolveUrl("~/services/" + options.Service) : Q.ResolveUrl(options.Service), Data = Q.ToJSON(options.Request), Success = (data, textStatus, request) => { //try { var response = data.As <TResponse>(); try { if (response.Error == null) { if (options.OnSuccess != null) { options.OnSuccess(response); } } else { if (Q.Config.NotLoggedInHandler != null && response != null && response.Error != null && response.Error.Code == "NotLoggedIn" && Q.Config.NotLoggedInHandler(options.As <ServiceCallOptions>(), response)) { return; } if (options.OnError != null) { options.OnError(response); } else { Q.ErrorHandling.ShowServiceError(response.Error); } } } finally { if (options.BlockUI) { Q.BlockUndo(); } if (options.OnCleanup != null) { options.OnCleanup(); } } } //catch (Exception e) //{ // StackTrace.Log(e); //} }, Error = (xhr, status, ev) => { //try { try { if (xhr.Status == 403) { string l = null; try { l = xhr.GetResponseHeader("Location"); } catch { l = null; } if (l != null) { Window.Top.Location.Href = l; return; } } var html = xhr.ResponseText; Q.Externals.IFrameDialog(new { html = html }); } finally { if (options.BlockUI) { Q.BlockUndo(); } if (options.OnCleanup != null) { options.OnCleanup(); } } } //catch (Exception e) //{ // StackTrace.Log(e); //} } }, options); if (options.BlockUI) { Q.BlockUI(); } return(jQuery.Ajax(options.As <jQueryAjaxOptions>())); }
public static extern XmlHttpRequest ServiceCall(ServiceCallOptions options);
protected void LoadByIdHandler(ServiceCallOptions <RetrieveResponse <TEntity> > options, Action <RetrieveResponse <TEntity> > callback) { Q.ServiceCall(options); }
protected virtual void UndeleteHandler(ServiceCallOptions <UndeleteResponse> options, Action <UndeleteResponse> callback) { Q.ServiceCall(options); }
protected virtual void ExecuteQueryByKey(ServiceCallOptions <RetrieveResponse <TItem> > options) { Q.ServiceCall(options); }
protected virtual void ExecuteQuery(ServiceCallOptions <ListResponse <TItem> > options) { Q.ServiceCall(options); }