Esempio n. 1
0
 public bool UpdateBoarding(BoardingModel model)
 {
     using (ISession session = NHibernateSession.OpenSession())
     {
         Boarding foundBoarding = session.Query <Boarding>().FirstOrDefault(c => c.BoardingId == model.BoardingId.Value);
         if (foundBoarding == null)
         {
             return(false);
         }
         foundBoarding.Modified      = DateTime.UtcNow;
         foundBoarding.Comments      = model.Comments;
         foundBoarding.Company       = model.Company;
         foundBoarding.Address       = model.Address;
         foundBoarding.Reason        = model.Reason;
         foundBoarding.PaymentAmount = model.PaymentAmount;
         foundBoarding.Website       = model.Website;
         foundBoarding.StartDateTime = model.StartDateTime;
         foundBoarding.EndDateTime   = model.EndDateTime;
         using (ITransaction transaction = session.BeginTransaction()) //  Begin a transaction
         {
             session.Update(foundBoarding);                            //  Save the user in session
             transaction.Commit();                                     //  Commit the changes to the database
         }
     }
     return(true);
 }
Esempio n. 2
0
        public bool CreateBoarding(BoardingModel model)
        {
            Boarding newBoarding = new Boarding
            {
                Comments      = model.Comments,
                Company       = model.Company,
                Address       = model.Address,
                Reason        = model.Reason,
                PaymentAmount = model.PaymentAmount,
                Website       = model.Website,
                StartDateTime = model.StartDateTime,
                EndDateTime   = model.EndDateTime,
                Created       = model.Created,
                Modified      = model.Modified,
                Deleted       = model.Deleted
            };

            using (ISession session = NHibernateSession.OpenSession())
            {
                Dog foundDog = session.Query <Dog>().FirstOrDefault(u => u.DogId == model.Dog.DogId.Value);
                if (foundDog == null)
                {
                    return(false);
                }
                newBoarding.Dog = foundDog;
                using (ITransaction transaction = session.BeginTransaction()) //  Begin a transaction
                {
                    session.Save(newBoarding);                                //  Save the user in session
                    transaction.Commit();                                     //  Commit the changes to the database
                }
            }
            return(true);
        }
Esempio n. 3
0
        static void Main(string[] args)
        {
            var boarding = new Boarding(File.ReadAllLines("../input.txt").Select(_ => new BoardingPass(_)));

            //Part one
            Console.WriteLine($"{boarding.GetHighestSeatId()}");

            //Part two
            Console.WriteLine($"{boarding.GetMissingSeat()}");
        }
        /// <summary>
        /// Animation start to view.
        /// </summary>
        /// <param name="childElement"></param>
        /// <param name="item"></param>
        public async void StartAnimation(List <View> childElement, Boarding item)
        {
            var fadeAnimationImage               = childElement[0].FadeTo(1, 250);
            var fadeAnimationtaskTitleTime       = childElement[1].FadeTo(1, 1000);
            var translateAnimation               = childElement[1].TranslateTo(0, 0, 500);
            var scaleAnimationTitle              = childElement[1].ScaleTo(1.5, 500, Easing.SinIn);
            var fadeAnimationTaskDescriptionTime = childElement[2].FadeTo(1, 1000);

            var animation          = new Animation();
            var scaleDownAnimation = new Animation(v => childElement[0].Scale = v, 0.5, 1, Easing.SinIn);

            animation.Add(0, 1, scaleDownAnimation);
            animation.Commit((item as Boarding).RotatorItem as ContentView, "animation", 16, 500);

            await Task.WhenAll(fadeAnimationTaskDescriptionTime, fadeAnimationtaskTitleTime, translateAnimation, scaleAnimationTitle);
        }
Esempio n. 5
0
 public bool DeleteBoarding(BoardingDeleteRequest request)
 {
     using (ISession session = NHibernateSession.OpenSession())
     {
         Boarding foundBoarding = session.Query <Boarding>().FirstOrDefault(c => c.BoardingId == request.BoardingId.Value);
         if (foundBoarding == null)
         {
             return(false);
         }
         foundBoarding.Deleted = DateTime.UtcNow;
         using (ITransaction transaction = session.BeginTransaction()) //  Begin a transaction
         {
             session.Update(foundBoarding);                            //  Save the user in session
             transaction.Commit();                                     //  Commit the changes to the database
         }
     }
     return(true);
 }
Esempio n. 6
0
 public static BoardingModel ToBoardingModel(this Boarding dbBoarding)
 {
     return(new BoardingModel()
     {
         BoardingId = new BoardingId()
         {
             Value = dbBoarding.BoardingId
         },
         Comments = dbBoarding.Comments,
         Company = dbBoarding.Company,
         Address = dbBoarding.Address,
         Reason = dbBoarding.Reason,
         PaymentAmount = dbBoarding.PaymentAmount,
         Dog = dbBoarding.Dog.ToDogModel(),
         Website = dbBoarding.Website,
         StartDateTime = dbBoarding.StartDateTime,
         EndDateTime = dbBoarding.EndDateTime,
         Created = dbBoarding.Created,
         Modified = dbBoarding.Modified,
         Deleted = dbBoarding.Deleted
     });
 }
Esempio n. 7
0
        public void PartTwoTest()
        {
            var subject = new Boarding(File.ReadAllLines("input.txt").Select(_ => new BoardingPass(_)));

            Assert.Equal(515, subject.GetMissingSeat());
        }
Esempio n. 8
0
        public void PartOneTest()
        {
            var subject = new Boarding(GetExampleInput().Select(_ => new BoardingPass(_)));

            Assert.Equal(820, subject.GetHighestSeatId());
        }
Esempio n. 9
0
 public Startup()
 {
     boarding = new Boarding();
 }
Esempio n. 10
0
 // Метод, запускающий событие  ПОСАДКА
 public void OnBoarding(BoardingEventArgs arg)
 {
     Console.WriteLine($"\n*********************Самолет\0{this.ModelAir}\0идет на посадку!!");
     Boarding?.Invoke(this, arg);
 }