Aspose.Tasks for C++
Rate.h
1 #pragma once
2 //-----------------------------------------------------------------------
3 // <copyright file="Rate.cs" company="Aspose Pty Ltd">
4 // Copyright (c) 2002-2024 Aspose Pty Ltd. All Rights Reserved.
5 // </copyright>
6 //-----------------------------------------------------------------------
7 
8 #include <system/object.h>
9 #include <system/decimal.h>
10 #include <system/date_time.h>
11 
12 #include "aspose.tasks.cpp/aspose_tasks_api_defs.h"
13 
14 namespace Aspose
15 {
16 namespace Tasks
17 {
18 namespace Calculations
19 {
20 class RateByDateEnumeratorBase;
21 } // namespace Calculations
22 namespace Connectivity
23 {
24 class MpdResourceRateMapper;
25 } // namespace Connectivity
26 namespace IO
27 {
28 namespace MSProject
29 {
30 template <typename, typename> class FieldItem;
31 class MPP14ResourceAssignmentWriter;
32 } // namespace MSProject
33 namespace PrimaveraXml
34 {
35 class PrimaveraResourceRateNodeReader;
36 class PrimaveraRoleRateNodeReader;
37 } // namespace PrimaveraXml
38 namespace Xer
39 {
40 class XerResourceRateReader;
41 class XerUtils;
42 } // namespace Xer
43 } // namespace IO
44 class RateByDateCollection;
45 class RateCollection;
46 enum class RateFormatType;
47 enum class RateType;
48 class ResourceAssignment;
49 namespace Util
50 {
51 class RateHelper;
52 } // namespace Util
53 } // namespace Tasks
54 } // namespace Aspose
55 
56 namespace Aspose {
57 
58 namespace Tasks {
59 
60 /// <summary>
61 /// Represents a definition of a time period and rates applicable for a resource during that period.
62 /// </summary>
63 class ASPOSE_TASKS_SHARED_CLASS Rate : public System::Object
64 {
65  typedef Rate ThisType;
66  typedef System::Object BaseType;
67 
68  typedef ::System::BaseTypesInfo<BaseType> ThisTypeBaseTypesInfo;
69  ASPOSE_TASKS_SHARED_RTTI_INFO_DECL();
70 
71  friend class Aspose::Tasks::Calculations::RateByDateEnumeratorBase;
72  friend class Aspose::Tasks::IO::PrimaveraXml::PrimaveraResourceRateNodeReader;
73  friend class Aspose::Tasks::IO::PrimaveraXml::PrimaveraRoleRateNodeReader;
75  friend class Aspose::Tasks::Util::RateHelper;
76  friend class Aspose::Tasks::Connectivity::MpdResourceRateMapper;
77  template<typename FT0, typename FT1> friend class Aspose::Tasks::IO::MSProject::FieldItem;
78  friend class Aspose::Tasks::IO::MSProject::MPP14ResourceAssignmentWriter;
79  friend class Aspose::Tasks::IO::Xer::XerResourceRateReader;
80  friend class Aspose::Tasks::IO::Xer::XerUtils;
82  friend class Aspose::Tasks::RateCollection;
83 
84 private:
85 
86  enum class UpdateType
87  {
88  StandardRate,
89  StandardRateFormat,
90  OvertimeRate,
91  OvertimeRateFormat,
92  CostPerUse
93  };
94 
95 
96 public:
97 
98  /// <summary>
99  /// Gets the date when a rate becomes effective.
100  /// </summary>
101  ASPOSE_TASKS_SHARED_API System::DateTime get_RatesFrom() const;
102  /// <summary>
103  /// Sets the date when a rate becomes effective.
104  /// </summary>
105  ASPOSE_TASKS_SHARED_API void set_RatesFrom(System::DateTime value);
106  /// <summary>
107  /// Gets the last date when a rate is effective.
108  /// </summary>
109  ASPOSE_TASKS_SHARED_API System::DateTime get_RatesTo() const;
110  /// <summary>
111  /// Sets the last date when a rate is effective.
112  /// </summary>
113  ASPOSE_TASKS_SHARED_API void set_RatesTo(System::DateTime value);
114  /// <summary>
115  /// Gets the unique identifier of a rate table for a resource.
116  /// </summary>
117  ASPOSE_TASKS_SHARED_API RateType get_RateTable() const;
118  /// <summary>
119  /// Sets the unique identifier of a rate table for a resource.
120  /// </summary>
121  ASPOSE_TASKS_SHARED_API void set_RateTable(RateType value);
122  /// <summary>
123  /// Gets the standard rate per hour for a resource.
124  /// </summary>
125  ASPOSE_TASKS_SHARED_API System::Decimal get_StandardRate() const;
126  /// <summary>
127  /// Sets the standard rate per hour for a resource.
128  /// </summary>
129  ASPOSE_TASKS_SHARED_API void set_StandardRate(System::Decimal value);
130  /// <summary>
131  /// Gets the units used by Microsoft Project to display the standard rate.
132  /// </summary>
133  ASPOSE_TASKS_SHARED_API RateFormatType get_StandardRateFormat() const;
134  /// <summary>
135  /// Sets the units used by Microsoft Project to display the standard rate.
136  /// </summary>
137  ASPOSE_TASKS_SHARED_API void set_StandardRateFormat(RateFormatType value);
138  /// <summary>
139  /// Gets the overtime rate per hour for a resource.
140  /// </summary>
141  ASPOSE_TASKS_SHARED_API System::Decimal get_OvertimeRate() const;
142  /// <summary>
143  /// Sets the overtime rate per hour for a resource.
144  /// </summary>
145  ASPOSE_TASKS_SHARED_API void set_OvertimeRate(System::Decimal value);
146  /// <summary>
147  /// Gets the units used by Microsoft Project to display the overtime rate.
148  /// </summary>
149  ASPOSE_TASKS_SHARED_API RateFormatType get_OvertimeRateFormat() const;
150  /// <summary>
151  /// Sets the units used by Microsoft Project to display the overtime rate.
152  /// </summary>
153  ASPOSE_TASKS_SHARED_API void set_OvertimeRateFormat(RateFormatType value);
154  /// <summary>
155  /// Gets the cost per use of a resource. This value retrieved from the current date if a rate table exists for a resource.
156  /// </summary>
157  ASPOSE_TASKS_SHARED_API System::Decimal get_CostPerUse() const;
158  /// <summary>
159  /// Sets the cost per use of a resource. This value retrieved from the current date if a rate table exists for a resource.
160  /// </summary>
161  ASPOSE_TASKS_SHARED_API void set_CostPerUse(System::Decimal value);
162 
163 protected:
164 
165  static ASPOSE_TASKS_SHARED_API System::DateTime& MinDate();
166  static ASPOSE_TASKS_SHARED_API System::DateTime& MaxDate();
167 
168  ASPOSE_TASKS_SHARED_API System::SharedPtr<RateCollection> get_ParentCollection() const;
169  ASPOSE_TASKS_SHARED_API void set_ParentCollection(const System::SharedPtr<RateCollection>& value);
170 
171  /// <summary>
172  /// Initializes a new instance of the <see cref="Rate"></see> class.
173  /// </summary>
174  ASPOSE_TASKS_SHARED_API Rate();
175 
176  ASPOSE_TASKS_SHARED_API MEMBER_FUNCTION_MAKE_OBJECT_DECLARATION(Rate, CODEPORTING_ARGS());
177 
178  /// <summary>Initializes a new instance of the <see cref="Rate"></see> class.</summary>
179  ASPOSE_TASKS_SHARED_API Rate(System::Decimal standardRate, System::DateTime ratesFrom);
180 
181  ASPOSE_TASKS_SHARED_API MEMBER_FUNCTION_MAKE_OBJECT_DECLARATION(Rate, CODEPORTING_ARGS(System::Decimal standardRate, System::DateTime ratesFrom));
182 
183  /// <summary>Initializes a new instance of the <see cref="Rate"></see> class.</summary>
184  ASPOSE_TASKS_SHARED_API Rate(RateType type);
185 
186  ASPOSE_TASKS_SHARED_API MEMBER_FUNCTION_MAKE_OBJECT_DECLARATION(Rate, CODEPORTING_ARGS(RateType type));
187 
188  /// <summary>Initializes a new instance of the <see cref="Rate"></see> class.</summary>
189  ASPOSE_TASKS_SHARED_API Rate(System::Decimal standardRate);
190 
191  ASPOSE_TASKS_SHARED_API MEMBER_FUNCTION_MAKE_OBJECT_DECLARATION(Rate, CODEPORTING_ARGS(System::Decimal standardRate));
192 
193  /// <summary>Initializes a new instance of the <see cref="Rate"></see> class.</summary>
194  ASPOSE_TASKS_SHARED_API Rate(System::DateTime from);
195 
196  ASPOSE_TASKS_SHARED_API MEMBER_FUNCTION_MAKE_OBJECT_DECLARATION(Rate, CODEPORTING_ARGS(System::DateTime from));
197  ASPOSE_TASKS_SHARED_API void ConvertToMaterial();
198  static ASPOSE_TASKS_SHARED_API System::SharedPtr<Rate> GetDefaultRate(const System::SharedPtr<RateCollection>& collection, RateType type);
199  static ASPOSE_TASKS_SHARED_API System::SharedPtr<Rate> GetDefaultRate(RateType rateTable);
200  static ASPOSE_TASKS_SHARED_API System::SharedPtr<Rate> CreateRate(System::Decimal stdRate);
201  static ASPOSE_TASKS_SHARED_API System::SharedPtr<Rate> GetRateEffectiveOnDate(const System::SharedPtr<RateCollection>& rateCollection, RateType rateType, System::DateTime date);
202 
203  virtual ASPOSE_TASKS_SHARED_API ~Rate();
204 
205  #ifdef ASPOSE_GET_SHARED_MEMBERS
206  ASPOSE_TASKS_SHARED_API void GetSharedMembers(System::Object::shared_members_type& result) const override;
207  #endif
208 
209 
210 private:
211 
212  System::Decimal standardRate;
213  RateFormatType standardRateFormat;
214  System::Decimal overtimeRate;
215  RateFormatType overtimeRateFormat;
216  System::WeakPtr<RateCollection> parentCollection;
217  System::Decimal costPerUse;
218  System::DateTime pr_RatesFrom;
219  System::DateTime pr_RatesTo;
220  RateType pr_RateTable;
221 
222  bool get_IsDefault();
223 
224  /// <summary>Initializes a new instance of the <see cref="Rate"></see> class.</summary>
225  Rate(RateFormatType type);
226 
227  MEMBER_FUNCTION_MAKE_OBJECT_DECLARATION(Rate, CODEPORTING_ARGS(RateFormatType type));
228  bool IsEffectiveOnDate(System::DateTime date);
229  void UpdateResourceValue(Rate::UpdateType type);
230 
231 };
232 
233 } // namespace Tasks
234 } // namespace Aspose
235 
236 
Represents a collection which mappings of DateTime to Rate objects.
Definition: RateByDateCollection.h:32
Represents a collection which contains Rate objects.
Definition: RateCollection.h:81
Represents a definition of a time period and rates applicable for a resource during that period.
Definition: Rate.h:64
void set_RateTable(RateType value)
Sets the unique identifier of a rate table for a resource.
RateFormatType get_OvertimeRateFormat() const
Gets the units used by Microsoft Project to display the overtime rate.
void set_StandardRateFormat(RateFormatType value)
Sets the units used by Microsoft Project to display the standard rate.
System::Decimal get_CostPerUse() const
Gets the cost per use of a resource. This value retrieved from the current date if a rate table exist...
System::DateTime get_RatesTo() const
Gets the last date when a rate is effective.
void set_CostPerUse(System::Decimal value)
Sets the cost per use of a resource. This value retrieved from the current date if a rate table exist...
void set_StandardRate(System::Decimal value)
Sets the standard rate per hour for a resource.
System::Decimal get_OvertimeRate() const
Gets the overtime rate per hour for a resource.
void set_RatesTo(System::DateTime value)
Sets the last date when a rate is effective.
void set_OvertimeRate(System::Decimal value)
Sets the overtime rate per hour for a resource.
System::Decimal get_StandardRate() const
Gets the standard rate per hour for a resource.
void set_RatesFrom(System::DateTime value)
Sets the date when a rate becomes effective.
void set_OvertimeRateFormat(RateFormatType value)
Sets the units used by Microsoft Project to display the overtime rate.
System::DateTime get_RatesFrom() const
Gets the date when a rate becomes effective.
RateFormatType get_StandardRateFormat() const
Gets the units used by Microsoft Project to display the standard rate.
RateType get_RateTable() const
Gets the unique identifier of a rate table for a resource.
Represents a resource assignment in a project.
Definition: ResourceAssignment.h:219
Definition: Asn.h:13