private DestinationFacility GetUniqueDest() { var destFacility = new DestinationFacility() { ContactAddress = GetUniqueContactAddress(), ContactPerson = GetUniqueContactPerson(), Name = $"Name {Guid.NewGuid().ToString().Substring(0, 4)}", CustomerId = "", DepartmentCode = "Dep code", DepartmentName = "Dep name" }; return(destFacility); }
/// <summary> /// </summary> private void add_order_button_Click(object sender, EventArgs e) { var order = new ExternalOrder(); var tick = DateTime.Now.Ticks; /* * Steps to reproduce inserting an order in to the system. * * 1. Create Customer if not existing * 2. Create medication if not existing, * 3. Make sure that the medication is released and can be used for production * 4. Create the order and assign intake details. */ //PostToServer($"{Webserver}/customers/", GetUniqueCustomer()); var customers = JsonConvert.DeserializeObject <List <Customer> >(GetFromServer($"{Webserver}/customers/")); var customer = customers.First(); // customer.CustomerId = "453436"; //14714 - 13829 //var custFromServer = JsonConvert.DeserializeObject<List<Customer>>(GetFromServer($"{Webserver}/customers/")).ToArray()[1]; //PostToServer($"{Webserver}/medicines/", GetUniqueMedicine()); var serverMedicine = JsonConvert.DeserializeObject <Medicine>(GetFromServer($"{Webserver}/medicines/794921000171115")); var destinationFacility = new DestinationFacility() { CustomerId = "0", DepartmentName = "Destination Facility", Name = "81bdd4e4-e378-4cab-925b-2fb5e1d1484e", ContactAddress = new ContactAddress() { Addressline1 = "Straße", City = "Stadt", Country = "Germany", Postalcode = "123456", }, ContactPerson = new ContactPerson() { TelephoneNumber = "12345678" } }; var pharmacy = new Customer() { CustomerId = "APO-123456789-XXX", Name = "Apotheke", ContactAddress = new ContactAddress() { Addressline1 = "Straße", City = "Stadt", Country = "Germany", Postalcode = "123456", }, ContactPerson = new ContactPerson() { TelephoneNumber = "12345678" } }; var patient = new Patient() { ContactAddress = new ContactAddress() { NameLine1 = "Ms Helen Bradley", Addressline1 = "115 Kingsway South, Warrington, Cheshire", City = "Warrington", Country = "Cheshire", Postalcode = "WA4 1RW", }, ContactPerson = new ContactPerson() { Name = "Ms Helen Bradley", }, RoomNumber = "", Gender = Gender.Female, DateOfBirth = new DateTime(1944, 10, 08).ToString(), BedNumber = "", ExternalPatientNumber = "2100" }; order.Customer = customer; order.ExternalId = "Helens Order " + Environment.TickCount.ToString(); order.State = OrderState.Undefined; order.Timestamp = DateTime.Now.Ticks.ToString(); order.OrderDetails = new List <OrderDetail>() { new OrderDetail() { DestinationFacility = destinationFacility, Pharmacy = pharmacy, Patient = patient, IntakeDetails = new List <IntakeDetail>() { new IntakeDetail() { IntakeDateTime = DateTime.Now.AddDays(1).ToString(), MedicationDetails = new List <MedicationDetail>() { new MedicationDetail() { MedicineId = serverMedicine.Identifier, Physician = "DR Doolittle", IntakeAdvice = "Take one", Count = 2 } } }, new IntakeDetail() { IntakeDateTime = DateTime.Now.AddDays(2).ToString(), MedicationDetails = new List <MedicationDetail>() { new MedicationDetail() { MedicineId = serverMedicine.Identifier, Physician = "DR Doolittle", IntakeAdvice = "Take one", Count = 2 } } }, new IntakeDetail() { IntakeDateTime = DateTime.Now.AddDays(3).ToString(), MedicationDetails = new List <MedicationDetail>() { new MedicationDetail() { MedicineId = serverMedicine.Identifier, Physician = "DR Doolittle", IntakeAdvice = "Take one", Count = 2 } } }, new IntakeDetail() { IntakeDateTime = DateTime.Now.AddDays(4).ToString(), MedicationDetails = new List <MedicationDetail>() { new MedicationDetail() { MedicineId = serverMedicine.Identifier, Physician = "DR Doolittle", IntakeAdvice = "Take one", Count = 2 } } } } } }; #region //{ // ExternalId = Guid.NewGuid().ToString().Replace("-",""), // State = OrderState.Undefined, // Timestamp = DateTime.Now.ToString(CultureInfo.InvariantCulture), // Customer = new Customer // { // Name = Guid.NewGuid().ToString(), // Description = Guid.NewGuid().ToString(), // CustomerId = Guid.NewGuid().ToString(), // Fax = Guid.NewGuid().ToString(), // Website = Guid.NewGuid().ToString(), // ContactPerson = new ContactPerson // { // Name = Guid.NewGuid().ToString(), // Email = Guid.NewGuid().ToString(), // TelephoneNumber = Guid.NewGuid().ToString() // }, // ContactAddress = new ContactAddress // { // State = Guid.NewGuid().ToString(), // Addressline1 = Guid.NewGuid().ToString(), // City = Guid.NewGuid().ToString(), // Country = Guid.NewGuid().ToString(), // NameLine1 = Guid.NewGuid().ToString(), // Postalcode = Guid.NewGuid().ToString() // } // }, // OrderDetails = new List<OrderDetail> // { // new OrderDetail // { // DestinationFacility = new DestinationFacility // { // Name = Guid.NewGuid().ToString(), // CustomerId = Guid.NewGuid().ToString(), // DepartmentName = Guid.NewGuid().ToString(), // DepartmentCode = Guid.NewGuid().ToString(), // ContactPerson = new ContactPerson // { // Name = Guid.NewGuid().ToString(), // Email = Guid.NewGuid().ToString(), // TelephoneNumber = Guid.NewGuid().ToString() // }, // ContactAddress = new ContactAddress // { // State = Guid.NewGuid().ToString(), // Addressline1 = Guid.NewGuid().ToString(), // City = Guid.NewGuid().ToString(), // Country = Guid.NewGuid().ToString(), // NameLine1 = Guid.NewGuid().ToString(), // Postalcode = Guid.NewGuid().ToString() // } // }, // Pharmacy = new Customer // { // Name = Guid.NewGuid().ToString(), // CustomerId = Guid.NewGuid().ToString(), // Website = Guid.NewGuid().ToString(), // ContactPerson = new ContactPerson // { // Name = Guid.NewGuid().ToString(), // Email = Guid.NewGuid().ToString(), // TelephoneNumber = Guid.NewGuid().ToString() // }, // ContactAddress = new ContactAddress // { // State = Guid.NewGuid().ToString(), // Addressline1 = Guid.NewGuid().ToString(), // City = Guid.NewGuid().ToString(), // Country = Guid.NewGuid().ToString(), // NameLine1 = Guid.NewGuid().ToString(), // Postalcode = Guid.NewGuid().ToString() // } // }, // Patient = new Patient // { // BedNumber = "505", // DateOfBirth = "yesterday", // Gender = Gender.Male, // WardName = "Ward", // ContactPerson = new ContactPerson // { // Name = Guid.NewGuid().ToString(), // Email = Guid.NewGuid().ToString(), // TelephoneNumber = Guid.NewGuid().ToString() // }, // ContactAddress = new ContactAddress // { // State = Guid.NewGuid().ToString(), // Addressline1 = Guid.NewGuid().ToString(), // City = Guid.NewGuid().ToString(), // Country = Guid.NewGuid().ToString(), // NameLine1 = Guid.NewGuid().ToString(), // Postalcode = Guid.NewGuid().ToString() // } // }, // IntakeDetails = new List<IntakeDetail> // { // new IntakeDetail // { // IntakeDateTime = DateTime.Now.AddDays(1D).ToString(), // MedicationDetails = new List<MedicationDetail> // { // new MedicationDetail // { // Count = 1, // IntakeAdvice = "Take one", // MedicineId = "medID", // PhysicianComment = "Comment", // Physician = "Dr Doolittle" // }, // new MedicationDetail // { // Count = 1, // IntakeAdvice = "Take one", // MedicineId = "medID", // PhysicianComment = "Comment", // Physician = "Dr Doolittle" // }, // new MedicationDetail // { // Count = 1, // IntakeAdvice = "Take one", // MedicineId = "medID", // PhysicianComment = "Comment", // Physician = "Dr Doolittle" // } // } // } // } // }, // new OrderDetail // { // DestinationFacility = new DestinationFacility // { // Name = Guid.NewGuid().ToString(), // CustomerId = Guid.NewGuid().ToString(), // DepartmentName = Guid.NewGuid().ToString(), // DepartmentCode = Guid.NewGuid().ToString(), // ContactPerson = new ContactPerson // { // Name = Guid.NewGuid().ToString(), // Email = Guid.NewGuid().ToString(), // TelephoneNumber = Guid.NewGuid().ToString() // }, // ContactAddress = new ContactAddress // { // State = Guid.NewGuid().ToString(), // Addressline1 = Guid.NewGuid().ToString(), // City = Guid.NewGuid().ToString(), // Country = Guid.NewGuid().ToString(), // NameLine1 = Guid.NewGuid().ToString(), // Postalcode = Guid.NewGuid().ToString() // } // }, // Pharmacy = new Customer // { // Name = Guid.NewGuid().ToString(), // CustomerId = Guid.NewGuid().ToString(), // Website = Guid.NewGuid().ToString(), // ContactPerson = new ContactPerson // { // Name = Guid.NewGuid().ToString(), // Email = Guid.NewGuid().ToString(), // TelephoneNumber = Guid.NewGuid().ToString() // }, // ContactAddress = new ContactAddress // { // State = Guid.NewGuid().ToString(), // Addressline1 = Guid.NewGuid().ToString(), // City = Guid.NewGuid().ToString(), // Country = Guid.NewGuid().ToString(), // NameLine1 = Guid.NewGuid().ToString(), // Postalcode = Guid.NewGuid().ToString() // } // }, // Patient = new Patient // { // BedNumber = "505", // DateOfBirth = "yesterday", // Gender = Gender.Male, // WardName = "Ward" // } // } // } //}; #endregion PostToServer($"{Webserver}/Orders/", order); //var orders = JsonConvert.DeserializeObject<List<OrderStatus>>(GetFromServer($"{Webserver}/Orders/")); //var x = 1; }