Example #1
0
        // Get Customer
        public CustomerResponse getCustomer(CustomerRequest request)
        {
            CustomerResponse response = new CustomerResponse();
            // Check if customers needs a binding
            if (request.CustomerId == 0 && request.Customer.Name != "")
            {
                // Apply the search the customer
                var customerFound = Asgard._Foreing.CLI_CLIENTES.Where(x => x.CLI_Nombre.ToUpper() == request.Customer.Name.ToUpper()).FirstOrDefault();

                if (customerFound != null)
                {
                    // Add the Customer to Nexus
                    var newCustomer = new CustomerDto()
                    {
                        Name = customerFound.CLI_Nombre,
                        Address = customerFound.CLI_Direccion
                    };

                    newCustomer.BindCustomer = new BindCustomerDto { AlienId = customerFound.CLI_Cliente };

                    // Check if the Customer has a contact defined
                    if (customerFound.CLI_Contacto != null)
                    {
                        // Add Person to Contact
                        var newPerson = new PersonDto()
                        {
                            Name = customerFound.CLI_Contacto,
                            LastName = ""
                        };
                        // Add Contact to Customer
                        var newCustomerContact = new CustomerContactDto()
                        {
                            Job = "Funcionario",
                            Person = newPerson,
                            Email = "*****@*****.**"
                        };
                        newCustomer.CustomerContacts.Add(newCustomerContact);
                    }
                    response.Customer = newCustomer;
                }
            }
            return response;
        }
Example #2
0
        private void FixupPerson(PersonDto previousValue)
        {
            if (previousValue != null && previousValue.Employees.Contains(this))
            {
                previousValue.Employees.Remove(this);
            }

            if (Person != null)
            {
                if (!Person.Employees.Contains(this))
                {
                    Person.Employees.Add(this);
                }
                if (PersonId != Person.Id)
                {
                    PersonId = Person.Id;
                }
            }
        }