Exemple #1
0
 public void Copy(TerminalData data)
 {
     this.UpdatedAt     = data.UpdatedAt;
     this.Width         = data.Width;
     this.Height        = data.Height;
     this.Color         = data.Color;
     this.Gray          = data.Gray;
     this.BackGray      = data.BackGray;
     this.DeviceModel   = data.DeviceModel;
     this.DeviceVersion = data.DeviceVersion;
     this.CommModel     = data.CommModel;
     this.Online        = data.Online;
 }
Exemple #2
0
        public IList <TerminalData> API_TerminalList()
        {
            IList <TerminalData> list = new List <TerminalData>();
            string httpWebRequestGet  = this.cloudserver + "terminals";
            string text = this.SetHttpWebRequestGet(httpWebRequestGet);

            if (text != string.Empty)
            {
                JArray jArray = this.JsonToJArray(text);
                if (jArray == null)
                {
                    return(null);
                }
                JArray jArray2 = this.JsonToJArray("[" + jArray[0]["page"].ToString() + "]");
                JArray jArray3 = (JArray)JsonConvert.DeserializeObject(jArray2[0]["content"].ToString());
                if (jArray3.Count <= 0)
                {
                    return(null);
                }
                this.TerminalIdList.Clear();
                for (int i = 0; i < jArray3.Count; i++)
                {
                    TerminalData terminalData = new TerminalData();
                    if (jArray3[i]["contact"] != null)
                    {
                        JArray jArray4 = this.JsonToJArray("[" + jArray3[i]["contact"].ToString() + "]");
                        jArray4[0]["id"].ToObject <string>();
                        jArray4[0]["createdAt"].ToObject <string>();
                        jArray4[0]["updatedAt"].ToObject <string>();
                        jArray4[0]["contactName"].ToObject <string>();
                        jArray4[0]["phoneNumber"].ToObject <string>();
                        jArray4[0]["mobileNumber"].ToObject <string>();
                        jArray4[0]["email"].ToObject <string>();
                        jArray4[0]["faxNumber"].ToObject <string>();
                        jArray4[0]["address"].ToObject <string>();
                        jArray4[0]["comment"].ToObject <string>();
                    }
                    terminalData.Id              = jArray3[i]["id"].ToObject <string>();
                    terminalData.CreatedAt       = jArray3[i]["createdAt"].ToObject <string>();
                    terminalData.UpdatedAt       = jArray3[i]["updatedAt"].ToObject <string>();
                    terminalData.TerminalCode    = jArray3[i]["terminalCode"].ToObject <string>();
                    terminalData.TerminalName    = jArray3[i]["terminalName"].ToObject <string>();
                    terminalData.Width           = jArray3[i]["width"].ToObject <string>();
                    terminalData.Height          = jArray3[i]["height"].ToObject <string>();
                    terminalData.Color           = jArray3[i]["color"].ToObject <string>();
                    terminalData.Gray            = jArray3[i]["gray"].ToObject <string>();
                    terminalData.BackGray        = jArray3[i]["backGray"].ToObject <string>();
                    terminalData.DeviceModel     = jArray3[i]["deviceModel"].ToObject <string>();
                    terminalData.PhoneNumber     = jArray3[i]["phoneNumber"].ToObject <string>();
                    terminalData.DeviceVersion   = jArray3[i]["deviceVersion"].ToObject <string>();
                    terminalData.Description     = jArray3[i]["description"].ToObject <string>();
                    terminalData.LastHeartbeat   = jArray3[i]["latitude"].ToObject <string>();
                    terminalData.CommModel       = jArray3[i]["commModel"].ToObject <string>();
                    terminalData.ProductSubmodel = jArray3[i]["productSubmodel"].ToObject <string>();
                    terminalData.ProductExtra    = jArray3[i]["productExtra"].ToObject <string>();
                    if (jArray3[i]["online"].ToObject <string>() == "False")
                    {
                        terminalData.Online = false;
                    }
                    else
                    {
                        terminalData.Online = true;
                    }
                    terminalData.Ip                      = jArray3[i]["ip"].ToObject <string>();
                    terminalData.Port                    = jArray3[i]["port"].ToObject <string>();
                    terminalData.LastHeartbeat           = jArray3[i]["lastHeartbeat"].ToObject <string>();
                    terminalData.SignalStrength          = jArray3[i]["signalStrength"].ToObject <string>();
                    terminalData.TotalCapacity           = jArray3[i]["totalCapacity"].ToObject <string>();
                    terminalData.UsedCapacity            = jArray3[i]["usedCapacity"].ToObject <string>();
                    terminalData.ProductModelDescription = jArray3[i]["productModelDescription"].ToObject <string>();
                    terminalData.TotalCapacityStr        = jArray3[i]["totalCapacityStr"].ToObject <string>();
                    terminalData.UsedCapacityStr         = jArray3[i]["usedCapacityStr"].ToObject <string>();
                    terminalData.FreeCapacity            = jArray3[i]["freeCapacity"].ToObject <string>();
                    terminalData.FreeCapacityStr         = jArray3[i]["freeCapacityStr"].ToObject <string>();
                    if (terminalData.ProductModelDescription.IndexOf("单双色") > -1 || terminalData.ProductModelDescription.IndexOf("未知型号") > -1)
                    {
                        list.Add(terminalData);
                        this.TerminalIdList.Add(terminalData.Id);
                    }
                }
            }
            return(list);
        }