コード例 #1
0
        private static void InitCustomers(AppContext context)
        {
            var customer = new Customer()
            {
                CompanyName = "My Rental Pos",
                Email = "*****@*****.**",
                //Password = "******",
                FirstName = "Guest",
                LastName = "User",
                StoreId=1,
                ZipCode = "",
                Address = "",
                City = "",
                PhoneNumber = "",
                State = "",
                CreatedDate = DateTime.UtcNow
            };

            if (context.Set<Customer>().Any())
                return;

            context.Set<Customer>().AddOrUpdate(customer);

            context.SaveChanges();
        }
コード例 #2
0
        /// <summary>
        /// Gets a customer time zone
        /// </summary>
        /// <param name="customer">Customer</param>
        /// <returns>Customer time zone; if customer is null, then default store time zone</returns>
        public virtual TimeZoneInfo GetCustomerTimeZone(Customer customer)
        {
            //registered user
            TimeZoneInfo timeZoneInfo = null;
            //if (_dateTimeSettings.AllowCustomersToSetTimeZone)
            {
                string timeZoneId = string.Empty;
                /*if (customer != null)
                    timeZoneId = customer.TimeZoneId;
                */
                try
                {
                    if (!String.IsNullOrEmpty(timeZoneId))
                        timeZoneInfo = FindTimeZoneById(timeZoneId);
                }
                catch (Exception exc)
                {
                    Debug.Write(exc.ToString());
                }
            }

            //default timezone
            if (timeZoneInfo == null)
                timeZoneInfo = this.DefaultStoreTimeZone;

            return timeZoneInfo;
        }