Example #1
0
 private void btnEditar_Click(object sender, EventArgs e)
 {
     Modelo.Region region = new Modelo.Region();
     region.IdRegion = (int)dgvRegiones[0, index].Value;
     region.Nombre   = dgvRegiones[1, index].Value.ToString();
     new FrmAgregarEditarRegiones(region).ShowDialog();
     cargarTabla();
 }
 public FrmAgregarEditarRegiones(Modelo.Region region)
 {
     InitializeComponent();
     this.region = region;
     if (region != null)
     {
         editar = true;
     }
     RegionAEditar = region;
 }
Example #3
0
 private void cbRegiones_SelectedIndexChanged(object sender, EventArgs e)
 {
     Modelo.Region objRegion = (Modelo.Region)cbRegiones.SelectedItem;
     ltsSedes = new DaoSede().SELECT_FOR_REGION(objRegion.IdRegion);
     cbSedes.Items.Clear();
     cbConcursos.Items.Clear();
     if (ltsSedes != null)
     {
         foreach (Sede sede in ltsSedes)
         {
             cbSedes.Items.Add(sede);
         }
     }
 }
        private void btnGuardarCambios_Click(object sender, EventArgs e)
        {
            bool nombre = Validaciones(Strings.Nombres, txtNombre, "Nombre no valido ");


            if (nombre)
            {
                if (editar)
                {
                    sedeAEditar.Nombre = txtNombre.Text;

                    bool res = objDaoSede.UPDATE(sedeAEditar);
                    if (res)
                    {
                        MessageBox.Show("Sede Actualizada Exitosamente", "Info", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        this.Close();
                    }
                    else
                    {
                        MessageBox.Show("Error Al Actualizar La Sede", "Info", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    }
                }
                else
                {
                    Modelo.Region newRegion = (Modelo.Region)cbIdRegion.SelectedItem;
                    sedeAAgregar.IdRegion = newRegion.IdRegion;

                    sedeAAgregar.Nombre = txtNombre.Text;


                    int res = objDaoSede.INSERT(sedeAAgregar);
                    if (res != 0)
                    {
                        MessageBox.Show("Sede Agregada Exitosamente", "Info", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        this.Close();
                    }
                    else
                    {
                        MessageBox.Show("Error Al Agregar La Sede ", "Info", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    }
                }
            }
        }
Example #5
0
        public string ListarRegion()
        {
            ServicioDireccion   servicio = new ServicioDireccion();
            List <Datos.REGION> region   = servicio.ListarRegion();

            Modelo.RegionCollection listaRegion = new Modelo.RegionCollection();
            foreach (Datos.REGION r in region)
            {
                Modelo.Region rModelo = new Modelo.Region();
                rModelo.Id_Pais   = r.ID_PAIS;
                rModelo.Id_Region = r.ID_REGION;
                rModelo.Nombre    = r.NOMBRE_REGION;
                listaRegion.Add(rModelo);
            }
            XmlSerializer ser    = new XmlSerializer(typeof(Modelo.RegionCollection));
            StringWriter  writer = new StringWriter();

            ser.Serialize(writer, listaRegion);
            return(writer.ToString());
        }
        private void btnAceptar_Click(object sender, EventArgs e)
        {
            bool nombre = Validaciones(Strings.Nombres, txtNombre, "Nombre no valido ");

            if (nombre)
            {
                if (region == null)
                {
                    Modelo.Region reg = new Modelo.Region();
                    reg.Nombre = txtNombre.Text;
                    new DaoRegion().INSERT(reg);
                    this.Close();
                }
                else
                {
                    Modelo.Region reg = new Modelo.Region();
                    reg.Nombre   = txtNombre.Text;
                    reg.IdRegion = region.IdRegion;
                    new DaoRegion().UPDATE(reg);
                    this.Close();
                }
            }
        }
        private void txtGuardarCambios_Click(object sender, EventArgs e)
        {
            bool nombreCompleto = Validaciones(Strings.Nombres, txtNombreCompleto, "Titulo no valido ");
            bool nombreCorto    = Validaciones(Strings.Nombres, txtNombreCorto, "Nombre no valido ");
            bool paginaWeb      = Validaciones(Strings.validarCorreo, txtPaginaWeb, "Email no valido ");
            bool gradoOfrecido  = Validaciones(Strings.Nombres, txtGradoOfrecido, "Locacion no valida ");
            bool companiaCalle  = Validaciones(Strings.Nombres, txtCompañiaCalle, "Informacion De Facturacion no valida ");
            bool state          = Validaciones(Strings.Nombres, txtState, "Titulo no valido ");
            bool ciudad         = Validaciones(Strings.Nombres, txtCiudad, "Nombre no valido ");
            bool codigoPostal   = Validaciones(Strings.validarCorreo, txtCodigoPostal, "Email no valido ");
            bool lineaDeCalle2  = Validaciones(Strings.Nombres, txtLineaDeCalle2, "Locacion no valida ");
            bool lineaDeCalle3  = Validaciones(Strings.Nombres, txtLineaDeCalle3, "Informacion De Facturacion no valida ");
            bool estado         = Validaciones(Strings.Nombres, txtEstado, "Titulo no valido ");


            if (nombreCompleto & nombreCorto & paginaWeb & gradoOfrecido & companiaCalle & state & ciudad & codigoPostal & lineaDeCalle2 & lineaDeCalle3 & estado)
            {
                if (editar)
                {
                    institucionAEditar.NombreCompleto = txtNombreCompleto.Text;
                    institucionAEditar.NombreCorto    = txtNombreCorto.Text;
                    institucionAEditar.PaginaWeb      = txtPaginaWeb.Text;
                    institucionAEditar.GradoOfrecido  = txtGradoOfrecido.Text;
                    institucionAEditar.CompaniaCalle  = txtCompañiaCalle.Text;
                    institucionAEditar.State          = txtState.Text;
                    institucionAEditar.Ciudad         = txtCiudad.Text;
                    institucionAEditar.CodigoPostal   = txtCodigoPostal.Text;
                    institucionAEditar.LineaDeCalle_2 = txtLineaDeCalle2.Text;
                    institucionAEditar.LineaDeCalle_3 = txtLineaDeCalle3.Text;
                    institucionAEditar.Estado         = txtEstado.Text;

                    bool res = objDaoInstitucion.UPDATE(institucionAEditar);
                    if (res)
                    {
                        MessageBox.Show("Institucion Actualizada Exitosamente", "Info", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        this.Close();
                    }
                    else
                    {
                        MessageBox.Show("Error Al Actualizar La Institucion", "Info", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    }
                }
                else
                {
                    Modelo.Region newRegion = (Modelo.Region)cbIdRegion.SelectedItem;
                    InstitucionAAgregar.IdRegion = newRegion.IdRegion;

                    InstitucionAAgregar.NombreCompleto = txtNombreCompleto.Text;
                    InstitucionAAgregar.NombreCorto    = txtNombreCorto.Text;
                    InstitucionAAgregar.PaginaWeb      = txtPaginaWeb.Text;
                    InstitucionAAgregar.GradoOfrecido  = txtGradoOfrecido.Text;
                    InstitucionAAgregar.CompaniaCalle  = txtCompañiaCalle.Text;
                    InstitucionAAgregar.State          = txtState.Text;
                    InstitucionAAgregar.Ciudad         = txtCiudad.Text;
                    InstitucionAAgregar.CodigoPostal   = txtCodigoPostal.Text;
                    InstitucionAAgregar.LineaDeCalle_2 = txtLineaDeCalle2.Text;
                    InstitucionAAgregar.LineaDeCalle_3 = txtLineaDeCalle3.Text;
                    InstitucionAAgregar.Estado         = txtEstado.Text;

                    int res = objDaoInstitucion.INSERT(InstitucionAAgregar);
                    if (res != 0)
                    {
                        MessageBox.Show("Institucion Agregada Exitosamente", "Info", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        this.Close();
                    }
                    else
                    {
                        MessageBox.Show("Error Al Agregar La Institucion ", "Info", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    }
                }
            }
        }