コード例 #1
0
 internal void GeneratePassword()
 {
     try {
         PasswordGenerator pw = new PasswordGenerator();
         string new_pass = pw.Generate();
         this.plainpassword = new_pass;
         this.password = UDF.EncryptString(new_pass);
     } catch (Exception) {}
 }
コード例 #2
0
        internal void Save()
        {
            EcommercePlatformDataContext db = new EcommercePlatformDataContext();
            PasswordGenerator pw = new PasswordGenerator();
                string new_pass = pw.Generate();

            // Make sure we don't have an account with this e-mail address
            Customer cust = this.GetCustomerByEmail();
            if (cust != null && cust.ID > 0) {
                throw new Exception("An account using the E-Mail address you provided already exists.");
            }

            // We are going to make an attempt at saving the Customer record

            Customer new_customer = new Customer {
                email = this.email,
                fname = this.fname,
                lname = this.lname,
                phone = this.phone,
                dateAdded = this.dateAdded,
                isSuspended = this.isSuspended,
                isValidated = this.isValidated,
                validator = this.validator,
                password = this.password,
                receiveNewsletter = this.receiveNewsletter,
                receiveOffers = this.receiveOffers,
            };

            db.Customers.InsertOnSubmit(new_customer);
            db.SubmitChanges();
            this.ID = new_customer.ID;

            SendNotification();
        }