예제 #1
0
        public WSStatus WriteJson(JsonWriter writer, JsonSerializer serializer, List <Type> printedTypes, WSRequest Request, MetaFunctions CFunc, WSDataContext DBContext)
        {
            WSStatus status = WSStatus.NONE_Copy();

            try
            {
                if (entity == null)
                {
                    status.CODE = WSStatus.ERROR.CODE;
                    status.AddNote("WSEntity not known", WSConstants.ACCESS_LEVEL.READ);
                }
                else
                {
                    List <Type> postPrintedTypes = printedTypes.Select(x => x).ToList();
                    postPrintedTypes.Add(entity.GetType());

                    if (entity != null)
                    {
                        status.childs.Add(entity.WriteJson(writer, serializer, schema, outFields, postPrintedTypes, Request, CFunc, DBContext));
                    }
                }
            }
            catch (Exception e) {
                CFunc.RegError(GetType(), e, ref status);
                status.CODE = WSStatus.ERROR.CODE;
                status.AddNote("Error(line" + e.LineNumber() + "- " + e.Message + ")");
            }
            return(status);
        }
예제 #2
0
        private WSStatus WriteJMembers(IEnumerable <MemberInfo> members, JsonWriter writer, JsonSerializer serializer, WSEntitySchema eSchema, WSSource xSource, WSParamList outFields, List <Type> printedTypes, WSRequest Request, MetaFunctions CFunc, WSDataContext DBContext)
        {
            WSStatus status = WSStatus.NONE_Copy();

            try
            {
                Type    eType = GetType();
                object  obj   = null;
                WSParam param = null;
                if (this is WSDynamicEntity)
                {
                    foreach (WSSchema fieldSchema in eSchema.Fields /*.Items*/)
                    {
                        if (fieldSchema is WSFieldSchema)
                        {
                            param = ((WSFieldSchema)fieldSchema).param;
                        }
                        else if (fieldSchema is WSEntityBaseSchema)
                        {
                            param = GetParam(xSource, fieldSchema.Name);
                        }
                        //else if (childSchema is WSEntitySchema) { param = GetParam(childSchema.Name); }
                        //else if (childSchema is WSEntityListSchema) { param = GetParam(((WSEntityListSchema)childSchema).EntitySchema.Name); }

                        MemberInfo member = param == null ? null : members.FirstOrDefault(p => param.Match(p.Name, null, null, false));
                        obj = member == null ? null : member is PropertyInfo ? ((PropertyInfo)member).GetValue(this, null) : member is FieldInfo ? ((FieldInfo)member).GetValue(this) : null;

                        if (param != null)
                        {
                            status.childs.Add(WriteJProperty(obj, param, writer, serializer, fieldSchema, xSource, outFields, printedTypes, Request, CFunc, DBContext));
                        }
                    }
                }
                else if (this is WSStaticEntity)
                {
                    foreach (MemberInfo member in members)
                    {
                        param = GetParam(xSource, member.Name, member.ReflectedType);
                        obj   = member is PropertyInfo ? ((PropertyInfo)member).GetValue(this, null) : member is FieldInfo ? ((FieldInfo)member).GetValue(this) : null;

                        if (param != null)
                        {
                            status.childs.Add(WriteJProperty(obj, param, writer, serializer, null, xSource, outFields, printedTypes, Request, CFunc, DBContext));
                        }
                    }
                }

                status.AddNote("done", WSConstants.ACCESS_LEVEL.READ);
            }
            catch (Exception e)
            {
                status.CODE = WSStatus.ERROR.CODE;
                status.AddNote("Error(line" + e.LineNumber() + "- " + e.Message + ")");
                CFunc.RegError(GetType(), e, ref status);
            }
            return(status);
        }
예제 #3
0
        public override bool Match(WSJson json, out WSStatus status)
        {
            status = WSStatus.NONE_Copy();
            try
            {
                if (json == null)
                {
                    status = WSStatus.ERROR_Copy(); return(false);
                }
                else if (!(json is WSJObject))
                {
                    status = WSStatus.ERROR_Copy(); return(false);
                }
                else
                {
                    WSJObject            jObj  = (WSJObject)json;
                    IEnumerable <string> keys  = Value.Select(v1 => v1.Key);
                    IEnumerable <string> keys1 = jObj.Value.Select(v1 => v1.Key);
                    if (keys1.Any(p1 => !keys.Any(p => p1.Equals(p))))
                    {
                        status = WSStatus.ERROR_Copy();
                        status.AddNote($"An original service generates response with additional properties:[{keys1.Where(p1 => !keys.Any(p => p1.Equals(p))).Aggregate((a,b)=>a+","+b)}] which is not exists in current object.");
                    }
                    else if (keys.Count() != keys1.Count())
                    {
                        status = WSStatus.ERROR_Copy();
                        status.AddNote($"The current service generates response with additional properties:[{keys.Where(p1 => !keys1.Any(p => p1.Equals(p))).Aggregate((a, b) => a + "," + b)}] which is not exists in original object.");
                    }
                    else
                    {
                        foreach (WSJProperty jProp1 in jObj.Value)
                        {
                            WSJProperty jProp = Value.FirstOrDefault(x => x.Key.Equals(jProp1.Key));

                            WSStatus pStatus = jProp.Match(jProp1, out pStatus) ? WSStatus.SUCCESS_Copy() : pStatus;

                            status = pStatus;

                            if (pStatus.CODE != WSStatus.SUCCESS.CODE)
                            {
                                return(false);
                            }
                        }
                        return(!status.childs.Any(x => x.CODE != WSStatus.SUCCESS.CODE));
                    }
                }
            }
            catch (Exception) { }
            return(status.CODE == WSStatus.SUCCESS.CODE);
        }
예제 #4
0
 public override bool Match(WSJson json, out WSStatus status)
 {
     status = WSStatus.NONE_Copy();
     try
     {
         if (json == null)
         {
             status = WSStatus.ERROR_Copy(); return(false);
         }
         else if (!(json is WSJArray))
         {
             status = WSStatus.ERROR_Copy(); return(false);
         }
         else
         {
             WSJProperty jProp1 = (WSJProperty)json;
             if (!Key.Equals(jProp1.Key))
             {
                 status = WSStatus.ERROR_Copy();
                 status.AddNote($"Keys not match:[{Key}<->{jProp1.Key}]");
             }
             else
             {
                 status = Value.Match(jProp1.Value, out status) ? WSStatus.SUCCESS_Copy() : status;
             }
         }
     }
     catch (Exception) { }
     return(status.CODE == WSStatus.SUCCESS.CODE);
 }
예제 #5
0
 public override bool Match(WSJson json, out WSStatus status)
 {
     status = json != null && json is WSJValue && Value.Equals(((WSJValue)json).Value) ? WSStatus.SUCCESS_Copy() : WSStatus.ERROR_Copy();
     if (status.CODE != WSStatus.SUCCESS.CODE)
     {
         status.AddNote($"Values not match:[{{current:{Value}}}<->{{original:{((WSJValue)json).Value}}}]");
         return(false);
     }
     return(true);
 }
예제 #6
0
 public static void Add(this List <WSStatus> list, string text)
 {
     try
     {
         if (list != null)
         {
             WSStatus status = WSStatus.NONE_Copy(); status.AddNote(text); list.Add(status);
         }
     }
     catch (Exception) { }
 }
예제 #7
0
        private bool Validate(object obj, WSParam xParam, JsonWriter writer, JsonSerializer serializer, WSSchema schema, WSSource xSource, WSParamList outFields, ref WSStatus status, WSRequest Request, MetaFunctions CFunc)
        {
            try
            {
                if (this is WSDynamicEntity && schema == null)
                {
                    status.CODE = WSStatus.ERROR.CODE; status.AddNote("No schema defined", WSConstants.ACCESS_LEVEL.READ);
                }
                else if (xParam == null)
                {
                    status.CODE = WSStatus.ERROR.CODE; status.AddNote("Undefined parameters are not allowed", WSConstants.ACCESS_LEVEL.READ);
                }
                else
                {
                    bool IsOwner          = false;//TODO@ANDVO:2015-09-11 : ADD IsOwner validation check
                    int  paramAccessLevel = xParam.READ_ACCESS_MODE.ACCESS_LEVEL;
                    paramAccessLevel = (xSource != null && xSource.AccessLevel > paramAccessLevel) ? xSource.AccessLevel : paramAccessLevel;

                    if (Request.Security.AuthToken.User.role < paramAccessLevel && !IsOwner)
                    {
                        #region ACCESS DENIED HANDLING
                        if (xSource != null && xSource.ShowMessageInaccessible)
                        {
                            string accessNote = "Access denied";
                            status.CODE = WSStatus.ATTANTION.CODE;
                            status.AddNote(accessNote, WSConstants.ACCESS_LEVEL.READ);
                            WritePropName(writer, xParam.NAME);
                            serializer.Serialize(writer, accessNote);
                        }
                        #endregion
                    }
                    else
                    {
                        if (!WSParamList.IsEmpty(outFields) && !outFields.Any(a => a.Match(schema.Name)))
                        {
                        }
                        else
                        {
                            if (obj == null && !xParam.SkipEmpty)
                            {
                                obj         = string.Empty;
                                status.CODE = WSStatus.ATTANTION.CODE;
                                status.AddNote("Can not write NULL to [" + xParam.DISPLAY_NAME + "]. Value set to empty string.", WSConstants.ACCESS_LEVEL.READ);
                            }

                            if (obj != null)
                            {
                                status.AddNote("done", WSConstants.ACCESS_LEVEL.READ);
                                return(true);
                            }
                        }
                    }
                }
            }
            catch (Exception e) {
                status.CODE = WSStatus.ERROR.CODE; status.AddNote("Error(line" + e.LineNumber() + "- " + e.Message + ")");
                CFunc.RegError(GetType(), e, ref status);
            }
            return(false);
        }
예제 #8
0
        public override Expression SortTable <TEntity>(MetaFunctions CFunc, WSDataContext dc, List <PropertyInfo> parents, Expression expression, ref WSStatus iostatus)
        {
            try
            {
                if (dc != null)
                {
                    parents = parents != null ? parents : new List <PropertyInfo>();
                    Type          srcType    = parents.Any() ? parents.LastOrDefault().PropertyType.IsCollection() ? parents.LastOrDefault().PropertyType.GetEntityType() : parents.LastOrDefault().PropertyType : typeof(TEntity);
                    ITable        initSource = srcType == null ? null : dc.GetTable(typeof(TEntity));
                    ITable        source     = srcType == null ? null : dc.GetTable(srcType);
                    WSTableSource schema     = srcType == null ? null : (WSTableSource)CFunc.GetSourceByType(srcType);
                    if (schema != null)
                    {
                        WSParam param = schema.GetXParam(Key);

                        if (param != null && param is WSTableParam)
                        {
                            WSTableParam tParam   = (WSTableParam)param;
                            PropertyInfo property = srcType.GetProperties().FirstOrDefault(p => tParam.WSColumnRef.NAME.Equals(p.Name));
                            if (property == null)
                            {
                                iostatus.AddNote(string.Format("No PropertyInfo found for : [{0}]", tParam.WSColumnRef.NAME));
                            }
                            else
                            {
                                parents.Add(property);

                                if (tParam.DataType.IsSimple() && tParam.IsSortable)
                                {
                                    bool IsDesc = false;
                                    if (Value is WSJValue)
                                    {
                                        IsDesc = ((WSJValue)Value).Value.ToLower().Equals("desc");
                                    }
                                    expression = SortPrimitiveType <TEntity>(initSource, source, param, IsDesc, parents, expression, ref iostatus);
                                }
                                else if (tParam.DataType.IsSameOrSubclassOf(typeof(WSEntity)) || tParam.DataType.IsCollectionOf <WSEntity>())
                                {
                                    expression = Value.SortTable <TEntity>(CFunc, dc, parents, expression, ref iostatus);
                                }
                            }
                        }
                    }
                }
            }
            catch (Exception e) { CFunc.RegError(GetType(), e, ref iostatus); }
            return(expression);
        }
예제 #9
0
        private void init()
        {
            try
            {
                if (meta.Request.SOURCE == null)
                {
                    iostatus.AddNote($"No data source found for [{meta.Request.SrcName}]. Make sure you trying to access a valid source with a valid permission.", WSConstants.ACCESS_LEVEL.READ);
                }
                else if (meta.Request.Security == null)
                {
                    iostatus.AddNote("Access denied. Security initialization failed.", WSConstants.ACCESS_LEVEL.READ);
                }
                else if (meta.Request.Security.AuthToken == null || meta.Request.Security.AuthToken.User == null)
                {
                    iostatus.AddNote("Access denied. User initialization failed.", WSConstants.ACCESS_LEVEL.READ);
                }
                else
                {
                    if ((meta.Request.ACTION == null || WSConstants.ALIACES.ACTION_NONE.Match(meta.Request.ACTION)))
                    {
                        meta.Request.INPUT.Save(WSConstants.PARAMS.KEYS.ACTION, WSConstants.ALIACES.ACTION_READ.ALIACES.FirstOrDefault());
                    }

                    if (meta.Request.ACTION == null)
                    {
                    }
                    else
                    {
                        callAction();
                    }
                }

                response = response == null
                    ? new V1SystemResponseRecord(meta.ClientFunctions, new V1SystemResponseEntity()
                {
                    status  = WSStatusBase.ERROR.NAME,
                    message = iostatus.DeepNotes
                }, meta.Request.Security.AuthToken.User.role)
                    : response;
            }
            catch (Exception e) { meta.RegError(GetType(), e, ref iostatus); }
        }
예제 #10
0
        private WSStatus WriteJProperty(object obj, WSParam xParam, JsonWriter writer, JsonSerializer serializer, WSSchema schema, WSSource xSource, WSParamList outFields, List <Type> printedTypes, WSRequest Request, MetaFunctions CFunc, WSDataContext DBContext)
        {
            WSStatus status = WSStatus.NONE_Copy();

            try
            {
                if (Validate(obj, xParam, writer, serializer, schema, xSource, outFields, ref status, Request, CFunc))
                {
                    if (obj == null)
                    {
                        WritePropName(writer, ((schema != null && !string.IsNullOrEmpty(schema.Name)) ? schema.Name : xParam.NAME), true, PrintMode.ValueCell);
                        serializer.Serialize(writer, obj);
                    }
                    else if (obj is WSStatus || obj is WSStatus_JSON)
                    {
                        #region PRINT WSStatus
                        WSStatus_JSON json = obj is WSStatus_JSON ? (WSStatus_JSON)obj : ((WSStatus)obj).GetJson();
                        if (json != null)
                        {
                            WritePropName(writer, ((schema != null && !string.IsNullOrEmpty(schema.Name)) ? schema.Name : xParam.NAME), true, PrintMode.TableHeader);
                            serializer.Serialize(writer, json);
                        }
                        #endregion
                    }
                    else if (obj.GetType().IsSimple())
                    {
                        #region PRINT PRIMITIVE FIELD

                        if (obj is DateTime)
                        {
                            obj = ((DateTime)obj).ToString(WSConstants.DATE_FORMAT);
                        }
                        else if (obj is TimeSpan)
                        {
                            obj = ((TimeSpan)obj).ToString(WSConstants.TIMESPAN_FORMAT_SIMPLE);
                        }

                        WritePropName(writer, (schema != null && !string.IsNullOrEmpty(schema.Name)) ? schema.Name : xParam.NAME);
                        object _obj = null;
                        serializer.Serialize(writer, xParam.TryReadPrimitiveWithDefault(obj, string.Empty, out _obj) ? _obj : string.Empty);

                        #endregion
                    }
                    else if (obj.GetType().IsSimpleCollection())
                    {
                        #region PRINT PRIMITIVE COLLECTION
                        string key = (schema != null && !string.IsNullOrEmpty(schema.Name)) ? schema.Name : xParam.NAME;
                        status.AddNote("ready to searialize primitive fields (" + key + ")");

                        WritePropName(writer, key);
                        serializer.Serialize(writer, obj);

                        #endregion
                    }
                    else if (obj is WSRecord)
                    {
                        #region PRINT WSRecord

                        string pKey = (schema != null && !string.IsNullOrEmpty(schema.Name)) ? schema.Name : xParam.NAME;
                        WritePropName(writer, pKey);
                        ((WSRecord)obj).WriteJson(writer, serializer, printedTypes, Request, CFunc, DBContext);

                        #endregion
                    }
                    else if (obj.IsCollectionOf <WSRecord>())
                    {
                        #region PRINT WSRecord Collection

                        string pKey = (schema != null && !string.IsNullOrEmpty(schema.Name)) ? schema.Name : xParam.NAME;

                        WritePropName(writer, pKey);
                        writer.WriteStartArray();

                        IList list = obj as IList;
                        foreach (WSRecord record in list)
                        {
                            if (record != null)
                            {
                                record.WriteJson(writer, serializer, printedTypes, Request, CFunc, DBContext);
                            }
                        }

                        writer.WriteEndArray();
                        #endregion
                    }
                    else
                    {
                        #region PRINT ENTITY

                        bool printAllowed =
                            (this is WSStaticEntity)
                            ||
                            (
                                schema is WSEntityBaseSchema
                                &&
                                validateType(writer, xParam, obj, printedTypes, true, Request, CFunc)
                            );

                        if (printAllowed)
                        {
                            string pKey = (schema != null && !string.IsNullOrEmpty(schema.Name)) ? schema.Name : xParam.NAME;
                            WritePropName(writer, pKey, false);

                            #region PRINT WSEntity
                            if (obj is WSEntity)
                            {
                                if (obj is WSDynamicEntity && !((WSDynamicEntity)obj).Match(Request, DBContext, CFunc, schema))
                                {
                                    serializer.Serialize(writer, "NULL");
                                }
                                else
                                {
                                    ((WSEntity)obj).WriteJson(writer, serializer, schema, outFields, printedTypes, Request, CFunc, DBContext);
                                }
                            }
                            #endregion

                            #region PRINT Collection
                            else if (obj.IsCollectionOf <WSEntity>())
                            {
                                IList list  = obj as IList;
                                Type  eType = list.GetEntityType();

                                writer.WriteStartArray();
                                foreach (WSEntity entity in list)
                                {
                                    if (entity != null)
                                    {
                                        if (entity is WSDynamicEntity)
                                        {
                                            WSDynamicEntity dEntity = (WSDynamicEntity)entity;
                                            if (dEntity.Match(Request, DBContext, CFunc, schema))
                                            {
                                                entity.WriteJson(writer, serializer, schema, outFields, printedTypes, Request, CFunc, DBContext);
                                            }
                                        }
                                        else
                                        {
                                            entity.WriteJson(writer, serializer, schema, outFields, printedTypes, Request, CFunc, DBContext);
                                        }
                                    }
                                }
                                writer.WriteEndArray();
                            }
                            #endregion
                        }

                        #endregion
                    }
                    status.AddNote("done", WSConstants.ACCESS_LEVEL.READ);
                }
            }
            catch (Exception e)
            {
                status.CODE = WSStatus.ERROR.CODE;
                status.AddNote("Error(line" + e.LineNumber() + "- " + e.Message + ")");
                CFunc.RegError(GetType(), e, ref status);
            }
            return(status);
        }
예제 #11
0
        public WSStatus regStatistics(HttpContext context)
        {
            WSStatus status = WSStatus.NONE_Copy();

            try
            {
                string httpSession = string.Empty;
                string urlQuery    = string.Empty;
                string postParams  = string.Empty;
                string routeData   = string.Empty;
                System.Text.StringBuilder request = new System.Text.StringBuilder();
                Guid errorKey = Guid.NewGuid();

                #region STANDARD_ASP_URL_PARAMS
                string[] STANDARD_ASP_URL_PARAMS = new string[] {
                    "__utma",
                    "__utmb",
                    "__utmc",
                    "__utmz",
                    //"ASP.NET_SessionId",
                    "fbm_876939902336614",
                    "fbm_881650921865512",
                    "fbsr_881650921865512",
                    "ALL_HTTP",
                    "ALL_RAW",
                    "APPL_MD_PATH",
                    //"APPL_PHYSICAL_PATH",
                    //"AUTH_TYPE",
                    //"AUTH_USER",
                    "AUTH_PASSWORD",
                    //"LOGON_USER",
                    //"REMOTE_USER",
                    "CERT_COOKIE",
                    "CERT_FLAGS",
                    "CERT_ISSUER",
                    "CERT_KEYSIZE",
                    "CERT_SECRETKEYSIZE",
                    "CERT_SERIALNUMBER",
                    "CERT_SERVER_ISSUER",
                    "CERT_SERVER_SUBJECT",
                    "CERT_SUBJECT",
                    "CONTENT_LENGTH",
                    //"CONTENT_TYPE",
                    "GATEWAY_INTERFACE",
                    "HTTPS",
                    "HTTPS_KEYSIZE",
                    "HTTPS_SECRETKEYSIZE",
                    "HTTPS_SERVER_ISSUER",
                    "HTTPS_SERVER_SUBJECT",
                    "INSTANCE_ID",
                    "INSTANCE_META_PATH",
                    //"LOCAL_ADDR",
                    //"PATH_INFO",
                    //"PATH_TRANSLATED",
                    //"QUERY_STRING",
                    //"REMOTE_ADDR",
                    //"REMOTE_HOST",
                    //"REMOTE_PORT",
                    //"REQUEST_METHOD",
                    "SCRIPT_NAME",
                    //"SERVER_NAME",
                    //"SERVER_PORT",
                    "SERVER_PORT_SECURE",
                    //"SERVER_PROTOCOL",
                    "SERVER_SOFTWARE",
                    //"URL",
                    "HTTP_CONNECTION",
                    "HTTP_CONTENT_LENGTH",
                    "HTTP_CONTENT_TYPE",
                    "HTTP_ACCEPT",
                    "HTTP_ACCEPT_ENCODING",
                    "HTTP_ACCEPT_LANGUAGE",
                    "HTTP_COOKIE",
                    //"HTTP_HOST",
                    //"HTTP_REFERER",
                    //"HTTP_USER_AGENT",
                    //"HTTP_ORIGIN",
                    "HTTP_X_REQUESTED_WITH",
                    "HTTP_DNT",
                    "AspSessionIDManagerInitializeRequestCalled",
                    //"AspSession"
                };
                #endregion

                string SecurityKey = string.Empty;
                string referrer    = (context.Request.UrlReferrer == null ? "" : context.Request.UrlReferrer.AbsoluteUri);

                new OBMWS.WSConverter().ToMd5Hash("Sdk1RtmB" + DateTime.Now.ToString("yyyyMMddhhmm"), out SecurityKey);

                #region READ 'postParams' PARAMETERS
                try
                {
                    Dictionary <string, string> items = new Dictionary <string, string>();

                    string[] PKeys = context.Request.Params.AllKeys.Where(x => !STANDARD_ASP_URL_PARAMS.Select(p => p.ToLower()).Contains(x.ToLower()) && !x.StartsWith("_")).ToArray();
                    foreach (var PKey in PKeys)
                    {
                        if (PKey != null)
                        {
                            try { items.Add(PKey, context.Request.Params[PKey]); } catch (Exception) { }
                        }
                    }
                    postParams = (items != null && items.Any()) ? items.Select(i => "\"" + i.Key + "\":\"" + i.Value + "\"").Aggregate((a, b) => a + "," + b) : "";
                }
                catch (Exception) { }
                #endregion

                #region READ 'httpSession' PARAMETERS
                try
                {
                    Dictionary <string, string> items = new Dictionary <string, string>()
                    {
                        { "SessionID", context.Session.SessionID }
                    };
                    System.Collections.Specialized.NameObjectCollectionBase.KeysCollection PKeys = context.Session.Keys;
                    foreach (var PKey in PKeys)
                    {
                        if (PKey != null)
                        {
                            try { items.Add(PKey.ToString(), context.Session[PKey.ToString()].ToString()); } catch (Exception) { }
                        }
                    }
                    httpSession = "{\"Session\":{" + ((items != null && items.Any()) ? items.Select(i => "\"" + i.Key + "\":\"" + i.Value + "\"").Aggregate((a, b) => a + "," + b) : "") + "}}";
                }
                catch (Exception) { }
                #endregion

                #region READ 'urlQuery' PARAMETERS
                try
                {
                    Dictionary <string, string> items = new Dictionary <string, string>();
                    foreach (var queryParam in context.Request.QueryString.Keys)
                    {
                        if (queryParam != null)
                        {
                            try { items.Add(queryParam.ToString(), context.Request.QueryString[queryParam.ToString()]); } catch (Exception) { }
                        }
                    }
                    urlQuery = (items != null && items.Any()) ? items.Select(i => "\"" + i.Key + "\":\"" + i.Value + "\"").Aggregate((a, b) => a + "," + b) : "";
                }
                catch (Exception) { }
                #endregion

                #region READ ROUTE-DATA PARAM
                try
                {
                    Dictionary <string, string> items = new Dictionary <string, string>();
                    foreach (var urlParam in context.Request.RequestContext.RouteData.Values)
                    {
                        try { items.Add(urlParam.Key, urlParam.Value != null ? urlParam.Value.ToString() : ""); } catch (Exception) { }
                    }
                    routeData = (items != null && items.Any()) ? items.Select(i => "\"" + i.Key + "\":\"" + i.Value + "\"").Aggregate((a, b) => a + "," + b) : "";
                }
                catch (Exception) { }
                #endregion

                #region Build 'Http_Request' object
                request.Append("{");
                request.Append("\"ApplicationPath\":\"" + context.Request.ApplicationPath + "\",");
                #region Browser
                request.Append("\"Browser\":{");
                if (context.Request.Browser != null)
                {
                    request.Append("\"Browser\":\"" + context.Request.Browser.Browser + "\",");
                    request.Append("\"Id\":\"" + context.Request.Browser.Id + "\",");
                    request.Append("\"Type\":\"" + context.Request.Browser.Type + "\",");
                    request.Append("\"Version\":\"" + context.Request.Browser.Version + "\",");
                    request.Append("\"IsMobileDevice\":\"" + context.Request.Browser.IsMobileDevice + "\",");
                    request.Append("\"Beta\":\"" + context.Request.Browser.Beta + "\",");
                    request.Append("\"Platform\":\"" + context.Request.Browser.Platform + "\",");
                    request.Append("\"ScreenPixelsHeight\":\"" + context.Request.Browser.ScreenPixelsHeight + "\",");
                    request.Append("\"ScreenPixelsWidth\":\"" + context.Request.Browser.ScreenPixelsWidth + "\",");
                    request.Append("\"SupportsCss\":\"" + context.Request.Browser.SupportsCss + "\",");
                    request.Append("\"Cookies\":\"" + context.Request.Browser.Cookies + "\",");
                    request.Append("\"SupportsCallback\":\"" + context.Request.Browser.SupportsCallback + "\",");
                    request.Append("\"W3CDomVersion\":\"" + context.Request.Browser.W3CDomVersion + "\",");
                    request.Append("\"Win16\":\"" + context.Request.Browser.Win16 + "\",");
                    request.Append("\"Win32\":\"" + context.Request.Browser.Win32 + "\",");

                    /*********************************************************
                     * "\"Frames\":\"" + Request.Browser.Frames + "\"," +
                     * "\"Tables\":\"" + Request.Browser.Tables + "\"," +
                     * "\"UseOptimizedCacheKey\":\"" + Request.Browser.UseOptimizedCacheKey + "\"," +
                     * "\"PreferredRequestEncoding\":\"" + Request.Browser.PreferredRequestEncoding + "\"," +
                     * "\"PreferredResponseEncoding\":\"" + Request.Browser.PreferredResponseEncoding + "\"," +
                     * "\"JScriptVersion\":\"" + (Request.Browser.JScriptVersion != null ? Request.Browser.JScriptVersion.Build : -1) + "\"," +
                     * "\"VBScript\":\"" + Request.Browser.VBScript + "\"," +
                     * "\"SupportsInputMode\":\"" + Request.Browser.SupportsInputMode + "\"," +
                     * "\"SupportsItalic\":\"" + Request.Browser.SupportsItalic + "\"," +
                     * "\"SupportsJPhoneMultiMediaAttributes\":\"" + Request.Browser.SupportsJPhoneMultiMediaAttributes + "\"," +
                     * "\"SupportsJPhoneSymbols\":\"" + Request.Browser.SupportsJPhoneSymbols + "\"," +
                     * "\"SupportsQueryStringInFormAction\":\"" + Request.Browser.SupportsQueryStringInFormAction + "\"," +
                     * "\"SupportsRedirectWithCookie\":\"" + Request.Browser.SupportsRedirectWithCookie + "\"," +
                     * "\"SupportsSelectMultiple\":\"" + Request.Browser.SupportsSelectMultiple + "\"," +
                     * "\"SupportsUncheck\":\"" + Request.Browser.SupportsUncheck + "\"," +
                     * "\"SupportsXmlHttp\":\"" + Request.Browser.SupportsXmlHttp + "\"," +
                     * "\"SupportsDivAlign\":\"" + Request.Browser.SupportsDivAlign + "\"," +
                     * "\"SupportsDivNoWrap\":\"" + Request.Browser.SupportsDivNoWrap + "\"," +
                     * "\"SupportsEmptyStringInCookieValue\":\"" + Request.Browser.SupportsEmptyStringInCookieValue + "\"," +
                     * "\"SupportsFontColor\":\"" + Request.Browser.SupportsFontColor + "\"," +
                     * "\"SupportsFontName\":\"" + Request.Browser.SupportsFontName + "\"," +
                     * "\"SupportsFontSize\":\"" + Request.Browser.SupportsFontSize + "\"," +
                     * "\"SupportsInputIStyle\":\"" + Request.Browser.SupportsInputIStyle + "\"," +
                     * "\"SupportsImageSubmit\":\"" + Request.Browser.SupportsImageSubmit + "\"," +
                     * "\"SupportsIModeSymbols\":\"" + Request.Browser.SupportsIModeSymbols + "\"," +
                     * "\"ActiveXControls\":\"" + Request.Browser.ActiveXControls + "\"," +
                     * "\"AOL\":\"" + Request.Browser.AOL + "\"," +
                     * "\"BackgroundSounds\":\"" + Request.Browser.BackgroundSounds + "\"," +
                     * "\"CanCombineFormsInDeck\":\"" + Request.Browser.CanCombineFormsInDeck + "\"," +
                     * "\"CanInitiateVoiceCall\":\"" + Request.Browser.CanInitiateVoiceCall + "\"," +
                     * "\"CanRenderAfterInputOrSelectElement\":\"" + Request.Browser.CanRenderAfterInputOrSelectElement + "\"," +
                     * "\"CanRenderEmptySelects\":\"" + Request.Browser.CanRenderEmptySelects + "\"," +
                     * "\"CanRenderInputAndSelectElementsTogether\":\"" + Request.Browser.CanRenderInputAndSelectElementsTogether + "\"," +
                     * "\"CanRenderMixedSelects\":\"" + Request.Browser.CanRenderMixedSelects + "\"," +
                     * "\"CanRenderOneventAndPrevElementsTogether\":\"" + Request.Browser.CanRenderOneventAndPrevElementsTogether + "\"," +
                     * "\"CanRenderPostBackCards\":\"" + Request.Browser.CanRenderPostBackCards + "\"," +
                     * "\"CanRenderSetvarZeroWithMultiSelectionList\":\"" + Request.Browser.CanRenderSetvarZeroWithMultiSelectionList + "\"," +
                     * "\"CanSendMail\":\"" + Request.Browser.CanSendMail + "\"," +
                     * "\"CDF\":\"" + Request.Browser.CDF + "\"," +
                     * "\"Crawler\":\"" + Request.Browser.Crawler + "\"," +
                     * "\"DefaultSubmitButtonLimit\":\"" + Request.Browser.DefaultSubmitButtonLimit + "\"," +
                     * "\"EcmaScriptVersion\":\"" + Request.Browser.EcmaScriptVersion + "\"," +
                     * "\"GatewayMajorVersion\":\"" + Request.Browser.GatewayMajorVersion + "\"," +
                     * "\"GatewayMinorVersion\":\"" + Request.Browser.GatewayMinorVersion + "\"," +
                     * "\"GatewayVersion\":\"" + Request.Browser.GatewayVersion + "\"," +
                     * "\"HasBackButton\":\"" + Request.Browser.HasBackButton + "\"," +
                     * "\"HidesRightAlignedMultiselectScrollbars\":\"" + Request.Browser.HidesRightAlignedMultiselectScrollbars + "\"," +
                     * "\"HtmlTextWriter\":\"" + Request.Browser.HtmlTextWriter + "\"," +
                     * "\"InputType\":\"" + Request.Browser.InputType + "\"," +
                     * "\"IsColor\":\"" + Request.Browser.IsColor + "\"," +
                     * "\"JavaApplets\":\"" + Request.Browser.JavaApplets + "\"," +
                     * "\"MajorVersion\":\"" + Request.Browser.MajorVersion + "\"," +
                     * "\"MaximumHrefLength\":\"" + Request.Browser.MaximumHrefLength + "\"," +
                     * "\"MaximumRenderedPageSize\":\"" + Request.Browser.MaximumRenderedPageSize + "\"," +
                     * "\"MaximumSoftkeyLabelLength\":\"" + Request.Browser.MaximumSoftkeyLabelLength + "\"," +
                     * "\"MinorVersion\":\"" + Request.Browser.MinorVersion + "\"," +
                     * "\"MinorVersionString\":\"" + Request.Browser.MinorVersionString + "\"," +
                     * "\"MobileDeviceManufacturer\":\"" + Request.Browser.MobileDeviceManufacturer + "\"," +
                     * "\"MobileDeviceModel\":\"" + Request.Browser.MobileDeviceModel + "\"," +
                     * "\"Browser\":\"" + (Request.Browser.MSDomVersion!=null?Request.Browser.MSDomVersion.Build:-1) + "\"," +
                     * "\"NumberOfSoftkeys\":\"" + Request.Browser.NumberOfSoftkeys + "\"," +
                     * "\"PreferredImageMime\":\"" + Request.Browser.PreferredImageMime + "\"," +
                     * "\"PreferredRenderingMime\":\"" + Request.Browser.PreferredRenderingMime + "\"," +
                     * "\"PreferredRenderingType\":\"" + Request.Browser.PreferredRenderingType + "\"," +
                     * "\"RendersBreakBeforeWmlSelectAndInput\":\"" + Request.Browser.RendersBreakBeforeWmlSelectAndInput + "\"," +
                     * "\"RendersBreaksAfterHtmlLists\":\"" + Request.Browser.RendersBreaksAfterHtmlLists + "\"," +
                     * "\"RendersBreaksAfterWmlAnchor\":\"" + Request.Browser.RendersBreaksAfterWmlAnchor + "\"," +
                     * "\"RendersWmlDoAcceptsInline\":\"" + Request.Browser.RendersWmlDoAcceptsInline + "\"," +
                     * "\"RendersWmlSelectsAsMenuCards\":\"" + Request.Browser.RendersWmlSelectsAsMenuCards + "\"," +
                     * "\"RequiredMetaTagNameValue\":\"" + Request.Browser.RequiredMetaTagNameValue + "\"," +
                     * "\"RequiresAttributeColonSubstitution\":\"" + Request.Browser.RequiresAttributeColonSubstitution + "\"," +
                     * "\"RequiresContentTypeMetaTag\":\"" + Request.Browser.RequiresContentTypeMetaTag + "\"," +
                     * "\"RequiresControlStateInSession\":\"" + Request.Browser.RequiresControlStateInSession + "\"," +
                     * "\"RequiresDBCSCharacter\":\"" + Request.Browser.RequiresDBCSCharacter + "\"," +
                     * "\"RequiresHtmlAdaptiveErrorReporting\":\"" + Request.Browser.RequiresHtmlAdaptiveErrorReporting + "\"," +
                     * "\"RequiresLeadingPageBreak\":\"" + Request.Browser.RequiresLeadingPageBreak + "\"," +
                     * "\"RequiresNoBreakInFormatting\":\"" + Request.Browser.RequiresNoBreakInFormatting + "\"," +
                     * "\"RequiresOutputOptimization\":\"" + Request.Browser.RequiresOutputOptimization + "\"," +
                     * "\"RequiresPhoneNumbersAsPlainText\":\"" + Request.Browser.RequiresPhoneNumbersAsPlainText + "\"," +
                     * "\"RequiresSpecialViewStateEncoding\":\"" + Request.Browser.RequiresSpecialViewStateEncoding + "\"," +
                     * "\"RequiresUniqueFilePathSuffix\":\"" + Request.Browser.RequiresUniqueFilePathSuffix + "\"," +
                     * "\"RequiresUniqueHtmlCheckboxNames\":\"" + Request.Browser.RequiresUniqueHtmlCheckboxNames + "\"," +
                     * "\"RequiresUniqueHtmlInputNames\":\"" + Request.Browser.RequiresUniqueHtmlInputNames + "\"," +
                     * "\"RequiresUrlEncodedPostfieldValues\":\"" + Request.Browser.RequiresUrlEncodedPostfieldValues + "\"," +
                     * "\"ScreenBitDepth\":\"" + Request.Browser.ScreenBitDepth + "\"," +
                     * "\"ScreenCharactersHeight\":\"" + Request.Browser.ScreenCharactersHeight + "\"," +
                     * "\"ScreenCharactersWidth\":\"" + Request.Browser.ScreenCharactersWidth + "\"," +
                     * "\"SupportsAccesskeyAttribute\":\"" + Request.Browser.SupportsAccesskeyAttribute + "\"," +
                     * "\"SupportsBodyColor\":\"" + Request.Browser.SupportsBodyColor + "\"," +
                     * "\"SupportsBold\":\"" + Request.Browser.SupportsBold + "\"," +
                     * "\"SupportsCacheControlMetaTag\":\"" + Request.Browser.SupportsCacheControlMetaTag + "\"," +
                     * ****************************************************************/

                    request.Append("\"Browser\":\"" + context.Request.Browser.ToString() + "\"");
                }
                request.Append("},");
                #endregion
                request.Append("\"HttpMethod\":\"" + context.Request.HttpMethod + "\",");
                request.Append("\"IsSecureConnection\":\"" + context.Request.IsSecureConnection + "\",");
                request.Append("\"RequestType\":\"" + context.Request.RequestType + "\",");
                request.Append("\"UserAgent\":\"" + context.Request.UserAgent + "\",");
                request.Append("\"UserHostAddress\":\"" + context.Request.UserHostAddress + "\",");
                request.Append("\"UserHostName\":\"" + context.Request.UserHostName + "\",");
                request.Append("\"UserLanguages\":[");
                if (context.Request.UserLanguages != null && context.Request.UserLanguages.Any())
                {
                    request.Append(context.Request.UserLanguages.Select(l => "\"" + l + "\"").Aggregate((a, b) => a + "," + b));
                }
                request.Append("],");
                request.Append("\"UrlReferrer\":\"" + referrer + "\"");
                request.Append("}");
                #endregion

                status = WSStatus.SUCCESS_Copy();
                status.AddNote(registerHttpActivity(context.Request.Url.AbsoluteUri, context.Request.UserHostAddress, request.ToString(), httpSession, urlQuery, postParams, referrer, null, true));
            }
            catch (Exception) { status = WSStatus.ERROR_Copy(); }
            return(status);
        }
예제 #12
0
        public WSCall(HttpContext _InContext)
        {
            try
            {
                if (_InContext != null)
                {
                    INPUT = new Dictionary <string, string>();

                    #region READ POST PARAMETERS
                    if (_InContext.Request.HttpMethod.Equals("POST"))
                    {
                        #region READ FORM PARAMETERS
                        foreach (string fKey in _InContext.Request.Form.AllKeys)
                        {
                            if (!string.IsNullOrEmpty(fKey))
                            {
                                string fValue = _InContext.Request.Form[fKey];
                                INPUT.Save(fKey, fValue);
                            }
                        }
                        #endregion


                        string[]             allKeys    = _InContext.Request.Params.AllKeys;
                        IEnumerable <string> actualKeys = allKeys.Where(x => x != null && !WSConstants.STANDARD_ASP_URL_PARAMS.Select(p => p.ToLower()).Contains(x.ToLower()));
                        string[]             PKeys      = actualKeys.ToArray();

                        foreach (string PKey in _InContext.Request.Params)
                        {
                            if (!string.IsNullOrEmpty(PKey))
                            {
                                if (!WSConstants.STANDARD_ASP_URL_PARAMS.Any(x => x.Equals(PKey)))
                                {
                                    bool   isValid = true;
                                    string PVal    = _InContext.Request.Params[PKey];
                                    if (PKey.ToLower().Equals("url"))
                                    {
                                        string RawUrl = _InContext.Request.RawUrl;
                                        if (PVal.Equals(RawUrl))
                                        {
                                            isValid = false;
                                        }
                                        else
                                        {
                                            PVal = PVal.Split(new char[] { ',' }).FirstOrDefault(x => !x.ToLower().Equals(RawUrl.ToLower())); isValid = !string.IsNullOrEmpty(PVal);
                                        }
                                    }
                                    if (isValid)
                                    {
                                        INPUT.Save(PKey, PVal, false);
                                    }
                                }
                            }
                            else
                            {
                                string jValue = _InContext.Request.Params[PKey];
                                status.AddNote("POST: try saving empty key {" + PKey + ":" + jValue + "}", WSConstants.ACCESS_LEVEL.READ);
                                if (!string.IsNullOrEmpty(jValue))
                                {
                                    WSJson json = jValue.ToJson();
                                    if (json == null)
                                    {
                                        status.AddNote("POST:failed convert json {" + jValue + "}. Try autoresolve.", WSConstants.ACCESS_LEVEL.READ);
                                        json = ("{data:" + jValue + "}").ToJson();
                                        json = json != null && (json is WSJObject) ? ((WSJObject)json).Value[0].Value : null;
                                    }

                                    if (json == null)
                                    {
                                        status.AddNote("POST:failed convert json {" + jValue + "}", WSConstants.ACCESS_LEVEL.READ);
                                    }
                                    else
                                    {
                                        if (json is WSJArray)
                                        {
                                            WSJArray jArray = (WSJArray)json;
                                            foreach (WSJson innerJson in jArray.Value)
                                            {
                                                if (innerJson is WSJProperty)
                                                {
                                                    WSJProperty jProp = (WSJProperty)innerJson;
                                                    INPUT.Save(jProp.Key, jProp.Value.ToString(), false);
                                                }
                                            }
                                        }
                                        else if (json is WSJObject)
                                        {
                                            foreach (WSJProperty jProp in ((WSJObject)json).Value)
                                            {
                                                string jVal = Newtonsoft.Json.JsonConvert.SerializeObject(jProp.Value, new WSFilterConverter());
                                                INPUT.Save(jProp.Key, jVal, false);
                                            }
                                        }
                                        else if (json is WSJProperty)
                                        {
                                            WSJProperty jProp = (WSJProperty)json;
                                            string      jVal  = Newtonsoft.Json.JsonConvert.SerializeObject(jProp.Value, new WSFilterConverter());
                                            INPUT.Save(jProp.Key, jVal, false);
                                        }
                                    }
                                }
                            }
                        }
                    }

                    #endregion

                    #region READ QUERY-STRING PARAMETERS
                    foreach (var queryParam in _InContext.Request.QueryString.Keys)
                    {
                        if (queryParam != null)
                        {
                            string qKey   = queryParam.ToString();
                            string qValue = _InContext.Request.QueryString[qKey];
                            INPUT.Save(qKey, qValue);
                        }
                    }
                    #endregion

                    #region READ ROUTE-DATA PARAM
                    foreach (var urlParam in _InContext.Request.RequestContext.RouteData.Values)
                    {
                        if (!WSConstants.STANDARD_ASP_URL_PARAMS.Select(p => p.ToLower()).Contains(urlParam.Key.ToLower()))
                        {
                            string uKey   = urlParam.Key;
                            string uValue = urlParam.Value.ToString();
                            INPUT.Save(uKey, uValue);
                        }
                    }
                    #endregion

                    SessionID = INPUT.Any(x => WSConstants.PARAMS.SESSIONID.Match(x.Key)) ? INPUT.FirstOrDefault(x => WSConstants.PARAMS.SESSIONID.Match(x.Key)).Value : string.Empty;
                    if (string.IsNullOrEmpty(SessionID))
                    {
                        if (_InContext.Session != null)
                        {
                            SessionID = _InContext.Session.SessionID;
                        }
                        else
                        {
                            SessionID = _InContext.Request.Params["ASP.NET_SessionId"];
                        }
                    }

                    IsLocal = _InContext.Request == null || _InContext.Request.IsLocal;

                    UserHostAddress = _InContext.Request.UserHostAddress;

                    HttpMethod = _InContext.Request.HttpMethod;

                    Url = _InContext.Request.Url;

                    Files = _InContext.Request.Files;
                }
            }
            catch (Exception) { }
        }
예제 #13
0
        private static WSSources <WSTableSource> LoadMetaSources()
        {
            LoadStatusStatic.AddNote($"IOSB.LoadMetaSources()");
            WSSources <WSTableSource>        ORG_SOURCES = new WSSources <WSTableSource>();
            Dictionary <Type, WSDataContext> dbList      = new Dictionary <Type, WSDataContext>();

            try
            {
                if (EntityTypes != null && EntityTypes.Any())
                {
                    IEnumerable <string> namespaces_         = EntityTypes.Select(t => t.Namespace).Distinct();
                    Dictionary <string, List <Type> > nsList = namespaces_.ToDictionary(key => key, val => new List <Type>());

                    foreach (Type type in EntityTypes)
                    {
                        nsList[type.Namespace].Add(type);
                    }
                    foreach (KeyValuePair <string, List <Type> > ns in nsList)
                    {
                        if (ns.Value.Any())
                        {
                            foreach (Type type in ns.Value)
                            {
                                try
                                {
                                    Type          DCType = GetDCTypeByEntityType(type);
                                    WSDataContext db     = null;
                                    if (dbList.Any(x => x.Key == DCType))
                                    {
                                        db = dbList.FirstOrDefault(x => x.Key == DCType).Value;
                                    }
                                    else
                                    {
                                        db = GetServerContext(DCType, null, $"{typeof(WSServerMeta).Name}.LoadMetaSources() => [{type.FullName}:{DCType.Name}");
                                        dbList.Add(DCType, db);
                                    }

                                    if (db != null)
                                    {
                                        string        DBName = db.GetType().CustomAttribute <DatabaseAttribute>(true).Name;
                                        WSTableSource tSrc   = new WSTableSource(
                                            type,
                                            SecurityMap.FirstOrDefault(m => m.Key.Equals(DBName)).Value.Zone,
                                            type.Name,
                                            ServerFunctions,
                                            WSConstants.ACCESS_LEVEL.READ
                                            );

                                        #region READ PROPERTIES
                                        List <MetaDataMember> eProps = db.ReadProperties(type, ref LoadStatusStatic);
                                        if (eProps != null && eProps.Any())
                                        {
                                            List <WSTableParam> _params = new List <WSTableParam>();
                                            foreach (MetaDataMember prop in eProps)
                                            {
                                                try
                                                {
                                                    WSTableParam tParam = new WSTableParam(type, next_code, prop.Name, new WSColumnRef(prop.Name), prop.Type, ServerFunctions);

                                                    object[] CustomAttributes = prop.Member.GetCustomAttributes(true);

                                                    IEnumerable <AssociationAttribute> assAttributes = CustomAttributes.OfType <AssociationAttribute>();
                                                    if (assAttributes != null && assAttributes.Any())
                                                    {
                                                        tParam.IsAssociation = true;
                                                    }

                                                    IEnumerable <ColumnAttribute> cAttributes = CustomAttributes.OfType <ColumnAttribute>();
                                                    if (cAttributes != null && cAttributes.Any())
                                                    {
                                                        tParam.IsColumn = true;
                                                        if (cAttributes.FirstOrDefault().IsPrimaryKey)
                                                        {
                                                            tParam.WRITE_ACCESS_MODE = new WSAccessMode(WSConstants.ACCESS_LEVEL.LOCK, false);
                                                            if (!tSrc.Params.Any(p => p.Match(WSConstants.PARAMS.RECORD_ID.NAME)))
                                                            {
                                                                tParam.DISPLAY_NAME = WSConstants.PARAMS.RECORD_ID.NAME;
                                                                if (!tParam.ALIACES.Any(a => a.Equals(WSConstants.PARAMS.RECORD_ID.NAME)))
                                                                {
                                                                    tParam.ALIACES.Add(WSConstants.PARAMS.RECORD_ID.NAME);
                                                                }
                                                            }
                                                        }
                                                    }
                                                    _params.Add(tParam);
                                                }
                                                catch (Exception) { }
                                            }
                                            tSrc.AddParams(_params);
                                            tSrc.ClearDublicatedAliaces();
                                        }
                                        #endregion

                                        if (!ORG_SOURCES.Any(x => x.Match(tSrc)))
                                        {
                                            ORG_SOURCES.Add(tSrc);
                                        }
                                    }
                                }
                                catch (Exception) { }
                            }
                        }
                    }
                }
            }
            catch (Exception) { }
            finally {
                foreach (Type t in dbList.Keys)
                {
                    try {
                        if (dbList[t] != null)
                        {
                            dbList[t].Dispose();
                        }
                    } catch (Exception e) { }
                }
            }
            return(ORG_SOURCES);
        }
예제 #14
0
        public override bool Match(WSJson json, out WSStatus status)
        {
            status = WSStatus.NONE_Copy();
            try
            {
                if (json == null)
                {
                    status = WSStatus.ERROR_Copy(); return(false);
                }
                else if (!(json is WSJArray))
                {
                    status = WSStatus.ERROR_Copy(); return(false);
                }
                else
                {
                    WSJArray jArr1 = (WSJArray)json;

                    IEnumerable <WSJValue> jValues = Value.OfType <WSJValue>();
                    jValues = jValues == null ? new List <WSJValue>() : jValues;
                    IEnumerable <WSJValue> jValues1 = jArr1.Value.OfType <WSJValue>();
                    jValues1 = jValues1 == null ? new List <WSJValue>() : jValues1;

                    if (!jValues.Any() && !jValues1.Any())
                    {
                    }
                    else
                    {
                        if (jValues.Count() > jValues1.Count())
                        {
                            status = WSStatus.ERROR_Copy();
                            status.AddNote($"Extra properties generated by the current service:[{jValues.Where(p1 => !jValues1.Any(p => p1.Value.Equals(p.Value))).Select(x => x.Value).Aggregate((a, b) => a + "," + b)}]");
                            return(false);
                        }
                        else
                        {
                            WSStatus subStatus = WSStatus.NONE_Copy();
                            foreach (WSJValue jVal1 in jValues1)
                            {
                                status = jValues.Any(jVal => jVal1.Match(jVal, out subStatus)) ? WSStatus.SUCCESS_Copy() : subStatus;
                                if (status.CODE != WSStatus.SUCCESS.CODE)
                                {
                                    return(false);
                                }
                            }
                        }
                    }

                    IEnumerable <WSJObject> jObjects = Value.OfType <WSJObject>();
                    jObjects = jObjects == null ? new List <WSJObject>() : jObjects;
                    IEnumerable <WSJObject> jObjects1 = jArr1.Value.OfType <WSJObject>();
                    jObjects1 = jObjects1 == null ? new List <WSJObject>() : jObjects1;

                    if (!jObjects.Any() && !jObjects1.Any())
                    {
                    }
                    else
                    {
                        if (jObjects.Count() > jObjects1.Count())
                        {
                            status = WSStatus.ERROR_Copy();
                            status.AddNote($"Extra objects generated by the current service");
                            return(false);
                        }
                        else
                        {
                            WSStatus subStatus = WSStatus.NONE_Copy();
                            foreach (WSJObject jObj1 in jObjects1)
                            {
                                status = jObjects.Any(jObj => jObj1.Match(jObj, out subStatus)) ? WSStatus.SUCCESS_Copy() : subStatus;
                                if (status.CODE != WSStatus.SUCCESS.CODE)
                                {
                                    return(false);
                                }
                            }
                        }
                    }

                    IEnumerable <WSJArray> jArrays = Value.OfType <WSJArray>();
                    jArrays = jArrays == null ? new List <WSJArray>() : jArrays;
                    IEnumerable <WSJArray> jArrays1 = jArr1.Value.OfType <WSJArray>();
                    jArrays1 = jArrays1 == null ? new List <WSJArray>() : jArrays1;

                    if (!jArrays.Any() && !jArrays1.Any())
                    {
                    }
                    else
                    {
                        if (jArrays.Count() > jArrays1.Count())
                        {
                            status = WSStatus.ERROR_Copy();
                            status.AddNote($"Extra arrays generated by the current service");
                            return(false);
                        }
                        else
                        {
                            WSStatus subStatus = WSStatus.NONE_Copy();
                            foreach (WSJArray jObj1 in jArrays1)
                            {
                                status = jArrays.Any(jObj => jObj1.Match(jObj, out subStatus)) ? WSStatus.SUCCESS_Copy() : subStatus;
                                if (status.CODE != WSStatus.SUCCESS.CODE)
                                {
                                    return(false);
                                }
                            }
                        }
                    }

                    status = WSStatus.SUCCESS_Copy();
                }
            }
            catch (Exception) { }
            return(status.CODE == WSStatus.SUCCESS.CODE);
        }