Ejemplo n.º 1
0
 public void GetHouseholdSearchRecordsTest()
 {
     var house = new Household();
     using (var db = new CSBCDbContext())
     {
         var rep = new HouseholdRepository(db);
         var homes = rep.GetRecords(1, name: "Fa").ToList();
         Assert.IsTrue(homes.Any());
         homes = rep.GetRecords(1, address: "Main").ToList();
         Assert.IsTrue(homes.Any());
         homes = rep.GetRecords(1, name: "Fa", phone: "954").ToList();
         Assert.IsTrue(homes.Any());
         homes = rep.GetRecords(1, name: "Fa", address: "123", email: "yahoo.com").ToList();
         Assert.IsTrue(homes.Any());
     }
 }
Ejemplo n.º 2
0
        private void GetData()
        {
            var rep = new HouseholdRepository(new CSBCDbContext());

            try
            {
                var rsData = rep.GetRecords( Master.CompanyId, Session["Name"].ToString(),
                    Session["Address"].ToString(), Session["Phone"].ToString(), Session["Email"].ToString()).ToList();
                //grdHouseholds.Clear()
                if (rsData.Any())
                {
                    var _with1 = grdHouseholds;
                    _with1.DataSource = rsData;
                    _with1.DataBind();
                }
            }
            catch (Exception ex)
            {
                lblError.Text = ex.Message;
            }
            finally
            {
                rep = null;
            }
        }