//Ф-я загрузки данных с сервера private List <ComplectationItem> loadData() { HTTPManager.HTTPRequest http = HTTPManager.HTTPRequest.Create(Settings.uri); http.UseCookie = true; http.addParameter("entity", "ComplectationItem/get"); if (!http.post()) { return(null); } ResponseParser parser = ResponseParser.Parse(http.ResponseData); if (!parser.NoError) { return(null); } return(parser.ToObject <List <ComplectationItem> >()); }
public bool generateSerialNumber() { try { HTTPManager.HTTPRequest http = HTTPManager.HTTPRequest.Create(Settings.uri); http.UseCookie = true; http.addParameter("entity", "Bid/generateEquipmentBidSerialNumber"); http.addParameter("id", Id); if (!http.post()) { LastError = HTTPManager.HTTPRequest.LastError; return(false); } ResponseParser parser = ResponseParser.Parse(http.ResponseData); if (!parser.NoError) { LastError = parser.LastError; return(false); } if (parser.ServerErrorFlag != 0) { LastError = parser.ToObject <string>(); return(false); } List <TempEquipmentBid> updatedEquipmentBid = parser.ToObject <List <TempEquipmentBid> >(); for (int i = 0; i < updatedEquipmentBid.Count; i++) { EquipmentBid equipmentBid = EquipmentBidViewModel.instance().getById(updatedEquipmentBid[i].Id); if (equipmentBid == null) { continue; } equipmentBid.setSerialNumber(updatedEquipmentBid[i].SerialNumber); } return(true); } catch (Exception ex) { LastError = ex.ToString(); return(false); } }
public bool CheckUpdate(string currentVersion) { if (!Auth.getInstance().IsAuth) { LastError = "Для обновления необходимо авторизоваться!"; IsError = true; return(false); } HTTPManager.HTTPRequest http = HTTPManager.HTTPRequest.Create(Settings.uri); http.addParameter("entity", "Version/check"); http.addParameter("current", currentVersion); if (!http.post()) { LastError = HTTPManager.HTTPRequest.LastError; IsError = true; return(false); } ResponseParser parser = ResponseParser.Parse(http.ResponseData); if (!parser.NoError) { LastError = parser.LastError; IsError = true; return(false); } if (parser.ServerErrorFlag == 1) { LastError = parser.ToObject <string>(); IsError = true; return(false); } updatePath = parser.ToObject <Uri>(); if (updatePath == null) { return(false); } return(true); }
//Ф-я загрузки модифицированных данных с сервера private List <Bid> loadLastModified() { HTTPManager.HTTPRequest http = HTTPManager.HTTPRequest.Create(Settings.uri); http.UseCookie = true; string lastModified = maxLastModified().ToString("yyyy-MM-dd HH:mm:ss"); http.addParameter("entity", "Bid/lastmodified"); http.addParameter("last_modified", lastModified); if (!http.post()) { return(null); } ResponseParser parser = ResponseParser.Parse(http.ResponseData); if (!parser.NoError) { return(null); } return(parser.ToObject <List <Bid> >()); }