static void Main(string[] args) { SqlConnectionStringBuilder builder = new SqlConnectionStringBuilder(); builder.DataSource = @"DESKTOP-6QJTG7S\SQLEXPRESS"; builder.UserID = "sa"; builder.Password = "******"; builder.InitialCatalog = "funeraria"; EstadoDAO edodao = new EstadoDAO(); edodao.SqlConString = builder.ConnectionString; edodao.GetAll(); MunicipioDAO mpoDao = new MunicipioDAO(); mpoDao.SqlConString = builder.ConnectionString; mpoDao.GetAll(); mpoDao.GetByFilter(new MunicipioFilter() { IdEstado = 14 }); TipoTelefonoDAO tipoteldao = new TipoTelefonoDAO(); tipoteldao.SqlConString = builder.ConnectionString; tipoteldao.GetAll(); PaqueteServicioDAO paquetedao = new PaqueteServicioDAO(); paquetedao.SqlConString = builder.ConnectionString; paquetedao.GetAll(); FrecuenciaAbonoDAO frecuenciadao = new FrecuenciaAbonoDAO(); frecuenciadao.SqlConString = builder.ConnectionString; frecuenciadao.GetAll(); }
public static IDao DaoFactory(Type type) { IDao dao = null; if (type == typeof(EstadoDAO)) { dao = new EstadoDAO(); } else if (type == typeof(MunicipioDAO)) { dao = new MunicipioDAO(); } else if (type == typeof(FrecuenciaAbonoDAO)) { dao = new FrecuenciaAbonoDAO(); } else if (type == typeof(PaqueteServicioDAO)) { dao = new PaqueteServicioDAO(); } else if (type == typeof(TipoTelefonoDAO)) { dao = new TipoTelefonoDAO(); } else if (type == typeof(ClienteDAO)) { dao = new ClienteDAO(); } else if (type == typeof(AsesorDAO)) { dao = new AsesorDAO(); } else if (type == typeof(DocumentosDAO)) { dao = new DocumentosDAO(); } else if (type == typeof(DomiciliosDAO)) { dao = new DomiciliosDAO(); } else if (type == typeof(TelefonosDAO)) { dao = new TelefonosDAO(); } else if (type == typeof(RelacionAsesoresDocumentosDAO)) { dao = new RelacionAsesoresDocumentosDAO(); } else if (type == typeof(CargosDAO)) { dao = new CargosDAO(); } else if (type == typeof(ServicioFunerarioDAO)) { dao = new ServicioFunerarioDAO(); } else { throw new Exception("Tipo de Dao Desconocido: " + type.ToString()); } dao.SqlConString = WebConfigHelper.GetConnectionString(); return(dao); }