public AddPet(PetReadModel PetModel, Page ReturnPage)
        {
            InitializeComponent();

            submitPet.Clicked += SubmitPet_Clicked;
            this._petModel     = PetModel;
            this._returnPage   = ReturnPage;

            if (_petModel != null)
            {
                PetName.Text = _petModel.Name;
                Weight.Text  = _petModel.Weight;
                Type.Text    = _petModel.Type;
                Breed.Text   = _petModel.Breed;
                Age.Text     = _petModel.Age.ToString();
                Gender.Text  = _petModel.Gender;
            }

            if (_returnPage.GetType() == typeof(CustomMaster))
            {
                NavigationPage.SetHasNavigationBar(this, false);
            }
            else
            {
                NavigationPage.SetHasNavigationBar(this, true);
            }
        }
Ejemplo n.º 2
0
        public async Task Consume(ConsumeContext <IAppointmentFinalizedEvent> context)
        {
            var @event = context.Message;
            var pet    = new PetReadModel();

            pet = _redisService.HashGet <PetReadModel>($"{pet.RedisKey}", $"{@event.PetId}", CommandFlags.PreferMaster);
            var oldAppointment = pet.Appointments.FirstOrDefault(a => a.Id == @event.AggregateId);

            pet.Appointments.Remove(oldAppointment);
            pet.Appointments.Add(new AppointmentReadModel
            {
                Id = oldAppointment.Id,
                OwnerFamilyName = oldAppointment.OwnerFamilyName,
                OwnerGivenName  = oldAppointment.OwnerGivenName,
                OwnerId         = oldAppointment.OwnerId,
                DoctorId        = oldAppointment.DoctorId,
                PetId           = oldAppointment.PetId,
                PetName         = oldAppointment.PetName,
                StartingTime    = oldAppointment.StartingTime,
                State           = @event.State,
                MedicalHistory  = @event.MedicalHistory,
                Diagnostic      = @event.Diagnostic
            });
            _redisService.HashSet($"{pet.RedisKey}", $"{@event.PetId}", pet, When.Always, CommandFlags.PreferMaster);
        }
Ejemplo n.º 3
0
        public async Task Consume(ConsumeContext <IPetCreatedEvent> context)
        {
            var @event = context.Message;

            var pet = new PetReadModel
            {
                Id              = @event.AggregateId,
                OwnerId         = @event.OwnerId,
                BirthDate       = @event.BirthDate,
                Breed           = @event.Breed,
                ColorHex        = @event.ColorHex,
                Name            = @event.Name,
                ProfileImageUrl = @event.ProfileImageUrl,
                Sex             = @event.Sex,
                Species         = @event.Species,
                Version         = @event.Version
            };

            _redisService.HashSet($"{pet.RedisKey}", $"{pet.Id}", pet, When.Always, CommandFlags.PreferMaster);
        }
        public async Task Consume(ConsumeContext <IAppointmentCreatedEvent> context)
        {
            var @event = context.Message;
            var pet    = new PetReadModel();

            pet = _redisService.HashGet <PetReadModel>($"{pet.RedisKey}", $"{@event.PetId}", CommandFlags.PreferMaster);
            pet.Appointments.Add(new AppointmentReadModel
            {
                Id              = @event.AggregateId,
                CalendarId      = @event.CalendarId,
                DoctorId        = @event.DoctorId,
                OwnerFamilyName = @event.OwnerFamilyName,
                OwnerGivenName  = @event.OwnerGivenName,
                OwnerId         = @event.OwnerId,
                PetId           = @event.PetId,
                PetName         = @event.PetName,
                StartingTime    = @event.StartingTime,
                State           = @event.State
            });
            _redisService.HashSet($"{pet.RedisKey}", $"{pet.Id}", pet, When.Always, CommandFlags.PreferMaster);
        }
 private async void ShowAddPetModalPage(PetReadModel Pet)
 {
     _AddPetModal = new AddPet(Pet, this);
     await Navigation.PushModalAsync(_AddPetModal);
 }