コード例 #1
0
        public override CategorySale[] GetSalesByFilmCategory(string category)
        {
            List <CategorySale> itemlist = new List <CategorySale>();

            using (SakilaEntities dc = new SakilaEntities())
            {
                var model = from c in dc.sales_by_film_category
                            where c.category.Contains(category)
                            orderby c.category
                            select c;

                List <sales_by_film_category> sales = model.ToList();
                for (int i = 0; i < sales.Count; i++)
                {
                    CategorySale cs = new CategorySale();
                    if (sales[i].total_sales.HasValue)
                    {
                        cs = cs.Create(sales[i].category, sales[i].total_sales.Value);
                    }
                    else
                    {
                        cs = cs.Create(sales[i].category);
                    }
                    itemlist.Add(cs);
                }
            }
            return(itemlist.ToArray <CategorySale>());
        }
コード例 #2
0
        public CategorySale Create(string category)
        {
            CategorySale cs = new CategorySale();

            cs.category = category;
            return(cs);
        }
コード例 #3
0
        /// <summary>
        /// Create a new sales_by_film_category object.
        /// </summary>
        /// <param name="category">Initial value of the category property.</param>
        public CategorySale Create(string category, Decimal total_sales)
        {
            CategorySale cs = new  CategorySale();

            cs.category    = category;
            cs.total_sales = total_sales;
            return(cs);
        }
コード例 #4
0
        public override CategorySale[] GetSalesByFilmCategory(string category)
        {
            List<CategorySale> itemlist = new List<CategorySale>();
            using (SakilaEntities dc = new SakilaEntities())
            {
                var model = from c in dc.sales_by_film_category
                            where c.category.Contains(category)
                            orderby c.category
                            select c;

                List<sales_by_film_category> sales = model.ToList();
                for (int i = 0; i < sales.Count; i++)
                {
                    CategorySale cs = new CategorySale();
                    if (sales[i].total_sales.HasValue)
                    {
                        cs = cs.Create(sales[i].category, sales[i].total_sales.Value);
                    }
                    else
                    {
                        cs = cs.Create(sales[i].category);
                    }
                    itemlist.Add(cs);
                }
            }
            return itemlist.ToArray<CategorySale>();
        }
コード例 #5
0
 public CategorySale Create(string category)
 {
     CategorySale cs = new CategorySale();
     cs.category = category;
     return cs;
 }
コード例 #6
0
 /// <summary>
 /// Create a new sales_by_film_category object.
 /// </summary>
 /// <param name="category">Initial value of the category property.</param>
 public CategorySale Create(string category, Decimal total_sales)
 {
     CategorySale cs= new  CategorySale();
     cs.category = category;
     cs.total_sales = total_sales;
     return cs;
 }