Ejemplo n.º 1
0
 private void GuardarDenuncianteSession(Denunciante denunciante)
 {
     if (this.Page.Session["Denunciante"] == null)
     {
         this.Page.Session.Add("Denunciante", denunciante);
     }
     else
     {
         this.Page.Session["Denunciante"] = denunciante;
     }
 }
Ejemplo n.º 2
0
    protected void btnRegresar_Click(object sender, EventArgs e)
    {
        Denunciante denunciante = new Denunciante();

        try
        {
            if (gvDatoDenunciante.SelectedIndex != -1)
            {
                denunciante = NegocioExpedientes.TraerDenuncianteCompletoPorID(Convert.ToInt32(gvDatoDenunciante.SelectedRow.Cells[1].Text));

                GuardarDenuncianteSession(denunciante);
            }

            string str = "<script type = text/javascript>";
            str = str + "window.close();</script>";

            Page.ClientScript.RegisterStartupScript(Page.ClientScript.GetType(), "cerrarVentana", str);
        }
        catch (Exception ex)
        {
            Response.Write(ex);
        }
    }
Ejemplo n.º 3
0
    private Denunciante CargarDenunciante(Denunciante denunciante)
    {
        try
        {
            if (denunciante == null)
            {
                denunciante = new Denunciante();
                denunciante.idDenunciante = NegocioExpedientes.TraerProxIdDenunciante();
            }

            //List<Contacto> contactos = new List<Contacto>();
            //Contacto contacto;
            //contacto = new Contacto();
            //contacto.idDenunciante = denunciante.idDenunciante;
            //contacto.tipoContacto = "T";
            //contactos.Add(contacto);

            //contacto = new Contacto();
            //contacto.idDenunciante = denunciante.idDenunciante;
            //contacto.tipoContacto = "C";
            //contactos.Add(contacto);

            //contacto = new Contacto();
            //contacto.idDenunciante = denunciante.idDenunciante;
            //contacto.tipoContacto = "E";
            //contactos.Add(contacto);

            //denunciante.contactos = contactos;

            denunciante.apellido        = txtApellido.Text.ToUpper();
            denunciante.nombre          = txtNombres.Text;
            denunciante.domicilio       = txtCalle.Text;
            denunciante.numero          = txtNro.Text != "" ? int.Parse(txtNro.Text) : (Byte)0;
            denunciante.piso            = txtPiso.Text != "" ? Byte.Parse(txtPiso.Text) : (Byte)0;
            denunciante.dpto            = txtDpto.Text;
            denunciante.idTipoDocumento = Byte.Parse(cboTipoDni.SelectedValue);
            denunciante.nroDocumento    = int.Parse(txtNroDNI.Text);

            //foreach (Contacto cont in denunciante.contactos)
            //{
            //    switch (cont.tipoContacto)
            //    {
            //        case "T":   cont.contacto = txtTelefono.Text;
            //                    break;
            //        case "C":   cont.contacto = txtCelular.Text;
            //                    break;
            //        case "E":   cont.contacto = txtEmail.Text;
            //                    break;
            //    }
            //}

            if (cboLocalidad.SelectedValue != "0")
            {
                denunciante.idLocalidad = int.Parse(cboLocalidad.SelectedValue);
            }
            else
            {
                denunciante.idLocalidad = int.Parse(hOtraLoc.Value.Split('|')[0].ToString());
            }


            return(denunciante);
        }
        catch (Exception ex)
        {
            Response.Redirect("Errores.aspx?error=" + ex.Message);
            throw;
        }
    }
Ejemplo n.º 4
0
    private void SetearControlesDenunciante(Denunciante denunciante)
    {
        try
        {
            this.txtApellido.Text         = denunciante.apellido;
            this.txtNombres.Text          = denunciante.nombre;
            this.txtCalle.Text            = denunciante.domicilio;
            this.txtDpto.Text             = denunciante.dpto;
            this.txtNro.Text              = denunciante.numero.ToString();
            this.txtPiso.Text             = denunciante.piso.ToString();
            this.txtNroDNI.Text           = denunciante.nroDocumento.ToString();
            this.cboTipoDni.SelectedValue = denunciante.idTipoDocumento.ToString();
            bool flag = false;
            foreach (ListItem item in cboLocalidad.Items)
            {
                if (item.Value == denunciante.idLocalidad.ToString())
                {
                    flag = true;
                }
            }
            if (flag)
            {
                cboLocalidad.SelectedValue = denunciante.idLocalidad.ToString();
            }
            else
            {
                Localidad localidad = NegocioMantenimiento.TraerLocalidadPorId(denunciante.idLocalidad);

                cboLocalidad.SelectedValue = "0";
                this.cboLocalidad.Enabled  = false;
                this.txtOtraLoc.Text       = localidad.descLocalidad;
                hOtraLoc.Value             = denunciante.idLocalidad + "|" + localidad.descLocalidad;
            }

            this.txtTelefono.Text = NegocioContactos.TraerTelefonoActivo(denunciante.idDenunciante);
            this.txtCelular.Text  = NegocioContactos.TraerCelularActivo(denunciante.idDenunciante);
            this.txtEmail.Text    = NegocioContactos.TraerMailActivo(denunciante.idDenunciante);



            //foreach (Contacto contacto in denunciante.contactos)
            //{
            //    switch (contacto.tipoContacto)
            //    {
            //        case "T":
            //            this.txtTelefono.Text = contacto.contacto;
            //            break;
            //        case "C":
            //            this.txtCelular.Text = contacto.contacto;
            //            break;
            //        case "E":
            //            this.txtEmail.Text = contacto.contacto;
            //            break;
            //    }
            //}
        }
        catch (Exception ex)
        {
            Response.Redirect("Errores.aspx?error=" + ex.Message);
        }
    }
Ejemplo n.º 5
0
    protected void btnGuardar_Click(object sender, EventArgs e)
    {
        try
        {
            Expediente expediente = TraerExpedienteSession();
            if (expediente == null)//nuevo expediente
            {
                expediente = new Expediente();
                Denunciante denunciante = this.TraerDenuncianteSession();
                if (denunciante == null)//agregar tambien al denunciante
                {
                    denunciante = CargarDenunciante(denunciante);
                    NegocioExpedientes.AgregarDenunciante(denunciante);
                    GuardarDenuncianteSession(denunciante);
                }
                else//modificar denunciante
                {
                    denunciante = CargarDenunciante(denunciante);
                    NegocioExpedientes.ModificarDenunciante(denunciante);
                    GuardarDenuncianteSession(denunciante);
                }
                expediente = CargarExpediente(expediente);
                NegocioExpedientes.Agregar(expediente);
                this.GuardarExpedienteSession(expediente);
                GuardarDenuncianteSession(denunciante);

                HabilitarDesHabilitarControlesDenuncia(false);
                HabilitarDesHabilitarControlesDenunciante(false);
                btnADMCont.Enabled  = true;
                btnADMCont.CssClass = "ButtonBlue11px";
            }
            else //modificar expediente
            {
                Denunciante denunciante = CargarDenunciante(expediente.denunciante);
                NegocioExpedientes.ModificarDenunciante(expediente.denunciante);
                GuardarDenuncianteSession(expediente.denunciante);

                expediente = CargarExpediente(expediente);
                NegocioExpedientes.Modificar(expediente);
                GuardarExpedienteSession(expediente);
                GuardarDenuncianteSession(expediente.denunciante);
                HabilitarDesHabilitarControlesDenuncia(false);
                HabilitarDesHabilitarControlesDenunciante(false);
                SetearControlesExpediente(expediente);
                SetearControlesDenunciante(expediente.denunciante);
            }

            this.btnNuevo.Enabled      = true;
            this.btnNuevo.CssClass     = "ButtonBlue11px";
            this.btnModificar.Enabled  = true;
            this.btnModificar.CssClass = "ButtonBlue11px";
            this.btnBuscar.Enabled     = true;
            this.btnBuscar.CssClass    = "ButtonBlue11px";
            this.btnGuardar.Enabled    = false;
            this.btnGuardar.CssClass   = "ButtonBlue11pxDisable";
            this.btnCancelar.Enabled   = false;
            this.btnCancelar.CssClass  = "ButtonBlue11pxDisable";

            this.btnPrimero.Enabled    = true;
            this.btnPrimero.CssClass   = "ButtonBlue11px";
            this.btnAnterior.Enabled   = true;
            this.btnAnterior.CssClass  = "ButtonBlue11px";
            this.btnSiguiente.Enabled  = true;
            this.btnSiguiente.CssClass = "ButtonBlue11px";
            this.btnUltimo.Enabled     = true;
            this.btnUltimo.CssClass    = "ButtonBlue11px";
        }
        catch (Exception ex)
        {
            Response.Redirect("Errores.aspx?error=" + ex.Message);
        }
    }
Ejemplo n.º 6
0
    protected void imgBuscarDen_Click(object sender, ImageClickEventArgs e)
    {
        try
        {
            if (this.txtNroDNI.Text.Trim() != "") //&& TraerDenuncianteSession() == null)
            {
                int         nroDoc      = int.Parse(this.txtNroDNI.Text);
                Denunciante denunciante = NegocioExpedientes.TraerDenunciantePorNroDoc(nroDoc);
                if (denunciante != null)
                {
                    this.txtApellido.Text = denunciante.apellido;
                    this.txtNombres.Text  = denunciante.nombre;
                    this.txtCalle.Text    = denunciante.domicilio;
                    this.txtDpto.Text     = denunciante.dpto;
                    this.txtNro.Text      = denunciante.numero.ToString();
                    this.txtNroDNI.Text   = denunciante.nroDocumento.ToString();
                    this.txtOtraLoc.Text  = "";
                    this.txtPiso.Text     = denunciante.piso.ToString();


                    this.txtTelefono.Text = NegocioContactos.TraerTelefonoActivo(denunciante.idDenunciante);
                    this.txtCelular.Text  = NegocioContactos.TraerCelularActivo(denunciante.idDenunciante);
                    this.txtEmail.Text    = NegocioContactos.TraerMailActivo(denunciante.idDenunciante);



                    //foreach (Contacto contacto in denunciante.contactos)
                    //{
                    //    switch (contacto.tipoContacto)
                    //    {
                    //        case "T":
                    //            this.txtTelefono.Text = contacto.contacto;
                    //            break;
                    //        case "C":
                    //            this.txtCelular.Text = contacto.contacto;
                    //            break;
                    //        case "E":
                    //            this.txtEmail.Text = contacto.contacto;
                    //            break;
                    //    }

                    //}

                    this.lblApellido.Text = denunciante.apellido;
                    this.lblNombres.Text  = denunciante.nombre;
                    this.lblTelefono.Text = this.txtTelefono.Text;

                    GuardarDenuncianteSession(denunciante);

                    //HabilitarDesHabilitarControlesDenunciante(false);
                    //this.imgBuscarDen.Enabled = true;
                }
                else
                {
                    string str = "<script type=\"text/javascript\">";
                    str = str + "mostrarDeseaHacer();</script>";
                    Page.ClientScript.RegisterStartupScript(Page.ClientScript.GetType(), "mostrarConfirmacion", str);
                }
            }
            else
            {
                Session.Add("EsPopup", 1);
                AbrirPopupDenunciantes();
            }
        }
        catch (System.Threading.ThreadAbortException) { }
        catch (Exception ex)
        {
            Response.Redirect("Errores.aspx?error=" + ex.Message);
        }
    }
Ejemplo n.º 7
0
    protected void Page_Load(object sender, EventArgs e)
    {
        try
        {
            this.lblDenuncia.Attributes.Add("onclick", "seleccionarTabDenuncia();");
            this.lblDenunciante.Attributes.Add("onclick", "seleccionarTabDenunciante();");
            this.btnNuevo.Attributes.Add("onclick", "limpiarCampos();return habilitarCampos(true);");
            this.btnCancelar.Attributes.Add("onclick", "return habilitarCampos(false)");
            //this.imgBuscarLoc.Attributes.Add("onclick", "return AbrirPopupLocalidades();");
            this.chkDocumentacion.Attributes.Add("onClick", "chkTraeDoc_OnClick()");
            // this.imgPopupContactos.Attributes.Add("onclick", "AbrirPopupContactos();");
            this.cboLocalidad.Attributes.Add("onChange", "return cboLocalidad_SelectedIndexChange();");
            this.btnGuardar.Attributes.Add("onClick", "return validarIngresos();");
            this.cboEntDenunciada.Attributes.Add("onChange", "cboEntDenunciada_SelectedIndexChange();");



            if (!this.IsPostBack)
            {
                this.CargarCombosInformante();
                this.CargarComboTiposDocumento();
                this.CargarComboLocalidades();
                this.CargarComboEntidades();
                this.CargarComboAreas();
                this.CargarComboTiposDenuncia();


                Expediente expediente = TraerExpedienteSession();

                if (expediente == null)
                {
                    expediente = NegocioExpedientes.TraerExpedienteCompletoPorIdExpediente(1);
                    GuardarExpedienteSession(expediente);
                }
                if (expediente != null)
                {
                    SetearControlesExpediente(expediente);
                    this.btnModificar.Enabled  = true;
                    this.btnModificar.CssClass = "ButtonBlue11px";
                }
            }
            else
            {
                //evaluo respuesta de usuario..
                if (hNavegarBusqDenunciantes.Value == "true")
                {
                    Session.Add("EsPopup", 1);
                    AbrirPopupDenunciantes();
                    hNavegarBusqDenunciantes.Value = "";
                }
                else if (hNavegarBusqDenunciantes.Value == "false")
                {
                    ReestablecerEstado();
                    hNavegarBusqDenunciantes.Value = "";
                }

                Denunciante denunciante = TraerDenuncianteSession();

                int esPopup = Session["EsPopup"] != null?int.Parse(Session["EsPopup"].ToString()) : 0;

                if (denunciante != null && esPopup == 1)
                {
                    SetearControlesDenunciante(denunciante);
                    //HabilitarDesHabilitarControlesDenunciante(false);
                    this.imgBuscarDen.Enabled = true;
                    Session["EsPopup"]        = 0;
                }

                if (hOtraLoc.Value != "")
                {
                    this.txtOtraLoc.Text            = hOtraLoc.Value.Split('|')[1].ToString();
                    this.cboLocalidad.SelectedValue = "0";
                }
                else
                {
                    this.txtOtraLoc.Text = "";
                }

                int PopupContactos = Session["PopupContactos"] != null?int.Parse(Session["PopupContactos"].ToString()) : 0;

                if (PopupContactos == 1 && denunciante != null)
                {
                    txtTelefono.Text = NegocioContactos.TraerTelefonoActivo(denunciante.idDenunciante);
                    lblTelefono.Text = txtTelefono.Text;
                    txtCelular.Text  = NegocioContactos.TraerCelularActivo(denunciante.idDenunciante);
                    txtEmail.Text    = NegocioContactos.TraerMailActivo(denunciante.idDenunciante);
                    Session.Add("PopupContactos", 0);
                }
            }
        }
        catch (Exception ex)
        {
            Response.Redirect("Errores.aspx?error=" + ex.Message.ToString());
        }
    }