Exemple #1
0
 /// <summary>
 /// 
 /// </summary>
 /// <param name="userDto"></param>
 /// <returns></returns>
 public long CreateUser(IUserDTO userDto)
 {
     var retVal = -1L;//public const int DefaultCreateId = -1; todo add this to Global constants
     try
     {
         if (userDto != null)
         {
             using (TransactionScope trans = new TransactionScope())
             {
                 using (var TMCDbContext = new TMCContext())
                 {
                     var user = new User();
                     EntityConverter.FillEntityFromDTO(userDto, user);
                     user.CreatedOn = DateTime.Now;
                     user.CreatedBy = 11;//todo
                     user.UpdatedOn = DateTime.Now;
                     user.UpdatedBy = 11;
                     user.IsActive = true;
                     user.IsDeleted = false;
                     user.UserTypeId = 1;
                     user.AddressLine1 = "Default AddressLine1";
                     user.PinCode = 12345;
                     TMCDbContext.User.AddObject(user);
                     if (TMCDbContext.SaveChanges() > 0)
                     {
                         retVal = user.UserId;
                         //userDto.ListingId = listing.ListingId;
                     }
                 }
                 trans.Complete();
             }
         }
     }
     catch (Exception ex)
     {
         ExceptionManager.HandleException(ex);
         throw new DACException("Error while creating the user.", ex);
     }
     return retVal;
 }
Exemple #2
0
 /// <summary>
 /// Deprecated Method for adding a new object to the User EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
 /// </summary>
 public void AddToUser(User user)
 {
     base.AddObject("User", user);
 }
Exemple #3
0
 /// <summary>
 /// Create a new User object.
 /// </summary>
 /// <param name="userId">Initial value of the UserId property.</param>
 /// <param name="userName">Initial value of the UserName property.</param>
 /// <param name="userTypeId">Initial value of the UserTypeId property.</param>
 /// <param name="createdOn">Initial value of the CreatedOn property.</param>
 /// <param name="updatedOn">Initial value of the UpdatedOn property.</param>
 /// <param name="createdBy">Initial value of the CreatedBy property.</param>
 /// <param name="updatedBy">Initial value of the UpdatedBy property.</param>
 /// <param name="isActive">Initial value of the IsActive property.</param>
 public static User CreateUser(global::System.Int64 userId, global::System.String userName, global::System.Int16 userTypeId, global::System.DateTime createdOn, global::System.DateTime updatedOn, global::System.Int64 createdBy, global::System.Int64 updatedBy, global::System.Boolean isActive)
 {
     User user = new User();
     user.UserId = userId;
     user.UserName = userName;
     user.UserTypeId = userTypeId;
     user.CreatedOn = createdOn;
     user.UpdatedOn = updatedOn;
     user.CreatedBy = createdBy;
     user.UpdatedBy = updatedBy;
     user.IsActive = isActive;
     return user;
 }