Пример #1
0
    protected void Calendar1_DayRender(object sender, DayRenderEventArgs e)
    {
        if (e.Day.IsWeekend)
        {
            //IsSelectable布尔属性控制日期是否可被选择
            e.Day.IsSelectable = false;
        }
        if (e.Day.IsOtherMonth)
        {
            //e.Cell属性代表一个日期框
            e.Cell.Text = "-";
        }

        //检查日期是否为3月5号。
        if (e.Day.Date.Day == 5 && e.Day.Date.Month == 3)
        {
            e.Cell.BackColor = System.Drawing.Color.Yellow;
            //向该列添加静态文本
            Label lbl = new Label();
            lbl.Text = "<br />学习雷锋好榜样!";
            e.Cell.Controls.Add(lbl);
        }
        Calendar1.SelectedDate = DateTime.Now.AddDays(2).Date;
        //下面的代码将使用SelectedDates选中2008年3月的每个星期天
        SelectedDatesCollection theDates = Calendar1.SelectedDates;

        theDates.Clear();
        theDates.Add(new DateTime(2008, 3, 2));
        theDates.Add(new DateTime(2008, 3, 9));
        theDates.Add(new DateTime(2008, 3, 16));
        theDates.Add(new DateTime(2008, 3, 23));
    }
Пример #2
0
        public void AddTask(DateTime dt)
        {
            List <ListOfTasks>      ls       = new List <ListOfTasks>();
            SelectedDatesCollection theDates = calander1.SelectedDates;

            theDates.Clear();
            theDates.Add(dt);
            ViewModel vm = new ViewModel(popAlert);

            vm.getAll(ls);
            foreach (Task t in ls[0].Tasks.ToList())
            {
                DateTime d = t.DateTask;
                theDates.Add(d);
            }
            foreach (Task t in ls[1].Tasks.ToList())
            {
                theDates.Add(t.DateTask);
            }
            foreach (Task t in ls[2].Tasks.ToList())
            {
                theDates.Add(t.DateTask);
            }
            //theDates.Add(new DateTime(2000, 2, 9));
            //theDates.Add(new DateTime(2000, 2, 16));
            //theDates.Add(new DateTime(2000, 2, 23));
        }
Пример #3
0
        public void SelectRangeMethod()
        {
            ArrayList list            = new ArrayList();
            SelectedDatesCollection s = new SelectedDatesCollection(list);

            s.Add(DateTime.Today);
            s.Add(DateTime.Today);
            // Internally clears the list
            s.SelectRange(new DateTime(2000, 1, 1), new DateTime(2001, 1, 1));

            Assert.AreEqual(367, s.Count, "A1");
        }
Пример #4
0
        public void AddMethod()
        {
            ArrayList list            = new ArrayList();
            SelectedDatesCollection s = new SelectedDatesCollection(list);

            s.Add(DateTime.Today);
            Assert.AreEqual(true, s.Contains(DateTime.Today), "A1");
            Assert.AreEqual(1, s.Count, "A2");

            s.Add(DateTime.Today);              // Duplicates are not inserted
            Assert.AreEqual(1, s.Count, "A2");
        }
Пример #5
0
    protected void Calendar1_DayRender(object sender, DayRenderEventArgs e)
    {
        SelectedDatesCollection dates = Calendar1.SelectedDates;

        if (DropDownList1.SelectedIndex == 0)
        {
            dates.Add(new DateTime(2016, 5, 26));
            dates.Add(new DateTime(2016, 4, 26));
        }
        if (DropDownList1.SelectedIndex == 1)
        {
            dates.Add(new DateTime(2016, 6, 6));
            dates.Add(new DateTime(2016, 5, 7));
        }
        if (DropDownList1.SelectedIndex == 2)
        {
            dates.Add(new DateTime(2016, 6, 15));
            dates.Add(new DateTime(2016, 6, 29));
        }
        if (DropDownList1.SelectedIndex == 3)
        {
            dates.Add(new DateTime(2016, 5, 3));
            dates.Add(new DateTime(2016, 5, 28));
        }
    }
Пример #6
0
 public EditDayViewModel(DocNames Doc)
 {
     WorkDays     = con.GetListOfWorkingDays(Convert.ToInt32(Doc.docID));
     docSelected  = Doc;
     selectedDays = DateTime.Now;
     tempSelected.Add(DateTime.Now);
 }
Пример #7
0
        public void ClearMethod()
        {
            ArrayList list            = new ArrayList();
            SelectedDatesCollection s = new SelectedDatesCollection(list);

            s.Add(DateTime.Today);
            s.Clear();
            Assert.AreEqual(0, s.Count, "A1");
        }
Пример #8
0
        //Highlight dates on calendar
        private void HighliteDatesOnCalendar()
        {
            try
            {
                SelectedDatesCollection dates = ClndOfStuff.SelectedDates;
                dates.Clear();
                DateTime today = DateTime.Today;

                dates.Add(today);

                foreach (ToDoRecord date in thingsToDos)
                {
                    dates.Add(Convert.ToDateTime(date.Date));
                }
            }
            catch
            {
            }
        }