public List <TipoEmpresaDTO> GetAll()
        {
            List <TipoEmpresaDTO> toReturn = new List <TipoEmpresaDTO>();
            TipoEmpresaDTO        obj;

            try
            {
                this.BEMEConnectionObj.Open();

                OleDbCommand    cmd    = new OleDbCommand("SELECT IdTipoEmpresa,DescTipoEmpresa FROM TipoEmpresa", this.BEMEConnectionObj);
                OleDbDataReader reader = cmd.ExecuteReader();

                while (reader.Read())
                {
                    obj = new TipoEmpresaDTO();
                    obj.IdTipoEmpresa   = Convert.ToInt32(reader["IdTipoEmpresa"]);
                    obj.DescTipoEmpresa = Convert.ToString(reader["DescTipoEmpresa"]);
                    toReturn.Add(obj);
                }

                reader.Close();
                this.BEMEConnectionObj.Close();
            }
            catch (OleDbException ex)
            {
                toReturn = null;
                throw ex;
            }

            return(toReturn);
        }
Beispiel #2
0
        private void SetDataFromPreviousPage()
        {
            if (PreviousPage is IConsulta)
            {
                HdnIdFormAction.Value = Convert.ToString((int)Parameters.FormAction.Update);

                try
                {
                    txtRutCliente.Text = ((IConsulta)PreviousPage).Rut;
                    Presenter.GetById();

                    txtNombreCliente.ReadOnly        = true;
                    txtRutCliente.ReadOnly           = true;
                    txtTelefonoCliente.ReadOnly      = true;
                    txtCorreoCliente.ReadOnly        = true;
                    txtNombreEmpresaCliente.ReadOnly = true;
                    txtRutEmpresaCliente.ReadOnly    = true;
                    txtGiroComercial.ReadOnly        = true;
                }
                catch (NotFoundIdException ex)
                {
                    litMensaje.Text = ex.Message;
                    mpeMensaje.Show();
                }
            }
            else
            {
                HdnIdFormAction.Value = Convert.ToString((int)Parameters.FormAction.Insert);

                IIngreso pagPrevia = (IIngreso)PreviousPage;

                #region Nombre de Usuario
                UsuariosDTO objUsuariosDTO = pagPrevia.ObjUsuariosDTO;
                ddlUsuarios.SelectedValue = Convert.ToString(objUsuariosDTO.IdUsuario);
                #endregion

                #region Formalidad
                TipoFormalidadDTO objTipoFormalidadDTO = pagPrevia.ObjTipoFormalidadDTO;
                ddlTipoFormalidad.SelectedValue = Convert.ToString(objTipoFormalidadDTO.IdFormalidad);
                #endregion

                #region Nivel de Ventas
                NivelVentasDTO objNivelVentasDTO = pagPrevia.ObjNivelVentasDTO;
                ddlNivelVentas.SelectedValue = Convert.ToString(objNivelVentasDTO.IdNivelVentas);
                #endregion

                #region Tipo de Empresa
                TipoEmpresaDTO objTipoEmpresaDTO = pagPrevia.ObjTipoEmpresaDTO;
                ddlTipoEmpresa.SelectedValue = Convert.ToString(objTipoEmpresaDTO.IdTipoEmpresa);
                #endregion

                #region Permanencia en el Rubro
                PermanenciaRubroDTO objPermanenciaRubroDTO = pagPrevia.ObjPermanenciaRubroDTO;
                ddlPermanenciaRubro.SelectedValue = Convert.ToString(objPermanenciaRubroDTO.IdPermanenciaRubro);
                #endregion

                #region Familia de Productos - Productos Disponibles
                repFamiliaProductos.DataSource = (List <FamiliaProductosDTO>)(((IIngreso)PreviousPage).LstFamiliaProductos);
                repFamiliaProductos.DataBind();
                #endregion

                txtNombreCliente.ReadOnly        = false;
                txtRutCliente.ReadOnly           = false;
                txtTelefonoCliente.ReadOnly      = false;
                txtCorreoCliente.ReadOnly        = false;
                txtNombreEmpresaCliente.ReadOnly = false;
                txtRutEmpresaCliente.ReadOnly    = false;
                txtGiroComercial.ReadOnly        = false;
            }
        }