コード例 #1
0
        protected void Button1_Click(object sender, EventArgs e)
        {
            // going to delete option/component values

            ExamOption_List eol1 = new ExamOption_List();

            eol1.Load(YearCode.ToString(), SeasonCode.ToString());
            ExamCompononent_List ecl1 = new ExamCompononent_List();

            ecl1.LoadAllComponentsSeason(YearCode.ToString(), SeasonCode.ToString());

            foreach (ExamOption eo in eol1.m_list)
            {
                eo.Delete();
            }
            foreach (ExamComponent ec in ecl1.m_list)
            {
                ec.Delete();
            }
        }
コード例 #2
0
        protected void SetupSummaryTable()
        {
            DateTime t1 = new DateTime(Year, SeasonCode - 2, 1);//so summer season might start in april???
            DateTime t0 = new DateTime(); t0 = t1;

            //advance to Monday
            while (t0.DayOfWeek != DayOfWeek.Monday)
            {
                t0 = t0.AddDays(1);
            }
            //this is our start date...
            string[] data = new string[300];//should be enough!
            for (int i = 0; i < 120; i++)
            {
                data[i] = "";
            }

            int n = 0; int nmin = 200; int nmax = -1;
            // list for the contents of this row...
            DateTime             t2        = new DateTime();
            TimeSpan             tspan1    = new TimeSpan();
            TimeSpan             tspanWeek = new TimeSpan(0, 1, 0, 0);
            ExamCompononent_List ecl1      = new ExamCompononent_List();

            ecl1.LoadAllComponentsSeason(YearCode.ToString(), SeasonCode.ToString());
            ExamsUtility u                 = new ExamsUtility();

            //ecl1.LoadAllComponents_NotScheduled(Year.ToString(), SeasonCode.ToString());
            foreach (ExamComponent ec in ecl1.m_list)
            {
                t2       = ec.m_TimetableDate; tspan1 = t2 - t0; n = tspan1.Days;
                data[n] += ec.m_ComponentTitle + ":" + ec.m_ComponentCode + ":" + ec.m_ComponentID.ToString() + (char)0x09;
                //component title:option code
                if (n > nmax)
                {
                    nmax = n;
                }
                if (n < nmin)
                {
                    nmin = n;
                }
            }
            List <ComponentNotScheduled> list1 = new List <ComponentNotScheduled>();

            //so want to do whole weeks from t0;
            n = 0; while ((nmin - n) > 7)
            {
                n += 7;
            }
            //so we start the table at n...
            t2 = t0.AddDays(n);
            while (n < nmax)
            {
                TableRow  r1 = new TableRow(); Table_Summary.Rows.Add(r1);
                TableCell c0 = new TableCell(); c0.Text = t2.ToShortDateString(); r1.Cells.Add(c0);
                for (int i = 0; i < 5; i++)
                {
                    //so date is t2
                    list1 = u.LoadComponentsNotSchedlued(Year.ToString(), SeasonCode.ToString(), t2.AddHours(-1), t2.AddHours(22));
                    TableCell c1 = new TableCell();
                    if (list1.Count > 0)
                    {
                        Button b1 = new Button();
                        b1.Text = t2.ToString("M");

                        c1.Controls.Add(b1);
                        b1.Click    += B1_Click;
                        b1.ID        = "Button" + (n + i).ToString();
                        b1.BackColor = System.Drawing.Color.AntiqueWhite;
                    }
                    r1.Cells.Add(c1); t2 = t2.AddDays(1);
                }
                n += 7; t2 = t2.AddDays(2);
            }
        }