Пример #1
0
        private static Sensitivity ReadSensitivityCrossCurrencyBasis(EntryObject o)
        {
            if (!String.IsNullOrEmpty(o.Bucket) || !String.IsNullOrEmpty(o.Label1) || !String.IsNullOrEmpty(o.Label2))
            {
                throw new InvalidDataException("The CRIF file cannot specify Bucket, Label1 and Label2 properties for Risk_XCcyBasis entries.");
            }

            if (!Enum.TryParse(o.ProductClass, out Model.Product product))
            {
                throw new InvalidDataException("The CRIF file contains a Risk_XCcyBasis entry with an invalid ProductClass property.");
            }

            if (product != Model.Product.RatesFx)
            {
                throw new InvalidDataException($"The CRIF file contains a Risk_XCcyBasis entry associated to a product class other than {Model.Product.RatesFx}.");
            }

            if (!Currency.TryParse(o.Qualifier, out Currency currency))
            {
                throw new InvalidDataException("The CRIF file contains a Risk_XCcyBasis entry with an invalid Qualifier property.");
            }

            Amount          amount          = ReadAmount(o);
            RegulationsInfo regulationsInfo = ReadRegulationsInfo(o);
            TradeInfo       tradeInfo       = ReadTradeInfo(o);

            return(Sensitivity.CrossCurrencyBasis(currency, amount, regulationsInfo, tradeInfo));
        }
Пример #2
0
        private static Amount ReadAmount(EntryObject o)
        {
            Boolean amountLocalDefined    = Decimal.TryParse(o.Amount, NumberStyles.Any, CultureInfo.InvariantCulture, out Decimal amountLocal);
            Boolean amountCurrencyDefined = Currency.TryParse(o.AmountCurrency, out Currency amountCurrency);
            Boolean amountUsdDefined      = Decimal.TryParse(o.AmountUsd, NumberStyles.Any, CultureInfo.InvariantCulture, out Decimal amountUsd);

            if (amountLocalDefined && amountCurrencyDefined)
            {
                if (amountUsdDefined && (amountCurrency == Currency.Usd) && (amountLocal != amountUsd))
                {
                    throw new InvalidDataException($"The CRIF file contains a {o.RiskType} entry with AmountCurrency set to \"USD\" and mismatching values of Amount and AmountUSD properties.");
                }

                return(Amount.OfUnchecked(amountCurrency, amountLocal));
            }

            if (amountLocalDefined || amountCurrencyDefined)
            {
                if (amountLocalDefined)
                {
                    throw new InvalidDataException($"The CRIF file contains a {o.RiskType} entry with a valid Amount property and an invalid or undefined AmountCurrency property.");
                }

                throw new InvalidDataException($"The CRIF file contains a {o.RiskType} entry with a valid AmountCurrency property and an invalid or undefined Amount property.");
            }

            if (!amountUsdDefined)
            {
                throw new InvalidDataException($"The CRIF file contains a {o.RiskType} entry with no amount information (either Amount and AmountCurrency properties or AmountUSD property must be defined).");
            }

            return(Amount.OfUnchecked(Currency.Usd, amountUsd));
        }
Пример #3
0
        public List <EntryObject> FetchAll(string conditionStatement, params SQLiteParameter[] parameters)
        {
            DataSet dataSet;

            if (conditionStatement == null)
            {
                dataSet = _hDatabase.Fetch("SELECT * FROM device_tracks ORDER BY artist");
            }
            else
            {
                dataSet = _hDatabase.Fetch("SELECT * FROM device_tracks " + conditionStatement + " ORDER BY artist", parameters);
            }

            if (dataSet.Tables[0].Rows.Count > 0)
            {
                List <EntryObject> entries = new List <EntryObject>();

                foreach (DataRow row in dataSet.Tables[0].Rows)
                {
                    EntryObject entryObject = new EntryObject();
                    SetDatabaseFields(ref entryObject, row);

                    entries.Add(entryObject);
                }
                return(entries);
            }
            else
            {
                return(null);
            }
        }
Пример #4
0
        private static AddOnProductMultiplier ReadProductMultiplier(EntryObject o)
        {
            foreach (String property in s_Properties.Except(s_PropertiesCommon.Union(s_PropertiesScalar)))
            {
                if (!String.IsNullOrEmpty((String)o.GetType().GetProperty(property)?.GetValue(o)))
                {
                    throw new InvalidDataException($"The CRIF file cannot specify the {property} property for Param_ProductClassMultiplier entries.");
                }
            }

            if (!Enum.TryParse(o.Qualifier, out Model.Product product))
            {
                throw new InvalidDataException("The CRIF file contains a Param_ProductClassMultiplier entry with an invalid Qualifier property.");
            }

            if (!Decimal.TryParse(o.Amount, NumberStyles.Any, CultureInfo.InvariantCulture, out Decimal multiplier))
            {
                throw new InvalidDataException("The CRIF file contains a Param_ProductClassMultiplier entry with an invalid Amount property.");
            }

            multiplier -= 1m;

            if (multiplier <= 0m)
            {
                throw new InvalidDataException("The CRIF file contains a Param_ProductClassMultiplier entry with a multiplier less than 1.");
            }

            RegulationsInfo regulationsInfo = ReadRegulationsInfo(o);

            return(AddOnProductMultiplier.OfUnchecked(product, multiplier, regulationsInfo));
        }
Пример #5
0
        private static AddOnNotionalFactor ReadAddOnNotionalFactor(EntryObject o)
        {
            foreach (String property in s_Properties.Except(s_PropertiesCommon.Union(s_PropertiesScalar)))
            {
                if (!String.IsNullOrEmpty((String)o.GetType().GetProperty(property)?.GetValue(o)))
                {
                    throw new InvalidDataException($"The CRIF file cannot specify the {property} property for Param_AddOnNotionalFactor entries.");
                }
            }

            if (!DataValidator.IsValidNotionalQualifier(o.Qualifier))
            {
                throw new InvalidDataException("The CRIF file contains a Param_AddOnNotionalFactor entry with an invalid Qualifier property.");
            }

            if (!Decimal.TryParse(o.Amount, NumberStyles.Any, CultureInfo.InvariantCulture, out Decimal factor))
            {
                throw new InvalidDataException("The CRIF file contains a Param_AddOnNotionalFactor entry with an invalid Amount property.");
            }

            factor /= 100m;

            if ((factor <= 0m) || (factor > 1m))
            {
                throw new InvalidDataException("The CRIF file contains a Param_AddOnNotionalFactor entry whose factor is not between 0 and 100.");
            }

            RegulationsInfo regulationsInfo = ReadRegulationsInfo(o);

            return(AddOnNotionalFactor.OfUnchecked(o.Qualifier, factor, regulationsInfo));
        }
Пример #6
0
        public List <EntryObject> GenerateScrobbleTimes(List <EntryObject> entries, DateTime startDateTime)
        {
            List <EntryObject> playedTracks = new List <EntryObject>();

            if (entries == null)
            {
                return(null);
            }

            foreach (EntryObject entry in entries)
            {
                EntryObject playedTrack = new EntryObject();
                playedTrack.DateSubmitted = startDateTime;

                playedTrack.Id           = entry.Id;
                playedTrack.PersistentId = entry.PersistentId;
                playedTrack.Name         = entry.Name;
                playedTrack.Artist       = entry.Artist;
                playedTrack.Album        = entry.Album;
                playedTrack.Length       = entry.Length;
                playedTrack.Device       = entry.Device;
                playedTrack.PlayCount    = entry.PlayCount;
                playedTrack.Filename     = entry.Filename;
                playedTrack.PlayCountHis = entry.PlayCountHis;

                playedTracks.Add(playedTrack);
                startDateTime = startDateTime.AddSeconds(-entry.LengthSeconds);
            }
            return(playedTracks);
        }
Пример #7
0
        private static void UpdateEntry(EntryObject entry, IEnumerable <string> properties)
        {
            var entryType = entry.GetType();

            foreach (var name in properties)
            {
                var property  = entryType.GetProperty(name);
                var attribute = GetAttribute(property);

                if (attribute == null || attribute.IsReadOnly)
                {
                    continue;
                }

                var value = GetPropertyValue(entry, property);

                if (value != null)
                {
                    entry.Entry.Properties[attribute.Name].Value = value;
                }
                else
                {
                    entry.Entry.Properties[attribute.Name].Clear();
                }
            }
        }
Пример #8
0
    /**
     * ######################################################################################################
     * ############################################### ENTRY ################################################
     * ######################################################################################################
     */

    /// <summary>
    /// Crée le GameObject correspondant à une entrée (qubit).
    /// </summary>
    /// <param name="entryStruct"></param>
    private EntryObject CreateEntryObject(Circuit.EntryStruct entryStruct)
    {
        EntryObject entryObject = ObjectFactory.ENTRY(_gridGame.transform);

        entryObject.entryStruct = entryStruct;

        return(entryObject);
    }
Пример #9
0
    /// <summary>
    /// Détruis le GameObject correspondant à une entrée et retire leur association du dictionnaire.
    /// </summary>
    /// <param name="entryStruct"></param>
    private void RemoveEntry(Circuit.EntryStruct entryStruct)
    {
        EntryObject entryObject = entryObjects[entryStruct];

        entryObjects.Remove(entryStruct);

        entryObject.FadeOutAndDestroy();
    }
Пример #10
0
        public override void OnEntryClick(GameObject entryObject)
        {
            EntryObject entryProperties = entryObject.GetComponent <EntryObject>();

            QCS.Circuit.EntryStruct entryStruct = entryProperties.entryStruct;

            context.gridBoard.SwapEntryValue(entryStruct);
        }
Пример #11
0
 public void SetEntryObjectChanged(EntryObject entryObject)
 {
     if (!Changes.ContainsKey(entryObject))
     {
         entryObject.ChangeState = ChangeState.Update;
         Changes.Add(entryObject, new List <string>());
     }
 }
Пример #12
0
    /// <summary>
    /// Renvoie la position que doit occuper l'objet représentant l'entry correspondante.
    /// </summary>
    /// <param name="entryStruct"></param>
    /// <returns></returns>
    private Vector3 ComputeEntryPosition(Circuit.EntryStruct entryStruct)
    {
        EntryObject entryObject = entryObjects[entryStruct];

        int col = entryStruct.col;

        return(new Vector3(-((_circuit.NbCol - 1) * localColWidth / 2) + localColWidth * col, 0, 3));
    }
Пример #13
0
        private List <string> GetPropertyList(EntryObject entryObject)
        {
            if (!Changes.ContainsKey(entryObject))
            {
                Changes.Add(entryObject, new List <string>());
            }

            return(Changes[entryObject]);
        }
Пример #14
0
        protected override void ProcessRecord()
        {
            var items = EntryObject.Get(Database, Criteria);

            foreach (var item in items)
            {
                WriteObject(item);
            }
        }
Пример #15
0
    /// <summary>
    /// Calcule et positionne une entry à sa nouvelle position.
    /// </summary>
    /// <param name="entryStruct"></param>
    private void PositionEntry(Circuit.EntryStruct entryStruct)
    {
        EntryObject entryObject     = entryObjects[entryStruct];
        GameObject  entryGameObject = entryObject.root;

        Vector3 newPosition = ComputeEntryPosition(entryStruct);

        entryGameObject.transform.localPosition = newPosition;
    }
Пример #16
0
    /// <summary>
    /// Clacule et fait transiter une entry vers sa nouvelle position.
    /// </summary>
    /// <param name="entryStruct"></param>
    private void TransitionEntry(Circuit.EntryStruct entryStruct)
    {
        EntryObject entryObject     = entryObjects[entryStruct];
        GameObject  entryGameObject = entryObject.root;

        Vector3 newPosition = ComputeEntryPosition(entryStruct);

        AnimationManager.Move(entryGameObject, newPosition, animationTime);
    }
Пример #17
0
 protected override void ProcessRecord()
 {
     if (writer != null)
     {
         EntryObject.Run(writer, Class);
         writer.WriteLine();
     }
     EntryObject.Run(Console.Out, Class);
     Console.WriteLine();
 }
Пример #18
0
        private static object GetPropertyValue(EntryObject entry, PropertyInfo property)
        {
            var value = property.GetValue(entry, null);

            if (value is Guid)
            {
                return(((Guid)value).ToByteArray());
            }

            return(value);
        }
Пример #19
0
    public void SelectCol(int col)
    {
        EntryObject entryObject = GetEntryObject(col);

        entryObject.Select();
        Debug.Log("saluttttt");
        for (int i = 0; i < _circuit.NbRow; i++)
        {
            GateObject gateObject = GetGateObject(i, col);
            gateObject.Select();//aaaaaaaaaaaaaaaaaaaaaaaaa
        }
    }
Пример #20
0
    public void DeselectCol(int col)
    {
        EntryObject entryObject = GetEntryObject(col);

        entryObject.Deselect();

        for (int i = 0; i < _circuit.NbRow; i++)
        {
            GateObject gateObject = GetGateObject(i, col);
            gateObject.Deselect();
        }
    }
Пример #21
0
        public EntryObject LoadObject(string persistentId)
        {
            DataSet dataSet = _hDatabase.Fetch("SELECT * FROM device_tracks WHERE persistent_id = '" + persistentId + "' LIMIT 1");

            if (dataSet.Tables[0].Rows.Count > 0)
            {
                EntryObject entryObject = new EntryObject();
                SetDatabaseFields(ref entryObject, dataSet.Tables[0].Rows[0]);

                return(entryObject);
            }
            return(null);
        }
Пример #22
0
 public void SetDatabaseFields(ref EntryObject entryObject, DataRow row)
 {
     entryObject.Id           = row["id"] as string;
     entryObject.PersistentId = row["persistent_id"] as string;
     entryObject.Filename     = row["filename"] as string;
     entryObject.Name         = row["name"] as string;
     entryObject.Artist       = row["artist"] as string;
     entryObject.Album        = row["album"] as string;
     entryObject.Length       = (int)((long)row["length"]);
     entryObject.PlayCount    = (int)((long)row["play_count"]);
     entryObject.PlayCountHis = (int)((long)row["play_count_his"]);
     entryObject.Ignored      = (int)((long)row["ignored"]);
     entryObject.Device       = row["device"] as string;
 }
Пример #23
0
    /// <summary>
    /// Construit un Objet unity englobé dans la classe "EntryObject" représentant une entrée du jeu.
    /// </summary>
    /// <param name="parent">Parent de l'objet qui doit être créé</param>
    public static EntryObject ENTRY(Transform parent)
    {
        /* root */
        GameObject root = new GameObject();

        root.tag  = "entry";
        root.name = "entry";

        /* root Trasnform */
        root.transform.parent        = parent;
        root.transform.localScale    = new Vector3(1, 1, 1);
        root.transform.localPosition = new Vector3(0, 0, 0);

        /* entry */
        //GameObject entry = GameObject.CreatePrimitive(PrimitiveType.Sphere);
        GameObject     entry = new GameObject();
        SpriteRenderer sp    = entry.AddComponent(typeof(SpriteRenderer)) as SpriteRenderer;
        //Sprite pipeSprite = Sprite.Create(materialQubitZero, new Rect(0.0f, 0.0f, materialQubitZero.width, materialQubitZero.height), new Vector2(0.5f, 0.5f));

        /* entry BoxCollider */
        BoxCollider boxCollider = entry.AddComponent <BoxCollider>();

        boxCollider.size = new Vector3(0.5f * GridBoard.localColWidth, GridBoard.localRowHeight, GridBoard.pipeDiameter + 0.5f);

        entry.tag  = "entry";
        entry.name = "entry";

        /* entry Transform */
        entry.transform.parent        = root.transform;
        entry.transform.localScale    = new Vector3(GridBoard.pipeDiameter, GridBoard.pipeDiameter, GridBoard.pipeDiameter);
        entry.transform.localPosition = new Vector3(0f, 1f, 0f);

        /* collar */
        GameObject collar = STARTING_PIPE2D(entry.transform);

        /* collar Transform */
        collar.transform.parent        = root.transform;
        collar.transform.localScale    = new Vector3(1, 1, 1);
        collar.transform.localPosition = new Vector3(0, -1f, 0);

        /* bind gateObject */
        EntryObject entryObject = entry.AddComponent <EntryObject>();

        entryObject.root   = root;
        entryObject.entry  = entry;
        entryObject.collar = collar;

        return(entryObject);
    }
Пример #24
0
        private static Sensitivity ParseSensitivityCreditNonQualifying(EntryObject o)
        {
            if (!Enum.TryParse(o.ProductClass, out Model.Product product))
            {
                throw new InvalidDataException($"The CRIF file contains a {o.RiskType} entry with an invalid ProductClass property.");
            }

            if (product != Model.Product.Credit)
            {
                throw new InvalidDataException($"The CRIF file contains a {o.RiskType} entry associated to a product class other than {Model.Product.Credit}.");
            }

            if (!BucketCreditNonQualifying.TryParse(o.Bucket, out BucketCreditNonQualifying bucket))
            {
                throw new InvalidDataException($"The CRIF file contains a {o.RiskType} entry with an invalid Bucket property.");
            }

            if (!Tenor.TryParse(o.Label1, out Tenor tenor))
            {
                throw new InvalidDataException($"The CRIF file contains a {o.RiskType} entry with an invalid Label1 property.");
            }

            if (!tenor.IsCreditTenor)
            {
                throw new InvalidDataException($"The CRIF file contains a {o.RiskType} entry associated to an improper tenor (accepted tenors are: {String.Join(", ", Tenor.Values.Where(x => x.IsCreditTenor).Select(x => x.Name))}.");
            }

            if (!String.IsNullOrEmpty(o.Label2))
            {
                throw new InvalidDataException($"The CRIF file cannot specify the Label2 property for {o.RiskType} entries.");
            }

            Amount          amount          = ReadAmount(o);
            RegulationsInfo regulationsInfo = ReadRegulationsInfo(o);
            TradeInfo       tradeInfo       = ReadTradeInfo(o);

            if (o.RiskType == "Risk_CreditNonQ")
            {
                if (!DataValidator.IsValidQualifier(o.Qualifier, true))
                {
                    throw new InvalidDataException($"The CRIF file contains a {o.RiskType} entry with an invalid Qualifier property.");
                }

                return(Sensitivity.CreditNonQualifyingDelta(o.Qualifier, bucket, tenor, amount, regulationsInfo, tradeInfo));
            }

            return(Sensitivity.CreditNonQualifyingVega(o.Qualifier, bucket, tenor, amount, regulationsInfo, tradeInfo));
        }
Пример #25
0
        private static Sensitivity ReadSensitivityEquity(EntryObject o)
        {
            if (!Enum.TryParse(o.ProductClass, out Model.Product product))
            {
                throw new InvalidDataException($"The CRIF file contains a {o.RiskType} entry with an invalid ProductClass property.");
            }

            if (product != Model.Product.Equity)
            {
                throw new InvalidDataException($"The CRIF file contains a {o.RiskType} entry associated to a product class other than {Model.Product.Equity}.");
            }

            if (!DataValidator.IsValidQualifier(o.Qualifier, false))
            {
                throw new InvalidDataException($"The CRIF file contains a {o.RiskType} entry with an invalid Qualifier property.");
            }

            if (!BucketEquity.TryParse(o.Bucket, out BucketEquity bucket))
            {
                throw new InvalidDataException($"The CRIF file contains a {o.RiskType} entry with an invalid Bucket property.");
            }

            Amount          amount          = ReadAmount(o);
            RegulationsInfo regulationsInfo = ReadRegulationsInfo(o);
            TradeInfo       tradeInfo       = ReadTradeInfo(o);

            if (o.RiskType == "Risk_Equity")
            {
                if (!String.IsNullOrEmpty(o.Label1) || !String.IsNullOrEmpty(o.Label2))
                {
                    throw new InvalidDataException("The CRIF file cannot specify Label1 and Label2 properties for Risk_Equity entries.");
                }

                return(Sensitivity.EquityDelta(o.Qualifier, bucket, amount, regulationsInfo, tradeInfo));
            }

            if (!Tenor.TryParse(o.Label1, out Tenor tenor))
            {
                throw new InvalidDataException("The CRIF file contains a Risk_EquityVol entry with an invalid Label1 property.");
            }

            if (!String.IsNullOrEmpty(o.Label2))
            {
                throw new InvalidDataException("The CRIF file cannot specify the Label2 property for Risk_EquityVol entries.");
            }

            return(Sensitivity.EquityVega(o.Qualifier, bucket, tenor, amount, regulationsInfo, tradeInfo));
        }
Пример #26
0
        private static Sensitivity ReadSensitivityFx(EntryObject o)
        {
            if (!Enum.TryParse(o.ProductClass, out Model.Product product))
            {
                throw new InvalidDataException($"The CRIF file contains a {o.RiskType} entry with an invalid ProductClass property.");
            }

            if (product != Model.Product.RatesFx)
            {
                throw new InvalidDataException($"The CRIF file contains a {o.RiskType} entry associated to a product class other than {Model.Product.RatesFx}.");
            }

            Amount          amount          = ReadAmount(o);
            RegulationsInfo regulationsInfo = ReadRegulationsInfo(o);
            TradeInfo       tradeInfo       = ReadTradeInfo(o);

            if (o.RiskType == "Risk_FX")
            {
                if (!Currency.TryParse(o.Qualifier, out Currency currency))
                {
                    throw new InvalidDataException("The CRIF file contains a Risk_FX entry with an invalid Qualifier property.");
                }

                if (!String.IsNullOrEmpty(o.Bucket) || !String.IsNullOrEmpty(o.Label1) || !String.IsNullOrEmpty(o.Label2))
                {
                    throw new InvalidDataException("The CRIF file cannot specify Bucket, Label1 and Label2 properties for Risk_FX entries.");
                }

                return(Sensitivity.FxDelta(currency, amount, regulationsInfo, tradeInfo));
            }

            if (!CurrencyPair.TryParse(o.Qualifier, out CurrencyPair pair))
            {
                throw new InvalidDataException("The CRIF file contains a Risk_FXVol entry with an invalid Qualifier property.");
            }

            if (!Tenor.TryParse(o.Label1, out Tenor tenor))
            {
                throw new InvalidDataException("The CRIF file contains a Risk_FXVol entry with an invalid Label1 property.");
            }

            if (!String.IsNullOrEmpty(o.Bucket) || !String.IsNullOrEmpty(o.Label2))
            {
                throw new InvalidDataException("The CRIF file cannot specify the Label2 property for Risk_EquityVol entries.");
            }

            return(Sensitivity.FxVega(pair, tenor, amount, regulationsInfo, tradeInfo));
        }
Пример #27
0
    /// <summary>
    /// Actualise le material de l'objet correspondant à une entrée (qubit).
    /// </summary>
    /// <param name="entry"></param>
    private void SetEntryMaterial(Circuit.EntryStruct entryStruct)
    {
        Qubit qubit = entryStruct.qubit;

        EntryObject entryObject     = entryObjects[entryStruct];
        GameObject  entryGameObject = entryObject.entry;
        Renderer    renderer        = entryGameObject.GetComponent <Renderer>();

        if (qubit.Equals(Qubit.One))
        {
            renderer.material = ObjectFactory.materialQubitOne;
        }
        else
        {
            renderer.material = ObjectFactory.materialQubitZero;
        }
    }
Пример #28
0
    /// <summary>
    /// Actualise le material de l'objet correspondant à une entrée (qubit).
    /// </summary>
    /// <param name="entry"></param>
    private void SetEntryMaterial(Circuit.EntryStruct entryStruct)
    {
        Qubit qubit = entryStruct.qubit;

        EntryObject    entryObject     = entryObjects[entryStruct];
        GameObject     entryGameObject = entryObject.entry;
        SpriteRenderer renderer        = entryGameObject.GetComponent <SpriteRenderer>();

        if (qubit.Equals(Qubit.One))
        {
            renderer.sprite = Sprite.Create(ObjectFactory.materialQubitOne, new Rect(0.0f, 0.0f, ObjectFactory.materialQubitOne.width, ObjectFactory.materialQubitOne.height), new Vector2(0.5f, 0.5f));
        }
        else
        {
            renderer.sprite = Sprite.Create(ObjectFactory.materialQubitZero, new Rect(0.0f, 0.0f, ObjectFactory.materialQubitZero.width, ObjectFactory.materialQubitZero.height), new Vector2(0.5f, 0.5f));  //ObjectFactory.materialQubitZero;
        }
    }
Пример #29
0
        private static TradeInfo ReadTradeInfo(EntryObject o)
        {
            if (!DataValidator.IsValidTradeReference(o.PortfolioId))
            {
                throw new InvalidDataException($"The CRIF file contains a {o.RiskType} entry with an invalid portfolio identifier.");
            }

            if (!DataValidator.IsValidTradeReference(o.TradeId))
            {
                throw new InvalidDataException($"The CRIF file contains a {o.RiskType} entry with an invalid trade identifier.");
            }

            if (!DateTime.TryParseExact(o.EndDate, "yyyy-MM-dd", CultureInfo.InvariantCulture, DateTimeStyles.None, out DateTime endDate))
            {
                throw new InvalidDataException($"The CRIF file contains a {o.RiskType} entry with an invalid EndDate property.");
            }

            return(TradeInfo.OfUnchecked(o.PortfolioId, o.TradeId, endDate));
        }
Пример #30
0
        private List <string> GetAllPropertyNames(EntryObject entryObject)
        {
            var type          = entryObject.GetType();
            var propertyNames = new List <string>();

            foreach (var item in type.GetProperties())
            {
                var attribute = GetAttribute(item);

                if (attribute == null || string.IsNullOrEmpty(attribute.Name) || attribute.IsReadOnly)
                {
                    continue;
                }

                propertyNames.Add(item.Name);
            }

            return(propertyNames);
        }