none
como puedo hacer para que no me retorne las entidades completas en 3 capas en mi datagrid RRS feed

  • Pregunta

  • buenas tardes  disculpen las molestia estoy realizando una aplicacion en 3 capas pero al momento de realizar la consulta  y mandarla a un  datagrid me aparecen las entidades  completas  y no busco como quitarselo a mi grid para que no se vean

    agradeceria mucho si me pudieran ayudar

    mi codigo es el siguiente en mi DAL

     private static BranchOfficeEntity LoadBranchOffice(IDataReader reader)
            {
                BranchOfficeEntity branchOffice = new BranchOfficeEntity();
                FtpEntity ftp = new FtpEntity();
                EmailEntity email = new EmailEntity();
    
                branchOffice.Branch_Office_id = Convert.ToInt32(reader["branch_office_id"]);
                if (reader["branch_office"] != DBNull.Value)
                     branchOffice.Branch_Office = Convert.ToString(reader["branch_office"]);
                if (reader["path_local"] != DBNull.Value)
                    branchOffice.path_local = Convert.ToString(reader["path_local"]);
                if (reader["log_directory"] != DBNull.Value)
                    branchOffice.log_directoy = Convert.ToString(reader["log_directory"]);
                if (reader["type_archive"] != DBNull.Value)
                    branchOffice.log_directoy = Convert.ToString(reader["type_archive"]);  
                if (reader["user_bussinespro"] != DBNull.Value)
                    branchOffice.user_bussinespro = Convert.ToString(reader["user_bussinespro"]);
                if (reader["hour_event"] != DBNull.Value)
                    branchOffice.hour_event = Convert.ToString(reader["hour_event"]);
                if (reader["configuracion_ftp"] != DBNull.Value)
                   ftp.name= Convert.ToString(reader["configuracion_ftp"]);
                   branchOffice.ftp = ftp;
                if (reader["configuracion_email"] != DBNull.Value)
                    email.name = Convert.ToString(reader["configuracion_email"]);
                branchOffice.email = email;
                if (reader["status"] != DBNull.Value)
                    branchOffice.status = Convert.ToString(reader["status"]);
    
                //ftp = null;
                //email = null;
                return branchOffice;
            }
    

      public static List<BranchOfficeEntity> GetAllBranchOffice()
            {
                List<BranchOfficeEntity> list = new List<BranchOfficeEntity>();
    
    
                using (SqlConnection conn = new SqlConnection())
                {
                    conn.ConnectionString = Configuration.MyConnectionString;
                    using (SqlCommand cmd = new SqlCommand())
                    {
                        cmd.Connection = conn;
                        cmd.CommandText = "sp_GetListBranchOffice";
                        cmd.CommandType = CommandType.StoredProcedure;
    
                        conn.Open();
                        using (SqlDataReader reader = cmd.ExecuteReader())
                        {
                            while (reader.Read())
                            {
                                list.Add(LoadBranchOffice(reader));
                            }
    
                        }
    
                    }
                }
                return list;
            }

    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;
    using System.Threading.Tasks;
    
    namespace Simetrical.Entities
    {
        public class BranchOfficeEntity
        {
            public int Branch_Office_id { get; set; }
    
            public string Branch_Office { get; set; }
    
            public string path_local { get; set; }
    
            public string log_directoy { get; set; }
    
            public string type_archive { get; set; }
            public string user_bussinespro { get; set; }
    
            public string hour_event { get; set; }
    
            public FtpEntity ftp { get; set; }
    
            public EmailEntity email { get; set; }
    
            public string ftp_name
            {
                get { return ftp.name; }
            }
    
            public string email_name
            {
                get { return email.name; }
            }
    
            public string status { get; set; }
        }
    
    }
    

    lunes, 21 de diciembre de 2015 21:31

Respuestas

Todas las respuestas