コード例 #1
0
 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;
     }
 }
コード例 #2
0
 public bool CanCancelRecurringPayment(Member memberToValidate, RecurringPayment recurringPayment)
 {
     throw new NotImplementedException();
 }
コード例 #3
0
        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;
            }
        }
コード例 #4
0
 public void Insert(Member entity)
 {
     using (var dba = new BetEXDataContainer())
     {
         dba.AddToMembers(entity);
         dba.SaveChanges();
     }
 }
コード例 #5
0
        public ActionResult Register(RegisterModel model)
        {
            MembershipCreateStatus createStatus = new MembershipCreateStatus();
            var member = new Member();
            if (IoC.Resolve<ICustomerService>().checkExistEmail(model.Email))
            {
                createStatus = MembershipCreateStatus.DuplicateEmail;
            }
            else if (model.Email2 != null && IoC.Resolve<ICustomerService>().checkExistEmail(model.Email2))
            {
                createStatus = MembershipCreateStatus.DuplicateEmail;
            }
            else if (IoC.Resolve<ICustomerService>().checkExistNickName(model.NickName))
            {
                createStatus = MembershipCreateStatus.DuplicateUserName;
            }
            else
            {
                // Attempt to register the user
                member.NickName = CommonHelper.EnsureNotNull(model.NickName);
                member.Password = FormsAuthentication.HashPasswordForStoringInConfigFile(model.Password.Trim(), "sha1");
                member.SecurityQuestion1 = CommonHelper.EnsureNotNull(model.SecurityQuestion1);
                member.SecurityAnswer1 = CommonHelper.EnsureNotNull(model.SecurityAnswer1);
                member.SecurityQuestion2 = CommonHelper.EnsureNotNull(model.SecurityQuestion2);
                member.SecurityAnswer2 = CommonHelper.EnsureNotNull(model.SecurityAnswer2);
                member.Currency = short.Parse(Request.Form["Currency"].ToString());
                member.FirstName = CommonHelper.EnsureNotNull(model.FirstName);
                member.MiddleName = CommonHelper.EnsureNotNull(model.MiddleName);
                member.LastName = CommonHelper.EnsureNotNull(model.LastName);
                member.Address = CommonHelper.EnsureNotNull(model.Address);
                member.City = CommonHelper.EnsureNotNull(model.City);
                member.PostalCode = CommonHelper.EnsureNotNull(model.PostalCode);
                member.Telephone = CommonHelper.EnsureNotNull(model.Telephone);
                member.Cellphone = CommonHelper.EnsureNotNull(model.Cellphone);
                member.Country = Request.Form["Country"].ToInt64();
                member.Email1 = CommonHelper.EnsureNotNull(model.Email);
                member.Email2 = CommonHelper.EnsureNotNull(model.Email2);
                member.Gender = Request.Form["Gender"] == "M" ? true : false;
                member.BettingRegion = CommonHelper.EnsureNotNull(model.BettingRegion);
                member.Timezone = CommonHelper.EnsureNotNull(model.Timezone);
                member.AddedDate = DateTime.UtcNow;
                member.Updatedate = DateTime.UtcNow;
                member.Status = Constant.Status.INACTIVE;
                member.IsActive = false;

                IoC.Resolve<ICustomerService>().Insert(member);
                createStatus = MembershipCreateStatus.Success;
            }

            if (createStatus == MembershipCreateStatus.Success)
            {
                //FormsAuthentication.SetAuthCookie(member.NickName, false /* createPersistentCookie */);
                return RedirectToAction("Index", "Home");
            }
            else
            {
                ModelState.AddModelError("", ErrorCodeToString(createStatus));
            }

            // If we got this far, something failed, redisplay form
            return View(model);
        }
コード例 #6
0
 public ActionResult MyProfile(Member model)
 {
     IoC.Resolve<ICustomerService>().Update(model);
     return View();
 }
コード例 #7
0
 /// <summary>
 /// Deprecated Method for adding a new object to the Members EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
 /// </summary>
 public void AddToMembers(Member member)
 {
     base.AddObject("Members", member);
 }
コード例 #8
0
 /// <summary>
 /// Create a new Member object.
 /// </summary>
 /// <param name="memberID">Initial value of the MemberID property.</param>
 /// <param name="nickName">Initial value of the NickName property.</param>
 /// <param name="password">Initial value of the Password property.</param>
 /// <param name="securityQuestion1">Initial value of the SecurityQuestion1 property.</param>
 /// <param name="securityQuestion2">Initial value of the SecurityQuestion2 property.</param>
 /// <param name="securityAnswer1">Initial value of the SecurityAnswer1 property.</param>
 /// <param name="securityAnswer2">Initial value of the SecurityAnswer2 property.</param>
 /// <param name="firstName">Initial value of the FirstName property.</param>
 /// <param name="middleName">Initial value of the MiddleName property.</param>
 /// <param name="lastName">Initial value of the LastName property.</param>
 /// <param name="country">Initial value of the Country property.</param>
 /// <param name="address">Initial value of the Address property.</param>
 /// <param name="city">Initial value of the City property.</param>
 /// <param name="postalCode">Initial value of the PostalCode property.</param>
 /// <param name="telephone">Initial value of the Telephone property.</param>
 /// <param name="cellphone">Initial value of the Cellphone property.</param>
 /// <param name="email1">Initial value of the Email1 property.</param>
 /// <param name="email2">Initial value of the Email2 property.</param>
 /// <param name="gender">Initial value of the Gender property.</param>
 public static Member CreateMember(global::System.Int64 memberID, global::System.String nickName, global::System.String password, global::System.String securityQuestion1, global::System.String securityQuestion2, global::System.String securityAnswer1, global::System.String securityAnswer2, global::System.String firstName, global::System.String middleName, global::System.String lastName, global::System.Int64 country, global::System.String address, global::System.String city, global::System.String postalCode, global::System.String telephone, global::System.String cellphone, global::System.String email1, global::System.String email2, global::System.Boolean gender)
 {
     Member member = new Member();
     member.MemberID = memberID;
     member.NickName = nickName;
     member.Password = password;
     member.SecurityQuestion1 = securityQuestion1;
     member.SecurityQuestion2 = securityQuestion2;
     member.SecurityAnswer1 = securityAnswer1;
     member.SecurityAnswer2 = securityAnswer2;
     member.FirstName = firstName;
     member.MiddleName = middleName;
     member.LastName = lastName;
     member.Country = country;
     member.Address = address;
     member.City = city;
     member.PostalCode = postalCode;
     member.Telephone = telephone;
     member.Cellphone = cellphone;
     member.Email1 = email1;
     member.Email2 = email2;
     member.Gender = gender;
     return member;
 }