Example #1
0
        public void Init()
        {
            var autoMapperBootstrapper = new AutoMapperBootstrapper();

            autoMapperBootstrapper.Bootstrap();

            DependencyRegistrar.RegisterDependencies();

            _organizationService        = IoC.Resolve <IOrganizationService>();
            _corporateAccountRepository = IoC.Resolve <ICorporateAccountRepository>();

            var organizationEditModel = new OrganizationEditModel
            {
                Name            = "TestOrg",
                Description     = "TestOrg Description",
                BusinessAddress =
                    new AddressEditModel()
                {
                    StreetAddressLine1 = "StreetAddressLine1",
                    StreetAddressLine2 = "StreetAddressLine1",
                    City      = "Austin",
                    StateId   = 123,
                    CountryId = 1,
                    ZipCode   = "78705"
                },
                BillingAddress =
                    new AddressEditModel()
                {
                    StreetAddressLine1 = "StreetAddressLine11",
                    StreetAddressLine2 = "StreetAddressLine11",
                    City      = "Austin",
                    StateId   = 123,
                    CountryId = 1,
                    ZipCode   = "78701"
                },
                PhoneNumber = new PhoneNumber()
                {
                    AreaCode = "+1", Number = "232131"
                },
                FaxNumber = new PhoneNumber()
                {
                    AreaCode = "+1", Number = "232131"
                },
                Email = "*****@*****.**"
            };

            _corporateAccountEditModel = new CorporateAccountEditModel
            {
                OrganizationEditModel = organizationEditModel,
                ContractNotes         = "Some Contract",
                DefaultPackages       =
                    new List <Package>
                {
                    new Package()
                    {
                        Id = 1, Name = "abc temp"
                    }
                }
            };
        }
Example #2
0
        public ActionResult EditModel(long id, bool openNextTab = false)
        {
            var model = new CorporateAccountEditModel {
                AccountId = id, OpenNextTab = openNextTab
            };

            return(PartialView(model));
        }
Example #3
0
        public ActionResult Create()
        {
            var model = new CorporateAccountEditModel
            {
                ShippingOptions = _shippingOptionRepository.GetAllShippingOptionsForBuyingProcess()
            };

            return(View(model));
        }
Example #4
0
        public long CreateHostFromAccount(CorporateAccountEditModel corporateAccount)
        {
            Host host = null;

            if (corporateAccount.ConvertedHostId.HasValue && corporateAccount.ConvertedHostId.Value > 0)
            {
                host = _hostRepository.GetHostById(corporateAccount.ConvertedHostId.Value);
            }
            else
            {
                host = new Host();
            }

            var hostAddressId        = host.Address != null ? host.Address.Id : 0;
            var hostMailingAddressId = host.MailingAddress != null ? host.MailingAddress.Id : 0;

            host.Address        = Mapper.Map <AddressEditModel, Address>(corporateAccount.OrganizationEditModel.BusinessAddress);
            host.MailingAddress = Mapper.Map <AddressEditModel, Address>(corporateAccount.OrganizationEditModel.BillingAddress);

            host.Address.Id        = hostAddressId;
            host.MailingAddress.Id = hostMailingAddressId;

            host.OrganizationName = corporateAccount.OrganizationEditModel.Name;
            host.Type             = HostProspectType.CorporateLocation;
            host.Notes            = corporateAccount.ContractNotes;
            if (!string.IsNullOrEmpty(corporateAccount.OrganizationEditModel.Email))
            {
                string[] emailSplitUp = corporateAccount.OrganizationEditModel.Email.Split(new[] { '@' });

                host.Email = new Email {
                    Address = emailSplitUp[0], DomainName = emailSplitUp[1]
                };
            }
            host.OfficePhoneNumber = corporateAccount.OrganizationEditModel.PhoneNumber;
            host.FaxNumber         = corporateAccount.OrganizationEditModel.FaxNumber;
            if (host.DataRecorderMetaData == null)
            {
                host.DataRecorderMetaData = new DataRecorderMetaData
                {
                    DateCreated = DateTime.Now
                }
            }
            ;
            host.Address        = _addressService.SaveAfterSanitizing(host.Address);
            host.MailingAddress = _addressService.SaveAfterSanitizing(host.MailingAddress);
            host = _hostRepository.CreateHost(host);
            return(host.Id);
        }