//Boton para modificar los cambios al seleccionar el botón guardar protected void botonGuardarTercero_Click(object sender, EventArgs e) { if (txtNombre.Text != "" & txtApellido.Text != "" & txtNacimiento.Text != "" & ddlTipoDocumentoTercero.Text != "" & txtIdentificacion.Text != "" & ddlDepartamento.Text != "" & ddlCiudad.Text != "" & ddlHabeasData.Text != "") { if (txtCelular.Text != "" | txtTelefono1.Text != "" | txtTelefono2.Text != "") { if (txtDireccion.Text != "" & ddlGeneroTercero.Text != "" & ddlEstadoCivilTercero.Text != "" & ddlOcupacionTercero.Text != "") { AdministrarTercero.ModificarTercero(txtDocumento.Text, ddlTipoDocumentoTercero.SelectedValue, txtNombre.Text, txtApellido.Text, DateTime.Parse(txtNacimiento.Text), txtCorreo.Text, ddlGeneroTercero.SelectedValue, ddlDepartamento.SelectedValue, ddlCiudad.SelectedValue, txtCelular.Text, txtTelefono1.Text, txtDireccion.Text, txtTelefono2.Text, ddlOcupacionTercero.SelectedValue, ddlEstadoCivilTercero.SelectedValue, int.Parse(ddlHabeasData.SelectedValue)); //limpiar(); mostrarControles(); buscarTercero(); //- bloquearCampos(); } else { ClientScript.RegisterStartupScript(GetType(), "alert", "alert('" + "FALTAN DATOS POR INGRESAR" + "');", true); } } else { ClientScript.RegisterStartupScript(GetType(), "alert", "alert('" + "FALTAN DATOS POR INGRESAR" + "');", true); } } else { ClientScript.RegisterStartupScript(GetType(), "alert", "alert('" + "FALTAN DATOS POR INGRESAR" + "');", true); } }
protected void botonEliminarTercero_Click(object sender, EventArgs e) { string mensaje = AdministrarTercero.EliminarTercero(txtDocumento.Text); //Se envia parámetro limpiar(); ClientScript.RegisterStartupScript(GetType(), "alert", "alert('" + mensaje + "');", true); }
//JC protected void ddlDepartamento_SelectedIndexChanged(object sender, EventArgs e) { AdministrarTercero.ConsultarCiudad(ddlDepartamento.SelectedValue); DataTable dt = new DataTable(); dt = AdministrarTercero.asegurado.sp_ConsultarCiudad(); ddlCiudad.DataTextField = "ciu_Nombre"; // Cargamos lo que aparece en el ddl ddlCiudad.DataValueField = "ciu_Id"; // Cargamos lo que vale por debajo ddlCiudad.DataSource = dt; ddlCiudad.DataBind(); }
protected void btnInsertar_Click(object sender, EventArgs e) { AdministrarTercero.InsertarTercero(txtIdentificacion.Text, DBNull.Value.ToString(), txtNombre.Text, txtApellido.Text, DateTime.Today, txtCorreo.Text, DBNull.Value.ToString(), ddlDepartamento.SelectedValue, DBNull.Value.ToString(), txtCelular.Text, txtTelefono1.Text, txtDireccion.Text, txtTelefono2.Text, DBNull.Value.ToString(), DBNull.Value.ToString(), 0); //Response.Redirect("DevolucionDePrima2.aspx"); Response.RedirectToRoute("devolucionPrimaTramitar"); }
//Método buscarTercero - JC private void buscarTercero() { AdministrarTercero.asegurado = new Asegurado(); //string mensaje = Funciones.validarCampoVacio(txtDocumento.Text); //Se envía dato a la función y valida si el campo está vacio //if (mensaje != "") if (txtDocumento.Text == "") { ClientScript.RegisterStartupScript(GetType(), "alert", "alert('" + "POR FAVOR INGRESE UN NÚMERO DE DOCUMENTO" + "');", true); limpiar(); ocultarBotones(); ocultarControles(); } else { AdministrarTercero.MostrarTercero(txtDocumento.Text); if (AdministrarTercero.asegurado.Mensaje == "Busqueda exitosa!") { mostrarControles(); DataTable dt = new DataTable(); dt = AdministrarTercero.asegurado.sp_MostrarDepartamento(); ddlDepartamento.DataTextField = "dep_Nombre"; // Cargamos lo que aparece en el ddl ddlDepartamento.DataValueField = "dep_Id"; // Cargamos lo que vale por debajo ddlDepartamento.DataSource = dt; ddlDepartamento.DataBind(); //ddlDepartamento.Items.FindByText(AdministrarTercero.asegurado.DepartamentoNombre); ddlDepartamento.SelectedIndex = ddlDepartamento.Items.IndexOf(ddlDepartamento.Items.FindByText(AdministrarTercero.asegurado.DepartamentoNombre)); //ddlDepartamento.SelectedItem.Text = AdministrarTercero.asegurado.DepartamentoNombre; dt = AdministrarTercero.asegurado.sp_ConsultarCiudad(); ddlCiudad.DataTextField = "ciu_Nombre"; // Cargamos lo que aparece en el ddl ddlCiudad.DataValueField = "ciu_Id"; // Cargamos lo que vale por debajo ddlCiudad.DataSource = dt; ddlCiudad.DataBind(); ddlTipoDocumentoTercero.SelectedIndex = ddlTipoDocumentoTercero.Items.IndexOf(ddlTipoDocumentoTercero.Items.FindByText(AdministrarTercero.asegurado.TipoDocumentoNombre)); txtIdentificacion.Text = AdministrarTercero.asegurado.NumeroDocumento; txtNombre.Text = AdministrarTercero.asegurado.Nombres.ToUpper(); txtApellido.Text = AdministrarTercero.asegurado.Apellidos; txtEdad.Text = Funciones.Edad(AdministrarTercero.asegurado.FechaNacimiento).ToString(); //Envía fecha y devuelve la edad if (AdministrarTercero.asegurado.FechaNacimiento.Year != 1) { txtNacimiento.Text = AdministrarTercero.asegurado.FechaNacimiento.ToString("yyyy-MM-dd"); } else { txtEdad.Text = ""; txtNacimiento.Text = ""; } txtCorreo.Text = AdministrarTercero.asegurado.CorreoElectronico; ddlGeneroTercero.SelectedIndex = ddlGeneroTercero.Items.IndexOf(ddlGeneroTercero.Items.FindByText(AdministrarTercero.asegurado.Sexo)); int hd = 0; if (AdministrarTercero.asegurado.HabeasData.ToString() == "1") { hd = 1; } ddlHabeasData.SelectedValue = hd.ToString(); //ddlDepartamento.SelectedItem.Text = AdministrarTercero.asegurado.DepartamentoNombre; //ddlCiudad.Items.FindByText(AdministrarTercero.asegurado.CiudadNombre); //ddlCiudad.SelectedIndex = 2; ddlCiudad.SelectedIndex = ddlCiudad.Items.IndexOf(ddlCiudad.Items.FindByText(AdministrarTercero.asegurado.CiudadNombre)); //ddlCiudad.SelectedItem.Text = AdministrarTercero.asegurado.CiudadNombre; txtCelular.Text = AdministrarTercero.asegurado.Celular; txtTelefono1.Text = AdministrarTercero.asegurado.Telefono1; txtDireccion.Text = AdministrarTercero.asegurado.Direccion; txtTelefono2.Text = AdministrarTercero.asegurado.Telefono2; ddlOcupacionTercero.SelectedIndex = ddlOcupacionTercero.Items.IndexOf(ddlOcupacionTercero.Items.FindByText(AdministrarTercero.asegurado.OcupacionNombre)); ddlEstadoCivilTercero.SelectedIndex = ddlEstadoCivilTercero.Items.IndexOf(ddlEstadoCivilTercero.Items.FindByText(AdministrarTercero.asegurado.EstadoCivilNombre)); mostrarBotones(); bloquearCampos(); botonRegistrarTercero.Visible = false; botonGuardarTercero.Visible = false; botonCancelarTercero.Visible = false; ClientScript.RegisterStartupScript(GetType(), "alert", "alert('" + AdministrarTercero.asegurado.Mensaje + "');", true); limpiarObjetosClaseAdministrarTercero(); //llama el método if ((string)Session["flag"] == "2") { botonProductosTercero.Visible = false; if (txtNombre.Text != "" & txtApellido.Text != "" & txtNacimiento.Text != "" & ddlTipoDocumentoTercero.Text != "" & txtIdentificacion.Text != "" & ddlDepartamento.Text != "" & ddlCiudad.Text != "") { if (txtCelular.Text != "" | txtTelefono1.Text != "" | txtTelefono2.Text != "") { if (txtDireccion.Text != "" & ddlGeneroTercero.Text != "" & ddlEstadoCivilTercero.Text != "" & ddlOcupacionTercero.Text != "") { PasarCertificado.Visible = true; botonProductosTercero.Visible = false; } } } Session["flagTemp"] = "2"; // Session["flag"] = "1"; } } else { ClientScript.RegisterStartupScript(GetType(), "alert", "alert('" + AdministrarTercero.asegurado.Mensaje + "');", true); //ocultarControles(); ocultarBotones(); ocultarControles(); limpiar(); } } }