예제 #1
0

        
예제 #2
0
        public IList <GroupOfCloudServer> API_GetGroupsList()
        {
            string httpWebRequestGet = this.cloudserver + "/groups";
            string text   = this.SetHttpWebRequestGet(httpWebRequestGet);
            JArray jArray = this.JsonToJArray(text);

            if (jArray == null || text == string.Empty)
            {
                return(null);
            }
            JArray jArray2 = this.JsonToJArray("[" + jArray[0]["page"].ToString() + "]");

            if (jArray[0]["success"].ToObject <bool>())
            {
                IList <GroupOfCloudServer> list = new List <GroupOfCloudServer>();
                for (int i = 0; i < jArray2.Count; i++)
                {
                    JArray jArray3 = (JArray)JsonConvert.DeserializeObject(jArray2[i]["content"].ToString());
                    for (int j = 0; j < jArray3.Count; j++)
                    {
                        GroupOfCloudServer groupOfCloudServer = new GroupOfCloudServer();
                        groupOfCloudServer.Id           = jArray3[j]["id"].ToObject <string>();
                        groupOfCloudServer.CreatedAt    = jArray3[j]["createdAt"].ToObject <string>();
                        groupOfCloudServer.UpdatedAt    = jArray3[j]["updatedAt"].ToObject <string>();
                        groupOfCloudServer.GroupName    = jArray3[j]["groupName"].ToObject <string>();
                        groupOfCloudServer.CustomerName = jArray3[j]["customerName"].ToObject <string>();
                        JArray jArray4 = this.JsonToJArray("[" + jArray3[j]["contact"].ToString() + "]");
                        groupOfCloudServer.GroupContact = new GroupContactInfo
                        {
                            Id           = jArray4[0]["id"].ToObject <string>(),
                            CreatedAt    = jArray4[0]["createdAt"].ToObject <string>(),
                            UpdateAt     = jArray4[0]["updatedAt"].ToObject <string>(),
                            ContactName  = jArray4[0]["contactName"].ToObject <string>(),
                            PhoneNumber  = jArray4[0]["phoneNumber"].ToObject <string>(),
                            MoblieNumber = jArray4[0]["mobileNumber"].ToObject <string>(),
                            Email        = jArray4[0]["email"].ToObject <string>(),
                            FaxNumber    = jArray4[0]["faxNumber"].ToObject <string>(),
                            Address      = jArray4[0]["address"].ToObject <string>(),
                            Comment      = jArray4[0]["comment"].ToObject <string>()
                        };
                        JArray jArray5 = (JArray)JsonConvert.DeserializeObject(jArray3[j]["terminals"].ToString());
                        for (int k = 0; k < jArray5.Count; k++)
                        {
                            GroupTerminal groupTerminal = new GroupTerminal();
                            groupTerminal.Id           = jArray5[k]["id"].ToObject <string>();
                            groupTerminal.terminalCode = jArray5[k]["terminalCode"].ToObject <string>();
                            groupTerminal.terminalName = jArray5[k]["terminalName"].ToObject <string>();
                            groupOfCloudServer.GroupTerminals.Add(groupTerminal);
                        }
                        list.Add(groupOfCloudServer);
                    }
                }
                return(list);
            }
            return(null);
        }
예제 #3
0

        
예제 #4
0