Ejemplo n.º 1
0
 public void FindHouseholdById()
 {
     var house = new Household();
     var rep = new HouseholdRepository(new CSBCDbContext());
     var houses = rep.GetByName(HouseholdName1);
     Assert.IsTrue(houses.Count<Household>() > 0);
     house = rep.GetById(houses.FirstOrDefault().HouseID);
     Assert.IsTrue(house != null);
     Assert.IsTrue(house.Name == HouseholdName1);
 }
Ejemplo 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);
            }
        }
Ejemplo n.º 3
0
 //private List<>
 private void LoadRow(int id)
 {
     using (var db = new CSBCDbContext())
     {
         var rep = new UserRepository(db);
         try
         {
             var user = rep.GetById(id);
             if ((user != null))
             {
                 lblId.Value = user.UserID.ToString();
                 txtName.Text = user.Name;
                 txtUserName.Text = user.UserName;
                 Master.HouseId = (int)user.HouseID;
                 txtPWord.Text = user.PWord.ToString();
                 radioUserType.SelectedValue = user.UserType.ToString(); //change this to radio
                 if (user.HouseID != 0)
                 {
                     var repHouse = new HouseholdRepository(db);
                     var house = repHouse.GetById(user.HouseID);
                     lblHouseHold.Text = house.Name;
                     lblEmail.Text = house.Email;
                     lblHouseID.Text = user.HouseID.ToString();
                 }
             }
         }
         catch (Exception ex)
         {
             lblError.Text = "LoadRow::" + ex.Message;
         }
     }
 }
Ejemplo n.º 4
0
        private void ReadHouse()
        {
            var rep = new HouseholdRepository(new CSBCDbContext());

            try
            {
                var house = rep.GetById(Master.HouseId);
                if ((house != null))
                {

                    lnkHouseName.Text = house.Name;
                    lblAddress.Text = " " + house.Address1;
                    lblCSZ.Text = house.City + " " + house.State + " " + house.Zip;
                    lblPhone.Text = house.Phone;
                    lblEmail.Text = house.Email;
                    var repPeople = new PersonRepository(new CSBCDbContext());
                    var people = repPeople.GetByHousehold(Master.HouseId);
                    if (people.Any<Person>())
                        LoadMembers(people.ToList<Person>());

                }
                Session.Add("LinkName", txtFirstName.Text + ", " + txtLastName.Text);
            }
            catch (Exception ex)
            {
                lblError.Text = "ReadHouse::" + ex.Message;
            }
            finally
            {
                Session.Add("LinkName", txtLastName.Text);
            }

            //LoadMembers(Master.HouseId);
        }
Ejemplo n.º 5
0
        private void UpdRow(int rowId)
        {
            var householdRepository = new HouseholdRepository(new CSBCDbContext());
            var household = householdRepository.GetById(rowId);
            try
            {
                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;
                householdRepository.Update(household);
            }
            catch (Exception ex)
            {
                Session["ErrorMSG"] = "UpdRow::" + ex.Message;
            }
        }
Ejemplo n.º 6
0
 private static Household GetHouseHoldObject(int rowId)
 {
     var rep = new HouseholdRepository(new CSBCDbContext());
     var household = rep.GetById(rowId);
     return household;
 }