public string obj2jsonstr(object obj, int type) { string ret = ""; switch (type) { case 0: ClientData d = (ClientData)obj; ret = clientData2jsonstr(d); break; case 1: OnLineConfig con = (OnLineConfig)obj; ret = onlineconfig2jsonstr(con); break; case 2: UpdatePreference pre = (UpdatePreference)obj; ret = update2jsonstr(pre); break; case 3: Event e = (Event)obj; ret = eventData2jsonstr(e); break; case 4: //all data ret = allData2jsonstr(); break; case 5: //error ErrorInfo err = (ErrorInfo)obj; ret = errorData2jsonstr(err); break; case 6: //page info PageInfo page = (PageInfo)obj; ret = pageData2jsonstr(page); break; case 7: //tag data Tag tag = (Tag)obj; ret = tag2jsonstr(tag); break; case 8: //userid data Userid userids = (Userid)obj; ret = userids2jsonstr(userids); break; case 9: //pushid data Pushid pushids = (Pushid)obj; ret = pushids2jsonstr(pushids); break; default: break; } return(ret); }
private string update2jsonstr(UpdatePreference obj) { string ret = ""; ret = UmsJson.Serialize(obj); return(ret); }
public UpdatePreference getUpdatePreference(string version) { UpdatePreference obj = new UpdatePreference(); obj.appkey = UmsManager.appkey; obj.version_code = version; return(obj); }
//check new version public void checkNewVersionProceed(string version) { UpdatePreference obj = model.getUpdatePreference(version); if ((Utility.GetNetStates() == "WiFi" && settings["updateonlywifi"].Equals("1")) || (Utility.isNetWorkConnected() && !settings["updateonlywifi"].Equals("1"))) { Post post = new Post((int)UMSAgent.UMSApi.DataType.UPDATEDATA, obj); post.stateChanged += new Post.stateChangedHandler(this.getData); post.sendData(model.getUrl((int)UMSAgent.UMSApi.DataType.UPDATEDATA)); } }
public async Task <string> obj2jsonstr(object obj, int type) { string ret = ""; switch (type) { case 0: ClientData d = (ClientData)obj; ret = clientData2jsonstr(d); break; case 1: OnLineConfig con = (OnLineConfig)obj; ret = onlineconfig2jsonstr(con); break; case 2: UpdatePreference pre = (UpdatePreference)obj; ret = update2jsonstr(pre); break; case 3: Event e = (Event)obj; ret = eventData2jsonstr(e); break; case 4: //all data ret = await allData2jsonstr(); break; case 5: //error ErrorInfo err = (ErrorInfo)obj; ret = errorData2jsonstr(err); break; case 6: //page info PageInfo page = (PageInfo)obj; ret = pageData2jsonstr(page); break; default: break; } return(ret); }