public static async System.Threading.Tasks.Task <Boolean> FetchCompanyHistoryAsync(Models.HistoryU obj) { Uri u = new Uri(url1 + "insertHistoryC?Search=" + obj.Wyszukiwanie + "&Description=" + obj.Description + "&Companyid=" + obj.User + "&Expoid=" + obj.Expo); System.Net.HttpWebRequest request = (System.Net.HttpWebRequest)System.Net.HttpWebRequest.Create(u); request.ContentType = "application/json"; request.Method = "GET"; // Send the request to the server and wait for the response: using (System.Net.WebResponse response = await request.GetResponseAsync()) { // Get a stream representation of the HTTP web response: using (Stream stream = response.GetResponseStream()) { // Use this stream to build a JSON document object: System.Json.JsonValue jsonDoc = await System.Threading.Tasks.Task.Run(() => System.Json.JsonObject.Load(stream)); Console.Out.WriteLine("Response: {0}", jsonDoc.ToString()); if (Boolean.Parse(jsonDoc["saved"].ToString()) == true) { return(true); } else { return(false); } } } return(false); }
public static async System.Threading.Tasks.Task <Models.Company> FetchCompanyAsync(string email) { // Create an HTTP web request using the URL: System.Net.HttpWebRequest request = (System.Net.HttpWebRequest)System.Net.HttpWebRequest.Create(new Uri(url1 + "/company?Email=" + email)); request.ContentType = "application/json"; request.Method = "GET"; // Send the request to the server and wait for the response: try { using (System.Net.WebResponse response = await request.GetResponseAsync()) { // Get a stream representation of the HTTP web response: using (Stream stream = response.GetResponseStream()) { // Use this stream to build a JSON document object: System.Json.JsonValue jsonDoc = await System.Threading.Tasks.Task.Run(() => System.Json.JsonObject.Load(stream)); Console.Out.WriteLine("Response: {0}", jsonDoc.ToString()); // Return the JSON document: return(Droid.Modules.Parsers.Company(jsonDoc)); } } } catch (System.Net.WebException ex) { } return(null); }
public static async System.Threading.Tasks.Task <Boolean> FetchUserEditAsync(Models.User obj) { Uri u = new Uri(url1 + "EditProfileUser?Email=" + obj.Email + "&ForName=" + obj.ForName + "&SurName=" + obj.SurName + "&Phone=" + obj.Phone + "&Nationality=" + obj.Nationality); System.Net.HttpWebRequest request = (System.Net.HttpWebRequest)System.Net.HttpWebRequest.Create(u); request.ContentType = "application/json"; request.Method = "GET"; // Send the request to the server and wait for the response: using (System.Net.WebResponse response = await request.GetResponseAsync()) { // Get a stream representation of the HTTP web response: using (Stream stream = response.GetResponseStream()) { // Use this stream to build a JSON document object: System.Json.JsonValue jsonDoc = await System.Threading.Tasks.Task.Run(() => System.Json.JsonObject.Load(stream)); Console.Out.WriteLine("Response: {0}", jsonDoc.ToString()); if (Boolean.Parse(jsonDoc["AccountChanged"].ToString()) == true) { return(true); } else if (Boolean.Parse(jsonDoc["Unactual"].ToString()) == true) { LDbConnection.InsertUser(await DbConnection.FetchUserAsync(obj.Email)); return(true); } } } return(false); }
public static async System.Threading.Tasks.Task <Boolean> FetchCompanyJoinExpoAsync(Models.Company us, Models.Expo e) { Uri u = new Uri(url1 + "insertCExpo?Expoid=" + e.Id + "&Companyid=" + us.Id); System.Net.HttpWebRequest request = (System.Net.HttpWebRequest)System.Net.HttpWebRequest.Create(u); request.ContentType = "application/json"; request.Method = "GET"; // Send the request to the server and wait for the response: using (System.Net.WebResponse response = await request.GetResponseAsync()) { // Get a stream representation of the HTTP web response: using (Stream stream = response.GetResponseStream()) { // Use this stream to build a JSON document object: System.Json.JsonValue jsonDoc = await System.Threading.Tasks.Task.Run(() => System.Json.JsonObject.Load(stream)); Console.Out.WriteLine("Response: {0}", jsonDoc.ToString()); if (Boolean.Parse(jsonDoc["JoinedC"].ToString()) == true) { return(true); } else { return(false); } } } return(false); }
public static async System.Threading.Tasks.Task <Boolean> FetchCompanyEditAsync(Models.Company obj) { Uri u = new Uri(url1 + "EditProfileCompany?Email=" + obj.Email + "&CompanyName=" + obj.CompanyName + "&CompanyFullName=" + obj.CompanyFullName + "&CompanyAbout=" + obj.CompanyAbout + "&ProductsAbout=" + obj.ProductsAbout + "&Facebook=" + obj.Facebook + "&Instagram=" + obj.Instagram + "&Snapchat=" + obj.Snapchat + "&Youtube=" + obj.Youtube + "&Phone=" + obj.Phone + "&UserPhone=" + obj.UserPhone + "&ContactEmail=" + obj.ContactEmail + "&www=" + obj.www + "&Adress=" + obj.www + "&NIP=" + obj.NIP + "&Forname_And_Surname=" + obj.ForName_And_SurName); System.Net.HttpWebRequest request = (System.Net.HttpWebRequest)System.Net.HttpWebRequest.Create(u); request.ContentType = "application/json"; request.Method = "GET"; // Send the request to the server and wait for the response: using (System.Net.WebResponse response = await request.GetResponseAsync()) { // Get a stream representation of the HTTP web response: using (Stream stream = response.GetResponseStream()) { // Use this stream to build a JSON document object: System.Json.JsonValue jsonDoc = await System.Threading.Tasks.Task.Run(() => System.Json.JsonObject.Load(stream)); Console.Out.WriteLine("Response: {0}", jsonDoc.ToString()); if (Boolean.Parse(jsonDoc["AccountChanged"].ToString()) == true) { return(true); } else if (Boolean.Parse(jsonDoc["Unactual"].ToString()) == true) { LDbConnection.InsertCompany(await DbConnection.FetchCompanyAsync(obj.Email)); return(true); } } } return(false); }
public static Models.Company Company(System.Json.JsonValue json) { System.Json.JsonValue jsonR = json; Console.WriteLine("jsonResult: " + jsonR["Email"]); var u = new Models.Company(); u.Id = Java.Lang.Long.ParseLong(json["Id"].ToString()); u.Email = jsonR["Email"]; u.Adress = jsonR["Adress"]; u.CompanyAbout = jsonR["CompanyAbout"]; u.CompanyFullName = jsonR["CompanyFullName"]; u.Phone = Java.Lang.Long.ParseLong(json["Phone"].ToString()); u.CompanyLogo = jsonR["CompanyLogo"]; u.CompanyName = jsonR["CompanyName"]; u.ContactEmail = jsonR["ContactEmail"]; u.Facebook = jsonR["Facebook"]; u.Instagram = jsonR["Instagram"]; u.ForName_And_SurName = jsonR["ForName_And_SurName"]; u.NIP = jsonR["NIP"]; u.ProductsAbout = jsonR["ProductsAbout"]; u.Snapchat = jsonR["Snapchat"]; u.StandPhoto = jsonR["StandPhoto"]; u.Photo1 = jsonR["Photo1"]; u.Photo2 = jsonR["Photo2"]; u.Photo3 = jsonR["Photo3"]; u.Photo4 = jsonR["Photo4"]; u.Photo5 = jsonR["Photo5"]; u.UserPhone = Java.Lang.Long.ParseLong(json["Phone"].ToString()); u.www = jsonR["www"]; u.Youtube = jsonR["Youtube"]; return(u); }
public static Models.MobileLogin Login(System.Json.JsonValue json) { // Extract the array of name/value results for the field name "weatherObservation". System.Json.JsonValue jsonR = json; var u = new Models.MobileLogin(); u.UserAndPasswordCorrect = bool.Parse(jsonR["UserAndPasswordCorrect"].ToString()); u.UserType = jsonR["UserType"]; return(u); }
public static Models.MobileRegister Register(System.Json.JsonValue json) { // Extract the array of name/value results for the field name "weatherObservation". System.Json.JsonValue jsonR = json; var u = new Models.MobileRegister(); u.AccountCreated = bool.Parse(jsonR["AccountCreated"].ToString()); u.UnValid = jsonR["UnValid"]; return(u); }
internal static string decryptAndGetApiSetting(this System.Json.JsonValue jsonObject, string settingString) { var value = jsonObject[settingString]; if (Constants.ENCRYPTED_ASSETS.Contains(settingString)) { //we decrypt return(JhpSecurity.Decrypt(value)); } return(value); }
public static Models.User User(System.Json.JsonValue json) { System.Json.JsonValue jsonR = json; Console.WriteLine("jsonResult: " + jsonR["Email"]); var u = new Models.User(); u.ID = Java.Lang.Long.ParseLong(json["ID"].ToString()); u.Email = jsonR["Email"]; u.ForName = jsonR["ForName"]; u.SurName = jsonR["SurName"]; u.Photo = jsonR["Photo"]; u.Phone = Java.Lang.Long.ParseLong(json["Phone"].ToString()); u.Nationality = jsonR["Nationality"]; return(u); }
public async Task <UpdatePushTokenResponse> SendPushToServer(string token) { UpdatePushTokenResponse updateDeviceTokenResponse = new UpdatePushTokenResponse(); if (!String.IsNullOrEmpty(SessionHelper.AccessToken)) { UpdatePushTokenRequest updateDeviceTokenRequest = new UpdatePushTokenRequest(); updateDeviceTokenRequest.DevicePushToken = token; updateDeviceTokenRequest.DeviceType = Device.RuntimePlatform; updateDeviceTokenRequest.AuthToken = SessionHelper.AccessToken; System.Json.JsonValue updateUserResponse = await HttpRequestHelper <UpdatePushTokenRequest> .POSTreq(ServiceTypes.UpdatePushToken, updateDeviceTokenRequest); updateDeviceTokenResponse = JsonConvert.DeserializeObject <UpdatePushTokenResponse>(updateUserResponse.ToString()); } return(updateDeviceTokenResponse); }
public static async System.Threading.Tasks.Task <System.Collections.Generic.List <Models.Expo> > FetchUserExposAsync(Models.User u) { // Create an HTTP web request using the URL: System.Net.HttpWebRequest request = (System.Net.HttpWebRequest)System.Net.HttpWebRequest.Create(new Uri(url1 + "UserExpos?email=" + u.Email)); request.ContentType = "application/json"; request.Method = "GET"; // Send the request to the server and wait for the response: using (System.Net.WebResponse response = await request.GetResponseAsync()) { // Get a stream representation of the HTTP web response: using (Stream stream = response.GetResponseStream()) { // Use this stream to build a JSON document object: System.Json.JsonValue jsonDoc = await System.Threading.Tasks.Task.Run(() => System.Json.JsonObject.Load(stream)); Console.Out.WriteLine("Response: {0}", jsonDoc.ToString()); // Return the JSON document: System.Collections.Generic.List <Models.Expo> lista = new System.Collections.Generic.List <Models.Expo>(); for (int i = 0; i != jsonDoc.Count; i++) { Models.Expo e = new Models.Expo { Name_Expo = jsonDoc[i]["Name_Expo"], Id = Int32.Parse(jsonDoc[i]["Id"].ToString()), Photo = jsonDoc[i]["Photo"], MapPhoto = jsonDoc[i]["MapPhoto"], Adres = jsonDoc[i]["Adres"], Description = jsonDoc[i]["Description"] }; var start = double.Parse(jsonDoc[i]["ExpoStartData"].ToString().Replace('/', ' ').Replace('"', ' ').Replace(')', ' ').Replace("Date(", "").Trim()); TimeSpan time = TimeSpan.FromMilliseconds(start); DateTime startdate = new DateTime(1970, 1, 1) + time; e.DataTargowStart = startdate; var end = double.Parse(jsonDoc[i]["ExpoEndData"].ToString().Replace('/', ' ').Replace('"', ' ').Replace(')', ' ').Replace("Date(", "").Trim()); TimeSpan time1 = TimeSpan.FromMilliseconds(end); DateTime enddate = new DateTime(1970, 1, 1) + time1; e.DataTargowEnd = enddate; lista.Add(e); } return(lista); } } }
public static async System.Threading.Tasks.Task <Models.MobileLogin> FetchLoginAsync(String email, String password) { Uri u = new Uri(url1 + "Login?Email=" + email + "&Password="******"application/json"; request.Method = "GET"; // Send the request to the server and wait for the response: using (System.Net.WebResponse response = await request.GetResponseAsync()) { // Get a stream representation of the HTTP web response: using (Stream stream = response.GetResponseStream()) { // Use this stream to build a JSON document object: System.Json.JsonValue jsonDoc = await System.Threading.Tasks.Task.Run(() => System.Json.JsonObject.Load(stream)); Console.Out.WriteLine("Response: {0}", jsonDoc.ToString()); return(Droid.Modules.Parsers.Login(jsonDoc)); } } return(null); }
public async Task <String> GetAccessToken(string url) { try { var client = new System.Net.Http.HttpClient(); var response = await client.GetAsync(new Uri(url)); var result = await response.Content.ReadAsStringAsync(); System.Json.JsonValue json = System.Json.JsonValue.Parse(result); return(json.ToString()); } catch { using (ErrorsContext db = new ErrorsContext()) { db.Errors.Add(new Error { ErrorText = "Ошибка await GetAccessToken(Не получен code)!" }); } return(""); } }
private static int GetDeepHashCode(System.Json.JsonValue value) { int hash = 0; if (value != null) { if (value.JsonType == System.Json.JsonType.Array) { foreach (System.Json.JsonValue child in (System.Json.JsonArray)value) { hash ^= ParsePerfTests.GetDeepHashCode(child); } } else if (value.JsonType == System.Json.JsonType.Object) { foreach (KeyValuePair <string, System.Json.JsonValue> pair in (System.Json.JsonObject)value) { hash ^= ParsePerfTests.GetDeepHashCode(pair.Value); } } else if (value.JsonType == System.Json.JsonType.Boolean) { hash = ((bool)value).GetHashCode(); } else if (value.JsonType == System.Json.JsonType.String) { hash = ((string)value).GetHashCode(); } else if (value.JsonType == System.Json.JsonType.Number) { hash = ((decimal)value).GetHashCode(); } } return(hash); }
public static async System.Threading.Tasks.Task <System.Collections.Generic.List <Models.HistoryU> > FetchHistory(Models.Company u) { // Create an HTTP web request using the URL: System.Net.HttpWebRequest request = (System.Net.HttpWebRequest)System.Net.HttpWebRequest.Create(new Uri(url1 + "History?email=" + u.Email)); request.ContentType = "application/json"; request.Method = "GET"; // Send the request to the server and wait for the response: using (System.Net.WebResponse response = await request.GetResponseAsync()) { // Get a stream representation of the HTTP web response: using (Stream stream = response.GetResponseStream()) { // Use this stream to build a JSON document object: System.Json.JsonValue jsonDoc = await System.Threading.Tasks.Task.Run(() => System.Json.JsonObject.Load(stream)); Console.Out.WriteLine("Response: {0}", jsonDoc.ToString()); // Return the JSON document: System.Collections.Generic.List <Models.HistoryU> lista = new System.Collections.Generic.List <Models.HistoryU>(); for (int i = 0; i != jsonDoc.Count; i++) { Models.HistoryU h = new Models.HistoryU { ID = Int32.Parse(jsonDoc[i]["ID"].ToString()), Description = jsonDoc[i]["Description"], Wyszukiwanie = jsonDoc[i]["Wyszukiwanie"], User = Int32.Parse(jsonDoc[i]["User"].ToString()), Expo = Int32.Parse(jsonDoc[i]["Expo"].ToString()) }; lista.Add(h); } return(lista); } } }
public static bool TryReadAsType <T>(this System.Json.JsonValue jsonValue, out T valueOfT) { valueOfT = default(T); throw null; }
public JsonContent(System.Json.JsonValue content) : this(content : content.ToString()) { }
public JsonValueChangeEventArgs(System.Json.JsonValue child, System.Json.JsonValueChange change, int index) { }
public JsonValueChangeEventArgs(System.Json.JsonValue child, System.Json.JsonValueChange change, string key) { }
public static object ReadAsType(this System.Json.JsonValue jsonValue, System.Type type) { throw null; }
public static T ReadAsType <T>(this System.Json.JsonValue jsonValue, T fallback) { throw null; }
public static bool TryReadAsType(this System.Json.JsonValue jsonValue, System.Type type, out object value) { value = default(object); throw null; }