Exemplo n.º 1
0
        public static void Run()
        {
            //ExStart:ReplaceCalendar
            // The path to the documents directory.
            string  dataDir = RunExamples.GetDataDir(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.FullName);
            Project project = new Project(dataDir + "ReplaceCalendar.mpp");

            // Add a new calendar to the project's calendars collection
            project.Calendars.Add("New cal1", project.Get(Prj.Calendar));

            // Now traverse through project calendars and replace the already added calendar with a new one
            CalendarCollection calColl = project.Calendars;

            foreach (Calendar c in calColl)
            {
                if (c.Name != "New cal1")
                {
                    continue;
                }

                calColl.Remove(c);
                calColl.Add("New cal2", project.Get(Prj.Calendar));
                break;
            }
            //ExEnd:ReplaceCalendar
        }
Exemplo n.º 2
0
        public static void Run()
        {
            try
            {
                // The path to the documents directory.
                string dataDir = RunExamples.GetDataDir(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.FullName);

                //ExStart:ReplaceCalendarWithNewCalendar
                // Create project
                Project project = new Project(dataDir + "Project5.mpp");

                // Access project calendars
                CalendarCollection calColl = project.Calendars;
                foreach (Calendar myCalendar in calColl)
                {
                    if (myCalendar.Name == "TestCalendar")
                    {
                        // Remove calendar
                        calColl.Remove(myCalendar);
                    }
                }

                // Add new calendar
                Calendar newCalendar = calColl.Add("TestCalendar");
                project.Save(dataDir + "ReplaceCalendar_out.mpp", SaveFileFormat.MPP);
                //ExEnd:ReplaceCalendarWithNewCalendar
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message + "\nThis example will only work if you apply a valid Aspose License. You can purchase full license or get 30 day temporary license from http://www.aspose.com/purchase/default.aspx.");
            }
        }
        public static void Run()
        {
            // The path to the documents directory.
            string  dataDir = RunExamples.GetDataDir_Projects();
            Project project = new Project(dataDir + "ReplaceCalendar.mpp");

            Aspose.Tasks.Calendar cal     = new Aspose.Tasks.Calendar("New Cal");
            CalendarCollection    calColl = project.Calendars;

            foreach (Aspose.Tasks.Calendar c in calColl)
            {
                if (c.Name == "Standard")
                {
                    calColl.Remove(c);
                    calColl.Add("Standard", cal);
                    break;
                }
            }
        }
Exemplo n.º 4
0
        public static void Run()
        {
            // ExStart:ReplaceCalendarWithNewCalendar
            // The path to the documents directory.
            string dataDir = RunExamples.GetDataDir_CustomizingCreatedProject();

            Project            project  = new Project(dataDir + "Project5.mpp");
            Calendar           calendar = new Calendar("New Cal");
            CalendarCollection calColl  = project.Calendars;

            foreach (Calendar getcalendar in calColl)
            {
                if (getcalendar.Name == "Standard")
                {
                    calColl.Remove(getcalendar);
                    calColl.Add("Standard", getcalendar);
                    break;
                }
            }
            // ExEnd:ReplaceCalendarWithNewCalendar
        }
        public static void Run()
        {
            // ExStart:ReplaceCalendar
            // The path to the documents directory.
            string  dataDir = RunExamples.GetDataDir_WorkingWithProjects();
            Project project = new Project(dataDir + "ReplaceCalendar.mpp");

            // Add a new calendar to the project's calendars collection
            project.Calendars.Add("New cal1", project.Get(Prj.Calendar));

            // Now traverse through project calendars and replace the already added calendar with a new one
            CalendarCollection calColl = project.Calendars;

            foreach (Calendar c in calColl)
            {
                if (c.Name == "New cal1")
                {
                    calColl.Remove(c);
                    calColl.Add("New cal2", project.Get(Prj.Calendar));
                    break;
                }
            }
            // ExEnd:ReplaceCalendar
        }