Ejemplo n.º 1
0
        /// <summary>
        /// IshBackgroundTask creation through an ishbackgroundTask xml element.
        /// Incoming is: &lt;ishbackgroundtask ishtaskref="169075" ishhistoryref="122259"&gt;
        /// </summary>
        /// <param name="xmlIshBackgroundTask">One ishbackgroundTask xml.</param>
        public IshBackgroundTask(XmlElement xmlIshBackgroundTask)
        {
            _backgroundTaskRef = new Dictionary <Enumerations.ReferenceType, string>();
            StringEnum stringEnum = new StringEnum(typeof(Enumerations.ReferenceType));

            // Loop all reference attributes present in the xml
            foreach (string refType in stringEnum.GetStringValues())
            {
                if (xmlIshBackgroundTask.HasAttribute(refType))
                {
                    Enumerations.ReferenceType enumValue = (Enumerations.ReferenceType)StringEnum.Parse(typeof(Enumerations.ReferenceType), refType);
                    _backgroundTaskRef.Add(enumValue, xmlIshBackgroundTask.Attributes[refType].Value);
                }
            }
            _ishFields = new IshFields((XmlElement)xmlIshBackgroundTask.SelectSingleNode("ishfields"));
            _ishRef    = _ishFields.GetFieldValue("TASKID", Enumerations.Level.Task, Enumerations.ValueType.Value);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// IshEvent creation through an ishevent xml element.
        /// Incoming is: <ishevent ishprogressref="807"/> or <ishevent ishprogressref="807" ishdetailref="16317"/>
        /// </summary>
        /// <param name="xmlIshEvent">One ishevent xml.</param>
        public IshEvent(XmlElement xmlIshEvent)
        {
            _eventRef = new Dictionary <Enumerations.ReferenceType, string>();
            StringEnum stringEnum = new StringEnum(typeof(Enumerations.ReferenceType));

            // Loop all reference attributes present in the xml
            foreach (string refType in stringEnum.GetStringValues())
            {
                if (xmlIshEvent.HasAttribute(refType))
                {
                    Enumerations.ReferenceType enumValue = (Enumerations.ReferenceType)StringEnum.Parse(typeof(Enumerations.ReferenceType), refType);
                    _eventRef.Add(enumValue, xmlIshEvent.Attributes[refType].Value);
                }
            }
            _ishFields    = new IshFields((XmlElement)xmlIshEvent.SelectSingleNode("ishfields"));
            _ishEventData = new IshEventData((XmlElement)xmlIshEvent.SelectSingleNode("ishdata"));
            _ishRef       = _ishFields.GetFieldValue("EVENTID", Enumerations.Level.Progress, Enumerations.ValueType.Value);
        }
Ejemplo n.º 3
0
        /// <summary>
        /// IshObject creation through an ishobject xml element.
        /// Incoming is: <ishobject ishref="D1E1030" ishtype="ISHModule" ishlogicalref="26288" ishversionref="26291" ishlngref="39490" />
        /// </summary>
        /// <param name="xmlIshObject">One ishobject xml.</param>
        public IshObject(XmlElement xmlIshObject)
        {
            _ishType   = (Enumerations.ISHType)Enum.Parse(typeof(Enumerations.ISHType), xmlIshObject.Attributes["ishtype"].Value);
            _ishRef    = xmlIshObject.Attributes["ishref"].Value;
            _objectRef = new Dictionary <Enumerations.ReferenceType, string>();
            StringEnum stringEnum = new StringEnum(typeof(Enumerations.ReferenceType));

            // Loop all reference attributes present in the xml
            foreach (string refType in stringEnum.GetStringValues())
            {
                if (xmlIshObject.HasAttribute(refType))
                {
                    Enumerations.ReferenceType enumValue = (Enumerations.ReferenceType)StringEnum.Parse(typeof(Enumerations.ReferenceType), refType);
                    _objectRef.Add(enumValue, xmlIshObject.Attributes[refType].Value);
                }
            }
            _ishFields = new IshFields((XmlElement)xmlIshObject.SelectSingleNode("ishfields"));
            _ishData   = new IshData((XmlElement)xmlIshObject.SelectSingleNode("ishdata"));
        }
Ejemplo n.º 4
0
 /// <summary>
 /// Initializing by something that looks like
 /// <![CDATA[
 /// <?xml version="1.0" encoding="utf-16"?>
 /// <ishdataobjects>
 ///   <ishdataobject ishlngref="1826972" ishdataref="1826973"
 ///   ed="GUID-7EE439B0-EE28-463A-A409-7AB83DE2E92D" edt="EDTCHM"
 ///   size="35802" mimetype="application/mshelp" fileextension="chm" />
 /// </ishdataobjects>
 /// ]]>
 /// </summary>
 public IshDataObject(XmlElement ishData)
 {
     if (ishData != null)
     {
         _edt           = ishData.Attributes["edt"].Value;
         _ed            = ishData.Attributes["ed"].Value;
         _mimeType      = ishData.Attributes["mimetype"].Value;
         _fileExtension = ishData.Attributes["fileextension"].Value;
         _ishDataRef    = ishData.Attributes["ishdataref"].Value;
         _objectRef     = new Dictionary <Enumerations.ReferenceType, string>();
         StringEnum stringEnum = new StringEnum(typeof(Enumerations.ReferenceType));
         // Loop all reference attributes present in the xml
         foreach (string refType in stringEnum.GetStringValues())
         {
             if (ishData.HasAttribute(refType))
             {
                 Enumerations.ReferenceType enumValue = (Enumerations.ReferenceType)StringEnum.Parse(typeof(Enumerations.ReferenceType), refType);
                 _objectRef.Add(enumValue, ishData.Attributes[refType].Value);
             }
         }
         int.TryParse(ishData.Attributes["size"].Value, out _size);
     }
 }
Ejemplo n.º 5
0
        public IActionResult EditReferenceValues(Enumerations.ReferenceType referenceType)
        {
            ApplicationContext appContext = new ApplicationContext(this.Cache);

            List <ReferenceValue> referenceList = new List <ReferenceValue>();

            switch (referenceType)
            {
            case Enumerations.ReferenceType.Project:
                referenceList = appContext.Projects;
                break;

            case Enumerations.ReferenceType.Phase:
                referenceList = appContext.Phases;
                break;

            case Enumerations.ReferenceType.Classification:
                referenceList = appContext.Classifications;
                break;

            case Enumerations.ReferenceType.Location:
                referenceList = appContext.Locations;
                break;

            case Enumerations.ReferenceType.ImpactBenefitRange:
                referenceList = appContext.ImpactBenefitRanges;
                break;

            case Enumerations.ReferenceType.CostImpact:
                referenceList = appContext.CostImpacts;
                break;

            case Enumerations.ReferenceType.RiskRanking:
                referenceList = appContext.RiskRankings;
                break;

            case Enumerations.ReferenceType.Discipline:
                referenceList = appContext.Disciplines;
                break;

            case Enumerations.ReferenceType.CredibilityChecklist:
                referenceList = appContext.CredibilityChecklists;
                break;

            case Enumerations.ReferenceType.LessonTypeValid:
                referenceList = appContext.LessonTypesValid;
                break;

            case Enumerations.ReferenceType.LessonTypeInvalid:
                referenceList = appContext.LessonTypesInvalid;
                break;

            case Enumerations.ReferenceType.Theme:
                referenceList = appContext.Themes;
                break;

            default:
                throw new ArgumentOutOfRangeException("referenceType");
            }

            var model = new AdminViewData(this.Cache)
            {
                ListName                  = Utility.StringValue(referenceType),
                EditReferenceType         = (int)referenceType,
                EditingReferenceValueList = referenceList,
                ReferenceValueEnabled     = referenceList.Where(x => x.Enabled).Select(x => x.Name).ToList(),
                ReferenceValueDisabled    = referenceList.Where(x => !x.Enabled).Select(x => x.Name).ToList()
            };

            return(PartialView(model));
        }