Exemplo n.º 1
0
        public override void Parse(int propIndex, IPropertyValue value, int[] nestedIndex)
        {
            switch (propIndex)
            {
            case 0:
                _relatingMonetaryUnit = (IfcMonetaryUnit)(value.EntityVal);
                return;

            case 1:
                _relatedMonetaryUnit = (IfcMonetaryUnit)(value.EntityVal);
                return;

            case 2:
                _exchangeRate = value.RealVal;
                return;

            case 3:
                _rateDateTime = (IfcDateAndTime)(value.EntityVal);
                return;

            case 4:
                _rateSource = (IfcLibraryInformation)(value.EntityVal);
                return;

            default:
                throw new XbimParserException(string.Format("Attribute index {0} is out of range for {1}", propIndex + 1, GetType().Name.ToUpper()));
            }
        }
Exemplo n.º 2
0
        /// <summary>
        /// Get Monetary Unit
        /// </summary>
        /// <param name="ifcMonetaryUnit">IfcMonetaryUnit object</param>
        /// <returns>string holding the Monetary Unit</returns>
        private static string GetMonetaryUnitName(IfcMonetaryUnit ifcMonetaryUnit)
        {
            var value = CultureInfo.GetCultures(CultureTypes.SpecificCultures)
                        .Where(c => new RegionInfo(c.LCID).ISOCurrencySymbol == ifcMonetaryUnit.Currency.ToString())
                        .Select(c => new RegionInfo(c.LCID).CurrencyEnglishName)
                        .FirstOrDefault();

            //TODO: Convert currency to match pick list
            //convert to pick list hard coded for now
            if (!string.IsNullOrEmpty(value))
            {
                if (value.Contains("Dollar"))
                {
                    value = "Dollars";
                }
                else if (value.Contains("Euro"))
                {
                    value = "Euros";
                }
                else if (value.Contains("Pound"))
                {
                    value = "Pounds";
                }
                else
                {
                    value = DEFAULT_STRING;
                }
            }
            else
            {
                value = DEFAULT_STRING;
            }
            return(value);
        }
        public void IfcParse(int propIndex, IPropertyValue value)
        {
            switch (propIndex)
            {
            case 0:
                _relatingMonetaryUnit = (IfcMonetaryUnit)value.EntityVal;
                break;

            case 1:
                _relatedMonetaryUnit = (IfcMonetaryUnit)value.EntityVal;
                break;

            case 2:
                _exchangeRate = value.RealVal;
                break;

            case 3:
                _rateDateTime = (IfcDateAndTime)value.EntityVal;
                break;

            case 4:
                _rateSource = (IfcLibraryInformation)value.EntityVal;
                break;

            default:
                this.HandleUnexpectedAttribute(propIndex, value); break;
            }
        }
Exemplo n.º 4
0
 public IfcCurrencyRelationship(IfcMonetaryUnit __RelatingMonetaryUnit, IfcMonetaryUnit __RelatedMonetaryUnit, IfcPositiveRatioMeasure __ExchangeRate, IfcDateAndTime __RateDateTime, IfcLibraryInformation __RateSource)
 {
     this._RelatingMonetaryUnit = __RelatingMonetaryUnit;
     this._RelatedMonetaryUnit  = __RelatedMonetaryUnit;
     this._ExchangeRate         = __ExchangeRate;
     this._RateDateTime         = __RateDateTime;
     this._RateSource           = __RateSource;
 }
Exemplo n.º 5
0
 public IfcCurrencyRelationship(IfcLabel?__Name, IfcText?__Description, IfcMonetaryUnit __RelatingMonetaryUnit, IfcMonetaryUnit __RelatedMonetaryUnit, IfcPositiveRatioMeasure __ExchangeRate, IfcDateTime?__RateDateTime, IfcLibraryInformation __RateSource)
     : base(__Name, __Description)
 {
     this.RelatingMonetaryUnit = __RelatingMonetaryUnit;
     this.RelatedMonetaryUnit  = __RelatedMonetaryUnit;
     this.ExchangeRate         = __ExchangeRate;
     this.RateDateTime         = __RateDateTime;
     this.RateSource           = __RateSource;
 }
        /// <summary>
        ///Get full Native name of the currency
        /// </summary>
        /// <returns>String holding full name</returns>
        public static string GetFullNativeName(this IfcMonetaryUnit moneyUnit)
        {
            string value = CultureInfo.GetCultures(CultureTypes.SpecificCultures)
                           .Where(c => new RegionInfo(c.LCID).ISOCurrencySymbol == moneyUnit.Currency.ToString())
                           .Select(c => new RegionInfo(c.LCID).CurrencyNativeName)
                           .FirstOrDefault();

            return(string.IsNullOrEmpty(value) ? moneyUnit.Currency.ToString() : value);
        }
Exemplo n.º 7
0
        /// <summary>
        /// Get Monetary Unit
        /// </summary>
        ///<param name="value">string representing the currency type</param>
        private void SetMonetaryUnit(string value)
        {
            string code = "";

            //TODO: Convert currency to match pick list
            //convert to pick list hard coded for now
            if (!string.IsNullOrEmpty(value))
            {
                if (value == "Dollars")
                {
                    code = "USD";
                }
                else if (value == "Euros")
                {
                    code = "EUR";
                }
                else if (value == "Pounds")
                {
                    code = "GBP";
                }
            }
            if (string.IsNullOrEmpty(code))
            {
                code = CultureInfo.GetCultures(CultureTypes.SpecificCultures)
                       .Where(c => new RegionInfo(c.LCID).CurrencyEnglishName == value)
                       .Select(c => new RegionInfo(c.LCID).ISOCurrencySymbol)
                       .FirstOrDefault();
            }
            IfcCurrencyEnum enumCode;

            if (Enum.TryParse(code, out enumCode))
            {
                IfcUnitAssignment ifcUnitAssignment = GetProjectUnitAssignment();
                IfcMonetaryUnit   mu = ifcUnitAssignment.Units.OfType <IfcMonetaryUnit>().FirstOrDefault();
                if (mu != null)
                {
                    mu.Currency = enumCode;
                }
                else
                {
                    ifcUnitAssignment.Units.Add(Model.Instances.New <IfcMonetaryUnit>(ifcmu =>
                    {
                        ifcmu.Currency = enumCode;
                    }));
                }
            }
        }