예제 #1
0
 private static LayoutSchedule CreateLayoutSchedule(ScheduleLayout layout)
 {
     LayoutSchedule schedule = new LayoutSchedule {
         LayoutFile = layout.File
     };
     string s = schedule.LayoutFile.TrimEnd(".xml".ToCharArray());
     schedule.LayoutFile = Settings.Default.LibraryPath + @"\Layouts\" + s + ".mosaic";
     schedule.ID = int.Parse(s);
     if (schedule.NodeName != "default")
     {
         schedule.Priority = layout.Priority;
         schedule.FromDate = DateTime.Parse(layout.FromDate);
         schedule.ToDate = DateTime.Parse(layout.ToDate);
         int scheduleId = -1;
         if (layout.ScheduleId != -1)
         {
             scheduleId = layout.ScheduleId;
         }
         if (scheduleId != -1)
         {
             schedule.Scheduleid = scheduleId;
         }
     }
     return schedule;
 }
예제 #2
0
    private static LayoutSchedule CreateLayoutSchedule(ScheduleLayout layout)
    {
        LayoutSchedule temp = new LayoutSchedule();

        // All nodes have file properties
        temp.LayoutFile = layout.File;

        // Replace the .xml extension with nothing
        string replace = ".xml";
        string layoutFile = temp.LayoutFile.TrimEnd(replace.ToCharArray());

        // Set these on the temp layoutschedule
        temp.LayoutFile = Settings.Default.LibraryPath + "\\" + "Layouts\\" + layoutFile + ".mosaic";
        temp.ID = int.Parse(layoutFile);

        // Get attributes that only exist on the default
        if (temp.NodeName != "default")
        {
            // Priority flag
            temp.Priority = layout.Priority;

            // Get the fromdt,todt
            temp.FromDate = DateTime.Parse(layout.FromDate);
            temp.ToDate = DateTime.Parse(layout.ToDate);

            // Pull out the scheduleid if there is one
            int scheduleId = -1;
            if (layout.ScheduleId != -1)
                scheduleId = layout.ScheduleId;

            // Add it to the layout schedule
            if (scheduleId != -1)
                temp.Scheduleid = scheduleId;
        }
        return temp;
    }