示例#1
0
        private string PreProcessReplicatorParameteres(GXProcedure procWorker, string innerMethod, Dictionary <string, object> bodyParameters)
        {
            var methodInfo = procWorker.GetType().GetMethod(innerMethod);

            object[] parametersForInvocation = ReflectionHelper.ProcessParametersForInvoke(methodInfo, bodyParameters);
            var      synchroInfo             = parametersForInvocation[1];

            return(synchroInfo.GetType().GetProperty(Synchronizer.SYNCHRONIZER_INFO).GetValue(synchroInfo) as string);
        }
示例#2
0
        private void PreProcessSynchronizerParameteres(GXProcedure instance, string method, Dictionary <string, object> bodyParameters)
        {
            var gxParameterName = instance.GetType().GetMethod(method).GetParameters().First().Name.ToLower();
            GxUnknownObjectCollection hashList;

            if (bodyParameters.ContainsKey(string.Empty))
            {
                hashList = (GxUnknownObjectCollection)ReflectionHelper.ConvertStringToNewType(bodyParameters[string.Empty], typeof(GxUnknownObjectCollection));
            }
            else
            {
                hashList = new GxUnknownObjectCollection();
            }
            bodyParameters[gxParameterName] = TableHashList(hashList);
        }
示例#3
0
 private bool IsCoreEventReplicator(GXProcedure procWorker)
 {
     return(procWorker.GetType().FullName == Synchronizer.CORE_OFFLINE_EVENT_REPLICATOR);
 }
示例#4
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="key"></param>
        /// <returns></returns>
        public virtual Task MethodBodyExecute(object key)
        {
            try
            {
                String innerMethod = EXECUTE_METHOD;
                bool   wrapped     = true;
                Dictionary <string, object> bodyParameters = null;
                if (IsCoreEventReplicator(_procWorker))
                {
                    bodyParameters = ReadBodyParameters();
                    string synchronizer = PreProcessReplicatorParameteres(_procWorker, innerMethod, bodyParameters);
                    if (!IsAuthenticated(synchronizer))
                    {
                        return(Task.CompletedTask);
                    }
                }
                else if (!IsAuthenticated())
                {
                    return(Task.CompletedTask);
                }
                if (Worker.UploadEnabled() && GxUploadHelper.IsUploadURL(_httpContext))
                {
                    GXObjectUploadServices gxobject = new GXObjectUploadServices(_gxContext);
                    gxobject.webExecute();
                    return(Task.CompletedTask);
                }
                if (!ProcessHeaders(_procWorker.GetType().Name))
                {
                    return(Task.CompletedTask);
                }
                _procWorker.IsMain = true;
                if (bodyParameters == null)
                {
                    bodyParameters = ReadBodyParameters();
                }

                if (_procWorker.IsSynchronizer2)
                {
                    innerMethod = SynchronizerMethod();
                    PreProcessSynchronizerParameteres(_procWorker, innerMethod, bodyParameters);
                    wrapped = false;
                }

                if (!String.IsNullOrEmpty(this.ServiceMethod))
                {
                    innerMethod = this.ServiceMethod;
                }
                Dictionary <string, object> outputParameters = ReflectionHelper.CallMethod(_procWorker, innerMethod, bodyParameters, _gxContext);

                wrapped = GetWrappedStatus(_procWorker, wrapped, outputParameters);
                setWorkerStatus(_procWorker);
                _procWorker.cleanup();
                RestProcess(outputParameters);
                return(Serialize(outputParameters, wrapped, _procWorker.IsApiObject));
            }
            catch (Exception e)
            {
                return(WebException(e));
            }
            finally
            {
                Cleanup();
            }
        }