Пример #1
0
 //List of Policies in a certain Policy category
 public List<Policy> ReturnListOfPoliciesInCategory(PolicyCategory category)
 {
     return _repo.GetPoliciesListInCategory(category);
 }
Пример #2
0
 public Policy()
 {
     Category = new PolicyCategory();
 }
Пример #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();
        }
Пример #4
0
 public List<Policy> GetPoliciesListInCategory(PolicyCategory category)
 {
     return ListOfPolicies.Select(p => p).Where(p => p.Category.CategoryTitle == category.CategoryTitle).ToList();
 }
Пример #5
0
 public void AddNewPolicyInNewCategory(Policy newPolicy)
 {
     ListOfPolicies.Add(newPolicy);
     PolicyCategory newCategory = new PolicyCategory()
     {
         CategoryTitle = newPolicy.Category.CategoryTitle
     };
     ListOfPolicyCategories.Add(newCategory);
 }
Пример #6
0
 public List<Policy> GetPoliciesListInCategory(PolicyCategory category)
 {
     throw new NotImplementedException();
 }