Beispiel #1
0
    protected void GetFullOverViewList(List <JobOverviewList> jobOverviewLists, int year)
    {
        string month = "";


        for (int i = 1; i < 13; i++)
        {
            List <Job>      jobsthismonth = new List <Job>();
            DateTime        dateTime      = new DateTime(year, i, 01);
            JobOverviewList jobOverview   = new JobOverviewList(dateTime.ToString("MMMM"), jobsthismonth);
            jobOverviewLists.Add(jobOverview);
        }

        var list = CheckForJobsFromSession();

        if (list.Count > 0)
        {
            AddExtraJobs(list, jobOverviewLists);
        }

        for (int i = 1; i < jobOverviewLists.Count + 1; i++)
        {
            if (i < 10)
            {
                month = "0" + i;
            }
            else
            {
                month = i.ToString();
            }
            var jobs = SiteUtilities.GetJobsByMonth(year + "-" + month);
            for (int j = 0; j < jobs.Count; j++)
            {
                if (jobs[j].ParentJobID != Guid.Empty)
                {
                    return;
                }
                int startmonth = jobs[j].JobStartDate.Month - 1;
                switch (jobs[j].JobStartDate.Month - 1)
                {
                case 0:
                {
                    // Januari
                    jobOverviewLists[0].Jobs.Add(jobs[j]);
                    var months = CheckJobLenght(jobs[j]);
                    AddExtraMonths(jobOverviewLists, jobs[j], j, startmonth, months);
                }
                break;

                case 1:
                {
                    // Februari
                    jobOverviewLists[1].Jobs.Add(jobs[j]);
                    var months = CheckJobLenght(jobs[j]);
                    AddExtraMonths(jobOverviewLists, jobs[j], j, startmonth, months);
                }
                break;

                case 2:
                {
                    // Mars
                    jobOverviewLists[2].Jobs.Add(jobs[j]);
                    var months = CheckJobLenght(jobs[j]);
                    AddExtraMonths(jobOverviewLists, jobs[j], j, startmonth, months);
                }
                break;

                case 3:
                {
                    // April
                    jobOverviewLists[3].Jobs.Add(jobs[j]);
                    var months = CheckJobLenght(jobs[j]);
                    AddExtraMonths(jobOverviewLists, jobs[j], j, startmonth, months);
                }
                break;

                case 4:
                {
                    // Maj
                    jobOverviewLists[4].Jobs.Add(jobs[j]);
                    var months = CheckJobLenght(jobs[j]);
                    AddExtraMonths(jobOverviewLists, jobs[j], j, startmonth, months);
                }
                break;

                case 5:
                {
                    // Juni
                    jobOverviewLists[5].Jobs.Add(jobs[j]);
                    var months = CheckJobLenght(jobs[j]);
                    AddExtraMonths(jobOverviewLists, jobs[j], j, startmonth, months);
                }
                break;

                case 6:
                {
                    // Juli
                    jobOverviewLists[6].Jobs.Add(jobs[j]);
                    var months = CheckJobLenght(jobs[j]);
                    AddExtraMonths(jobOverviewLists, jobs[j], j, startmonth, months);
                }
                break;

                case 7:
                {
                    // Augusti
                    jobOverviewLists[7].Jobs.Add(jobs[j]);
                    var months = CheckJobLenght(jobs[j]);
                    AddExtraMonths(jobOverviewLists, jobs[j], j, startmonth, months);
                }
                break;

                case 8:
                {
                    // September
                    jobOverviewLists[8].Jobs.Add(jobs[j]);
                    var months = CheckJobLenght(jobs[j]);
                    AddExtraMonths(jobOverviewLists, jobs[j], j, startmonth, months);
                }
                break;

                case 9:
                {
                    // Oktober
                    jobOverviewLists[9].Jobs.Add(jobs[j]);
                    var months = CheckJobLenght(jobs[j]);
                    AddExtraMonths(jobOverviewLists, jobs[j], j, startmonth, months);
                }
                break;

                case 10:
                {
                    // November
                    jobOverviewLists[10].Jobs.Add(jobs[j]);
                    var months = CheckJobLenght(jobs[j]);
                    AddExtraMonths(jobOverviewLists, jobs[j], j, startmonth, months);
                }
                break;

                case 11:
                {
                    // December
                    jobOverviewLists[11].Jobs.Add(jobs[j]);
                    var months = CheckJobLenght(jobs[j]);
                    AddExtraMonths(jobOverviewLists, jobs[j], j, startmonth, months);
                }
                break;
                }
            }
        }
    }