CourseCategoryVector.cs :  » Network-Clients » iReaper » IReaper » CourseData » C# / CSharp Open Source

Home
C# / CSharp Open Source
1.2.6.4 mono .net core
2.2.6.4 mono core
3.Aspect Oriented Frameworks
4.Bloggers
5.Build Systems
6.Business Application
7.Charting Reporting Tools
8.Chat Servers
9.Code Coverage Tools
10.Content Management Systems CMS
11.CRM ERP
12.Database
13.Development
14.Email
15.Forum
16.Game
17.GIS
18.GUI
19.IDEs
20.Installers Generators
21.Inversion of Control Dependency Injection
22.Issue Tracking
23.Logging Tools
24.Message
25.Mobile
26.Network Clients
27.Network Servers
28.Office
29.PDF
30.Persistence Frameworks
31.Portals
32.Profilers
33.Project Management
34.RSS RDF
35.Rule Engines
36.Script
37.Search Engines
38.Sound Audio
39.Source Control
40.SQL Clients
41.Template Engines
42.Testing
43.UML
44.Web Frameworks
45.Web Service
46.Web Testing
47.Wiki Engines
48.Windows Presentation Foundation
49.Workflows
50.XML Parsers
C# / C Sharp
C# / C Sharp by API
C# / CSharp Tutorial
C# / CSharp Open Source » Network Clients » iReaper 
iReaper » IReaper » CourseData » CourseCategoryVector.cs
using System;
using System.Collections.Generic;
using System.Collections.Specialized;
using System.Text;
using IReaper.Category;

namespace IReaper.CourseData{
    public class CourseCategoryVector:CourseVectorBase
    {
        private Dictionary<string, CourseCollection> technology;
        private Dictionary<string, CourseCollection> series;
        private Dictionary<string, CourseCollection> product;
        private Dictionary<float, CourseCollection> rate;
        private Dictionary<string, CourseCollection> teacher;
        private Dictionary<System.DateTime, CourseCollection> time;
        private Dictionary<string, CourseCollection> level;
        StringCollection collevel, coltechnology, colseries, colspekaer, colproduct;
        List<float> colrate;
        List<DateTime> listdate;

        public CourseCategoryVector(CourseCollection courses):base(courses)
        {
            //Level
            collevel = new StringCollection();
            this.level = new Dictionary<string, CourseCollection>();
            //Technology
            coltechnology = new StringCollection();
            this.technology = new Dictionary<string, CourseCollection>();
            //Series
            colseries = new StringCollection();
            this.series = new Dictionary<string, CourseCollection>();
            //Speaker
            colspekaer = new StringCollection();
            this.teacher = new Dictionary<string, CourseCollection>();
            //Product
            colproduct = new StringCollection();
            this.product = new Dictionary<string, CourseCollection>();
            //Rate
            colrate = new List<float>();
            this.rate = new Dictionary<float, CourseCollection>();
            //Date
            listdate = new List<DateTime>();
            this.time = new Dictionary<DateTime, CourseCollection>();
            //
        }
        /// <summary>
        /// 
        /// </summary>
        internal Dictionary<string, CourseCollection> Technology
        {
            get
            {
                return technology;
            }
        }

        /// <summary>
        /// 
        /// </summary>
        internal Dictionary<string, CourseCollection> Series
        {
            get
            {
                return series;
            }
        }

        /// <summary>
        /// 
        /// </summary>
        internal Dictionary<string, CourseCollection> Product
        {
            get
            {
                return product;
            }
        }

        /// <summary>
        /// 
        /// </summary>
        internal Dictionary<float, CourseCollection> Rate
        {
            get
            {
                return rate;
            }
        }

        /// <summary>
        /// 
        /// </summary>
        internal Dictionary<string, CourseCollection> Speaker
        {
            get
            {
                return teacher;
            }
        }

        /// <summary>
        /// 
        /// </summary>
        internal Dictionary<string, CourseCollection> Level
        {
            get
            {
                return level;
            }
        }

        /// <summary>
        /// 
        /// </summary>
        internal Dictionary<DateTime, CourseCollection> Time
        {
            get
            {
                return time;
            }
        }

        /// <summary>
        /// 
        /// </summary>
        internal CourseCollection All
        {
            get
            {
                return all;
            }
        }

        //
        protected override void AddCourse(Course course)
        {
            //Level
            if (!collevel.Contains(course.Level) && course.Level != null)
            {
                collevel.Add(course.Level);
                this.level.Add(course.Level, this.all.GetTypedCoursesCollection());
                if(node != null)
                    node.AddData(CourseAttributeTypeEnum.Level, course.Level, this.level[course.Level]);
                
            }
            //Technology
            if (!coltechnology.Contains(course.Technology) && course.Technology != null)
            {
                coltechnology.Add(course.Technology);
                this.technology.Add(course.Technology, this.all.GetTypedCoursesCollection());
                if (node != null)
                    node.AddData(CourseAttributeTypeEnum.Technology, course.Technology, this.technology[course.Technology]);
            }
            //Series
            if (!colseries.Contains(course.Series) && course.Series != null)
            {
                colseries.Add(course.Series);
                this.series.Add(course.Series, this.all.GetTypedCoursesCollection());
                if (node != null)
                    node.AddData(CourseAttributeTypeEnum.Series, course.Series, this.series[course.Series]);
            }
            //Speaker
            if (!colspekaer.Contains(course.Speaker) && course.Speaker != null)
            {
                colspekaer.Add(course.Speaker);
                this.teacher.Add(course.Speaker, this.all.GetTypedCoursesCollection());
                if (node != null)
                    node.AddData(CourseAttributeTypeEnum.Speaker, course.Speaker, this.teacher[course.Speaker]);
            }
            //Product
            if (!colproduct.Contains(course.Products) && course.Products != null)
            {
                colproduct.Add(course.Products);
                this.product.Add(course.Products, this.all.GetTypedCoursesCollection());
                if (node != null)
                    node.AddData(CourseAttributeTypeEnum.Product, course.Products, this.product[course.Products]);
            }
            //Rate
            if (!colrate.Contains(course.Rate))
            {
                colrate.Add(course.Rate);
                this.rate.Add(course.Rate, this.all.GetTypedCoursesCollection());
                if (node != null)
                    node.AddData(CourseAttributeTypeEnum.Rating, course.Rate, this.rate[course.Rate]);
            }
            //Date
            DateTime month = new DateTime(course.Time.Year, course.Time.Month, 1);
            if (!listdate.Contains(month))
            {
                listdate.Add(month);
                this.time.Add(month, this.all.GetTypedCoursesCollection());
                if (node != null)
                    node.AddData(CourseAttributeTypeEnum.Time, month, this.time[month]);
            }
            //add data
            this.product[course.Products].Add(course);
            this.technology[course.Technology].Add(course);
            this.series[course.Series].Add(course);
            this.rate[course.Rate].Add(course);
            this.level[course.Level].Add(course);
            this.time[month].Add(course);
            this.teacher[course.Speaker].Add(course);
        }

        /// <summary>
        /// 
        /// </summary>
        /// <param name="course"></param>
        protected override void RemoveCourse(Course course)
        {
            this.product[course.Products].Remove(course);
            this.technology[course.Technology].Remove(course);
            this.series[course.Series].Remove(course);
            this.rate[course.Rate].Remove(course);
            this.level[course.Level].Remove(course);
            DateTime month = new DateTime(course.Time.Year, course.Time.Month, 1);
            this.time[month].Remove(course);
            this.teacher[course.Speaker].Remove(course);
            if (this.product[course.Products].Count == 0)
            {
                this.product.Remove(course.Products);
                this.colproduct.Remove(course.Products);
                node.RemoveData(CourseAttributeTypeEnum.Product, course.Products);
            }
            if (this.series[course.Series].Count == 0)
            {
                this.series.Remove(course.Series);
                this.colseries.Remove(course.Series);
                node.RemoveData(CourseAttributeTypeEnum.Series, course.Series);
            }
            if (this.technology[course.Technology].Count == 0)
            {
                this.technology.Remove(course.Technology);
                this.coltechnology.Remove(course.Technology);
                node.RemoveData(CourseAttributeTypeEnum.Technology, course.Technology);
            }
            if (this.rate[course.Rate].Count == 0)
            {
                this.rate.Remove(course.Rate);
                this.colrate.Remove(course.Rate);
                node.RemoveData(CourseAttributeTypeEnum.Rating, course.Rate);
            }
            if (this.level[course.Level].Count == 0)
            {
                this.level.Remove(course.Level);
                this.collevel.Remove(course.Level);
                node.RemoveData(CourseAttributeTypeEnum.Level, course.Level);
            }
            if (this.time[month].Count == 0)
            {
                this.time.Remove(month);
                this.listdate.Remove(month);
                node.RemoveData(CourseAttributeTypeEnum.Time, month);
            }
            if (this.teacher[course.Speaker].Count == 0)
            {
                this.teacher.Remove(course.Speaker);
                this.colspekaer.Remove(course.Speaker);
                node.RemoveData(CourseAttributeTypeEnum.Speaker, course.Speaker);
            }
        }
    }
}
www.java2v.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.