Ejemplo n.º 1
0
        public IAppointmentBuilder Create()
        {
            var bld = new AppointmentBuilder();

            CreateJobQueue.Enqueue(bld);
            return(bld);
        }
        private async Task <FrontDesk.Core.Aggregates.Appointment> CreateAppointment()
        {
            var appointment = new AppointmentBuilder().WithDefaultValues().Build();

            await _repository.AddAsync <FrontDesk.Core.Aggregates.Appointment, Guid>(appointment);

            return(appointment);
        }
        protected override void OnModelCreating(ModelBuilder modelBuilder)
        {
            AppointmentBuilder.BuildAppointment(modelBuilder);
            DoctorBuilder.BuildDoctor(modelBuilder);
            ReviewBuilder.BuildReview(modelBuilder);
            PatientBuilder.BuildPatient(modelBuilder);

            base.OnModelCreating(modelBuilder);
        }
Ejemplo n.º 4
0
        private static void CreateWeihnachten(DateTime now, AppointmentBuilder weihnachtenDef)
        {
            weihnachtenDef.Owner = "Familie";

            weihnachtenDef.Category  = AppointmentCategory.@private;
            weihnachtenDef.BeginDate = new mko.Timeline.Date(now.Year + 1, 12, 24);
            weihnachtenDef.BeginTime = new mko.Timeline.Time(16, 0, 0);

            Assert.IsFalse(weihnachtenDef.IsValid);

            weihnachtenDef.EndDate = new mko.Timeline.Date(now.Year + 1, 12, 25);
            weihnachtenDef.EndTime = new mko.Timeline.Time(0, 0, 0);
        }
        public void Execute()
        {
            var controller = new OnlineController();

            var cmd =
                new Appointment.Create()
            {
                ClientId  = 123,
                VisitDate = new DateTime(2009, 08, 07),
                Notes     = "test notes",
            };

            var createdAppointment = new AppointmentBuilder().Build();

            RootStub.StubExecute(cmd, createdAppointment);

            var result = (Appointment)controller.Execute(cmd).Data;

            Assert.That(result, Is.SameAs(createdAppointment));
        }
        public void Execute()
        {
            var controller = new OnlineController();

            var cmd =
                new Appointment.Create()
                {
                    ClientId = 123,
                    VisitDate = new DateTime(2009, 08, 07),
                    Notes = "test notes",
                };

            var createdAppointment = new AppointmentBuilder().Build();

            RootStub.StubExecute(cmd, createdAppointment);

            var result = (Appointment)controller.Execute(cmd).Data;

            Assert.That(result, Is.SameAs(createdAppointment));
        }
Ejemplo n.º 7
0
        public void SaveAndLoadTest()
        {
            var builders = new AppointmentBuilder[4]
            {
                new AppointmentBuilder(),
                new AppointmentBuilder(),
                new AppointmentBuilder(),
                new AppointmentBuilder()
            };

            using (var creator = new AppointmentCreator())
            {
                var yogaDateTime = new Diary.DateTime(new Date(1, Date.Month.FEBRUARY, 2017), 6, 30);
                builders[0].SetLabel("Yoga").SetOccurs(yogaDateTime).SetDurationMinutes(45);
                builders[0].SetDetails("Downward Dog");

                var doctorsDateTime = new Diary.DateTime(new Date(2, Date.Month.MARCH, 2017), 8, 20);
                builders[1].SetLabel("Ear Doctor").SetOccurs(doctorsDateTime).SetDurationMinutes(30);
                builders[1].SetDetails("Annual Cleaning");

                var teacherDateTime = new Diary.DateTime(new Date(7, Date.Month.APRIL, 2017), 12, 00);
                builders[2].SetLabel("School").SetOccurs(teacherDateTime).SetDurationMinutes(25);
                builders[2].SetDetails("5th Grade Arithmetic");

                var reviewDateTime = new Diary.DateTime(new Date(30, Date.Month.MAY, 2017), 18, 30);
                builders[3].SetLabel("Performance Review").SetOccurs(reviewDateTime).SetDurationMinutes(60);
                builders[3].SetDetails("6 Month Evaluation");

                foreach (var builder in builders)
                {
                    builder.SetCreator(creator);
                    var appointment = (Appointment)builder.Build();
                    builder.SetObjectId(appointment.GetObjectId());

                    Helper.AssertAreEqual(builder, appointment, "Original");
                }

                creator.Save();
            }

            using (var appointmentCreator = new AppointmentCreator()) // Re-open the files
            {
                foreach (var builder in builders)
                {
                    var objectId         = builder.GetObjectId();
                    var savedAppointment = (Appointment)appointmentCreator.Create(objectId);

                    Helper.AssertAreEqual(builder, savedAppointment, "Saved");
                }

                // Now add some contacts to the existing appointments
                using (var contactCreator = new ContactCreator())
                {
                    builders[1].SetContactBuilders();
                    builders[3].SetContactBuilders();
                    var contactBuilders = builders[1].GetContactBuilders();
                    var contacts        = new Contact[contactBuilders.Length];
                    for (int i = 0; i < contactBuilders.Length; i++)
                    {
                        contactBuilders[i].SetCreator(contactCreator);
                        contacts[i] = (Contact)contactBuilders[i].Build();
                    }

                    contactCreator.Save();

                    var drAppointment     = (Appointment)appointmentCreator.Create(builders[1].GetObjectId());
                    var reviewAppointment = (Appointment)appointmentCreator.Create(builders[3].GetObjectId());
                    for (int i = 0; i < contacts.Length; i++)
                    {
                        drAppointment.AddRelation(contacts[i]);
                        reviewAppointment.AddRelation(contacts[i]);
                    }

                    appointmentCreator.Save();
                }
            }

            using (var creator = new AppointmentCreator())   // Re-open the files
            {
                foreach (var builder in builders)
                {
                    var objectId         = builder.GetObjectId();
                    var savedAppointment = (Appointment)creator.Create(objectId);

                    Helper.AssertAreEqual(builder, savedAppointment, "Post Contact Save");
                }
            }
        }