예제 #1
0
        private void FillPropertySetsValues(COBieDataPropertySetValues allPropertyValues, IfcTypeObject type, COBieTypeRow typeRow)
        {
            //get related object properties to extract from if main way fails
            allPropertyValues.SetAllPropertyValues(type, "Pset_Asset");
            typeRow.AssetType = GetAssetType(type, allPropertyValues);
            allPropertyValues.SetAllPropertyValues(type, "Pset_ManufacturersTypeInformation");
            string manufacturer = allPropertyValues.GetPropertySingleValueValue("Manufacturer", false);

            typeRow.Manufacturer = ((manufacturer == DEFAULT_STRING) || (!IsEmailAddress(manufacturer))) ? Constants.DEFAULT_EMAIL : manufacturer;

            typeRow.ModelNumber = GetModelNumber(type, allPropertyValues);


            allPropertyValues.SetAllPropertyValues(type, new List <string>(new string[] { "COBie_Warranty", "Pset_Warranty" })); //reset property set name from "Pset_Warranty" to "COBie_Warranty"

            string warrantyDurationPart = allPropertyValues.GetPropertySingleValueValue("WarrantyDurationParts", false);

            typeRow.WarrantyDurationParts = ((warrantyDurationPart == DEFAULT_STRING) || (!IsNumeric(warrantyDurationPart))) ? DEFAULT_NUMERIC : warrantyDurationPart;
            Interval warrantyDuration = GetDurationUnitAndValue(allPropertyValues.GetPropertySingleValue("WarrantyDurationLabor"));

            typeRow.WarrantyDurationLabor = (!IsNumeric(warrantyDuration.Value)) ? DEFAULT_NUMERIC : warrantyDuration.Value;
            typeRow.WarrantyDurationUnit  = (string.IsNullOrEmpty(warrantyDuration.Unit)) ? "Year" : warrantyDuration.Unit;     //redundant column via matrix sheet states set as year

            typeRow.ReplacementCost        = GetReplacementCost(type, allPropertyValues);
            typeRow.WarrantyGuarantorParts = GetWarrantyGuarantorParts(type, allPropertyValues);
            typeRow.WarrantyGuarantorLabor = GetWarrantyGuarantorLabor(type, allPropertyValues);
            typeRow.WarrantyDescription    = GetWarrantyDescription(type, allPropertyValues);


            allPropertyValues.SetAllPropertyValues(type, "Pset_ServiceLife");

            Interval serviceDuration = GetDurationUnitAndValue(allPropertyValues.GetPropertySingleValue("ServiceLifeDuration"));

            typeRow.ExpectedLife = GetExpectedLife(type, serviceDuration, allPropertyValues);
            typeRow.DurationUnit = serviceDuration.Unit;

            allPropertyValues.SetAllPropertyValues(type, new List <string>(new string[] { "COBie_Specification", "Pset_Specification" }));//changed from "Pset_Specification" via v16 matrix sheet

            typeRow.Shape    = allPropertyValues.GetPropertySingleValueValue("Shape", false);
            typeRow.Size     = allPropertyValues.GetPropertySingleValueValue("Size", false);
            typeRow.Finish   = allPropertyValues.GetPropertySingleValueValue("Finish", false);
            typeRow.Grade    = allPropertyValues.GetPropertySingleValueValue("Grade", false);
            typeRow.Material = allPropertyValues.GetPropertySingleValueValue("Material", false);
            typeRow.Features = allPropertyValues.GetPropertySingleValueValue("Features", false);

            typeRow.NominalLength             = GetNominalLength(type, allPropertyValues);
            typeRow.NominalWidth              = GetNominalWidth(type, allPropertyValues);
            typeRow.NominalHeight             = GetNominalHeight(type, allPropertyValues);
            typeRow.ModelReference            = GetModelReference(type, allPropertyValues);
            typeRow.Color                     = GetColour(type, allPropertyValues);
            typeRow.Constituents              = GetConstituents(type, allPropertyValues);
            typeRow.AccessibilityPerformance  = GetAccessibilityPerformance(type, allPropertyValues);
            typeRow.CodePerformance           = GetCodePerformance(type, allPropertyValues);
            typeRow.SustainabilityPerformance = GetSustainabilityPerformance(type, allPropertyValues);
        }
예제 #2
0
        /// <summary>
        /// Get Formatted Start Date
        /// </summary>
        /// <param name="allPropertyValues"></param>
        /// <param name="propertyName"></param>
        /// <returns></returns>
        private string GetDateFromProperty(COBieDataPropertySetValues allPropertyValues, string propertyName)
        {
            string startData = "";
            IfcPropertySingleValue ifcPropertySingleValue = allPropertyValues.GetPropertySingleValue(propertyName);

            if (ifcPropertySingleValue != null)
            {
                if (ifcPropertySingleValue.NominalValue != null)
                {
                    startData = ifcPropertySingleValue.NominalValue.ToString();
                }
            }
            else
            {
                startData = allPropertyValues.GetPropertyValue(propertyName, false);
            }

            DateTime frmDate;

            if (DateTime.TryParse(startData, out frmDate))
            {
                startData = frmDate.ToString(Constants.DATE_FORMAT);
            }
            else if (string.IsNullOrEmpty(startData))
            {
                startData = Constants.DEFAULT_STRING;//Context.RunDate;
            }
            return(startData);
        }
예제 #3
0
        /// <summary>
        /// Fill sheet rows for Job sheet
        /// </summary>
        /// <returns>COBieSheet</returns>
        public override COBieSheet <COBieJobRow> Fill()
        {
            ProgressIndicator.ReportMessage("Starting Jobs...");

            //create new sheet
            COBieSheet <COBieJobRow> jobs = new COBieSheet <COBieJobRow>(Constants.WORKSHEET_JOB);

            // get all IfcTask objects from IFC file
            IEnumerable <IfcTask> ifcTasks = Model.Instances.OfType <IfcTask>();

            COBieDataPropertySetValues allPropertyValues = new COBieDataPropertySetValues(); //properties helper class

            //IfcTypeObject typObj = Model.Instances.OfType<IfcTypeObject>().FirstOrDefault();
            IfcConstructionEquipmentResource cer = Model.Instances.OfType <IfcConstructionEquipmentResource>().FirstOrDefault();

            ProgressIndicator.Initialise("Creating Jobs", ifcTasks.Count());

            foreach (IfcTask ifcTask in ifcTasks)
            {
                ProgressIndicator.IncrementAndUpdate();

                if (ifcTask == null)
                {
                    continue;
                }

                COBieJobRow job = new COBieJobRow(jobs);

                job.Name      = (string.IsNullOrEmpty(ifcTask.Name.ToString())) ? DEFAULT_STRING : ifcTask.Name.ToString();
                job.CreatedBy = GetTelecomEmailAddress(ifcTask.OwnerHistory);
                job.CreatedOn = GetCreatedOnDateAsFmtString(ifcTask.OwnerHistory);
                job.Category  = ifcTask.ObjectType.ToString();
                job.Status    = (string.IsNullOrEmpty(ifcTask.Status.ToString())) ? DEFAULT_STRING : ifcTask.Status.ToString();

                job.TypeName    = GetObjectType(ifcTask);
                job.Description = (string.IsNullOrEmpty(ifcTask.Description.ToString())) ? DEFAULT_STRING : ifcTask.Description.ToString();

                allPropertyValues.SetAllPropertyValues(ifcTask); //set properties values to this task
                IfcPropertySingleValue ifcPropertySingleValue = allPropertyValues.GetPropertySingleValue("TaskDuration");
                job.Duration = ((ifcPropertySingleValue != null) && (ifcPropertySingleValue.NominalValue != null)) ? ConvertNumberOrDefault(ifcPropertySingleValue.NominalValue.ToString()) : DEFAULT_NUMERIC;
                string unitName = ((ifcPropertySingleValue != null) && (ifcPropertySingleValue.Unit != null)) ? GetUnitName(ifcPropertySingleValue.Unit) : null;
                job.DurationUnit = (string.IsNullOrEmpty(unitName)) ?  DEFAULT_STRING : unitName;

                ifcPropertySingleValue = allPropertyValues.GetPropertySingleValue("TaskStartDate");
                job.Start         = GetStartTime(ifcPropertySingleValue);
                unitName          = ((ifcPropertySingleValue != null) && (ifcPropertySingleValue.Unit != null)) ? GetUnitName(ifcPropertySingleValue.Unit) : null;
                job.TaskStartUnit = (string.IsNullOrEmpty(unitName)) ? DEFAULT_STRING : unitName;

                ifcPropertySingleValue = allPropertyValues.GetPropertySingleValue("TaskInterval");
                job.Frequency          = ((ifcPropertySingleValue != null) && (ifcPropertySingleValue.NominalValue != null)) ? ConvertNumberOrDefault(ifcPropertySingleValue.NominalValue.ToString()) : DEFAULT_NUMERIC;
                unitName          = ((ifcPropertySingleValue != null) && (ifcPropertySingleValue.Unit != null)) ? GetUnitName(ifcPropertySingleValue.Unit) : null;
                job.FrequencyUnit = (string.IsNullOrEmpty(unitName)) ? DEFAULT_STRING : unitName;

                job.ExtSystem     = GetExternalSystem(ifcTask);
                job.ExtObject     = ifcTask.GetType().Name;
                job.ExtIdentifier = ifcTask.GlobalId;

                job.TaskNumber    = (string.IsNullOrEmpty(ifcTask.TaskId.ToString())) ? DEFAULT_STRING : ifcTask.TaskId.ToString();
                job.Priors        = GetPriors(ifcTask);
                job.ResourceNames = GetResources(ifcTask);

                jobs.AddRow(job);
            }

            jobs.OrderBy(s => s.Name);

            ProgressIndicator.Finalise();
            return(jobs);
        }