private string processSearchAppointmentRequest(string machineId, string hospitalName, string departmentname, string token, string url) { var request = new GetMachineAppointmentsRequest() { MachineId = new VMS.AWC.Common.Contracts.String() { Value = machineId }, HospitalName = new VMS.AWC.Common.Contracts.String() { Value = hospitalName }, DepartmentName = new VMS.AWC.Common.Contracts.String() { Value = departmentname } }; var response = ARIAAccessHelper.SendRequestData(request, url, token); return(response); }
static void Main(string[] args) { string apiKey = "YourAPIKey"; //string request = "{\"__type\":\"GetMachineListRequest:http://services.varian.com/AriaWebConnect/Link\",\"Attributes\":null,\"DepartmentID\":{\"Value\":\"Radiation Oncology\"}}"; //string response = SendData(request, true, apiKey); //Console.WriteLine(response); //var response_machines = JsonConvert.DeserializeObject<GetMachineListResponse>(response); //foreach(var machine in response_machines.Machines) //{ // Console.WriteLine(machine.MachineId.Value); //} //Console.ReadLine(); //**new request starts here ** string departmentName = "Radiation Oncology"; var hospitalName = "Varian Medical Center"; string resourceType = "Machine"; string machineId = "EDGE"; var startdate = new DateTime(2020, 3, 23); //var week_start = new DateTimeOffset(startdate, TimeZoneInfo.Local.GetUtcOffset(startdate)); var enddate = startdate.AddDays(5); GetMachineAppointmentsRequest getMachineAppointmentsRequest = new GetMachineAppointmentsRequest { DepartmentName = new VMSType.String { Value = departmentName }, HospitalName = new VMSType.String { Value = hospitalName }, ResourceType = new VMSType.String { Value = resourceType }, MachineId = new VMSType.String { Value = machineId }, StartDateTime = new VMSType.String { Value = startdate.ToString("yyyy-MM-ddTHH:mm:sszzz") }, EndDateTime = new VMSType.String { Value = enddate.ToString("yyyy-MM-ddTHH:mm:sszzz") } }; string request_appointments = $"{{\"__type\":\"GetMachineAppointmentsRequest:http://services.varian.com/AriaWebConnect/Link\",{JsonConvert.SerializeObject(getMachineAppointmentsRequest).TrimStart('{')}}}"; string response_appointments = SendData(request_appointments, true, apiKey); GetMachineAppointmentsResponse getMachineAppointmentsResponse = JsonConvert.DeserializeObject <GetMachineAppointmentsResponse>(response_appointments); Dictionary <string, int> appointments = new Dictionary <string, int>(); foreach (var appointment in getMachineAppointmentsResponse.MachineAppointments) { if (appointments.Keys.Contains(appointment.PatientId.Value)) { appointments[appointment.PatientId.Value]++; } else { appointments.Add(appointment.PatientId.Value, 1); } } Console.WriteLine($"Appointments for the week of {startdate.ToString("MM-dd-yyyy")}\n on Machine {machineId}"); foreach (var app in appointments) { Console.WriteLine($"{app.Key}: {app.Value}"); } Console.ReadLine(); }