Esempio n. 1
0
        public static int SavePharmacy(Pharmacy item)
        {
//			JsonSerializerSettings jsonSerSet = new JsonSerializerSettings { NullValueHandling = NullValueHandling.Ignore };
//			string json = JsonConvert.SerializeObject( item, Formatting.Indented,jsonSerSet);
//			var bytes = Encoding.Default.GetBytes (json);
//
//			Pharmacy afterUpload = null;
//
//			using (WebClient wb = new WebClient ()) {
//				wb.Headers.Add(HttpRequestHeader.ContentType, @"application/json");
//				var response = wb.UploadData ("http://sbl-logisapp.rhcloud.com/pharmacy", @"POST", bytes);
//
//				string pharmacy = Encoding.Default.GetString (response);
//				afterUpload = JsonConvert.DeserializeObject<Pharmacy> (pharmacy);
//			}

            return(PharmacyRepository.SavePharmacy(item));
        }
Esempio n. 2
0
        public static int DeletePharmacy(int id)
        {
            RestClient _restClient = new RestClient();
            var        request     = new RestRequest(@"http://sbl-logisapp.rhcloud.com/pharmacy/{id}", Method.DELETE);

            request.AddUrlSegment("id", "" + id);

//			Console.WriteLine ("Executing '{0}' request to '{1}'...", request.Method, _restClient.BuildUri (request));
            var response = _restClient.Execute(request);

            if (response.StatusCode == HttpStatusCode.NotFound)
            {
                throw new Exception("Build does not exist for ID: " + id);
            }
//			CheckForError(response);
//			CheckForExpectedStatusCode(response, HttpStatusCode.NoContent);
            return(PharmacyRepository.DeletePharmacy(id));
        }
Esempio n. 3
0
 public static IList <Pharmacy> GetPharmacies(string search = @"", int num = -1)
 {
     if (string.IsNullOrEmpty(search))
     {
         if (num == -1)
         {
             return(new List <Pharmacy> (PharmacyRepository.GetPharmacies()));
         }
         else
         {
             return(new List <Pharmacy> (PharmacyRepository.GetPharmacies(num)));
         }
     }
     else
     {
         return(new List <Pharmacy> (PharmacyRepository.GetPharmacies(search)));
     }
 }
Esempio n. 4
0
 public static IList <Pharmacy> GetPharmacies(int[] ids)
 {
     return(new List <Pharmacy> (PharmacyRepository.GetPharmacies(ids)));
 }
Esempio n. 5
0
 public static IList <Pharmacy> GetPharmacies(int page = 0, int num = 10)
 {
     return(new List <Pharmacy> (PharmacyRepository.GetPharmacies(page * num, num)));
 }
Esempio n. 6
0
 public static Pharmacy GetPharmacy(int id)
 {
     return(PharmacyRepository.GetPharmacy(id));
 }
Esempio n. 7
0
 public static void Refresh()
 {
     PharmacyRepository.Refresh();
 }