Exemplo n.º 1
0
 protected void DayPilotCalendar1_BeforeEventRecurrence(DayPilot.Web.Ui.Events.Calendar.BeforeEventRecurrenceEventArgs ea)
 {
     if (ea.Value == "5")
     {
         ea.Rule = RecurrenceRule.FromDateTime(ea.Value, ea.Start).Weekly(new DayOfWeek[] { DayOfWeek.Monday, DayOfWeek.Tuesday }).Times(5);
     }
 }
Exemplo n.º 2
0
    private DataTable GetData()
    {
        DataTable dt;

        dt = new DataTable();
        dt.Columns.Add("start", typeof(DateTime));
        dt.Columns.Add("end", typeof(DateTime));
        dt.Columns.Add("name", typeof(string));
        dt.Columns.Add("id", typeof(string));
        dt.Columns.Add("recurrence", typeof(string));

        DataRow dr;

        DateTime start = Week.FirstDayOfWeek().AddHours(15);
        // starting on the first day of this week today at 15:00, repeated every week, five times
        RecurrenceRule rule = RecurrenceRule.FromDateTime("1", start).Weekly().Times(5);

        dr               = dt.NewRow();
        dr["id"]         = 1;
        dr["start"]      = start;
        dr["end"]        = start.AddHours(1);
        dr["name"]       = "Every week";
        dr["recurrence"] = rule.Encode();
        dt.Rows.Add(dr);

        DateTime start2 = Week.FirstDayOfWeek().AddHours(10);
        // starting on the first day of this week at 10:00, repeated every day for one month
        //RecurrenceRule rule2 = RecurrenceRule.FromDateTime("2", start2).Daily().Until(start2.AddDays(31));
        RecurrenceRule rule2 = RecurrenceRule.FromDateTime("2", start2).Daily(2).Times(2);

        dr               = dt.NewRow();
        dr["id"]         = 2;
        dr["start"]      = start2;
        dr["end"]        = start2.AddHours(1);
        dr["name"]       = "Every day";
        dr["recurrence"] = rule2.Encode();
        dt.Rows.Add(dr);

        DateTime start3 = Week.FirstDayOfWeek().AddDays(1).AddHours(13);

        dr          = dt.NewRow();
        dr["id"]    = 3;
        dr["start"] = start3;
        dr["end"]   = start3.AddHours(1);
        dr["name"]  = "By hour (custom)";
        dt.Rows.Add(dr);

        dt.PrimaryKey = new DataColumn[] { dt.Columns["id"] };

        return(dt);
    }