Exemplo n.º 1
0
        public void InsertDirectorTest()
        {
            using (var db = new CSBCDbContext())
            {
                var repHouse = new HouseholdRepository(db);
                var house = repHouse.Insert(new Household {CompanyID=2, Name="Frost"});
                var repPeople = new PersonRepository(db);
                var person = repPeople.Insert(new Person { FirstName = "Jack", LastName = "Frost", HouseID = house.HouseID });
                var rep = new DirectorRepository(db);
                var director = new Director{ PeopleID = person.PeopleID, CompanyID = 2, Title = "President" };
                var records = rep.Insert(director);

                    Assert.IsTrue(records.PeopleID != 0);
                    Assert.IsTrue(records.Title != String.Empty);
                //rep.Delete
            }
        }
Exemplo n.º 2
0
        public void DeleteHouseholdRecord()
        {
            var house = new Household { Name = HouseholdName1, CompanyID = 1, Address1 = "10 Minute Lane",
                City = "Plainview",
                State = "NY",
                Email = "*****@*****.**",
                Phone = "516-222-2222" };
            using (var db = new CSBCDbContext())
            {
                var rep = new HouseholdRepository(db);

                var no = rep.Insert(house);
                Assert.IsTrue(no != null);
                var household = rep.GetById(no.HouseID);
                Assert.IsTrue(household != null );
                rep.Delete(household);
                household = rep.GetById(no.HouseID);
                Assert.IsTrue(household == null);
            }
        }
Exemplo n.º 3
0
 public void InsertHouseholdRecord()
 {
     var house = new Household { Name = HouseholdName1, Address1 = "10 Minute Lane", City = "Plainview", State = "NY", Email = "*****@*****.**", Phone = "516-222-2222" };
     var rep = new HouseholdRepository(new CSBCDbContext());
     int no = 0;
     no = rep.Insert(house).HouseID;
     Assert.IsTrue(no > 0);
 }
Exemplo n.º 4
0
        private void ADDRow()
        {
            using (var db = new CSBCDbContext())
            {
                try
                {
                    var rep = new HouseholdRepository(db);
                    var household = new Household();

                    household.Name = txtName.Text;
                    household.Address1 = txtAddress.Text;
                    household.Address2 = txtAddress2.Text;
                    household.City = txtCity.Text;
                    household.Email = txtEmail.Text;
                    household.EmailList = chkEmail.Checked;
                    household.SportsCard = txtCityCard.Text;
                    household.State = txtState.Text;
                    household.Zip = txtZip.Text;
                    household.Phone = txtPhone.Text;
                    household.CreatedUser = Master.UserName;
                    household.CompanyID = Master.CompanyId;
                    Master.HouseId = rep.Insert(household).HouseID;
                }
                catch (Exception ex)
                {
                    Session["ErrorMSG"] = ex.Message;
                }
            }
        }