Exemple #1
0
        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);
        }
Exemple #2
0
        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);
        }
Exemple #3
0
 public LDbConnection Instance()
 {
     if (db != null)
     {
         return(db);
     }
     else
     {
         db = new LDbConnection();
         return(db);
     }
 }