Пример #1
0
        private bool CreateEventAssociation(Mode mode, int itemID)
        {
            var returnCode = false;


            var association = (from ModeEvent me in _db.ModeEvents
                               where me.ModeID == mode.ModeID &&
                                     me.EventID == itemID
                               select me).FirstOrDefault();

            // If not found, then we create it
            if (association == null)
            {
                returnCode = true;
                association = new ModeEvent();
                association.ModeID = mode.ModeID;
                association.EventID = itemID;
                _db.ModeEvents.AddObject(association);
                SaveChanges();
            }

            return returnCode;
        }
Пример #2
0
 /// <summary>
 /// Create a new ModeEvent object.
 /// </summary>
 /// <param name="modeEventID">Initial value of the ModeEventID property.</param>
 /// <param name="modeID">Initial value of the ModeID property.</param>
 /// <param name="eventID">Initial value of the EventID property.</param>
 public static ModeEvent CreateModeEvent(global::System.Int32 modeEventID, global::System.Int32 modeID, global::System.Int32 eventID)
 {
     ModeEvent modeEvent = new ModeEvent();
     modeEvent.ModeEventID = modeEventID;
     modeEvent.ModeID = modeID;
     modeEvent.EventID = eventID;
     return modeEvent;
 }
Пример #3
0
 /// <summary>
 /// Deprecated Method for adding a new object to the ModeEvents EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
 /// </summary>
 public void AddToModeEvents(ModeEvent modeEvent)
 {
     base.AddObject("ModeEvents", modeEvent);
 }