コード例 #1
0
 internal void ClearAddress(int id)
 {
     if (this.billingID == id || this.shippingID == id) {
         Customer tmp = new Customer();
         EcommercePlatformDataContext db = new EcommercePlatformDataContext();
         tmp = db.Customers.Where(x => x.ID.Equals(this.ID)).FirstOrDefault<Customer>();
         if (tmp.billingID == id) {
             tmp.billingID = 0;
         }
         if (tmp.shippingID == id) {
             tmp.shippingID = 0;
         }
         db.SubmitChanges();
     }
 }
コード例 #2
0
		private void detach_Customers1(Customer entity)
		{
			this.SendPropertyChanging();
			entity.Address1 = null;
		}
コード例 #3
0
		private void attach_Customers(Customer entity)
		{
			this.SendPropertyChanging();
			entity.Address = this;
		}
コード例 #4
0
 partial void DeleteCustomer(Customer instance);
コード例 #5
0
 partial void UpdateCustomer(Customer instance);
コード例 #6
0
 partial void InsertCustomer(Customer instance);
コード例 #7
0
ファイル: Customer.cs プロジェクト: curt-labs/CURTeCommerce
        internal void Save() {
            EcommercePlatformDataContext db = new EcommercePlatformDataContext();
            Settings settings = new Settings();
            bool RequireCustomerActivation = true;
            if (settings.Get("RequireCustomerActivation") == "false") {
                RequireCustomerActivation = false;
            }

            // 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,
            };

            if (!RequireCustomerActivation) {
                new_customer.isValidated = 1;
            }
            db.Customers.InsertOnSubmit(new_customer);
            db.SubmitChanges();
            this.ID = new_customer.ID;

            if (RequireCustomerActivation) {
                SendValidation();
            }
        }
コード例 #8
0
ファイル: Customer.cs プロジェクト: curt-labs/CURTeCommerce
        internal void GetFromStorage(HttpContext ctx) {

            HttpCookie cart_cookie = null;
            int cartID = 0;
            int custID = 0;
            Cart cart = new Cart();
            cart_cookie = ctx.Request.Cookies.Get("hdcart");
            if (cart_cookie != null && cart_cookie.Value != null && cart_cookie.Value.Length > 0) {
                cartID = Convert.ToInt32(cart_cookie.Value);
            }
            if (cartID == 0) {
                // cart doesn't exist yet / no cookie
                cart = cart.Save();
                cartID = cart.ID;
                HttpCookie cook = new HttpCookie("hdcart", cartID.ToString());
                if (this.remember) {
                    cook.Expires = DateTime.Now.AddDays(30);
                }
                ctx.Response.Cookies.Add(cook);
            } else {
                // cookie exists
                try {
                    // attempt to get cart
                    cart = new Cart().Get(cartID);
                    custID = cart.cust_id;
                } catch {
                    // no cart
                    cart = cart.Save();
                    cartID = cart.ID;
                    HttpCookie cook = new HttpCookie("hdcart", cartID.ToString());
                    if (this.remember) {
                        cook.Expires = DateTime.Now.AddDays(30);
                    }
                    ctx.Response.Cookies.Add(cook);
                }
            }

            Customer customer = new Customer();
            if (custID > 0) {
                // customer ID exists on cart. Get customer
                try {
                    customer = customer.Get(custID);
                } catch { }
            }
            customer.Cart = cart;

            this.ID = customer.ID;
            this.email = customer.email;
            this.fname = customer.fname;
            this.lname = customer.lname;
            this.phone = customer.phone;
            this.dateAdded = customer.dateAdded;
            this.isSuspended = customer.isSuspended;
            this.receiveNewsletter = customer.receiveNewsletter;
            this.receiveOffers = customer.receiveOffers;
            this.billingID = customer.billingID;
            this.shippingID = customer.shippingID;
            this.validator = customer.validator;
            this.Cart = customer.Cart;
            this.remember = customer.remember;
        }
コード例 #9
0
ファイル: Customer.cs プロジェクト: curt-labs/CURTeCommerce
 internal void SetShippingDefaultAddress(int id) {
     EcommercePlatformDataContext db = new EcommercePlatformDataContext();
     Customer cust = new Customer();
     cust = db.Customers.Where(x => x.ID.Equals(this.ID)).FirstOrDefault<Customer>();
     cust.shippingID = id;
     db.SubmitChanges();
     this.shippingID = id;
 }
コード例 #10
0
ファイル: Customer.cs プロジェクト: curt-labs/CURTeCommerce
 internal Customer Get(int id = 0) {
     try {
         Customer cust = new Customer();
         EcommercePlatformDataContext db = new EcommercePlatformDataContext();
         cust = db.Customers.Where(x => x.ID.Equals(id)).FirstOrDefault<Customer>();
         return cust;
     } catch (Exception) {
         throw new Exception("Unable to retrieve Customer record.");
     }
 }
コード例 #11
0
ファイル: Customer.cs プロジェクト: curt-labs/CURTeCommerce
        internal void SaveAddresses(Address billing, Address shipping) {
            
            this.billingID = billing.ID;
            this.shippingID = shipping.ID;

            Customer tmp = new Customer();
            EcommercePlatformDataContext db = new EcommercePlatformDataContext();
            tmp = db.Customers.Where(x => x.ID.Equals(this.ID)).FirstOrDefault<Customer>();
            tmp.billingID = this.billingID;
            tmp.shippingID = this.shippingID;
            db.SubmitChanges();
        }
コード例 #12
0
ファイル: Customer.cs プロジェクト: curt-labs/CURTeCommerce
 internal void UpdatePassword() {
     Customer tmp = new Customer();
     EcommercePlatformDataContext db = new EcommercePlatformDataContext();
     tmp = db.Customers.Where(x => x.ID.Equals(this.ID)).FirstOrDefault<Customer>();
     tmp.password = this.password;
     db.SubmitChanges();
 }
コード例 #13
0
ファイル: Customer.cs プロジェクト: curt-labs/CURTeCommerce
 internal void Update(string email, string fname, string lname, string phone, int receiveOffers, int receiveNewsletter) {
     Customer tmp = new Customer();
     EcommercePlatformDataContext db = new EcommercePlatformDataContext();
     tmp = db.Customers.Where(x => x.ID.Equals(this.ID)).FirstOrDefault<Customer>();
     tmp.email = email;
     tmp.fname = fname;
     tmp.lname = lname;
     tmp.phone = phone;
     tmp.receiveNewsletter = receiveNewsletter;
     tmp.receiveOffers = receiveOffers;
     db.SubmitChanges();
 }