コード例 #1
0
 public bool AddUserPhone(IExchangeUserInfo exchangeUserInfo, long currentUserPID)
 {
     try
     {
         ExPhone phone = (ExPhone)exchangeUserInfo;
         using (UnitOfWork unitOfWork = new UnitOfWork())
         {
             PhoneRepository           = unitOfWork.GetRepoInstance <Phone>();
             UserDetailPhoneRepository = unitOfWork.GetRepoInstance <UserDetailPhone>();
             IQueryable <UserDetailPhone> userDetailPhones = UserDetailPhoneRepository.GetAllExpressions(x => x.UserDetailPID == currentUserPID && x.IsActive == true, null, null);
             if (userDetailPhones != null && userDetailPhones.Count <UserDetailPhone>() != 0)
             {
                 foreach (var item in userDetailPhones)
                 {
                     item.IsActive = false;
                 }
             }
             Phone dbphone = new Phone();
             dbphone.Number   = phone.strPhone;
             dbphone.IsActive = true;
             PhoneRepository.Insert(dbphone);
             UserDetailPhone udPhone = new UserDetailPhone();
             udPhone.IsActive      = true;
             udPhone.PhonePID      = dbphone.Phonepid;
             udPhone.UserDetailPID = currentUserPID;
             UserDetailPhoneRepository.Insert(udPhone);
             unitOfWork.SaveChanges();
         }
         return(true);
     }
     catch (Exception ex)
     {
         return(false);
     }
 }
コード例 #2
0
 public bool AddUserEmail(IExchangeUserInfo exchangeUserInfo, long currentUserPID)
 {
     try
     {
         ExEmail email = (ExEmail)exchangeUserInfo;
         using (UnitOfWork unitOfWork = new UnitOfWork())
         {
             UserDetailEmailRepository = unitOfWork.GetRepoInstance <UserDetailEmail>();
             EmailRepository           = unitOfWork.GetRepoInstance <Email>();
             IQueryable <UserDetailEmail> userDetailEmails = UserDetailEmailRepository.GetAllExpressions(x => x.UserDetailPID == currentUserPID && x.IsActive == true, null, null);
             if (userDetailEmails != null && userDetailEmails.Count <UserDetailEmail>() != 0)
             {
                 foreach (var item in userDetailEmails)
                 {
                     item.IsActive = false;
                 }
             }
             Email dbEmail = new Email();
             dbEmail.ID       = email.strEmail;
             dbEmail.IsActive = true;
             EmailRepository.Insert(dbEmail);
             UserDetailEmail udEmail = new UserDetailEmail();
             udEmail.IsActive      = true;
             udEmail.EmailPID      = dbEmail.EmailPid;
             udEmail.UserDetailPID = currentUserPID;
             UserDetailEmailRepository.Insert(udEmail);
             unitOfWork.SaveChanges();
         }
         return(true);
     }
     catch (Exception)
     {
         return(false);
     }
 }
コード例 #3
0
 public bool AddAddresses(IExchangeUserInfo exchangeUserInfo, long currentUserPID)
 {
     try
     {
         ExAddress address = (ExAddress)exchangeUserInfo;
         using (UnitOfWork unitOfWork = new UnitOfWork())
         {
             UserDetailAddressRepository = unitOfWork.GetRepoInstance <UserDetailAddress>();
             AddressRepository           = unitOfWork.GetRepoInstance <Address>();
             IQueryable <UserDetailAddress> userDetailAddresss = UserDetailAddressRepository.GetAllExpressions(x => x.UserDetailPID == currentUserPID && x.IsActive == true, null, null);
             if (userDetailAddresss != null && userDetailAddresss.Count <UserDetailAddress>() != 0)
             {
                 foreach (var item in userDetailAddresss)
                 {
                     item.IsActive = false;
                 }
             }
             Address dbAddress = new Address();
             dbAddress.Address1 = address.strAddress1;
             dbAddress.Address2 = address.strAddress2;
             dbAddress.Address3 = address.strAddress3;
             AddressRepository.Insert(dbAddress);
             UserDetailAddress udAddress = new UserDetailAddress();
             udAddress.IsActive      = true;
             udAddress.AddressPID    = dbAddress.AddressPID;
             udAddress.UserDetailPID = currentUserPID;
             UserDetailAddressRepository.Insert(udAddress);
             unitOfWork.SaveChanges();
         }
         return(true);
     }
     catch (Exception)
     {
         return(false);
     }
 }
コード例 #4
0
 public UserManagement(IExchangeUserInfo userInfo, long currentUserPID)
 {
     this.CurrentUserPID  = currentUserPID;
     this.UserProfileInfo = userInfo;
 }