appointment.RecurrenceRule = new RecurrenceRule(Pattern); ERROR

1 posts, 0 answers
  1. ITA
    ITA avatar
    383 posts
    Member since:
    Aug 2009

    Posted 20 Apr 2012 Link to this post

    Hi,

    i'm frustrated :-(
    For me it's unpossible to add Patterns to an Appointment. The code above shows how i create my Pattern Objekt and how
    i add this to my Appointment!

    var Pattern = new RecurrencePattern();
     
    Pattern.Frequency = Frequency_v;
    Pattern.DayOrdinal = DayOrdinal_i;
    Pattern.DaysOfWeekMask = DaysofWeekMask_v;
    Pattern.FirstDayOfWeek = FirstDayofWeek_d;
    Pattern.Frequency = Frequency_v;
    Pattern.Interval = Convert.ToInt32(tasks_dr.Field<Int64>("Interval"));
    Pattern.MaxOccurrences = Convert.ToInt32(tasks_dr.Field<Int64>("MaxOccurrences"));
    Pattern.MonthOfYear = Convert.ToInt32(tasks_dr.Field<Int64>("MonthofYear"));
    Pattern.DayOfMonth = Convert.ToInt32(tasks_dr.Field<Int64>("DayofMonth"));
     
    System.DateTime? RecursUntil_d;
    if (tasks_dr.Field<String>("RecursUntil") != "")
        {
              RecursUntil_d = Convert.ToDateTime(tasks_dr.Field<String>("RecursUntil")); 
        }
         else
         {
              RecursUntil_d = DateTime.Now;
         }
         Pattern.RecursUntil = RecursUntil_d;
      
     appointment.RecurrenceRule = new RecurrenceRule(Pattern);

    The Datasourc is an DB which is filled by Datas from an new created Appointment with all values.

    Table:

    cid      name               type        Value
    ------- ----------------- ---------- ---
    0        id                 INTEGER     n
    4        Subject            TEXT       Test
    5        Body               TEXT        Test
    6        Betreuer           TEXT       69001
    7        Startdatum         TEXT      19.04.2012 08:00:00
    8        Enddatum           TEXT      19.04.2012 15:00:00
    9        Kategorie          TEXT        Fertig
    10       Importance         TEXT      Low
    11       Ganztag            INTEGER  0
    12       Frequency          TEXT      Weekly
    13       DayofMonth         INTEGER   0 
    14       DayOridnal         INTEGER     0
    15       MaxOccurrences     INTEGER  0
    16       DaysofWeekMask     TEXT Thursday
    17       RecursUntil        TEXT        28.04.2012 15:00:00
    18       MonthofYear        INTEGER 0
    19       TimeMarker         TEXT        Normal
    20       FirstDayOfWeek     INTEGER 1
    21       Interval           INTEGER  1

    But i get an Error in the Schedule.xaml on InitializeComponent - ArgumentOutOfRangeException
    The added or subtracted value results in an unrepresentable DateTime.
    Parameter name: value

     
    I can't find out wehre the problem is?! Please i need help. Or how to create a Appointment with duration bei Code????

    thanks
    regards
    rene
Back to Top