示例#1
0
        public List <CurrentAuction> GetIntialAuction(int CurrentUserPID)
        {
            // int CurrentUserPID = ((TradeBulk_Web.Authe_AuthoATION.CustomPrincipal)HttpContext.User).UserId;
            List <CurrentAuction> lscAuction = new List <CurrentAuction>();
            GenericRepository <UserAuctionInfo> UserAuctionInfoRepository;
            GenericRepository <UserDetail>      UserDetailRepository;

            using (UnitOfWork unitOfWork = new UnitOfWork())
            {
                UserAuctionInfoRepository = unitOfWork.GetRepoInstance <UserAuctionInfo>();
                UserDetailRepository      = unitOfWork.GetRepoInstance <UserDetail>();
                UserDetail cUser = UserDetailRepository.GetAllExpressions(x => x.UserPID == CurrentUserPID).FirstOrDefault <UserDetail>();
                IEnumerable <UserAuctionInfo> currentUserAuction = UserAuctionInfoRepository.GetAllExpressions(x => x.ManagerUserDetailPID == cUser.ManagerPID, null, null, null);
                //CurrentUserPID = 11;
                //currentUserAuction = UserAuctionInfoRepository.GetAllExpressions(x => x.UserDetail.UserPID == CurrentUserPID, null, null, null);
                foreach (UserAuctionInfo usrAuction in currentUserAuction)
                {
                    lscAuction.Add(new CurrentAuction()
                    {
                        UserName = usrAuction.UserDetail.FirstName, UserAmount = usrAuction.AuctionAmount.ToString(), Timestamp = usrAuction.Timestamp.ToString()
                    });
                }
            }
            //var something=from x in lscAuction  select max
            LastUpdated = Convert.ToDateTime(lscAuction.Max(x => x.Timestamp));
            return(lscAuction);
        }
        public IList <UserDetail> GetAllUsers()
        {
            var repos = new UserDetailRepository(context);
            var list  = repos.GetAllUsers();

            return(list);
        }
        async public Task AuthenticateUserInCorrectPasswordTest()
        {
            var _userDetailRepository = new UserDetailRepository(_dbContext);

            var response = await _userDetailRepository.AuthenticateUser("TestUser", "TestUser1".HashPassword());

            Assert.IsNull(response);
        }
        async public Task GetUserDetailNotZeroTest()
        {
            var _userDetailRepository = new UserDetailRepository(_dbContext);

            var response = await _userDetailRepository.GetUserDetails();

            Assert.AreNotEqual(0, response.Count);
        }
        async public Task InsertDuplicateDataTest()
        {
            var _userDetailRepository = new UserDetailRepository(_dbContext);

            var response = await _userDetailRepository.InsertUserDetails(_testUserforDuplicateInsert);

            var response2 = await _userDetailRepository.InsertUserDetails(_testUserforDuplicateInsert);
        }
        async public Task InserUserWithCorrectDataTest()
        {
            var _userDetailRepository = new UserDetailRepository(_dbContext);

            var response = await _userDetailRepository.InsertUserDetails(_testUserforInsert);

            Assert.AreNotEqual(0, response);
        }
        async public Task GetUserDetailTypeOfTest()
        {
            var _userDetailRepository = new UserDetailRepository(_dbContext);

            var response = await _userDetailRepository.GetUserDetails();

            Assert.IsNotNull(response);
            Assert.IsInstanceOfType(response, typeof(List <UserDetails>));
        }
        //Changes districts for users based on userid
        public void ChangeDistricts(string userId, string oldDistrict, int newDistrict)
        {
            userDetail.UserId = userId;
            var userDetailRepo = new UserDetailRepository(context);

            userDetail = userDetailRepo.GetUserWithUserId(userDetail.UserId);
            var oldDistrictText = Convert.ToInt32(oldDistrict);
            var repo            = new UserDetailRepository(context);
            var row             = repo.ChangeUserDistrict(userDetail.UserId, oldDistrictText, newDistrict);
        }
        async public Task AuthenticateUserCorrectDataTest()
        {
            var _userDetailRepository = new UserDetailRepository(_dbContext);

            var response = await _userDetailRepository.AuthenticateUser("TestUser", "TestUser".HashPassword());

            Assert.IsNotNull(response);
            Assert.IsInstanceOfType(response, typeof(CustomUserModel));
            Assert.AreEqual(_testUser.UserName, response.UserName);
            Assert.AreEqual(_testUser.UserType, response.UserType);
        }
示例#10
0
        public string GetAdvertiserWallet(Guid idCampaign)
        {
            string advertiserWallet = string.Empty;
            UserDetailRepository userDetailRepository = new UserDetailRepository();

            var campaign    = GetById(idCampaign);
            var product     = productRepository.FindById(campaign.PRODUCT_IdProduct);
            var userProduct = userRepository.FindById(product.AspNetUsers_Id);

            var user       = userRepository.FindById(campaign.AspNetUser_Id);
            var userDetail = userDetailRepository.GetByUserById(campaign.AspNetUser_Id);

            if (userDetail != null && userDetail.IsMetamask)
            {
                advertiserWallet = user.WalletAddress;
            }

            return(advertiserWallet);
        }
示例#11
0
        public bool isAnyUpdate(int CurrentUserPID)
        {
            GenericRepository <UserAuctionInfo> UserAuctionInfoRepository;
            GenericRepository <UserDetail>      UserDetailRepository;

            using (UnitOfWork unitOfWork = new UnitOfWork())
            {
                UserAuctionInfoRepository = unitOfWork.GetRepoInstance <UserAuctionInfo>();
                UserDetailRepository      = unitOfWork.GetRepoInstance <UserDetail>();
                UserDetail cUser = UserDetailRepository.GetAllExpressions(x => x.UserPID == CurrentUserPID).FirstOrDefault <UserDetail>();
                IEnumerable <UserAuctionInfo> currentUserAuction = UserAuctionInfoRepository.GetAllExpressions(x => x.ManagerUserDetailPID == cUser.ManagerPID && x.Timestamp > LastUpdated, null, null, null);
                if (currentUserAuction.Count <UserAuctionInfo>() > 0)
                {
                    return(true);
                }
            }

            return(false);
        }
示例#12
0
        public void CreateUserTest()
        {
            //Arrange
            var userRepo = new UserDetailRepository();
            var user     = new UserDetailVm
            {
                City   = "Orastie",
                County = "Hunedoara",
                PersonalDescription = "Short description working!!!",
                Phone            = "0754566257",
                Position         = "Junior web developer",
                SelectedFile     = "Teorie.pdf",
                SelectedFileName = "D:/files/Teorie_20200616231210.pdf",
                UserModelId      = 6
            };

            //Act
            var userDetail = userRepo.GetById(4);

            //Assert
            Assert.AreEqual(userDetail, user);
        }
示例#13
0
        public void SaveNewUserDetails(NewUserRegistrationSupport NewUserDeatils)
        {
            GenericRepository <Phone>             PhoneRepository;
            GenericRepository <Email>             EmailRepository;
            GenericRepository <Address>           AddressRepository;
            GenericRepository <UserDetailAddress> UserDetailAddressRepository;
            GenericRepository <UserDetail>        UserDetailRepository;

            try
            {
                using (UnitOfWork unitOfWork = new UnitOfWork())
                {
                    try
                    {
                        #region Phone
                        PhoneRepository = unitOfWork.GetRepoInstance <Phone>();
                        Phone phone = new Phone();
                        phone.Number = NewUserDeatils.PhoneNumber;
                        PhoneRepository.Insert(phone);
                        #endregion

                        #region Email
                        EmailRepository = unitOfWork.GetRepoInstance <Email>();
                        Email email = new Email();
                        email.ID = NewUserDeatils.Email;
                        EmailRepository.Insert(email);
                        #endregion

                        #region Address
                        AddressRepository = unitOfWork.GetRepoInstance <Address>();
                        Address Add = new Address();
                        Add.Address1 = NewUserDeatils.Address1;
                        Add.Address2 = NewUserDeatils.Address2;
                        Add.Address3 = NewUserDeatils.Address3;
                        Add.Phone    = phone;
                        Add.Email    = email;
                        AddressRepository.Insert(Add);
                        #endregion

                        #region User Address Details
                        UserDetailAddressRepository = unitOfWork.GetRepoInstance <UserDetailAddress>();
                        UserDetailAddress UDA = new UserDetailAddress();
                        UDA.Address = Add;
                        UserDetailAddressRepository.Insert(UDA);
                        #endregion

                        #region User Details
                        UserDetailRepository = unitOfWork.GetRepoInstance <UserDetail>();
                        UserDetail newUser = new UserDetail();
                        newUser.FirstName   = NewUserDeatils.FirstName;
                        newUser.LastName    = NewUserDeatils.LastName;
                        newUser.MiddleName  = NewUserDeatils.MiddleName;
                        newUser.DateofBirth = NewUserDeatils.Dob;
                        UDA.UserDetail      = newUser;
                        //newUser.UserDetailAddress.=UDA;
                        UserDetailRepository.Insert(newUser);
                        #endregion

                        unitOfWork.SaveChanges();
                    }
                    catch (Exception ex)
                    {
                        System.Diagnostics.Debug.WriteLine("System Stack :: " + ex.StackTrace + " System Exception Message :: " + ex.Message);
                    }
                }
            }
            catch (Exception ex)
            {
                LogHelper.WriteErrorLog(ex);
            }
        }
示例#14
0
 public BalanceTransferService()
 {
     userDetailRepository          = new UserDetailRepository();
     userBalanceTransferRepository = new UserBalanceTransferRepository();
 }
 public HomeLoanService()
 {
     userDetailRepository   = new UserDetailRepository();
     userHomeLoanRepository = new UserHomeLoanRepository();
 }