public static void UpdateExtPosition(DateTime date, decimal Size, int custodianID, int original_Key)
        {
            IDalSession session = NHSessionFactory.CreateSession();

            ITradeableInstrument instrument = (ITradeableInstrument)InstrumentMapper.GetInstrument(session, original_Key);
            ExtCustodian custodian = ExtCustodianMapper.GetExtCustodian(session, custodianID);
            ExtPosition position = ExtCustodianMapper.GetExtCustodianPosition(session, custodian, instrument, date);

            InstrumentSize size = new InstrumentSize(Size, instrument);

            if (position == null)
                position = new ExtPosition(custodian, size, date);
            else
                position.Size = size;

            ExtCustodianMapper.InsertOrUpdate(session, position);

            session.Close();
        }
Esempio n. 2
0
 /// <summary>
 /// Creates/Updates a new object in the database
 /// </summary>
 /// <param name="session">An instance of the Data Access Library <see cref="T:B4F.TotalGiro.DAL.NHSession">NHSession</see> class</param>
 /// <param name="obj">Object of type ExtPosition</param>
 public static void InsertOrUpdate(IDalSession session, ExtPosition obj)
 {
     session.InsertOrUpdate(obj);
 }