public static bool AttemptLogin(string email, string password) { string tmp = DownloadData.ReceiveResponse(string.Format("http://swartkat.fossul.com/gui/finduser?email={0}&password={1}", email, password)); tmp = tmp.Substring(1, tmp.Length - 2); return(bool.Parse(tmp)); }
public static Farm GetUserFarm(string email) { string tmp = DownloadData.ReceiveResponse(string.Format("http://swartkat.fossul.com/gui/getusersfarm?email={0}", email)); tmp = tmp.Substring(1, tmp.Length - 2); tmp = tmp.Replace("\"", ""); string[] tmp2 = tmp.Split(','); Farm f = new Farm(); f.farmid = int.Parse(tmp2[0]); f.farmname = tmp2[1]; f.area = double.Parse(tmp2[2]); return(f); }
public static List <tmpdate> GetWeeklyDataDates(int userID) { try { string tmp = DownloadData.ReceiveResponse(string.Format("http://swartkat.fossul.com/gui/getfarmdates?userid={0}", userID)); return(JsonConvert.DeserializeObject <List <tmpdate> >(tmp)); } catch { return(null); } /*JavaScriptSerializer ser = new JavaScriptSerializer(); * //return ser.Deserialize<List<string>>(ReceiveResponse(string.Format("http://swartkat.fossul.com/gui/getfarmdates?userid={0}", userID))); //JSON decoded * return JsonConvert.DeserializeObject<List<DateTime>>(string.Format("http://swartkat.fossul.com/gui/getfarmdates?userid={0}", userID));*/ }
public static List <FullFarm> GetAllFullFarms() { string tmp = DownloadData.ReceiveResponse("http://swartkat.fossul.com/gui/getfarms"); return(JsonConvert.DeserializeObject <List <FullFarm> >(tmp)); }