Exemple #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];
        }
Exemple #2
0
        public virtual void PopulatePositionPdxData(IRegion <TKey, TVal> region, int setSize,
                                                    int numSets)
        {
            Util.Log("QueryHelper.PopulatePositionPdxData: putting for setSize={0}, numSets={1}",
                     setSize, numSets);

            string[] secIds    = PortfolioPdx.SecIds;
            int      numSecIds = secIds.Length;

            for (int set = 1; set <= numSets; set++)
            {
                for (int current = 1; current <= setSize; current++)
                {
                    PositionPdx pos = new PositionPdx(secIds[current % numSecIds],
                                                      current * 100);

                    TKey posName = (TKey)(object)string.Format("pos{0}-{1}", set, current);
                    //Util.Log("QueryHelper.PopulatePositionPdxData: creating key = {0} and"
                    //+ " puting data.", posName);
                    //Put Operation
                    region[posName] = (TVal)(object)pos;
                }
            }
            //m_positionSetSize = setSize;
            //m_positionNumSets = numSets;

            Util.Log("QueryHelper.PopulatePositionPdxData: all puts done.");
        }
Exemple #3
0
 public void FromData(IPdxReader reader)
 {
     m_id            = reader.ReadInt("ID");
     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");
 }