Ejemplo n.º 1
0
        public AccreditationApplications getAccreditDetails(string accommoId)
        {
            string json = null;
            AccreditationApplications acc = null;

            try
            {
                WebClient webClient = new WebClient();
                json = webClient.DownloadString(BASE_URL + "getAccreditDetails/" + accommoId);
                acc  = JsonConvert.DeserializeObject <AccreditationApplications>(json);

                return(acc);
            }
            catch
            {
                return(null);
            }
        }
Ejemplo n.º 2
0
        //Updates
        public string updateAccredApplication(AccreditationApplications application)
        {
            string response = "";
            string data     = null;

            try
            {
                DataContractJsonSerializer ser = new DataContractJsonSerializer(
                    typeof(AccreditationApplications));
                MemoryStream mem = new MemoryStream();
                ser.WriteObject(mem, application);
                data = Encoding.UTF8.GetString(mem.ToArray(), 0, (int)mem.Length);
                WebClient webClient = new WebClient();
                webClient.Headers["Content-type"] = "application/json";
                webClient.Encoding = Encoding.UTF8;
                response           = webClient.UploadString(BASE_URL + "updateAccredApplication", "PUT", data);

                return(response);
            }
            catch (Exception e)
            {
                return(e.Message);
            }
        }
Ejemplo n.º 3
0
        //Insertions
        public int applyForAccred(AccreditationApplications application)
        {
            string response = null;
            string data     = null;

            try
            {
                DataContractJsonSerializer ser = new DataContractJsonSerializer(
                    typeof(AccreditationApplications));
                MemoryStream mem = new MemoryStream();
                ser.WriteObject(mem, application);
                data = Encoding.UTF8.GetString(mem.ToArray(), 0, (int)mem.Length);
                WebClient webClient = new WebClient();
                webClient.Headers["Content-type"] = "application/json";
                webClient.Encoding = Encoding.UTF8;
                response           = webClient.UploadString(BASE_URL + "applyForAccred", "POST", data);

                return(Convert.ToInt32(response));
            }
            catch (Exception)
            {
                return(-1);
            }
        }