コード例 #1
0
ファイル: Daycare.cs プロジェクト: amjadalion/PayrollTracker
 public Daycare(DateTime date, Dog dog, Cost daycareCost, User user)
 {
     this.Date = date;
     this.Dog = dog;
     this.DaycareCost = daycareCost;
     this.User = user;
 }
コード例 #2
0
ファイル: Boarding.cs プロジェクト: amjadalion/PayrollTracker
 public Boarding(DateTime date, bool isDaycare, Dog dog, Cost boardingCost, User user)
 {
     this.Date = date;
     this.IsDaycare = isDaycare;
     this.Dog = dog;
     this.BoardingCost = boardingCost;
     this.User = user;
 }
コード例 #3
0
ファイル: Grooming.cs プロジェクト: amjadalion/PayrollTracker
 public Grooming(GroomingType groomingType, Double cost, DateTime date, Dog dog, User user)
 {
     this.GroomingType = groomingType;
     this.Cost = cost;
     this.Date = date;
     this.Dog = dog;
     this.User = user;
 }
コード例 #4
0
ファイル: Training.cs プロジェクト: amjadalion/PayrollTracker
 public Training(DateTime date, CostType classType, Cost classCost, Dog dog, User user)
 {
     this.Date = date;
     this.ClassType = classType;
     this.ClassCost = classCost;
     this.Dog = dog;
     this.User = user;
 }
コード例 #5
0
 public void Update(Dog dog)
 {
     using (ISession session = NHibernateHelper.OpenSession())
     using (ITransaction transaction = session.BeginTransaction())
     {
         session.Update(dog);
         transaction.Commit();
     }
 }
コード例 #6
0
ファイル: DogTest.cs プロジェクト: amjadalion/PayrollTracker
        public void Can_add_new_dog()
        {
            var dog = new Dog { FirstName = "Adam", LastName = "Patel" };
            IDogRepository repository = new DogRepository();
            repository.Add(dog);

            // use session to try to load the dog
            using (ISession session = _sessionFactory.OpenSession())
            {
                var fromDb = session.Get<Dog>(dog.DogId);
                // Test that the dog was successfully inserted
                Assert.IsNotNull(fromDb);
                Assert.AreNotSame(dog, fromDb);
                Assert.AreEqual(dog.FirstName, fromDb.FirstName);
                Assert.AreEqual(dog.LastName, fromDb.LastName);
            }

            repository.Remove(dog);
        }
コード例 #7
0
ファイル: DogTest.cs プロジェクト: amjadalion/PayrollTracker
        public void Can_add_multiple_new_dogs()
        {
            ISession session = _sessionFactory.OpenSession();

            int countBefore = getDogTableSize(session);

            ITransaction tx = session.BeginTransaction();
            Dog dog1 = new Dog();
            dog1.FirstName = "Luis";
            dog1.LastName = "Patel";
            session.Save(dog1);

            Dog dog2 = new Dog();
            dog2.FirstName = "Clark";
            dog2.LastName = "Patel";
            session.Save(dog2);

            Dog dog3 = new Dog();
            dog3.FirstName = "Jason";
            dog3.LastName = "Patel";
            session.Save(dog3);

            tx.Commit();

            Assert.AreEqual(countBefore + 3, getDogTableSize(session));

            tx = session.BeginTransaction();

            session.Delete(dog1);
            session.Delete(dog2);
            session.Delete(dog3);

            tx.Commit();

            session.Close();
        }
コード例 #8
0
ファイル: DogTest.cs プロジェクト: amjadalion/PayrollTracker
        private bool IsInCollection(Dog dog, ICollection<Dog> fromDb)
        {
            bool result = false;

            foreach (var item in fromDb)
            {
                if (dog.DogId == item.DogId)
                {
                    result = true;
                    break;
                }
            }
            return result;
        }
コード例 #9
0
 public PickupDropoff(DateTime date, Dog dog, User user)
 {
     this.Date = date;
     this.Dog = dog;
     this.User = user;
 }
コード例 #10
0
        private bool dataGridView1_RowValidating(int index, Dog dog)
        {
            if (dog.FirstName == null)
            {
                dataGridView1.Rows[index].ErrorText = "Dog's First Name must not be empty.";
                return false;
            }
            else if (dog.LastName == null)
            {
                dataGridView1.Rows[index].ErrorText = "Dog's Last Name must not be empty.";
                return false;
            }

            return true;
        }
コード例 #11
0
        private void dataGridView1_CellValueChanged(object sender, DataGridViewCellEventArgs e)
        {
            if (dataGridView1.IsCurrentCellDirty)
            {
                if (dirtyDogsMap.Keys.Contains(e.RowIndex))
                {
                    dirtyDogsMap.Remove(e.RowIndex);
                }

                Dog dog = new Dog();

                string dogId = (string)dataGridView1.Rows[e.RowIndex].Cells["DogIdColumn"].Value;
                dog.DogId = dogId;

                string dogFirstName = (string)dataGridView1.Rows[e.RowIndex].Cells["DogFirstNameColumn"].Value;
                if (dogFirstName != null)
                {
                    dog.FirstName = dogFirstName;
                }

                string dogLastName = (string)dataGridView1.Rows[e.RowIndex].Cells["DogLastNameColumn"].Value;
                if (dogLastName != null)
                {
                    dog.LastName = dogLastName;
                }

                dirtyDogsMap.Add(e.RowIndex, dog);
            }
        }