Esempio n. 1
0
 //List of Policies in a certain Policy category
 public List<Policy> ReturnListOfPoliciesInCategory(PolicyCategory category)
 {
     return _repo.GetPoliciesListInCategory(category);
 }
Esempio n. 2
0
 public Policy()
 {
     Category = new PolicyCategory();
 }
Esempio n. 3
0
        public List<PolicyCategory> GetPolicyCategories()
        {
            using (SqlConnection cn = new SqlConnection(Settings.ConnectionString))
            {
                var cmd = new SqlCommand();
                cmd.CommandText = "select * from [Categories]";
                cmd.Connection = cn;
                cn.Open();

                using (SqlDataReader dr = cmd.ExecuteReader())
                {
                    while (dr.Read())
                    {
                        var newCategory = new PolicyCategory();
                        newCategory.CategoryId = int.Parse(dr["CategoryID"].ToString());
                        newCategory.CategoryTitle = dr["CategoryTitle"].ToString();

                        ListOfPolicyCategories.Add(newCategory);
                    }
                }
            }

            return ListOfPolicyCategories.OrderBy(c => c.CategoryTitle).ToList();
        }
Esempio n. 4
0
 public List<Policy> GetPoliciesListInCategory(PolicyCategory category)
 {
     return ListOfPolicies.Select(p => p).Where(p => p.Category.CategoryTitle == category.CategoryTitle).ToList();
 }
Esempio n. 5
0
 public void AddNewPolicyInNewCategory(Policy newPolicy)
 {
     ListOfPolicies.Add(newPolicy);
     PolicyCategory newCategory = new PolicyCategory()
     {
         CategoryTitle = newPolicy.Category.CategoryTitle
     };
     ListOfPolicyCategories.Add(newCategory);
 }
Esempio n. 6
0
 public List<Policy> GetPoliciesListInCategory(PolicyCategory category)
 {
     throw new NotImplementedException();
 }