Beispiel #1
0
        private static void AddInternalBusinessAssociate()
        {
            // Generic business associate setup first
            AssociateRM agl       = CreateAssociate_AtlantaGasLight();
            PhoneRM     phoneRM   = AddPrimaryPhoneForAssociate(agl, PhoneTypeLookup.PhoneTypeEnum.Office, 6783242548);
            EMailRM     emailRM   = AddPrimaryEMailForAssociate(agl, "*****@*****.**");
            AddressRM   addressRM = AddPrimaryAddressForAssociate(agl);

            // Add contact
            ContactRM contactRM = AddContactForAssociate(agl, addressRM.Id, phoneRM.Id, emailRM.Id, "Joe", "Francis");

            // Add operating context
            OperatingContextRM operatingContextRM = AddOperatingContextForAssociate(agl);
        }
Beispiel #2
0
        static void DirectTest()
        {
            AssociateRM associateRM = CreateAssociate_AtlantaGasLight();
            IEnumerable <AssociateRM> associates              = GetListOfAssociates();
            ContactRM          contactRM                      = CreateContact_JoeFrancis(associateRM);
            UserRM             userRM                         = CreateUserForContact(associateRM, contactRM);
            CustomerRM         customerRM                     = CreateCustomer_WalMart(associateRM);
            OperatingContextRM operatingContextRM             = GetOperatingContext(customerRM);
            OperatingContextRM operatingContextForAssociateRM = GetOperatingContextForAssociate(associateRM);

            SetUpAGLServicesAgent();
            CreateUserForAgent(contactRM, associateRM);
            AssociateRM assetManagerRM = SetUpThirdPartyAssetManager();

            SetUpAssociateAsPredecessor();
        }
Beispiel #3
0
        private static UserRM CreateUserForContact(AssociateRM associateRM, ContactRM contactRM)
        {
            Console.WriteLine("EFTEST:  Setting up Joe Francis User from Joe Francis contact");

            Commands.V1.User.Create createUserCommand = new Commands.V1.User.Create
            {
                ContactId        = contactRM.Id,
                IDMSSID          = "1",
                DepartmentCodeId = 1,
                HasEGMSAccess    = true,
                IsActive         = true,
                IsInternal       = true
            };

            Commands.V1.User.CreateForAssociate createUserForAssociateCommand =
                new Commands.V1.User.CreateForAssociate(associateRM.Id, createUserCommand);

            return(_technologyType == 1 ? (UserRM)_appService.Handle(createUserForAssociateCommand).Result :
                   CreateUserForAssociateWithREST(createUserForAssociateCommand));
        }
Beispiel #4
0
        private static UserRM CreateUserForAgent(ContactRM contactRM, AssociateRM associateRM)
        {
            Console.WriteLine("EFTEST:  Create User for Agent");

            Commands.V1.User.Create createUserCommandForAgent = new Commands.V1.User.Create
            {
                IsActive         = true,
                IsInternal       = true,
                ContactId        = contactRM.Id,
                HasEGMSAccess    = true,
                IDMSSID          = "1",
                DeactivationDate = DateTime.Now.AddYears(10),
                DepartmentCodeId = 1
            };

            Commands.V1.User.CreateForAssociate createUserForAgent =
                new Commands.V1.User.CreateForAssociate(associateRM.Id, createUserCommandForAgent);

            return(_technologyType == 1 ? (UserRM)_appService.Handle(createUserForAgent).Result :
                   CreateUserForAssociateWithREST(createUserForAgent));
        }
        public void CreateAssociate()
        {
            var mapperConfig = new MapperConfiguration(cfg => { cfg.CreateMap <Associate, AssociateRM>(); });

            IMapper        mapper                      = new Mapper(mapperConfig);
            ILoggerFactory loggerFactory               = new NullLoggerFactory();
            ILogger <AssociateRepositoryEF> logger     = new Logger <AssociateRepositoryEF>(loggerFactory);
            BusinessAssociatesContext       context    = new BusinessAssociatesContext();
            AssociateRepositoryEF           repository = new AssociateRepositoryEF(context, logger, mapper);
            AssociatesApplicationService    appService = new AssociatesApplicationService(repository, mapper);

            // Set up Associate

            Debug.WriteLine("EFTEST:  Setting up Internal Associate Atlanta Gas Light");

            Commands.V1.Associate.Create createAssociateCommand = new Commands.V1.Associate.Create
            {
                AssociateTypeId = (int)AssociateTypeLookup.AssociateTypeEnum.InternalLDCFacility,
                DUNSNumber      = _dunsNumber++,
                IsDeactivating  = false,
                IsInternal      = true,
                IsParent        = false,
                LongName        = "Atlanta Gas Light",
                ShortName       = "AGL",
                StatusCodeId    = (int)StatusCodeLookup.StatusCodeEnum.Active
            };

            Debug.WriteLine("EFTEST:  Getting AssociateRM");

            AssociateRM associateRM = (AssociateRM)appService.Handle(createAssociateCommand).Result;

            // XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

            // Set up Contact
            Debug.WriteLine("EFTEST:  Setting up Joe Francis contact");

            Commands.V1.Contact.Create createContactCommand = new Commands.V1.Contact.Create
            {
                PrimaryAddressId = 1,
                IsActive         = true,
                PrimaryPhoneId   = 1,
                LastName         = "Francis",
                PrimaryEmailId   = 1,
                FirstName        = "Joe",
                Title            = "Mr."
            };

            Commands.V1.Contact.CreateForAssociate createContactForAssociateCommand =
                new Commands.V1.Contact.CreateForAssociate(associateRM.Id, createContactCommand);

            Debug.WriteLine("EFTEST:  Getting ContactRM");

            ContactRM contactRM = (ContactRM)appService.Handle(createContactForAssociateCommand).Result;

            // XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX


            Debug.WriteLine("EFTEST:  Setting up Joe Francis contact");

            Commands.V1.Contact.Address.Create createAddressCommand = new Commands.V1.Contact.Address.Create
            {
                StartDate       = DateTime.Now,
                Address1        = "401 Bloombridge Way",
                AddressType     = (int)AddressTypeLookup.AddressTypeEnum.Physical,
                Attention       = "Joe Francis",
                City            = "Marietta",
                Country         = 1,
                GeographicState = 1,
                EndDate         = DateTime.Now.AddYears(10),
                IsActive        = true,
                Comments        = "None",
                PostalCode      = "30066",
                IsPrimary       = true
            };

            Commands.V1.Contact.Address.CreateForContact createAddressForContactCommand =
                new Commands.V1.Contact.Address.CreateForContact(contactRM.Id, createAddressCommand);

            Debug.WriteLine("EFTEST:  Getting AddressRM");

            // ReSharper disable once UnusedVariable
            AddressRM addressRM = (AddressRM)appService.Handle(createAddressForContactCommand).Result;


            // XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

            // Set up User for Contact
            Debug.WriteLine("EFTEST:  Setting up Joe Francis User from Joe Francis contact");

            Commands.V1.User.Create createUserCommand = new Commands.V1.User.Create
            {
                ContactId        = contactRM.Id,
                IDMSSID          = "1",
                DepartmentCodeId = 1,
                HasEGMSAccess    = true,
                IsActive         = true,
                IsInternal       = true
            };

            Commands.V1.User.CreateForAssociate createUserForAssociateCommand =
                new Commands.V1.User.CreateForAssociate(associateRM.Id, createUserCommand);

            Debug.WriteLine("EFTEST:  Getting UserRM");

            // ReSharper disable once UnusedVariable
            UserRM userRM = (UserRM)appService.Handle(createUserForAssociateCommand).Result;

            // XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

            // Set up Customer for Associate - can we get rid of this and just use relationship object

            Debug.WriteLine("EFTEST:  Setting up WalMart customer for Associate");

            Commands.V1.Customer.Create createCustomerCommand = new Commands.V1.Customer.Create
            {
                StartDate           = DateTime.Now,
                AccountNumber       = "12345678",
                AlternateCustomerId = 1,
                BalancingLevelId    = 1,
                BasicPoolId         = 1,
                ContractTypeId      = 1,
                CurrentDemand       = 1,
                DUNSNumber          = _dunsNumber++,
                DailyInterruptible  = 1,
                DeliveryLocationId  = 1,
                DeliveryPressure    = 1,
                CustomerTypeId      = 1,
                DeliveryTypeId      = 1,
                EndDate             = DateTime.Now.AddYears(10),
                IsFederal           = false,
                MDQ                      = 1,
                GroupTypeId              = 1,
                LongName                 = "WalMart",
                TurnOffDate              = DateTime.Now.AddYears(10),
                PreviousDemand           = 1,
                SS1                      = false,
                NominationLevelId        = 1,
                MaxHourlyInterruptible   = 1,
                NAICSCode                = 1245,
                MaxDailyInterruptible    = 1,
                StatusCodeId             = 1,
                ShipperId                = 1,
                HourlyInterruptible      = 1,
                LDCId                    = 1,
                SICCode                  = 1,
                InterstateSpecifiedFirm  = 1,
                TotalDailySpecifiedFirm  = 1,
                ShortName                = "WMT",
                SICCodePercentage        = 1,
                ShippersLetterToDate     = DateTime.Now.AddYears(1),
                IntrastateSpecifiedFirm  = 1,
                MaxHourlySpecifiedFirm   = 1,
                TotalHourlySpecifiedFirm = 1,
                ShippersLetterFromDate   = DateTime.Now.AddYears(-1),
                LossTierTypeId           = 1,
                TurnOnDate               = DateTime.Now.AddYears(-1)
            };

            Commands.V1.Customer.CreateForAssociate createCustomerForAssociateCommand =
                new Commands.V1.Customer.CreateForAssociate(associateRM.Id, createCustomerCommand);

            Debug.WriteLine("EFTEST:  Getting CustomerRM");

            // ReSharper disable once NotAccessedVariable
            CustomerRM customerRM = (CustomerRM)appService.Handle(createCustomerForAssociateCommand).Result;

            // XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

            // Set Up Operating Context

            Commands.V1.OperatingContext.Create createOperatingContextCommand =
                new Commands.V1.OperatingContext.Create
            {
                ActingBATypeID       = 1,
                PrimaryAddressId     = 1,
                Status               = 1,
                CertificationId      = 1,
                OperatingContextType = 1,
                IsDeactivating       = false,
                ThirdPartySupplierId = 1,
                FacilityId           = 1,
                ProviderType         = 1,
                LegacyId             = 1,
                PrimaryPhoneId       = 1,
                PrimaryEmailId       = 1,
                StartDate            = DateTime.Now
            };

            Commands.V1.OperatingContext.CreateForCustomer createOperatingContextForCustomerCommand =
                new Commands.V1.OperatingContext.CreateForCustomer(customerRM.Id, createOperatingContextCommand);

            Debug.WriteLine("EFTEST:  Getting OperatingContextRM for Customer");


            // ReSharper disable once NotAccessedVariable
            // ReSharper disable once UnusedVariable
            OperatingContextRM operatingContextRM = (OperatingContextRM)appService.Handle(createOperatingContextForCustomerCommand).Result;

            // XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

            // Set up relationship between Associate and OperatingContext

            Debug.WriteLine("EFTEST:  Getting OperatingContextRM for Associate");

            // ReSharper disable once NotAccessedVariable

            Commands.V1.OperatingContext.CreateForAssociate createOperatingContextForAssociateCommand =
                new Commands.V1.OperatingContext.CreateForAssociate(associateRM.Id, createOperatingContextCommand);

            // ReSharper disable once UnusedVariable
            OperatingContextRM operatingContextForAssociateRM = (OperatingContextRM)appService.Handle(createOperatingContextForAssociateCommand).Result;

            // XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

            // Set up Associate as Agent

            // Set up Associate

            Debug.WriteLine("EFTEST:  Setting up AGL Services Agent");

            Commands.V1.Associate.Create createAssociateCommandForAgent = new Commands.V1.Associate.Create
            {
                AssociateTypeId = ExternalAssociateTypeLookup.ActingAssociateTypes[(int)ExternalAssociateTypeLookup.ExternalAssociateTypeEnum.AssetManager].ActingAssociateTypeId,
                DUNSNumber      = _dunsNumber++,
                IsDeactivating  = false,
                IsInternal      = true,
                IsParent        = false,
                LongName        = "AGL Services",
                ShortName       = "SCS",
                StatusCodeId    = (int)StatusCodeLookup.StatusCodeEnum.Active
            };

            Debug.WriteLine("EFTEST:  Getting AssociateRM for Agent");

            // ReSharper disable once NotAccessedVariable
            // ReSharper disable once UnusedVariable
            AssociateRM agentRM = (AssociateRM)appService.Handle(createAssociateCommandForAgent).Result;

            // XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

            // AddAssociate User to Agent

            Debug.WriteLine("EFTEST:  Create User for Agent");

            Commands.V1.User.Create createUserCommandForAgent = new Commands.V1.User.Create
            {
                IsActive         = true,
                IsInternal       = true,
                ContactId        = contactRM.Id,
                HasEGMSAccess    = true,
                IDMSSID          = "1",
                DeactivationDate = DateTime.Now.AddYears(10),
                DepartmentCodeId = 1
            };

            Commands.V1.User.CreateForAssociate createUserForAgent =
                new Commands.V1.User.CreateForAssociate(associateRM.Id, createUserCommandForAgent);

            Debug.WriteLine("EFTEST: Getting UserRM for Agent");

            // ReSharper disable once NotAccessedVariable
            // ReSharper disable once UnusedVariable
            UserRM userRM2 = (UserRM)appService.Handle(createUserForAgent).Result;

            // XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

            // Set up Asset Manager for Associate for Third-Party Suppliers

            Debug.WriteLine("EFTEST:  Set up third party asset manager");

            Commands.V1.Associate.Create createAssetManagerForTPS = new Commands.V1.Associate.Create
            {
                AssociateTypeId = ExternalAssociateTypeLookup.ActingAssociateTypes[(int)ExternalAssociateTypeLookup.ExternalAssociateTypeEnum.AssetManager].ActingAssociateTypeId,
                DUNSNumber      = _dunsNumber++,
                IsDeactivating  = false,
                IsInternal      = true,
                IsParent        = false,
                LongName        = "AGL Services",
                ShortName       = "SCS",
                StatusCodeId    = (int)StatusCodeLookup.StatusCodeEnum.Active
            };

            Debug.WriteLine("EFTEST:  Get AssociateRM for third party");

            // ReSharper disable once NotAccessedVariable
            // ReSharper disable once UnusedVariable
            AssociateRM assetManagerRM = (AssociateRM)appService.Handle(createAssetManagerForTPS).Result;

            // XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

            // Set up Associate as predecessor

            Debug.WriteLine("EFTEST:  Set up associate as predecessor");

            Commands.V1.Associate.Create createPredecessor = new Commands.V1.Associate.Create
            {
                AssociateTypeId = (int)AssociateTypeLookup.AssociateTypeEnum.InternalLDCFacility,
                DUNSNumber      = _dunsNumber++,
                IsDeactivating  = false,
                IsInternal      = true,
                IsParent        = false,
                LongName        = "AGL Services",
                ShortName       = "SCS",
                StatusCodeId    = (int)StatusCodeLookup.StatusCodeEnum.Active
            };

            Debug.WriteLine("EFTEST:  Get PredecessorManagerRM for predecessor");

            // ReSharper disable once NotAccessedVariable
            // ReSharper disable once UnusedVariable
            AssociateRM predecessorManagerRM = (AssociateRM)appService.Handle(createPredecessor).Result;
        }