public List <UserWalletBO> GetBO(TblUserAuth userAuth, Minny_Casino_AffiliateContext db) { var _qUi = from a in db.TblUserWallet join b in db.TblWalletType on a.WalletTypeId equals b.Id join c in db.TblExchangeRate on a.WalletType.CurrencyId equals c.SourceCurrencyId where a.UserAuthId == userAuth.Id select new UserWalletBO { Id = a.Id, UserAuthId = a.UserAuthId, WalletTypeId = a.WalletTypeId, IsEnabled = a.IsEnabled, Balance = a.Balance, BalanceFiat = a.Balance * c.Value, CreatedOn = a.CreatedOn, ModifiedOn = a.ModifiedOn, WalletType = a.WalletType, WalletName = a.WalletType.Name, WalletCode = a.WalletType.Code }; List <UserWalletBO> userWallet = _qUi.ToList <UserWalletBO>(); return(userWallet); }
public bool Create(TblUserAuth userAuth, Minny_Casino_AffiliateContext db) { // ENUMERATE ALL WALELT TYPES var _q = from a in db.TblWalletType //where a.Type == (int)WalletType.CurrencyValue select new TblWalletType { Name = a.Name, Desc = a.Desc, Type = a.Type, Code = a.Code, Id = a.Id }; List <TblWalletType> _qWalletTypeRes = _q.ToList <TblWalletType>(); for (int i = 0; i < _qWalletTypeRes.Count; i++) { var _userWallet = new TblUserWallet(); _userWallet.UserAuthId = userAuth.Id; _userWallet.WalletTypeId = _qWalletTypeRes[i].Id; _userWallet.Balance = 0.0m; _userWallet.IsEnabled = true; db.TblUserWallet.Add(_userWallet); } db.SaveChanges(); return(true); }
public TblUserRole Create(TblUserAuth userAuth, Minny_Casino_AffiliateContext db) { TblUserRole userRole = new TblUserRole(); userRole.UserAuthId = userAuth.Id; userRole.IsEnabled = true; userRole.AccessRole = UserRole.Client.ToString(); db.TblUserRole.Add(userRole); db.SaveChanges(); return(userRole); }
public TblUserAuth Get(UserBO userBO, Minny_Casino_AffiliateContext db) { byte[] _passwordByte = Encoding.ASCII.GetBytes(userBO.PasswordString); byte[] _hashPasswordByte; SHA512 shaM = new SHA512Managed(); _hashPasswordByte = shaM.ComputeHash(_passwordByte); string base64Password = System.Convert.ToBase64String(_hashPasswordByte); var _qAuth = from a in db.TblUserAuth where a.UserName == userBO.UserName && a.PasswordByte == _hashPasswordByte select new TblUserAuth { UserName = a.UserName, PasswordByte = a.PasswordByte, IsEnabled = a.IsEnabled, UserInfoId = a.UserInfoId, Id = a.Id }; TblUserAuth tblUserAuth = _qAuth.FirstOrDefault(); if (tblUserAuth == null) { var _qAuth2 = from a in db.TblUserAuth where a.UserName == userBO.UserName select new TblUserAuth { UserName = a.UserName, PasswordByte = a.PasswordByte, IsEnabled = a.IsEnabled, UserInfoId = a.UserInfoId, Id = a.Id }; tblUserAuth = _qAuth2.FirstOrDefault(); if (tblUserAuth == null) { throw new System.ArgumentException("User Does Not Exist"); } UserAuthHistoryRepository userAuthHistoryRepository = new UserAuthHistoryRepository(); userAuthHistoryRepository.Create((int)AuthStatus.Invalid_User, tblUserAuth, db); throw new System.ArgumentException("User Authentication Failed"); } else { UserAuthHistoryRepository userAuthHistoryRepository = new UserAuthHistoryRepository(); userAuthHistoryRepository.Create((int)AuthStatus.Success, tblUserAuth, db); return(tblUserAuth); } }
public TblUserRole Get(TblUserAuth userAuth, Minny_Casino_AffiliateContext db) { var _qObj = from a in db.TblUserRole where a.UserAuthId == userAuth.Id select new TblUserRole { AccessRole = a.AccessRole, IsEnabled = a.IsEnabled, CreatedOn = a.CreatedOn, Id = a.Id }; TblUserRole userRole = _qObj.FirstOrDefault(); return(userRole); }
public TblUserInfo Create(UserBO userBO, Minny_Casino_AffiliateContext db) { TblUserInfo _userInfo = new TblUserInfo(); _userInfo.FirstName = userBO.FirstName; _userInfo.LastName = userBO.LastName; _userInfo.PhoneNumber = userBO.PhoneNumber; _userInfo.Email = userBO.Email; _userInfo.Dob = userBO.Dob; _userInfo.CountryIsoCode2 = userBO.CountryIsoCode2; _userInfo.Gender = userBO.Gender; _userInfo.Uid = new Guid().ToString(); _userInfo.IsEnabled = true; _userInfo.EmailStatus = (short)EmailStatus.Unverified; db.TblUserInfo.Add(_userInfo); db.SaveChanges(); return(_userInfo); }
public List <TblUserWallet> Get(TblUserAuth userAuth, Minny_Casino_AffiliateContext db) { var _qUi = from a in db.TblUserWallet join b in db.TblWalletType on a.WalletTypeId equals b.Id where a.UserAuthId == userAuth.Id select new TblUserWallet { Id = a.Id, UserAuthId = a.UserAuthId, WalletTypeId = a.WalletTypeId, IsEnabled = a.IsEnabled, Balance = a.Balance, CreatedOn = a.CreatedOn, ModifiedOn = a.ModifiedOn, WalletType = a.WalletType }; List <TblUserWallet> userWallet = _qUi.ToList <TblUserWallet>(); return(userWallet); }
public bool Create(short authStatus, TblUserAuth userAuth, Minny_Casino_AffiliateContext db) { TblUserAuthHistory _userAuthHistory = new TblUserAuthHistory(); _userAuthHistory.AuthStatus = authStatus; _userAuthHistory.UserAuthId = userAuth.Id; if (authStatus == (int)AuthStatus.Success) { _userAuthHistory.IsSuccess = true; } else { _userAuthHistory.IsSuccess = false; } db.TblUserAuthHistory.Add(_userAuthHistory); db.SaveChanges(); return(true); }
public TblUserInfo Get(TblUserAuth userAuth, Minny_Casino_AffiliateContext db) { var _qUi = from a in db.TblUserInfo where a.Id == userAuth.UserInfoId select new TblUserInfo { FirstName = a.FirstName, LastName = a.LastName, Dob = a.Dob, Email = a.Email, PhoneNumber = a.PhoneNumber, Gender = a.Gender, Uid = a.Uid, EmailStatus = a.EmailStatus, CreatedOn = a.CreatedOn, CountryIsoCode2 = a.CountryIsoCode2, CompanyName = a.CompanyName }; TblUserInfo _tblUserInfo = _qUi.FirstOrDefault(); return(_tblUserInfo); }
public TblUserAuth Create(UserBO userBO, TblUserInfo userInfo, Minny_Casino_AffiliateContext db) { TblUserAuth _userAuth = new TblUserAuth(); byte[] _passwordByte = Encoding.ASCII.GetBytes(userBO.PasswordString); byte[] _hashPasswordByte; SHA512 shaM = new SHA512Managed(); _hashPasswordByte = shaM.ComputeHash(_passwordByte); string base64Password = System.Convert.ToBase64String(_hashPasswordByte); _userAuth.UserName = userBO.UserName; _userAuth.PasswordByte = _hashPasswordByte; _userAuth.IsTempPassword = false; _userAuth.IsEnabled = true; _userAuth.LoginStatus = (short)LoginStatus.Enabled; _userAuth.UserInfoId = userInfo.Id; db.TblUserAuth.Add(_userAuth); db.SaveChanges(); return(_userAuth); }