/// <summary> /// Get Bet for User login /// </summary> /// <param name="memberId">memberId</param> /// <returns>List mybet</returns> public List<PSV_MYBET> GetMyBetByMemberId(long memberId) { using (var dba = new BetEXDataContainer()) { var mybet = dba.PSV_MYBET.Where(w => w.MemberID == memberId).ToList(); return mybet; } }
/// <summary> /// Get Bet for User login follow bettype(Betting P/L,Settled Bets, Cancelled Bets, Lapsed Bets, Void Bets) /// </summary> /// <param name="memberId">memberId</param> /// <param name="type">type</param> /// <returns>List mybet</returns> public List<PSV_MYBET> GetMyBetByType(long memberId, Int16 type) { using (var dba = new BetEXDataContainer()) { var mybet = dba.PSV_MYBET.Where(w => w.BetStatusID == type && w.MemberID == memberId).ToList(); return mybet; } }
/// <summary> /// Check nickname is exist in database /// </summary> /// <param name="email">nickname to check</param> /// <returns>true, false</returns> public bool checkExistNickName(string nickName) { using (var dba = new BetEXDataContainer()) { var member = dba.Members.Where(w => w.NickName == nickName).SingleOrDefault(); if (member != null) return true; } return false; }
/// <summary> /// Check email is exist in database /// </summary> /// <param name="email">email to check</param> /// <returns>true, false</returns> public bool checkExistEmail(string email) { using (var dba = new BetEXDataContainer()) { var member = dba.Members.Where(w => w.Email1 == email || w.Email2 == email).SingleOrDefault(); if (member != null) return true; } return false; }
public bool Delete(Member entity) { using (var dba = new BetEXDataContainer()) { var member = dba.Members.Where(w => w.MemberID == entity.MemberID).SingleOrDefault(); if (member != null) { dba.DeleteObject(member); return true; } return false; } }
/// <summary> /// Authenticate a customer /// </summary> /// <param name="email">A customer email</param> /// <param name="password">Password</param> /// <returns>Result</returns> public bool Authenticate(string nickname, string password) { using (var dba = new BetEXDataContainer()) { var profile = dba.Members.Where(w => w.NickName == nickname && w.Password == password && w.Status == Constant.Status.ACTIVE && w.IsActive == true).SingleOrDefault(); if (profile != null) { FormsAuthentication.SetAuthCookie(nickname, false); return true; } } return false; }
/// <summary> /// Get Bet for User login /// </summary> /// <param name="memberId">memberId</param> /// <param name="dateFrom">date start to search</param> /// <param name="dateTo">date end to search</param> /// <returns>List mybet</returns> public List<PSV_MYBET> GetMyBetByMemberId(long memberId, DateTime? dateFrom, DateTime? dateTo) { var mybet= new List<PSV_MYBET>(); using (var dba = new BetEXDataContainer()) { if (dateFrom == null && dateTo == null) { mybet = GetMyBetByMemberId(memberId); } else { mybet = dba.PSV_MYBET.Where(w => w.MemberID == memberId && w.SubmitedTime>=dateFrom && w.SubmitedTime<=dateTo).ToList(); } return mybet; } }
/// <summary> /// get all country in database /// </summary> /// <returns></returns> public SelectList getAllCountry() { using (var dba = new BetEXDataContainer()) { var listCountry = dba.Countries.ToList(); List<SelectListItem> Items = new List<SelectListItem>(); foreach (Country item in listCountry) { SelectListItem AddItem = new SelectListItem(); AddItem.Value = item.ID.ToString(); AddItem.Text = item.Country1; Items.Add(AddItem); } SelectList Res = new SelectList(Items, "Value", "Text"); return Res; } }
/// <summary> /// Gets a customer /// </summary> /// <param name="customerId">Customer identifier</param> /// <returns>A customer</returns> public Member GetCustomerById(long customerId) { using (var dba = new BetEXDataContainer()) { return dba.Members.Where(w => w.MemberID == customerId).SingleOrDefault(); } }
/// <summary> /// Get Statement for User login /// </summary> /// <param name="memberId">memberId</param> /// <returns>List mybet</returns> public List<Statement> GetStatementByMemberId(long memberId) { using (var dba = new BetEXDataContainer()) { var statement = dba.Statements.Where(w => w.MemberId == memberId).ToList(); return statement; } }
public void Insert(Member entity) { using (var dba = new BetEXDataContainer()) { dba.AddToMembers(entity); dba.SaveChanges(); } }
/// <summary> /// Gets a customer by username /// </summary> /// <param name="username">Customer username</param> /// <returns>A customer</returns> public Member GetCustomerByUsername(string username) { using (var dba = new BetEXDataContainer()) { return dba.Members.Where(w => w.NickName == username && w.Status == Constant.Status.ACTIVE).SingleOrDefault(); } }
public bool Update(Member entity) { using (var dba = new BetEXDataContainer()) { var member = dba.Members.Where(w => w.MemberID == entity.MemberID).SingleOrDefault(); if (member != null) { member.NickName = CommonHelper.EnsureNotNull(entity.NickName); member.FirstName = CommonHelper.EnsureNotNull(entity.FirstName); member.LastName = CommonHelper.EnsureNotNull(entity.LastName); member.MiddleName = CommonHelper.EnsureNotNull(entity.MiddleName); member.SecurityQuestion1 = CommonHelper.EnsureNotNull(entity.SecurityQuestion1) ?? member.SecurityQuestion1; member.SecurityQuestion2 = CommonHelper.EnsureNotNull(entity.SecurityQuestion2) ?? member.SecurityQuestion2; member.SecurityAnswer1 = CommonHelper.EnsureNotNull(entity.SecurityAnswer1) ?? member.SecurityAnswer1; member.SecurityAnswer2 = CommonHelper.EnsureNotNull(entity.SecurityAnswer2) ?? member.SecurityAnswer2; member.Address = CommonHelper.EnsureNotNull(entity.Address) ?? member.Address; member.City = CommonHelper.EnsureNotNull(entity.City) ?? member.City; member.PostalCode = CommonHelper.EnsureNotNull(entity.PostalCode) ?? member.PostalCode; member.Telephone = CommonHelper.EnsureNotNull(entity.Telephone) ?? member.Telephone; member.Cellphone = CommonHelper.EnsureNotNull(entity.Cellphone) ?? member.Cellphone; member.Email1 = CommonHelper.EnsureNotNull(entity.Email1) ?? member.Email1; member.Email2 = CommonHelper.EnsureNotNull(entity.Email2) ?? member.Email2; member.Country = entity.Country; member.Gender = entity.Gender; member.Suffix = CommonHelper.EnsureNotNull(entity.Suffix) ?? member.Suffix; member.TotalPoints = entity.TotalPoints ?? member.TotalPoints; member.DiscountRate = entity.DiscountRate ?? member.DiscountRate; member.LastUpdate = entity.LastUpdate ?? member.LastUpdate; member.Language = CommonHelper.EnsureNotNull(entity.Language) ?? member.Language; member.BettingRegion = CommonHelper.EnsureNotNull(entity.BettingRegion) ?? member.BettingRegion; member.Timezone = CommonHelper.EnsureNotNull(entity.Timezone) ?? member.Timezone; member.Currency = entity.Currency ?? member.Currency; member.AutoLogout = entity.AutoLogout ?? member.AutoLogout; member.EmailFormat = CommonHelper.EnsureNotNull(entity.EmailFormat) ?? member.EmailFormat; dba.SaveChanges(); } return true; } }
/// <summary> /// Get Statement for User login /// </summary> /// <param name="memberId">memberId</param> /// <returns>List mybet</returns> public List<Statement> GetStatementByMemberId(long memberId, DateTime startDate, DateTime endDate, int betCategory, int betDisplay, int pageNo, int recordPerpage) { using (var dba = new BetEXDataContainer()) { var statement = dba.PSP_SEARCHSTATEMENT(memberId, startDate, endDate, betCategory, betDisplay, pageNo, recordPerpage).ToList(); return statement; } }
public long InsertHistory(LoginHistory history) { using (var dba = new BetEXDataContainer()) { dba.AddToLoginHistories(history); dba.SaveChanges(); return history.ID; } }
/// <summary> /// Gets last TransactionPayment by userID /// </summary> /// <param name="UserId">The UserId identifier</param> /// <returns>TransactionPayment</returns> public TransactionPayment GetTransactionPaymentByUserId(long UserId) { TransactionPayment transactionPayment = new TransactionPayment(); Transaction transaction=new Transaction(); using (var dba = new BetEXDataContainer()) { byte type = (byte)1; var listTransaction = dba.Transactions.Where(w => w.MemberId == UserId && w.Type == type).OrderByDescending(z=>z.Amount).ToList(); if (listTransaction != null) { transaction = listTransaction[0]; } } if (transaction != null) { transactionPayment.TransactionPaymentId = transaction.ID; transactionPayment.TransactionPaymentType = transaction.Type; transactionPayment.MemberId = transaction.MemberId; transactionPayment.MemberIP = transaction.MemberIP; transactionPayment.TransactionIDRespone = transaction.ResponeTranId!=null?transaction.ResponeTranId.Value:0; transactionPayment.TransactionPaymentTotal = transaction.Amount; transactionPayment.TransactionPaymentStatusId = transaction.Status; transactionPayment.PaymentMethodId = transaction.PaymentMenthodID; transactionPayment.MemberEmail = transaction.MemberEmail; } return transactionPayment; }
/// <summary> /// Gets a customer by email /// </summary> /// <param name="email">Customer Email</param> /// <returns>A customer</returns> public Member GetCustomerByEmail(string email) { using (var dba = new BetEXDataContainer()) { return dba.Members.Where(w => w.Email1 == email || w.Email2 == email && w.Status==Constant.Status.ACTIVE).SingleOrDefault(); } }
public LoginHistory LastLogin(long memberID) { using (var dba = new BetEXDataContainer()) { var lstHisttory = dba.LoginHistories.Where(w => w.MemberID == memberID).OrderByDescending(k => k.ID).ToList(); if (lstHisttory != null) return lstHisttory[0]; } return null; }
/// <summary> /// Marks customer as deleted /// </summary> /// <param name="customerId">Customer identifier</param> public bool MarkCustomerAsDeleted(long customerId) { using (var dba = new BetEXDataContainer()) { var member = dba.Members.Where(w => w.MemberID == customerId).SingleOrDefault(); if (member != null) { member.Status = Constant.Status.DELETED; dba.SaveChanges(); return true; } return false; } }
public bool UpdateHistory(LoginHistory history) { using (var dba = new BetEXDataContainer()) { try { var Orghistory = dba.LoginHistories.Where(w => w.ID == history.ID).SingleOrDefault(); if (Orghistory != null) { Orghistory.LogoutTime = history.LogoutTime; dba.SaveChanges(); } return true; } catch { return false; } } }
/// <summary> /// Marks customer as active the first time throught active email /// </summary> /// <param name="customerId">Customer identifier</param> public bool UpdateFirstActive(long customerId) { using (var dba = new BetEXDataContainer()) { var member = dba.Members.Where(w => w.MemberID == customerId).SingleOrDefault(); if (member != null) { member.Status = Constant.Status.ACTIVE; member.IsActive = true; dba.SaveChanges(); return true; } return false; } }
/// <summary> /// Gets List Transaction by userID /// </summary> /// <param name="UserId">The UserId identifier</param> /// <returns>List Transaction</returns> public List<Transaction> GetTransactionByUserId(long UserId) { using (var dba = new BetEXDataContainer()) { var lstTran = dba.Transactions.Where(w => w.MemberId == UserId).ToList(); if (lstTran != null && lstTran.Count > 0) return lstTran; } return null; }
public MyWallet GetAccountWallet(long memberId) { using (var dba = new BetEXDataContainer()) { return dba.MyWallets.Where(w => w.MemberID == memberId).SingleOrDefault(); } }
/// <summary> /// Gets an TransactionPayment /// </summary> /// <param name="TransactionPaymentId">The TransactionPayment identifier</param> /// <returns>TransactionPayment</returns> public TransactionPayment GetTransactionPaymentById(long transactionPaymentId) { TransactionPayment transactionPayment = new TransactionPayment(); Transaction transaction; using (var dba = new BetEXDataContainer()) { transaction = dba.Transactions.Where(w => w.ID == transactionPaymentId).SingleOrDefault(); } if (transaction != null) { transactionPayment.TransactionPaymentId = transactionPaymentId; transactionPayment.TransactionPaymentType = transaction.Type; transactionPayment.MemberId = transaction.MemberId; transactionPayment.MemberIP = transaction.MemberIP; transactionPayment.TransactionPaymentTotal = transaction.Amount; transactionPayment.TransactionPaymentStatusId = transaction.Status; transactionPayment.PaymentMethodId = transaction.PaymentMenthodID; transactionPayment.TransactionIDRespone = transaction.ResponeTranId!=null? transaction.ResponeTranId.Value:0; transactionPayment.MemberEmail = transaction.MemberEmail; } return transactionPayment; }
public IList<Member> GetAll() { using (var dba = new BetEXDataContainer()) { return dba.Members.Where(w => w.Status == Constant.Status.ACTIVE && w.IsActive == true).ToList(); } }
/// <summary> /// Gets all TransactionPayments by Member identifier /// </summary> /// <param name="MemberId">Member identifier</param> /// <returns>TransactionPayment collection</returns> public List<TransactionPayment> GetTransactionPaymentsByMemberId(long memberId) { List<TransactionPayment> lstTransactionPayment = new List<TransactionPayment>(); List<Transaction> lstTransaction; using (var dba = new BetEXDataContainer()) { lstTransaction = dba.Transactions.Where(w => w.MemberId == memberId).ToList(); } if (lstTransaction != null && lstTransaction.Count > 0) { foreach (var transaction in lstTransaction) { TransactionPayment transactionPayment = new TransactionPayment(); transactionPayment.TransactionPaymentId = transaction.ID; transactionPayment.TransactionPaymentType = transaction.Type; transactionPayment.MemberId = transaction.MemberId; transactionPayment.MemberIP = transaction.MemberIP; transactionPayment.TransactionPaymentTotal = transaction.Amount; transactionPayment.TransactionPaymentStatusId = transaction.Status; transactionPayment.PaymentMethodId = transaction.PaymentMenthodID; transactionPayment.MemberEmail = transaction.MemberEmail; transactionPayment.TransactionIDRespone = transaction.ResponeTranId != null ? transaction.ResponeTranId.Value : 0; lstTransactionPayment.Add(transactionPayment); } } return lstTransactionPayment; }
/// <summary> /// Sets a customer email /// </summary> /// <param name="customerId">Customer identifier</param> /// <param name="newEmail">New email</param> /// <returns>Customer</returns> public Member SetEmail(long customerId, string newEmail) { using (var dba = new BetEXDataContainer()) { var member = dba.Members.Where(w => w.MemberID == customerId).SingleOrDefault(); if (member != null) { member.Email1 = newEmail; dba.SaveChanges(); return member; } return null; } }