public HttpResponseMessage CreateAccount(PartnerServiceIntegration serviceIntegration)
        {
            AddGUID(ref serviceIntegration);

            ItemResponse <PartnerServiceIntegration> response = new ItemResponse <PartnerServiceIntegration>();
            PartnerServiceIntegrations integrations           = new PartnerServiceIntegrations();

            response.Item = integrations.Update(serviceIntegration);
            return(Request.CreateResponse(response));
        }
        public void AddGUID(ref PartnerServiceIntegration serviceIntegration)
        {
            if (serviceIntegration.AccountNumber == Guid.Empty)
            {
                var partnerService = new PartnerServiceIntegrations();
                var Integration    = partnerService.GetByClientID(serviceIntegration.ClientID, serviceIntegration.AdminClientID);
                if (Integration != null)
                {
                    serviceIntegration.AccountNumber = Integration.AccountNumber;
                    serviceIntegration.Id            = Integration.Id;
                }
            }

            if (serviceIntegration.AccountNumber == Guid.Empty)
            {
                serviceIntegration.AccountNumber = Guid.NewGuid();

                if (serviceIntegration.AdminClientID == 0)
                {
                    serviceIntegration.AdminClientID = Users.CurrentUser.ClientID;
                }

                //Send an email notification to [email protected] containing the customer client's name
                EmailRoutingCollection emailsCollection = EmailRouting.GetEmailsByAdminClient(serviceIntegration.AdminClientID);
                EmailRouting           emailRouting     = new EmailRouting();
                foreach (EmailRouting emails in emailsCollection)
                {
                    if (emails.EmailType == "New Client Activated")
                    {
                        emailRouting = emails;
                        break;
                    }
                }

                Clients client = new Clients(serviceIntegration.ClientID);

                MailMessage mailMessage = new MailMessage();
                mailMessage.From = new MailAddress(emailRouting.FromEmail);
                mailMessage.To.Add(new MailAddress("*****@*****.**"));

                mailMessage.IsBodyHtml = true;
                mailMessage.Priority   = MailPriority.Normal;
                mailMessage.Body       = client.Name + " was activated from " + Users.CurrentUser.Client.Name +
                                         ". Their account number is: " + serviceIntegration.AccountNumber.ToString();

                try
                {
                    Degatech.Utilities.Data.Utilities.SendEmail(mailMessage);
                }
                catch (Exception ex)
                {
                }
            }
        }
        private void AddGUID(AddCustomerAccountingInfoRequest model)
        {
            PartnerServiceIntegration serviceIntegration = new PartnerServiceIntegration();

            serviceIntegration.ClientID      = model.CustClientID;
            serviceIntegration.AdminClientID = model.AdminClientID;

            PartnerServiceIntegrationsAPIController integrationAPIController =
                new PartnerServiceIntegrationsAPIController();


            integrationAPIController.AddGUID(ref serviceIntegration);
            if (serviceIntegration.Id == 0)
            {
                PartnerServiceIntegrations integrations = new PartnerServiceIntegrations();
                integrations.Update(serviceIntegration);
            }
        }