예제 #1
0
        public static bool CreateUser(string username, string password, bool newsletter, string memberName, DateTime?dob,
                                      string gender, MemberTypeType mtype)
        {
            try
            {
                if (username.Trim() == string.Empty)
                {
                    return(false);
                }
                if (password.Trim() == string.Empty)
                {
                    return(false);
                }
                if (EmailExist(username))
                {
                    return(false);
                }

                using (RockyingDataClassesDataContext dc = new RockyingDataClassesDataContext(Utility.ConnectionString))
                {
                    Member m = new Member();
                    m.Createdate = DateTime.Now;
                    m.Email      = username;
                    m.MemberName = memberName;
                    m.Newsletter = newsletter;
                    m.Password   = password;
                    m.Status     = (byte)GeneralStatusType.Unverified;
                    m.UserType   = (byte)mtype;
                    m.DOB        = dob;
                    m.Gender     = char.Parse(gender);
                    dc.Members.InsertOnSubmit(m);
                    dc.SubmitChanges();
                    return(true);
                }
            }
            catch
            {
                throw;
            }
        }
예제 #2
0
 public static bool Update(string username,
                           string name, bool newsletter,
                           DateTime dob, string country, string alternateEmail,
                           string mobile, string alternateEmail2,
                           string phone, string address,
                           string lastname, long modifiedby,
                           string gender, MemberTypeType mtype)
 {
     try
     {
         using (RockyingDataClassesDataContext dc = new RockyingDataClassesDataContext(Utility.ConnectionString))
         {
             var m = (from t in dc.Members where t.Email == username select t).SingleOrDefault();
             m.MemberName      = name;
             m.Newsletter      = newsletter;
             m.DOB             = dob;
             m.Country         = country;
             m.AlternateEmail  = alternateEmail;
             m.AlternateEmail2 = alternateEmail2;
             m.Mobile          = mobile;
             m.Phone           = phone;
             m.Address         = address;
             m.LastName        = lastname;
             m.ModifiedBy      = modifiedby;
             m.ModifyDate      = DateTime.Now;
             m.Gender          = char.Parse(gender);
             m.UserType        = (byte)mtype;
             dc.SubmitChanges();
             return(true);
         }
     }
     catch
     {
         throw;
     }
 }