コード例 #1
0
        public bool AddCustomer(CustomerBasicDetails customer)
        {
            try
            {
                using (var dataContract = new CustomerContract())
                {
                    using (var scope = new TransactionScope())
                    {
                        Guid customerId = Guid.NewGuid();
                        var  isSaved    = dataContract.AddNewCoustomer(customer, customerId);
                        if (isSaved)
                        {
                            new CustomerAttributeServices().AddCustomerAddress(customer, customerId);
                            new PasswordServices().CreateAccountPassword(customerId, customer.Password);
                            new OtpServicescs().SendOTP(new OtpDetailsModel {
                                Email = customer.Email, RefCustomerGuid = customerId, CustomerName = customer.FirstName + " " + customer.LastName, Prupose = "RegisterUser"
                            });
                        }
                        scope.Complete();

                        return(true);
                    }
                }
            }
            catch
            {
                throw;
            }
        }
コード例 #2
0
        public ApiResponse <bool> UserRegistration(CustomerBasicDetails customerBasicDetails)
        {
            var customerSummary = _customerServices.GetCustomerSummaryByEmail(customerBasicDetails.Email);

            if (customerSummary == null)
            {
                bool isAdded = _customerServices.AddCustomer(customerBasicDetails);
                return(ApiUtility.ApiSuccess <bool>(isAdded, isAdded ? "New customer added successfully" : "Failed !!!"));
            }
            else
            {
                return(ApiUtility.ApiSuccess <bool>(false, "Email already found"));
            }
        }
コード例 #3
0
        public bool AddNewCoustomer(CustomerBasicDetails customerBasicDetails, Guid customerId)
        {
            try
            {
                using (var dataContext = new BrownBagDataEntities())
                {
                    var customer = new BrownBagService.DataAccess.DataEntity.Customer
                    {
                        Active                  = 0,
                        AdminComment            = null,
                        AffiliateId             = 0,
                        IsTaxExempt             = 0,
                        VendorId                = 0,
                        CannotLoginUntilDateUtc = DateTime.Now.ToUniversalTime(),
                        Deleted                 = 0,
                        Email                = customerBasicDetails.Email.Trim(),
                        EmailToRevalidate    = null,
                        Username             = customerBasicDetails.Email.Trim(),
                        CustomerGuid         = customerId,
                        BillingAddress_Id    = null,
                        FailedLoginAttempts  = 0,
                        HasShoppingCartItems = 0,
                        IsSystemAccount      = 0,
                        ShippingAddress_Id   = null,
                        LastActivityDateUtc  = DateTime.Now.ToUniversalTime(),
                        LastIpAddress        = null,
                        LastLoginDateUtc     = null,
                        RequireReLogin       = 0,
                        RegisteredInStoreId  = 1,
                        SystemName           = null,
                        CreatedOnUtc         = DateTime.Now.ToUniversalTime(),
                    };
                    dataContext.Customers.Add(customer);

                    int rowCount = dataContext.SaveChanges();
                    if (rowCount > 0)
                    {
                        dataContext.Customer_CustomerRole_Mapping.Add(new Customer_CustomerRole_Mapping {
                            CustomerRole_Id = 3, Customer_Id = customer.Id
                        });
                    }
                    return(dataContext.SaveChanges() > 0 ? true : false);
                }
            }
            catch
            {
                throw;
            }
        }
コード例 #4
0
 public bool AddCustomerAddress(CustomerBasicDetails customer, Guid customerId)
 {
     try
     {
         using (var dataAddressContract = new CustomerAttributeContract())
         {
             return(dataAddressContract.AddNewAddress(new CustomerDetailAttribute {
                 Customer_Id = customerId, Customer_Name = customer.FirstName.Trim() + " " + customer.LastName.Trim(), Customer_Phone = customer.PhoneNumber, Customer_Email = customer.Email, Customer_Active = 1
             }));
         }
     }
     catch
     {
         throw;
     }
 }