示例#1
0
 public static void CreateLicence(User currentUser, Tracker newTracker, DateTime dateTime)
 {
     Licence l = new Licence
         {
             UserId = currentUser.Id,
             TrackerId = newTracker.Id,
             CreationDate = DateTime.Now,
             ValidFrom = DateTime.Now,
             ValidUntil = dateTime,
             Id = Guid.NewGuid()
         };
     var context = DataHandler.GetContext();
     context.Licence.AddObject(l);
     context.SaveChanges();
 }
 partial void UpdateLicence(Licence instance);
 partial void DeleteLicence(Licence instance);
 partial void InsertLicence(Licence instance);
		private void detach_Licences(Licence entity)
		{
			this.SendPropertyChanging();
			entity.User = null;
		}
		private void attach_Licences(Licence entity)
		{
			this.SendPropertyChanging();
			entity.User = this;
		}
 /// <summary>
 /// Create a new Licence object.
 /// </summary>
 /// <param name="id">Initial value of the Id property.</param>
 /// <param name="trackerId">Initial value of the TrackerId property.</param>
 /// <param name="validFrom">Initial value of the ValidFrom property.</param>
 /// <param name="validUntil">Initial value of the ValidUntil property.</param>
 /// <param name="creationDate">Initial value of the CreationDate property.</param>
 /// <param name="userId">Initial value of the UserId property.</param>
 public static Licence CreateLicence(global::System.Guid id, global::System.Guid trackerId, global::System.DateTime validFrom, global::System.DateTime validUntil, global::System.DateTime creationDate, global::System.Guid userId)
 {
     Licence licence = new Licence();
     licence.Id = id;
     licence.TrackerId = trackerId;
     licence.ValidFrom = validFrom;
     licence.ValidUntil = validUntil;
     licence.CreationDate = creationDate;
     licence.UserId = userId;
     return licence;
 }
 /// <summary>
 /// Deprecated Method for adding a new object to the Licence EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
 /// </summary>
 public void AddToLicence(Licence licence)
 {
     base.AddObject("Licence", licence);
 }