Example #1
0
        public PortfolioPdx(int id, int size, string[] names)
        {
            m_names  = names;
            m_id     = id;
            m_pkid   = id.ToString();
            m_status = (id % 2 == 0) ? "active" : "inactive";
            m_type   = "type" + (id % 3);
            int numSecIds = m_secIds.Length;

            m_position1 = new PositionPdx(m_secIds[PositionPdx.Count % numSecIds],
                                          PositionPdx.Count * 1000);
            if (id % 2 != 0)
            {
                m_position2 = new PositionPdx(m_secIds[PositionPdx.Count % numSecIds],
                                              PositionPdx.Count * 1000);
            }
            else
            {
                m_position2 = null;
            }
            m_positions = new Hashtable();
            m_positions[m_secIds[PositionPdx.Count % numSecIds]] =
                m_position1;
            if (size > 0)
            {
                m_newVal = new byte[size];
                for (int index = 0; index < size; index++)
                {
                    m_newVal[index] = (byte)'B';
                }
            }
            m_creationDate  = DateTime.Now;
            m_arrayNull     = null;
            m_arrayZeroSize = new byte[0];
        }
Example #2
0
        public void FromData(IPdxReader reader)
        {
            m_id = reader.ReadInt("id");

            bool isIdentity = reader.IsIdentityField("id");

            if (isIdentity == false)
            {
                throw new IllegalStateException("Portfolio id is identity field");
            }

            bool isId = reader.HasField("id");

            if (isId == false)
            {
                throw new IllegalStateException("Portfolio id field not found");
            }

            bool isNotId = reader.HasField("ID");

            if (isNotId == true)
            {
                throw new IllegalStateException("Portfolio isNotId field found");
            }

            m_pkid          = reader.ReadString("pkid");
            m_position1     = (PositionPdx)reader.ReadObject("position1");
            m_position2     = (PositionPdx)reader.ReadObject("position2");
            m_positions     = (Hashtable)reader.ReadObject("positions");
            m_type          = reader.ReadString("type");
            m_status        = reader.ReadString("status");
            m_names         = reader.ReadStringArray("names");
            m_newVal        = reader.ReadByteArray("newVal");
            m_creationDate  = reader.ReadDate("creationDate");
            m_arrayNull     = reader.ReadByteArray("arrayNull");
            m_arrayZeroSize = reader.ReadByteArray("arrayZeroSize");
        }