public static RecentCaseCommunicationsUnmarshaller GetInstance()
 {
     if (instance == null)
     {
         instance = new RecentCaseCommunicationsUnmarshaller();
     }
     return(instance);
 }
Beispiel #2
0
        public CaseDetails Unmarshall(JsonUnmarshallerContext context)
        {
            context.Read();
            if (context.CurrentTokenType == JsonToken.Null)
            {
                return(null);
            }
            CaseDetails caseDetails = new CaseDetails();


            int targetDepth = context.CurrentDepth;

            while (context.ReadAtDepth(targetDepth))
            {
                if (context.TestExpression("caseId", targetDepth))
                {
                    caseDetails.CaseId = StringUnmarshaller.GetInstance().Unmarshall(context);
                    continue;
                }

                if (context.TestExpression("displayId", targetDepth))
                {
                    caseDetails.DisplayId = StringUnmarshaller.GetInstance().Unmarshall(context);
                    continue;
                }

                if (context.TestExpression("subject", targetDepth))
                {
                    caseDetails.Subject = StringUnmarshaller.GetInstance().Unmarshall(context);
                    continue;
                }

                if (context.TestExpression("status", targetDepth))
                {
                    caseDetails.Status = StringUnmarshaller.GetInstance().Unmarshall(context);
                    continue;
                }

                if (context.TestExpression("serviceCode", targetDepth))
                {
                    caseDetails.ServiceCode = StringUnmarshaller.GetInstance().Unmarshall(context);
                    continue;
                }

                if (context.TestExpression("categoryCode", targetDepth))
                {
                    caseDetails.CategoryCode = StringUnmarshaller.GetInstance().Unmarshall(context);
                    continue;
                }

                if (context.TestExpression("severityCode", targetDepth))
                {
                    caseDetails.SeverityCode = StringUnmarshaller.GetInstance().Unmarshall(context);
                    continue;
                }

                if (context.TestExpression("submittedBy", targetDepth))
                {
                    caseDetails.SubmittedBy = StringUnmarshaller.GetInstance().Unmarshall(context);
                    continue;
                }

                if (context.TestExpression("timeCreated", targetDepth))
                {
                    caseDetails.TimeCreated = StringUnmarshaller.GetInstance().Unmarshall(context);
                    continue;
                }

                if (context.TestExpression("recentCommunications", targetDepth))
                {
                    caseDetails.RecentCommunications = RecentCaseCommunicationsUnmarshaller.GetInstance().Unmarshall(context);
                    continue;
                }

                if (context.TestExpression("ccEmailAddresses", targetDepth))
                {
                    var unmarshaller = new ListUnmarshaller <String, StringUnmarshaller>(
                        StringUnmarshaller.GetInstance());
                    caseDetails.CcEmailAddresses = unmarshaller.Unmarshall(context);

                    continue;
                }

                if (context.TestExpression("language", targetDepth))
                {
                    caseDetails.Language = StringUnmarshaller.GetInstance().Unmarshall(context);
                    continue;
                }
            }

            return(caseDetails);
        }
        public CaseDetails Unmarshall(JsonUnmarshallerContext context)
        {
            CaseDetails caseDetails = new CaseDetails();

            caseDetails.CcEmailAddresses = null;

            int originalDepth = context.CurrentDepth;
            int targetDepth   = originalDepth + 1;

            while (context.Read())
            {
                if ((context.IsKey) && (context.CurrentDepth == targetDepth))
                {
                    context.Read();
                    context.Read();

                    if (context.TestExpression("CaseId", targetDepth))
                    {
                        caseDetails.CaseId = StringUnmarshaller.GetInstance().Unmarshall(context);
                        continue;
                    }

                    if (context.TestExpression("DisplayId", targetDepth))
                    {
                        caseDetails.DisplayId = StringUnmarshaller.GetInstance().Unmarshall(context);
                        continue;
                    }

                    if (context.TestExpression("Subject", targetDepth))
                    {
                        caseDetails.Subject = StringUnmarshaller.GetInstance().Unmarshall(context);
                        continue;
                    }

                    if (context.TestExpression("Status", targetDepth))
                    {
                        caseDetails.Status = StringUnmarshaller.GetInstance().Unmarshall(context);
                        continue;
                    }

                    if (context.TestExpression("ServiceCode", targetDepth))
                    {
                        caseDetails.ServiceCode = StringUnmarshaller.GetInstance().Unmarshall(context);
                        continue;
                    }

                    if (context.TestExpression("CategoryCode", targetDepth))
                    {
                        caseDetails.CategoryCode = StringUnmarshaller.GetInstance().Unmarshall(context);
                        continue;
                    }

                    if (context.TestExpression("SeverityCode", targetDepth))
                    {
                        caseDetails.SeverityCode = StringUnmarshaller.GetInstance().Unmarshall(context);
                        continue;
                    }

                    if (context.TestExpression("SubmittedBy", targetDepth))
                    {
                        caseDetails.SubmittedBy = StringUnmarshaller.GetInstance().Unmarshall(context);
                        continue;
                    }

                    if (context.TestExpression("TimeCreated", targetDepth))
                    {
                        caseDetails.TimeCreated = StringUnmarshaller.GetInstance().Unmarshall(context);
                        continue;
                    }

                    if (context.TestExpression("RecentCommunications", targetDepth))
                    {
                        caseDetails.RecentCommunications = RecentCaseCommunicationsUnmarshaller.GetInstance().Unmarshall(context);
                        continue;
                    }

                    if (context.TestExpression("CcEmailAddresses", targetDepth))
                    {
                        caseDetails.CcEmailAddresses = new List <String>();
                        StringUnmarshaller unmarshaller = StringUnmarshaller.GetInstance();
                        while (context.Read())
                        {
                            if ((context.IsArrayElement) && (context.CurrentDepth == targetDepth))
                            {
                                caseDetails.CcEmailAddresses.Add(unmarshaller.Unmarshall(context));
                            }
                            else if (context.IsEndArray)
                            {
                                break;
                            }
                        }
                        continue;
                    }

                    if (context.TestExpression("Language", targetDepth))
                    {
                        caseDetails.Language = StringUnmarshaller.GetInstance().Unmarshall(context);
                        continue;
                    }
                }
                else if (context.IsEndElement && context.CurrentDepth <= originalDepth)
                {
                    return(caseDetails);
                }
            }


            return(caseDetails);
        }
Beispiel #4
0
        public CaseDetails Unmarshall(JsonUnmarshallerContext context)
        {
            if (context.CurrentTokenType == JsonToken.Null)
            {
                return(null);
            }

            CaseDetails caseDetails = new CaseDetails();



            int originalDepth = context.CurrentDepth;
            int targetDepth   = originalDepth + 1;

            while (context.Read())
            {
                if (context.TestExpression("caseId", targetDepth))
                {
                    context.Read();
                    caseDetails.CaseId = StringUnmarshaller.GetInstance().Unmarshall(context);
                    continue;
                }

                if (context.TestExpression("displayId", targetDepth))
                {
                    context.Read();
                    caseDetails.DisplayId = StringUnmarshaller.GetInstance().Unmarshall(context);
                    continue;
                }

                if (context.TestExpression("subject", targetDepth))
                {
                    context.Read();
                    caseDetails.Subject = StringUnmarshaller.GetInstance().Unmarshall(context);
                    continue;
                }

                if (context.TestExpression("status", targetDepth))
                {
                    context.Read();
                    caseDetails.Status = StringUnmarshaller.GetInstance().Unmarshall(context);
                    continue;
                }

                if (context.TestExpression("serviceCode", targetDepth))
                {
                    context.Read();
                    caseDetails.ServiceCode = StringUnmarshaller.GetInstance().Unmarshall(context);
                    continue;
                }

                if (context.TestExpression("categoryCode", targetDepth))
                {
                    context.Read();
                    caseDetails.CategoryCode = StringUnmarshaller.GetInstance().Unmarshall(context);
                    continue;
                }

                if (context.TestExpression("severityCode", targetDepth))
                {
                    context.Read();
                    caseDetails.SeverityCode = StringUnmarshaller.GetInstance().Unmarshall(context);
                    continue;
                }

                if (context.TestExpression("submittedBy", targetDepth))
                {
                    context.Read();
                    caseDetails.SubmittedBy = StringUnmarshaller.GetInstance().Unmarshall(context);
                    continue;
                }

                if (context.TestExpression("timeCreated", targetDepth))
                {
                    context.Read();
                    caseDetails.TimeCreated = StringUnmarshaller.GetInstance().Unmarshall(context);
                    continue;
                }

                if (context.TestExpression("recentCommunications", targetDepth))
                {
                    context.Read();
                    caseDetails.RecentCommunications = RecentCaseCommunicationsUnmarshaller.GetInstance().Unmarshall(context);
                    continue;
                }

                if (context.TestExpression("ccEmailAddresses", targetDepth))
                {
                    context.Read();

                    if (context.CurrentTokenType == JsonToken.Null)
                    {
                        caseDetails.CcEmailAddresses = null;
                        continue;
                    }
                    caseDetails.CcEmailAddresses = new List <String>();
                    StringUnmarshaller unmarshaller = StringUnmarshaller.GetInstance();
                    while (context.Read())
                    {
                        JsonToken token = context.CurrentTokenType;
                        if (token == JsonToken.ArrayStart)
                        {
                            continue;
                        }
                        if (token == JsonToken.ArrayEnd)
                        {
                            break;
                        }
                        caseDetails.CcEmailAddresses.Add(unmarshaller.Unmarshall(context));
                    }
                    continue;
                }

                if (context.TestExpression("language", targetDepth))
                {
                    context.Read();
                    caseDetails.Language = StringUnmarshaller.GetInstance().Unmarshall(context);
                    continue;
                }

                if (context.CurrentDepth <= originalDepth)
                {
                    return(caseDetails);
                }
            }


            return(caseDetails);
        }