public async Task SearchAppointmentsByDateAsync_should_return_aggregate_given_appointment_exists() { var config = new AppointmentConfig() { AvailableIntervalStart = new LocalDate(2021, 5, 5), AvailableIntervalEnd = new LocalDate(2021, 5, 5), }; await configManager !.SaveConfigAsync(config); var slot = new AppointmentSlot() { From = new LocalDateTime(2021, 5, 5, 10, 0), Duration = Period.FromHours(1), CountOfSlot = 1, }; db !.Slots.Add(slot); var appointment = new Appointment() { From = new LocalDateTime(2021, 5, 5, 10, 0), Duration = Period.FromHours(1), }; db !.Appointments.Add(appointment); await db !.SaveChangesAsync(); var aggregatesForDay = await sut !.SearchAppointmentsByDateAsync(new LocalDate(2021, 5, 5)); Assert.IsTrue(aggregatesForDay.AllSlots.First().Appointments.Any()); }
public static void InitializeAppointments() { List <Appointment> appointmentList = HospitalDB.FetchAppointments(); foreach (Appointment appointment in appointmentList) { // Fetching Appointment Patient String patientID = HospitalDB.FetchAppointmentPatient(appointment.ID); appointment.Patient = (AppointmentPatient)Patients[patientID]; ((AppointmentPatient)Patients[patientID]).addAppointment(appointment); // Fetching Appointment Doctor String doctorID = HospitalDB.FetchAppointmentDoctor(appointment.ID); appointment.Doctor = (Doctor)Employees[doctorID]; ((Doctor)Employees[doctorID]).addAppointment(appointment); // Adding Doctor, Patient Relations if (((Doctor)Employees[doctorID]).Patients.ContainsKey(patientID) == false) { ((Doctor)Employees[doctorID]).addPatient(Patients[patientID]); } if (((AppointmentPatient)Patients[patientID]).Doctors.ContainsKey(doctorID) == false) { Patients[patientID].assignDoctor((Doctor)Employees[doctorID]); } Appointments.Add(appointment.ID, appointment); } }
private void IntializeAppoitments(int count) { for (int i = 0; i < count; i++) { ScheduleAppointment scheduleAppointment = new ScheduleAppointment(); scheduleAppointment.Color = color_collection[i]; scheduleAppointment.Subject = teamManagement[i]; scheduleAppointment.StartTime = start_time_collection[i]; scheduleAppointment.EndTime = end_time_collection[i]; Appointments.Add(scheduleAppointment); } int allDayCount = 0; //// AllDay Appointment for (int i = 0; i < count; i++) { ScheduleAppointment allDayAppointment = new ScheduleAppointment(); allDayAppointment.Color = color_collection[allDayCount]; allDayAppointment.Subject = allDayTeamManagement[allDayCount]; allDayAppointment.StartTime = start_time_collection[i]; allDayAppointment.EndTime = end_time_collection[i]; allDayAppointment.IsAllDay = true; Appointments.Add(allDayAppointment); allDayCount = allDayCount + 1; i = i + 1; } }
public async Task SearchAppointmentsByYearMonthAsync_should_return_aggregate_given_slot_and_appointment() { await configManager !.SaveConfigAsync(new AppointmentConfig() { AvailableIntervalStart = new LocalDate(2021, 1, 1), AvailableIntervalEnd = new LocalDate(2021, 12, 31), }); db !.Slots.Add(new AppointmentSlot() { From = new LocalDateTime(2021, 5, 1, 10, 0), Duration = Period.FromHours(1), CountOfSlot = 1, }); db !.Appointments.Add(new Appointment() { From = new LocalDateTime(2021, 5, 1, 10, 0), Duration = Period.FromHours(1), }); await db !.SaveChangesAsync(); var aggregatesForMonth = await sut !.SearchAppointmentsByYearMonthAsync(new YearMonth(2021, 5)); Assert.IsTrue(aggregatesForMonth.Appointments.First(e => e.Date == new LocalDate(2021, 5, 1)).AllSlots.Any()); Assert.AreEqual(new LocalDateTime(2021, 5, 1, 10, 0), aggregatesForMonth.Appointments.First(e => e.Date == new LocalDate(2021, 5, 1)).AllSlots.First().From); Assert.IsTrue(aggregatesForMonth.Appointments.First(e => e.Date == new LocalDate(2021, 5, 1)).AllSlots.First().Appointments.Any()); }
private void FillTasks() { Random rand = new Random(DateTime.Now.Millisecond); Appointments.Add(new HospitalAppointment() { StartTime = DateTime.Now.Date.AddHours(10), EndTime = DateTime.Now.Date.AddHours(11), DoctorId = 1, Notes = "", Location = "101", PatientName = "Dave Murrel", InsuranceNumber = GenerateNineNumbers(rand), FirstVisit = true }); Appointments.Add(new HospitalAppointment() { StartTime = DateTime.Now.Date.AddDays(2).AddHours(15), EndTime = DateTime.Now.Date.AddDays(2).AddHours(16), DoctorId = 1, Notes = "", Location = "101", PatientName = "Mike Roller", InsuranceNumber = GenerateNineNumbers(rand), FirstVisit = true }); Appointments.Add(new HospitalAppointment() { StartTime = DateTime.Now.Date.AddDays(1).AddHours(11), EndTime = DateTime.Now.Date.AddDays(1).AddHours(12), DoctorId = 2, Notes = "", Location = "103", PatientName = "Bert Parkins", InsuranceNumber = GenerateNineNumbers(rand), FirstVisit = true }); Appointments.Add(new HospitalAppointment() { StartTime = DateTime.Now.Date.AddDays(2).AddHours(10), EndTime = DateTime.Now.Date.AddDays(2).AddHours(12), DoctorId = 2, Notes = "", Location = "103", PatientName = "Carl Lucas", InsuranceNumber = GenerateNineNumbers(rand), FirstVisit = false }); Appointments.Add(new HospitalAppointment() { StartTime = DateTime.Now.Date.AddHours(12), EndTime = DateTime.Now.Date.AddHours(13), DoctorId = 3, Notes = "Blood test results are required", Location = "104", PatientName = "Brad Barnes", InsuranceNumber = GenerateNineNumbers(rand), FirstVisit = false }); Appointments.Add(new HospitalAppointment() { StartTime = DateTime.Now.Date.AddDays(1).AddHours(14), EndTime = DateTime.Now.Date.AddDays(1).AddHours(15), DoctorId = 3, Notes = "", Location = "104", PatientName = "Richard Fisher", InsuranceNumber = GenerateNineNumbers(rand), FirstVisit = true }); }
public AppointmentViewModel() { // Set the commands for Add/Remove the exception dates. this.SetUpCommands(); // Create the new recurrence exception dates. var exceptionDate = new DateTime(2017, 09, 07); var recExcepDate2 = new DateTime(2017, 09, 03); var recExcepDate3 = new DateTime(2017, 09, 05); //Adding schedule appointment in schedule appointment collection var recurrenceAppointment = new ScheduleAppointment() { Id = 1, StartTime = new DateTime(2017, 09, 01, 10, 0, 0), EndTime = new DateTime(2017, 09, 01, 12, 0, 0), Subject = "Occurs Daily", Color = Color.Blue, RecurrenceRule = "FREQ=DAILY;COUNT=20" }; // Add RecuurenceExceptionDates to appointment. recurrenceAppointment.RecurrenceExceptionDates = new ObservableCollection <DateTime>() { exceptionDate, recExcepDate2, recExcepDate3, }; //Adding schedule appointment in schedule appointment collection Appointments.Add(recurrenceAppointment); }
bool UpdateDayCount(int newDayCount) { DateTime newEndDate = this.startDate.AddDays(newDayCount); if (newEndDate.Equals(this.endDate)) { return(false); } for (DateTime date = this.endDate; date > newEndDate; date -= TimeSpan.FromDays(1)) { for (int i = 0; i < this.appointmentsPerDay; i++) { Appointments.RemoveAt(Appointments.Count - 1); } } for (DateTime date = this.endDate; date < newEndDate; date += TimeSpan.FromDays(1)) { for (int i = 0; i < this.appointmentsPerDay; i++) { Appointments.Add(CreateAppointment(Appointments.Count - 1, date, CalculateDuration(i), Resources.Count)); } } this.endDate = newEndDate; return(true); }
private void FetchAppointmentsExecute(DevExpress.XtraScheduler.FetchAppointmentsEventArgs e) { TimeInterval currentInterval = e.Interval as TimeInterval; if (lastFetchedInterval.Contains(currentInterval)) { return; } lastFetchedInterval = currentInterval; // var entities = from entity in context.IHP_HARMONOGRAM_DZIENNY where (entity.CZASSTART <lastFetchedInterval.End && entity.CZASSTOP> lastFetchedInterval.Start) select entity; entities.Load(); var Appo = context.IHP_HARMONOGRAM_DZIENNY.Local.ToList(); Appointments.Clear(); foreach (IHP_HARMONOGRAM_DZIENNY item in Appo) { // item.TEMAT = item.ARIT_HARMONOGRAM.HODOWCA ; // item.LABELID = 2; // item.WagaSr = 22; Appointments.Add(item); } }
public Details(ITaskData taskData, int taskId) : this() { Data.Task task = taskData.Get(taskId); TaskId = taskId; TaskCategoryId = task.CategoryId; TaskName = task.Name; TaskStartTime = task.StartTime; TaskEndTime = task.EndTime; CategoryName = task.Category.Name; if (task.Appointments != null) { foreach (Data.Appointment appointment in task.Appointments) { Appointments.Add(new Appointment(appointment)); } } if (task.Notes != null) { foreach (Data.Note note in task.Notes) { Notes.Add(new Note(note)); } } if (task.Documents != null) { foreach (Data.Document document in task.Documents) { Documents.Add(new Document(document)); } } }
private async void SetUpEvents() { var eventsResponse = await _apiManager.GetEvents(Config.Token); if (eventsResponse.IsSuccessStatusCode) { var json = await eventsResponse.Content.ReadAsStringAsync(); PaginatedResponse <Event> events = await Task.Run(() => JsonConvert.DeserializeObject <PaginatedResponse <Event> >(json)); foreach (Event e in events.Results) { string formatter = "yyyy-MM-dd HH:mm:ss"; DateTime from = DateTime.ParseExact($"{e.Date} {e.StartTime}", formatter, CultureInfo.InvariantCulture); DateTime to = DateTime.ParseExact($"{e.Date} {e.EndTime}", formatter, CultureInfo.InvariantCulture); CalendarInlineEvent meeting = new CalendarInlineEvent { Subject = e.Title, StartTime = from, EndTime = to }; Appointments.Add(meeting); Events.Add(e); } } }
public async Task FindAppointmentSlotByIdAsync_should_return_slot_given_appointment_exists() { var slot = new AppointmentSlot() { From = new LocalDateTime(2021, 5, 5, 10, 0), Duration = Period.FromHours(1), CountOfSlot = 1, }; db !.Slots.Add(slot); var appointment = new Appointment() { From = new LocalDateTime(2021, 5, 5, 10, 0), Duration = Period.FromHours(1), }; db !.Appointments.Add(appointment); await db !.SaveChangesAsync(); var aggregate = await sut !.FindAppointmentSlotByIdAsync(slot.Id); Assert.IsNotNull(aggregate); Assert.IsTrue(aggregate.Appointments.Any()); }
public void ExecuteCreateNewAppointment() { EditingAppointment.AppointmentFhirID = Guid.NewGuid().ToString(); EditingAppointment.PractitionerFhirID = null; foreach (var pid in PractitionerFhirIds) { if (pid.Name == EditingAppointment.PractitionerName) { EditingAppointment.PractitionerFhirID = pid.Id; } } if (EditingAppointment.PractitionerFhirID == null) { String id = Guid.NewGuid().ToString("X"); PractitionerFhirIds.Add(new PractitionerId(EditingAppointment.PractitionerName, id)); EditingAppointment.PractitionerFhirID = id; } Appointments.Add(EditingAppointment); Storage.SaveSimulationAppointments(Appointments); Storage.SaveSimulationIds(PractitionerFhirIds); EditingAppointment = new PmsAppointment(); DateTime dt = DateTime.Now; EditingAppointment.AppointmentStartTime = dt.AddTicks(-(dt.Ticks % TimeSpan.TicksPerSecond)); EditingAppointment.ArrivalStatus = AppointmentStatus.Booked; }
private void Find() { var workingFilter = string.Format("(workingfrom is null or workingfrom < '{0:yyyyMMdd HH:mm:ss}') and (workingtill is null or workingtill > '{1:yyyyMMdd HH:mm:ss}')", DateTill, DateFrom); var workFilter = string.Format("workid in (select workid_r from wmsworking where {0})", workingFilter); var operationFilter = string.Format("operationcode in (select operationcode_r from wmswork where workid in (select workid_r from wmsworking where {0}))", workingFilter); var workerFilter = string.Format("workerid in (select workerid_r from wmsworking where {0})", workingFilter); IEnumerable <Work> works; using (var mgr = IoC.Instance.Resolve <IBaseManager <Work> >()) works = mgr.GetFiltered(workFilter); IEnumerable <Working> workings; using (var mgr = IoC.Instance.Resolve <IBaseManager <Working> >()) workings = mgr.GetFiltered(workingFilter); IEnumerable <Worker> workers; using (var mgr = IoC.Instance.Resolve <IBaseManager <Worker> >()) workers = mgr.GetFiltered(workerFilter); IEnumerable <BillOperation> operations; using (var mgr = IoC.Instance.Resolve <IBaseManager <BillOperation> >()) operations = mgr.GetFiltered(operationFilter); // операции становятся Operations.Clear(); foreach (var operation in operations) { var op = new OperationModel() { Id = Operations.Count, Code = operation.OperationCode, Name = operation.OperationName, ClassCode = operation.OperationClassCode }; Operations.Add(op); } // работники становятся ресурсами Resources.Clear(); foreach (var worker in workers) { var res = new ResourceModel(worker); Resources.Add(res); } // выполнения становятся событиями Appointments.Clear(); foreach (var working in workings) { var work = works.First(i => i.GetKey <decimal>() == working.WORKID_R); var operation = Operations.First(i => i.Code == work.OPERATIONCODE_R); var worker = Resources.First(i => i.Id == working.WORKERID_R); var label = Labels.First(i => i.Code == operation.ClassCode); var a = new AppointmentModel(working, operation, worker, label); Appointments.Add(a); } }
private void RefreshAppointments() { Appointments.Clear(); Appointments.Add(new Appointment() { Time = DateTime.Now.Date.AddHours(17), Title = "Go shopping with Carolyn @ 10am" }); }
/// <summary> /// Loads the appointments. /// </summary> /// <returns>Task.</returns> protected async Task LoadAppointments() { var appointments = await DataManager.GetAppointmentsAsync(); foreach (var i in appointments) { Appointments.Add(i); } }
private void AddTestData() { // planowanieEntity.ARIT_HARMONOGRAM_DZIENNY.Local.Clear(); int godzstart = 6; int godzstop = godzstart + 5; // przeliczCzasStop(_arItharmonogramSel.ID_KONTRAH ?? 0); string LastMessage; decimal _waga = WyliczWage(); try { IHP_HARMONOGRAM_DZIENNY apt = new IHP_HARMONOGRAM_DZIENNY() { ID_IHP_HARMONOGRAM_DZIENNY = GetNextNumer(1), DATA = _submissiondate, // TEMAT = _arItharmonogramSel.HODOWCA, TEMAT = "MASZYNA1", CZASSTART = _submissiondate.AddHours(godzstart), CZASSTOP = _submissiondate.AddHours(godzstop), // ID_ARIT_HARMONOGRAM = _arItharmonogramSel.ID_HARMONOGRAM, ID_IHP_MASZYNA = _machine.ID_IHP_MASZYNA, LABELID = 2, ILOSC = 3, WAGA = _waga, ID_KARTOTEKA = 1, ID_KONTRAH = 1 }; Appointments.Add(apt); context.IHP_HARMONOGRAM_DZIENNY.Add(apt); context.SaveChanges(); } catch (DbEntityValidationException e) { foreach (var eve in e.EntityValidationErrors) { foreach (var ve in eve.ValidationErrors) { LastMessage = ve.PropertyName + ": " + ve.ErrorMessage; LogManager.WriteLogMessage(LogManager.LogType.Error, LastMessage); // Console.WriteLine("- Property: \"{0}\", Error: \"{1}\"", // ve.PropertyName, ve.ErrorMessage); } } throw; } /* * catch (Exception ex) * { * LastMessage = ex.ToString(); * if (LastMessage == string.Empty) * LastMessage = ex.InnerException.ToString(); * LogManager.WriteLogMessage(LogManager.LogType.Error, LastMessage); * } */ }
public void DisplayAllAppointments() { var allAppointments = AppointmentDB.GetAllAppointments(); foreach (var item in allAppointments) { Appointments.Add(item); } }
private void AddTestData() { ModelResource res1 = new ModelResource() { Id = 0, Name = "Resource 1", Color = 0xebecf0 }; ModelResource res2 = new ModelResource() { Id = 1, Name = "Resource 2", Color = 0xc1c5d6 }; ModelResource res3 = new ModelResource() { Id = 2, Name = "Resource 3", Color = 0x787fa0 }; Resources.Add(res1); Resources.Add(res2); Resources.Add(res3); DateTime baseTime = DateTime.Now; ModelAppointment apt1 = new ModelAppointment() { StartTime = baseTime.AddHours(1), EndTime = baseTime.AddHours(2), Subject = "Test", Location = "Office", Description = "Test procedure", Price = 10m, ResourceId = 1 }; ModelAppointment apt2 = new ModelAppointment() { StartTime = baseTime.AddHours(2), EndTime = baseTime.AddHours(3), Subject = "Test2", Location = "Office", Description = "Test procedure", ResourceId = 2 }; Appointments.Add(apt1); Appointments.Add(apt2); }
private void IntializeAppoitments(int count) { for (int i = 0; i < count; i++) { ScheduleAppointment scheduleAppointment = new ScheduleAppointment(); scheduleAppointment.Color = color_collection[i]; scheduleAppointment.Subject = teamManagement[i]; scheduleAppointment.StartTime = start_time_collection[i]; scheduleAppointment.EndTime = end_time_collection[i]; Appointments.Add(scheduleAppointment); } }
private void CreateAppointments() { Random rand = new Random(DateTime.Now.Millisecond); Appointments.Add(MedicalAppointment.Create(startTime: DateTime.Now.Date.AddHours(10), endTime: DateTime.Now.Date.AddHours(11.5), doctorId: 1, paymentStateId: 1, location: "101", patientName: "Dave Murrel", note: "Take care", firstVisit: true)); Appointments.Add(MedicalAppointment.Create(startTime: DateTime.Now.Date.AddDays(2).AddHours(15), endTime: DateTime.Now.Date.AddDays(2).AddHours(16.5), doctorId: 1, paymentStateId: 1, location: "101", patientName: "Mike Roller", note: "Schedule next visit soon", firstVisit: true)); Appointments.Add(MedicalAppointment.Create(startTime: DateTime.Now.Date.AddDays(1).AddHours(11), endTime: DateTime.Now.Date.AddDays(1).AddHours(12), doctorId: 2, paymentStateId: 1, location: "103", patientName: "Bert Parkins", note: string.Empty, firstVisit: true)); Appointments.Add(MedicalAppointment.Create(startTime: DateTime.Now.Date.AddDays(2).AddHours(10), endTime: DateTime.Now.Date.AddDays(2).AddHours(12), doctorId: 2, paymentStateId: 0, location: "103", patientName: "Carl Lucas", note: string.Empty, firstVisit: false)); Appointments.Add(MedicalAppointment.Create(startTime: DateTime.Now.Date.AddHours(12), endTime: DateTime.Now.Date.AddHours(13.5), doctorId: 3, paymentStateId: 1, location: "104", patientName: "Brad Barnes", note: "Tests are necessary", firstVisit: false)); Appointments.Add(MedicalAppointment.Create(startTime: DateTime.Now.Date.AddDays(1).AddHours(14), endTime: DateTime.Now.Date.AddDays(1).AddHours(15), doctorId: 3, paymentStateId: 1, location: "104", patientName: "Richard Fisher", note: string.Empty, firstVisit: true)); }
private void AddTestData() { ModelResource res1 = new ModelResource() { Id = 0, Name = "Computer1", Color = ToRgb(System.Drawing.Color.Yellow) }; ModelResource res2 = new ModelResource() { Id = 1, Name = "Computer2", Color = ToRgb(System.Drawing.Color.Green) }; ModelResource res3 = new ModelResource() { Id = 2, Name = "Computer3", Color = ToRgb(System.Drawing.Color.Blue) }; Resources.Add(res1); Resources.Add(res2); Resources.Add(res3); DateTime baseTime = DateTime.Today; ModelAppointment apt1 = new ModelAppointment() { StartTime = baseTime.AddHours(1), EndTime = baseTime.AddHours(2), Subject = "Test", Location = "Office", Description = "Test procedure", Price = 10m }; ModelAppointment apt2 = new ModelAppointment() { StartTime = baseTime.AddHours(2), EndTime = baseTime.AddHours(3), Subject = "Test2", Location = "Office", Description = "Test procedure", ResourceId = "<ResourceIds>\r\n<ResourceId Type=\"System.Int32\" Value=\"0\" />\r\n<ResourceId Type=\"System.Int32\" Value=\"1\" />\r\n</ResourceIds>" }; Appointments.Add(apt1); Appointments.Add(apt2); }
public void BookTime(DateTime date) { if (CheckTime(date)) { Appointments.Add(date); StreamWriter sw = new StreamWriter(@"D:\DZ\OOP\prep1\Course\Hospital_program\Doctors\" + Name + ".txt", true, Encoding.Default); sw.WriteLine(date); sw.Close(); Console.ForegroundColor = ConsoleColor.Cyan; Console.WriteLine("\nAppointment successfully booked!"); Console.ResetColor(); } }
private void AddTestData() { Resources.Add(CreateCustomResource(1, "Max Fowler", ToRgb(Color.PowderBlue), 3)); Resources.Add(CreateCustomResource(2, "Nancy Drewmore", ToRgb(Color.PaleVioletRed), 1)); Resources.Add(CreateCustomResource(3, "Pak Jang", ToRgb(Color.PeachPuff), 2)); foreach (ModelResource resource in Resources) { string subjPrefix = resource.Name + "'s "; Appointments.Add(CreateEvent(subjPrefix + "meeting", resource.Id, 2, 5)); Appointments.Add(CreateEvent(subjPrefix + "travel", resource.Id, 3, 6)); Appointments.Add(CreateEvent(subjPrefix + "phone call", resource.Id, 0, 10)); } }
public void DisplayList1() { List <Appointment> appointments = appointmentManager.DisplayDoctorAppointmentList(); foreach (var item in appointments) { Appointments.Add(item); } if (appointments.Count < 1) { MessageBox.Show("No Doctor record exists !"); } }
public override void NonUIThreadInitialize() { base.NonUIThreadInitialize(); #region appointments foreach (Appointment a in ((Study)Item).Appointments) { AppointmentViewModel avm = new AppointmentViewModel(a); //DataStoreItemViewModel avm = new DataStoreItemViewModel(a); Appointments.Add(avm); } #endregion }
private void GetAppointmentList() { int apptId = 0; int custId = 0; int userId = 0; string type = "type"; DateTime start = DateTime.UtcNow; DateTime end = DateTime.UtcNow; DateTime startUTC = DateTime.UtcNow; DateTime endUTC = DateTime.UtcNow; DateTime createDate = DateTime.UtcNow; string createdBy = "test"; DateTime lastUpdate = DateTime.UtcNow; con.Open(); string query = "select appointmentId, customerId, userId, type, start, end, createDate, createdBy, lastUpdate, lastUpdateBy from appointment"; MySqlDataReader row; row = con.ExecuteReader(query); if (row.HasRows) { while (row.Read()) { apptId = Convert.ToInt32(row["appointmentId"]); custId = Convert.ToInt32(row["customerId"]); userId = Convert.ToInt32(row["userId"]); type = (row["type"]).ToString(); startUTC = Convert.ToDateTime(row["start"]); endUTC = Convert.ToDateTime(row["end"]); createdBy = (row["createdBy"]).ToString(); lastUpdate = Convert.ToDateTime((row["lastUpdate"])); start = TimeZone.CurrentTimeZone.ToLocalTime(startUTC); end = TimeZone.CurrentTimeZone.ToLocalTime(endUTC); Appointment newAppointment = new Appointment(apptId, custId, userId, type, start, end, createDate, createdBy, lastUpdate); Appointments.Add(newAppointment); } } else { MessageBox.Show("Error loading appointments or no appointments found!", "Information"); } con.Close(); }
private void Calendar_AddAppointment(object sender, RoutedEventArgs e) { Appointment appointment = new Appointment(); appointment.Subject = "Subject?"; appointment.StartTime = new DateTime(2008, 10, 22, 16, 00, 00); appointment.EndTime = new DateTime(2008, 10, 22, 17, 00, 00); AddAppointmentWindow aaw = new AddAppointmentWindow(); aaw.DataContext = appointment; aaw.ShowDialog(); appointments.Add(appointment); }
//Method to call the searchpatient instance from the PatientDB. //This method will be attached to the button 'Search' command. //private void SearchAppointment() //{ // Appointments.Clear(); // var search = PatientDB.SearchPatient(SearchInput); // foreach (var item in search) // { // Patients.Add(item); // } //} private void AddAppointment() { Appointment appointment = new Appointment(); //adding additional row after the last row int lastRow = Appointments.Count; for (int i = 0; i <= lastRow; i++) { if (i == lastRow) { Appointments.Add(appointment); } } }
public void loadAppointments(DateTime?date) { if (date == null) { return; } DateTime temp = (DateTime)date; Appointments.Clear(); List <Appointment> result = dbContext.Appointments.Where(a => a.Date.Day == temp.Day).ToList(); foreach (Appointment a in result) { Appointments.Add(a); } }
private void AddNewAppointmentCommandExecute(object parameter) { DateTime baseTime = DateTime.Today; ModelAppointment apt = new ModelAppointment() { StartTime = baseTime.AddHours(3), EndTime = baseTime.AddHours(4), Subject = "Test3", Location = "Office", Description = "Test procedure", Price = 20m }; Appointments.Add(apt); }
public void TestSaveValid() { // Arrange // Setup appointment variables to save const string AppFile = "UnitTests/SaveFile.xml"; const string AppSub = "Test Appointment "; const string AppLoc = "Test Location"; const int AppLength = 30; DateTime appStart = new DateTime(DateTime.Now.Year + 1, 1, 1, 0, 0, 0); // Create dummy appointments Appointments testApps = new Appointments(); PrivateObject privApps = new PrivateObject(testApps); privApps.SetField("fileName", AppFile); for (int i = 0; i < 2; ++i) { testApps.Add(new Appointment(AppSub + i, AppLoc, AppLength, appStart)); } // Act bool successfullSave = testApps.Save(); // Assert Assert.IsTrue(successfullSave); string validXml = ""; using (StreamReader sr = new StreamReader("UnitTests/Load.xml")) { validXml = sr.ReadToEnd(); } string fileContent = ""; using (StreamReader sr = new StreamReader(AppFile)) { fileContent = sr.ReadToEnd(); } Assert.AreEqual(validXml, fileContent, "The appointments weren't saved!"); }