Propriétés du calendrier général

Propriétés du calendrier général

Microsoft Project utilise des calendriers et d’autres informations pour calculer les dates de fin du projet. Aspose.Tasks pour l’API C ++ prend en charge les fonctionnalités du calendrier. Cet article illustre les propriétés du calendrier qui peuvent être définies et montre comment elles sont appliquées dans le code.

Le calendrier expose un certain nombre de propriétés utilisées pour définir le calendrier de base dans Microsoft Outlook:

L’exemple de code ci-dessous montre comment obtenir les propriétés du calendrier général.

 1// Load an existing project
 2System::String dataDir = Examples::CPP::RunExamples::GetDataDir(System::Reflection::MethodBase::GetCurrentMethod(ASPOSE_CURRENT_FUNCTION)->get_DeclaringType().get_FullName());
 3System::SharedPtr<Project> project = System::MakeObject<Project>(dataDir + u"Project_GeneralCalendarProperties.xml");
 4    
 5    
 6{
 7    auto cal_enumerator = (project->get_Calendars())->GetEnumerator();
 8    decltype(cal_enumerator->get_Current()) cal;
 9    while (cal_enumerator->MoveNext() && (cal = cal_enumerator->get_Current(), true))
10    {
11        if (cal->get_Name() != nullptr)
12        {
13            System::Console::WriteLine(System::String(u"UID : ") + System::Convert::ToString(cal->get_Uid()) + u" Name: " + cal->get_Name());
14            
15            // Show if it is has a base calendar
16            System::Console::Write(u"Base Calendar : ");
17            if (cal->get_IsBaseCalendar())
18            {
19                System::Console::WriteLine(u"Self");
20            }
21            else
22            {
23                System::Console::WriteLine(cal->get_BaseCalendar()->get_Name());
24            }
25            
26            // Get Time in hours on each working day
27            
28            {
29                auto wd_enumerator = (cal->get_WeekDays())->GetEnumerator();
30                decltype(wd_enumerator->get_Current()) wd;
31                while (wd_enumerator->MoveNext() && (wd = wd_enumerator->get_Current(), true))
32                {
33                    System::TimeSpan ts = wd->GetWorkingTime();
34                    System::Console::WriteLine(System::String(u"Day Type: ") + System::ObjectExt::ToString(wd->get_DayType()) + u" Hours: " + System::ObjectExt::ToString(ts));
35                }
36            }
37        }
38    }
39}
Subscribe to Aspose Product Updates

Get monthly newsletters & offers directly delivered to your mailbox.