protected void GridViewConsulta_Edit(int id)
        {
            ContactoBLL contactoBLL = new ContactoBLL();
            Contacto    contacto    = contactoBLL.GetContactoByID(id);

            Application["contacto"] = contacto;
            Application["accion"]   = "editar";
            Response.Redirect("NuevoContacto.aspx");
        }
        //CONSULTA CON FILTROS
        protected void Consultar(Object sender, EventArgs e)
        {
            ContactoBLL contactoBLL = new ContactoBLL();

            FiltroContacto filtro = getFiltro();

            List <Contacto> gridData = contactoBLL.GetListContactoByFilter(filtro);

            bindGrid(gridData);
        }
        protected void GridViewConsulta_Activate(int idContacto)
        {
            ContactoBLL contactoBLL = new ContactoBLL();

            contactoBLL.Activate(idContacto);

            FiltroContacto filtro = (FiltroContacto)Application["filtro"];

            List <Contacto> gridData = contactoBLL.GetListContactoByFilter(filtro);

            bindGrid(gridData);
        }
        private void CargarFiltros()
        {
            FiltroContacto filtro = (FiltroContacto)Application["filtro"];

            if (filtro != null)
            {
                ContactoBLL contactoBLL = new ContactoBLL();

                List <Contacto> gridData = contactoBLL.GetListContactoByFilter(filtro);

                bindGrid(gridData);
            }
        }
Ejemplo n.º 5
0
        protected void GuardarContacto_Click(object sender, EventArgs e)
        {
            if (Page.IsValid)
            {
                Contacto nuevoContacto = new Contacto()
                {
                    NombreApellido = NombreApellidoContacto.Text,
                    Genero         = ComboGenero.SelectedValue,
                    Pais           = new Pais()
                    {
                        id = Convert.ToInt32(Paises.SelectedValue)
                    },
                    Localidad        = Localidad.Text,
                    Contacto_interno = new SiNo()
                    {
                        id = Convert.ToInt32(ContactoInternoList.SelectedValue)
                    },
                    Organizacion = OrganizacionBox.Text,
                    Area         = new Area()
                    {
                        id = Convert.ToInt32(AreaList.SelectedValue)
                    },
                    Fecha_ingreso = DateTime.Now,
                    Activo        = new SiNo()
                    {
                        id = Convert.ToInt32(ActivoList.SelectedValue)
                    },
                    Direccion        = DireccionContacto.Text,
                    Telefono_fijo    = Int64.Parse(TelFijoContacto.Text),
                    Telefono_celular = Int64.Parse(CelContacto.Text),
                    Email            = MailContacto.Text,
                    Skype            = CuentaSkype.Text
                };

                ContactoBLL contactoBLL = new ContactoBLL();
                string      accion      = (string)Application["accion"];

                if (accion == "editar")
                {
                    //le agrego el id a contacto
                    nuevoContacto.id = Convert.ToInt32(AgregarContacto.Attributes["id"]);
                    contactoBLL.Update(nuevoContacto);

                    redireccion();
                }
                else
                {
                    ServicioContacto servicioContacto = new ServicioContacto();
                    try
                    {
                        string cuil = servicioContacto.ObtenerCuil(nuevoContacto.NombreApellido, nuevoContacto.Genero);

                        nuevoContacto.Cuil = cuil;

                        contactoBLL.Insert(nuevoContacto);

                        redireccion();
                    } catch (Exception ex)
                    {
                        // mostrar mensaje de error en front end de no existe contacto
                    }
                }
            }
        }
 public void deleteContacto(Contacto contacto)
 {
     ContactoBLL.deleteContacto(contacto);
 }
 public List <Contacto> applyFilter(Filter filtro)
 {
     return(ContactoBLL.applyFilter(filtro));
 }
 public Contacto getContactoByGuid(Guid contactoGuid)
 {
     return(ContactoBLL.getContactoByGuid(contactoGuid));
 }
 public void updateContacto(Contacto contacto)
 {
     ContactoBLL.updateContacto(contacto);
 }
 public void createContacto(Contacto contacto)
 {
     ContactoBLL.createContacto(contacto);
 }
 public void createPersona(string nombre)
 {
     ContactoBLL.createPersona(Guid.NewGuid(), nombre);
 }
 //Llamadas a métodos de ContactoBLL
 public List <Contacto> getAllContactos()
 {
     return(ContactoBLL.getAllContactos());
 }