コード例 #1
0
        /// <summary>
        /// Sincroniza una lista Entity en una de Negocio
        /// </summary>
        /// <param name="listaDatos"></param>
        /// <returns>List<Cliente></returns>
        private List <Cliente> SyncList(List <Entity.Cliente> listaDatos)
        {
            List <Cliente> list = new List <Cliente>();

            try
            {
                foreach (var x in listaDatos)
                {
                    Cliente cliente = new Cliente();
                    CommonBC.Syncronize(x, cliente);

                    Sexo sexo = new Sexo();
                    sexo.Id = x.IdSexo;
                    if (sexo.Read())
                    {
                        cliente.Sexo = sexo;
                    }
                    else
                    {
                        throw new Exception("Error al leer el sexo.");
                    }

                    EstadoCivil estado = new EstadoCivil();
                    estado.Id = x.IdEstado;
                    if (estado.Read())
                    {
                        cliente.EstadoCivil = estado;
                    }
                    else
                    {
                        throw new Exception("Error al leer el Estado.");
                    }

                    list.Add(cliente);
                }
            }
            catch (Exception ex)
            {
                throw new Exception("Error Sincronizar Lista. " + ex.Message);
            }

            return(list);
        }