private void CargarGrilla(int idDen, string tipo) { try { string ids; switch (tipo) { case "T": txtTel.CssClass = "TextBoxTelefono"; DataSet dsTelefonos = NegocioContactos.TraerTelefonosDenunciante(idDen); ids = ""; foreach (DataRow r in dsTelefonos.Tables[0].Rows) { ids = ids + r["ID"].ToString() + ";"; } Session.Add("ids", ids); dsTelefonos.Tables[0].Columns.Remove("ID"); this.grdContactos.DataSource = dsTelefonos; this.grdContactos.DataBind(); break; case "C": txtTel.CssClass = "TextBoxTelefono"; DataSet dsCelulares = NegocioContactos.TraerCelularesDenunciante(idDen); ids = ""; foreach (DataRow r in dsCelulares.Tables[0].Rows) { ids = ids + r["ID"].ToString() + ";"; } Session.Add("ids", ids); dsCelulares.Tables[0].Columns.Remove("ID"); this.grdContactos.DataSource = dsCelulares; this.grdContactos.DataBind(); break; case "E": txtTel.CssClass = "TextBox"; DataSet dsEmails = NegocioContactos.TraerEmailsDenunciante(idDen); ids = ""; foreach (DataRow r in dsEmails.Tables[0].Rows) { ids = ids + r["ID"].ToString() + ";"; } Session.Add("ids", ids); dsEmails.Tables[0].Columns.Remove("ID"); this.grdContactos.DataSource = dsEmails; this.grdContactos.DataBind(); break; } } catch (Exception ex) { Response.Redirect("Errores.aspx?error=" + ex.Message); } }
protected void btnAceptar_Click(object sender, EventArgs e) { try { if (this.txtTel.Text == "") { MostrarMensaje("Debe ingresar el contacto"); } else { int idDen = int.Parse(Session["idDen"].ToString()); if (hAccion.Value == "agregar") { NegocioContactos.AgregarContacto(DropDownList1.SelectedValue, this.txtTel.Text.Trim(), idDen); CargarGrilla(idDen, DropDownList1.SelectedValue); txtTel.Text = ""; txtTel.Enabled = false; btnAceptar.Enabled = false; btnAceptar.CssClass = "ButtonBlue11pxDisable"; btnCancelar.Enabled = false; btnCancelar.CssClass = "ButtonBlue11pxDisable"; } else//modificar { string[] ids = Session["ids"].ToString().Split(';'); int index = grdContactos.SelectedIndex; NegocioContactos.ModificarContacto(DropDownList1.SelectedValue, this.txtTel.Text.Trim(), int.Parse(ids[index].ToString())); CargarGrilla(idDen, DropDownList1.SelectedValue); } txtTel.Text = ""; txtTel.Enabled = false; btnAceptar.Enabled = false; btnAceptar.CssClass = "ButtonBlue11pxDisable"; btnCancelar.Enabled = false; btnCancelar.CssClass = "ButtonBlue11pxDisable"; } } catch (Exception ex) { Response.Redirect("Errores.aspx?error=" + ex.Message); } }
protected void btnEliminar_Click(object sender, EventArgs e) { if (this.grdContactos.SelectedIndex == -1) { MostrarMensaje("Debe seleccionar el contacto a eliminar"); } else { string[] ids = Session["ids"].ToString().Split(';'); NegocioContactos.EliminarContacto(int.Parse(ids[grdContactos.SelectedIndex])); int idDen = int.Parse(Session["idDen"].ToString()); CargarGrilla(idDen, DropDownList1.SelectedValue); txtTel.Text = ""; grdContactos.SelectedIndex = -1; this.btnAplicar.Enabled = false; this.btnAplicar.CssClass = "ButtonBlue11pxDisable"; } }
protected void btnAplicar_Click(object sender, EventArgs e) { try { if (grdContactos.SelectedIndex != -1) { int index = grdContactos.SelectedIndex; string[] ids = Session["ids"].ToString().Split(';'); NegocioContactos.ActivarContacto(Session["idDen"].ToString(), int.Parse(ids[index].ToString()), DropDownList1.SelectedValue); switch (DropDownList1.SelectedValue) { case "T": hTelAct.Value = grdContactos.SelectedRow.Cells[1].Text; break; case "C": hCelAct.Value = grdContactos.SelectedRow.Cells[1].Text; break; case "E": hMailAct.Value = grdContactos.SelectedRow.Cells[1].Text; break; } MostrarMensaje("El contacto ha sido activado para ser mostrado en la pantalla principal del expediente."); hActivo.Value = hTelAct.Value; } else { MostrarMensaje("Debe seleccionar un telefono, o presionar Volver para regresar sin cambios."); } } catch (Exception ex) { Response.Write(ex); } }
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); } }
private void SetearControlesExpediente(Expediente expediente) { try { //Datos Expediente. TraerIniciadorExpediente(expediente); this.lblNroExpediente.Text = expediente.idExpediente.ToString(); this.cboAtendio.SelectedValue = expediente.atendio.idPersona.ToString(); if (expediente.informante != null) { this.cboInformante.SelectedValue = expediente.informante.idPersona.ToString(); } this.lblEstado.Text = TraerEstado(expediente.movimientos); if (expediente.fechaArchivo != DateTime.MinValue) { this.lblFechaArchivo.Text = expediente.fechaArchivo.ToShortDateString(); } else { this.lblFechaArchivo.Text = ""; } this.lblFechaIngreso.Text = expediente.fechaIngreso.ToShortDateString(); //Datos Denunciante. this.txtApellido.Text = expediente.denunciante.apellido; this.txtNombres.Text = expediente.denunciante.nombre; this.txtCalle.Text = expediente.denunciante.domicilio; this.txtDpto.Text = expediente.denunciante.dpto; this.txtNro.Text = expediente.denunciante.numero.ToString(); this.txtPiso.Text = expediente.denunciante.piso.ToString(); this.txtNroDNI.Text = expediente.denunciante.nroDocumento.ToString(); this.cboTipoDni.SelectedValue = expediente.denunciante.idTipoDocumento.ToString(); bool flag = false; foreach (ListItem item in cboLocalidad.Items) { if (item.Value == expediente.denunciante.idLocalidad.ToString()) { flag = true; } } if (flag) { cboLocalidad.SelectedValue = expediente.denunciante.idLocalidad.ToString(); } else { Localidad localidad = NegocioMantenimiento.TraerLocalidadPorId(expediente.denunciante.idLocalidad); cboLocalidad.SelectedValue = "0"; this.txtOtraLoc.Text = localidad.descLocalidad; hOtraLoc.Value = expediente.denunciante.idLocalidad.ToString() + "|" + localidad.descLocalidad; } this.txtTelefono.Text = NegocioContactos.TraerTelefonoActivo(expediente.denunciante.idDenunciante); this.txtCelular.Text = NegocioContactos.TraerCelularActivo(expediente.denunciante.idDenunciante); this.txtEmail.Text = NegocioContactos.TraerMailActivo(expediente.denunciante.idDenunciante); //expediente.denunciante.contactos = NegocioExpedientes.TraerContactoDenunciante(expediente.denunciante.idDenunciante); //foreach (Contacto contacto in expediente.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; // } //} //Datos Denuncia. this.lblApellido.Text = expediente.denunciante.apellido; this.lblNombres.Text = expediente.denunciante.nombre; this.lblTelefono.Text = this.txtTelefono.Text; if (expediente.movimientos.Count != 0) { this.btnMovimientos.Enabled = true; this.btnMovimientos.CssClass = "ButtonBlue11px"; } this.cboArea.SelectedValue = expediente.area.idArea.ToString(); this.cboEntDenunciada.SelectedValue = expediente.denunciado.idDenunciado.ToString(); this.cboTipoDenuncia.SelectedValue = expediente.idTipoDenuncia.ToString(); this.chkDocumentacion.Checked = expediente.traeDocumentacion == 1 ? true : false; this.txtDetalleDocumentacion.Text = expediente.descDocumentacion; this.txtDetalleDenuncia.Text = expediente.descDenuncia; } catch (Exception ex) { Response.Redirect("Errores.aspx?error=" + ex.Message); } }
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); } }
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()); } }