00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012 using System;
00013 using Mcs.Epm.MicrosoftProject.mpFx.CustomFieldsWebService;
00014 using Microsoft.Office.Project.Server.Library;
00015
00016 namespace Mcs.Epm.MicrosoftProject.mpFx
00017 {
00018
00019
00020
00021 public class CustomFieldDefinition
00022 {
00023 #region Public Enums
00024
00025
00026
00027
00028 public enum AttributeTypes
00029 {
00030 None,
00031 LookupTable,
00032 Formula
00033 }
00034
00035 public enum DisplayTypes
00036 {
00037 None,
00038 Data,
00039 GraphicalIndicators
00040 }
00041
00042 #endregion
00043
00044 #region Constructors
00045
00046
00047
00048
00049
00050 public CustomFieldDefinition(string name)
00051 {
00052 Name = name;
00053 }
00054
00055
00056
00057
00058
00059 public CustomFieldDefinition(CustomFieldDataSet.CustomFieldsRow customField)
00060 {
00061 Type = (CustomField.Type) customField.MD_PROP_TYPE_ENUM;
00062
00063 EntityGuid = customField.MD_ENT_TYPE_UID;
00064 Guid = customField.MD_PROP_UID;
00065 Name = customField.MD_PROP_NAME;
00066 IsRequired = customField.MD_PROP_IS_REQUIRED;
00067
00068 if (!customField.IsMD_LOOKUP_TABLE_UIDNull())
00069 {
00070 AttributeType = AttributeTypes.LookupTable;
00071 LookupTableGuid = customField.MD_LOOKUP_TABLE_UID;
00072
00073 if (!customField.IsMD_PROP_DEFAULT_VALUENull())
00074 {
00075 DefaultValueGuid = customField.MD_PROP_DEFAULT_VALUE;
00076 }
00077
00078 if (!customField.IsMD_PROP_IS_LEAF_NODE_ONLYNull())
00079 {
00080 LeafOnly = customField.MD_PROP_IS_LEAF_NODE_ONLY;
00081 }
00082
00083 if (!customField.IsMD_PROP_MAX_VALUESNull())
00084 {
00085 MultiSelect = (CustomField.AcceptableMaxValues) customField.MD_PROP_MAX_VALUES;
00086 }
00087
00088 }
00089 else if (!customField.IsMD_PROP_FORMULANull())
00090 {
00091 AttributeType = AttributeTypes.Formula;
00092 Formula = customField.MD_PROP_FORMULA;
00093 }
00094 else
00095 {
00096 MultiSelect = CustomField.AcceptableMaxValues.DEFAULT;
00097 AttributeType = AttributeTypes.None;
00098 }
00099
00100 if (!customField.IsMD_PROP_GRAPHICAL_INDICATORNull())
00101 {
00102 DisplayType = DisplayTypes.GraphicalIndicators;
00103
00104 NonSummaryCriteriaString = customField.MD_PROP_GRAPHICAL_INDICATOR;
00105 }
00106
00107 if (!customField.IsMD_PROP_PROJ_SUMM_GRAPHICAL_INDICATORNull())
00108 {
00109 DisplayType = DisplayTypes.GraphicalIndicators;
00110
00111 ProjectSummaryCriteriaString = customField.MD_PROP_PROJ_SUMM_GRAPHICAL_INDICATOR;
00112 }
00113
00114 if (!customField.IsMD_PROP_SUMM_GRAPHICAL_INDICATORNull())
00115 {
00116 DisplayType = DisplayTypes.GraphicalIndicators;
00117
00118 SummaryTaskCriteriaString = customField.MD_PROP_SUMM_GRAPHICAL_INDICATOR;
00119 }
00120 else
00121 {
00122 DisplayType = DisplayTypes.Data;
00123 }
00124
00125 if (!customField.IsMD_PROP_GRAPHICAL_INDICATOR_TOOLTIPNull())
00126 {
00127 ShowValuesInTooltip = customField.MD_PROP_GRAPHICAL_INDICATOR_TOOLTIP;
00128 }
00129 }
00130
00131 #endregion
00132
00133 #region Public Properties
00134
00135
00136
00137
00138 public CustomField.Type Type { get; set; }
00139 public Guid EntityGuid { get; set; }
00140 public Guid Guid { get; set; }
00141 public string Name { get; set; }
00142 public bool IsRequired { get; set; }
00143 public AttributeTypes AttributeType { get; set; }
00144 public DisplayTypes DisplayType { get; set; }
00145
00146
00147 public Guid LookupTableGuid { get; set; }
00148 public Guid DefaultValueGuid { get; set; }
00149 public bool LeafOnly { get; set; }
00150 public CustomField.AcceptableMaxValues MultiSelect { get; set; }
00151
00152
00153 public string Formula { get; set; }
00154
00155
00156 public string ProjectSummaryCriteriaString { get; set; }
00157 public string SummaryTaskCriteriaString { get; set; }
00158 public string NonSummaryCriteriaString { get; set; }
00159 public bool ShowValuesInTooltip { get; set; }
00160
00161 #endregion
00162 }
00163 }