コード例 #1
0
        public void SetCustomerLocalizationModel(int customerId, CustomerLocalizationModel customerLocalizationModel)
        {
            var customerProfile = RbacEntities.CustomerProfiles.FirstOrDefault(m => m.CustomerId == customerId);

            // Language
            var     settingFactory = new SettingsFactory();
            Setting setting        = settingFactory.GetListValue("Locale", customerLocalizationModel.LanguageId);

            if (setting != null)
            {
                settingFactory.Set(customerId, "CustomerLocale", setting.Value);

                // Write the local to customer.DefaultLocale also
                customerProfile.DefaultLocale = setting.Value;
            }


            // 12/ 24 hour format
            customerProfile.Is24HrFormat = customerLocalizationModel.Is24Hr;

            // TimeZone
            customerProfile.TimeZoneID = customerLocalizationModel.TimeZoneId;
            // Save changes.
            RbacEntities.SaveChanges();
        }
コード例 #2
0
        public void SetIdentificationModel(int customerId, MaintenanceGroupIdentificationModel identificationModel)
        {
            var customerProfile = RbacEntities.CustomerProfiles.SingleOrDefault(m => m.CustomerId == customerId);

            if (customerProfile == null)
            {
                return;
            }

            customerProfile.DisplayName = identificationModel.DisplayName;

            var settingFactory = new SettingsFactory();

            if (identificationModel.DefaultPassword != null)
            {
                settingFactory.Set(customerId, "DefaultPassword", identificationModel.DefaultPassword);
            }

            // Save customer contact
            SetCustomerContactModel(customerId, identificationModel.Contact);

            // Save Customer Localization data.
            SetCustomerLocalizationModel(customerId, identificationModel.Localization);

            RbacEntities.SaveChanges();
        }
コード例 #3
0
        public void SetCustomerContactModel(int customerId, CustomerContactModel customerContactModel)
        {
            var settingFactory = new SettingsFactory();

            if (customerContactModel.FirstName != null)
            {
                settingFactory.Set(customerId, "CustomerContactFirstName", customerContactModel.FirstName);
            }

            if (customerContactModel.LastName != null)
            {
                settingFactory.Set(customerId, "CustomerContactLastName", customerContactModel.LastName);
            }

            if (customerContactModel.FromEmailAddress != null)
            {
                settingFactory.Set(customerId, "CustomerContactEMail", customerContactModel.FromEmailAddress);
            }

            if (customerContactModel.PhoneNumber != null)
            {
                settingFactory.Set(customerId, "CustomerContactPhoneNumber", customerContactModel.PhoneNumber);
            }
        }