protected void Page_Load(object sender, EventArgs e) { if (Request.QueryString["JobID"] != null) { JobID = new Guid(Request.QueryString["JobID"]); var job = SiteUtilities.GetJobsByJobId(JobID); if (job.Count > 0) { sessionweekObject = SiteUtilities.GetWeekNumber(job[0].JobStartDate, 0); displayweek = Convert.ToInt16(sessionweekObject); if (Session["Week"] == null) { Session.Add("Week", week); } CurrentYear = job[0].JobStartDate.Year; CurrentWeek = Convert.ToInt16(sessionweekObject); now = job[0].JobStartDate; Session["Week"] = sessionweekObject; if (job[0].JobStartDate.ToString() == "9999-12-31 00:00:00") { FirstDayofWeek = SiteUtilities.GetFirstDayOfWeek(DateTime.Now.Year, SiteUtilities.GetWeekNumber(DateTime.Now, 0)); } else { FirstDayofWeek = SiteUtilities.GetFirstDayOfWeek(CurrentYear, CurrentWeek); } } } else { if (Session["CurrentWeekFirstDay"] != null) { FirstDayofWeek = Convert.ToDateTime(Session["CurrentWeekFirstDay"]); } else { FirstDayofWeek = SiteUtilities.GetFirstDayOfWeek(DateTime.Now.Year, SiteUtilities.GetWeekNumber(DateTime.Now, 0)); } } displayweek = SiteUtilities.GetWeekNumber(FirstDayofWeek, 0); weeknumber.Text = "Vecka " + displayweek.ToString() + " År: " + FirstDayofWeek.Year; Job(sender, e); }
protected void GetDate(DateTime now, List <JobList> jobLists) { DateTime firstdayofweek = new DateTime(); DateTime date = new DateTime(); firstdayofweek = SiteUtilities.GetFirstDayOfWeek(now.Year, displayweek); List <Job> jobs = new List <Job>(); for (int i = 0; i < 5; i++) { JobList jobList = new JobList(firstdayofweek.AddDays(i), jobs); jobLists.Add(jobList); } return; }