Ejemplo n.º 1
0
        protected void ShowData(string strFindPolicy = "")
        {
            List <Policy> Policys = _db.Policies.Include(p => p.Client).Include(p => p.TypeOfInsurance).Where(s => s.Client.FullName.Contains(strFindPolicy)).ToList();

            GridViewPolicy.DataSource = Policys;
            GridViewPolicy.DataBind();
        }
Ejemplo n.º 2
0
    protected void JoinStatement()
    {
        sc.Open();
        SqlCommand sqlQuery = new SqlCommand()
        {
            Connection = sc
        };

        sqlQuery.CommandText = "SELECT i.FirstName, i.LastName, a.HouseNumber, a.Street, a.CityCounty, a.StateAbb, a.CountryAbb, a.Zip, h.ExteriorType, h.Alarm, " +
                               "h.DistanceToFireStation FROM Insured i, Address a, Policy p LEFT JOIN Home h ON p.PolicyID = h.PolicyID " +
                               "WHERE i.AddressID = a.AddressID AND i.InsuredID = p.InsuredID; ";

        SqlDataReader reader = sqlQuery.ExecuteReader();

        GridViewPolicy.DataSource = reader;
        GridViewPolicy.DataBind();

        reader.Close();
        sc.Close();
    }