/// <summary> /// Actualiza el campo autorizado y aprobado de Organizador /// Autorizado /// 1 = Habilitado /// 0 = Deshabilitado /// Aprobado /// v = valido /// n = no valido /// </summary> protected void btnActualizar_Click(object sender, EventArgs e) { OrganizadorBLL org = new OrganizadorBLL(); foreach (GridViewRow row in grvOrganizador.Rows) { CheckBox check = row.Cells[2].FindControl("chkAprobado") as CheckBox; if (check.Checked) { int inscripcion = Int32.Parse(row.Cells[1].Text); org.updateAprobado(inscripcion, "v"); } else { int inscripcion = Int32.Parse(row.Cells[1].Text); org.updateAprobado(inscripcion, "n"); } CheckBox check1 = row.Cells[3].FindControl("chkAutorizado") as CheckBox; if (check1.Checked) { int inscripcion = Int32.Parse(row.Cells[1].Text); org.updateAutorizado(inscripcion, 1); } else { int inscripcion = Int32.Parse(row.Cells[1].Text); org.updateAutorizado(inscripcion, 0); } } }
/// <summary> /// Guarda los datos entregados por el usuario /// </summary> protected void btnGuardar_Click(object sender, EventArgs e) { String[] separadorRut = txtRut.Text.Split('-'); OrganizadorBEL orgBEL = new OrganizadorBEL(); orgBEL.Rut = Int32.Parse(separadorRut[0]); orgBEL.Dv = Char.Parse(separadorRut[1]); orgBEL.NombreRazonSocial = txtNombre.Text; orgBEL.Giro = txtGiro.Text; orgBEL.Direccion = txtDireccion.Text; orgBEL.Correo = txtCorreo.Text; orgBEL.IdComuna = Int32.Parse(ddlComuna.SelectedItem.Value); orgBEL.Valido = "v"; OrganizadorBLL orgBLL = new OrganizadorBLL(); if (lblTitulo.Text.CompareTo("Editar Organizador") == 0) { orgBEL.IdEstado = Int32.Parse(lblEstado.Text); orgBLL.editarOrganizador(orgBEL); Response.Write("<script>alert('Datos modificados correctamente');window.location='Organizadores.aspx';</script>"); } else { orgBLL.registroOrganizador(orgBEL); Response.Write("<script>alert('Se agregó correctamente');window.location='Organizadores.aspx';</script>"); txtRut.Text = String.Empty; txtNombre.Text = String.Empty; txtGiro.Text = String.Empty; txtDireccion.Text = String.Empty; txtCorreo.Text = String.Empty; } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { /// <summary> /// Carga la grilla con todos los Organizadores registrados /// </summary> OrganizadorBLL cliBLL = new OrganizadorBLL(); grvContrato.DataSource = cliBLL.listaContrato(); grvContrato.DataBind(); } }
/// <summary> /// Busca a un organizador por run /// </summary> protected void btnBusqueda_Click1(object sender, EventArgs e) { try { OrganizadorBLL orgBLL = new OrganizadorBLL(); grvOrganizadores.DataSource = orgBLL.buscarOrganizadores(Int32.Parse(txtBusqueda.Text)); grvOrganizadores.DataBind(); } catch { Response.Write("<script>alert('Rut solo números'); </script>"); } }
protected void Page_Load(object sender, EventArgs e) { /// <summary> /// Carga la grilla con todos los organizadores registrados /// </summary> if (!IsPostBack) { //linea con mensaje de cuadro de busqueda txtBusqueda.Attributes.Add("placeholder", "Ingrese run de organizador"); OrganizadorBLL organizador = new OrganizadorBLL(); grvOrganizadores.DataSource = organizador.listaOrganizador(); grvOrganizadores.DataBind(); } }
/// <summary> /// Busca a un organizador por habilitado o deshabilitado /// </summary> protected void ddlFiltro_SelectedIndexChanged(object sender, EventArgs e) { int itemSel = Int32.Parse(ddlFiltro.SelectedItem.Value); if (itemSel == 1 || itemSel == 0) { OrganizadorBLL orgBLL = new OrganizadorBLL(); grvOrganizadores.DataSource = orgBLL.FiltarOrganizadores(itemSel); grvOrganizadores.DataBind(); } else { OrganizadorBLL organizador = new OrganizadorBLL(); grvOrganizadores.DataSource = organizador.listaOrganizador(); grvOrganizadores.DataBind(); } }
protected void Page_Load(object sender, EventArgs e) { ComunaBEL clicomuna = new ComunaBEL(); RegionBEL cliregion = new RegionBEL(); int comuna = 0; /// <summary> /// Carga los datos si se requiere actualiar o editar /// </summary> if (!IsPostBack) { if (Request.QueryString["Rut"] != null) { int rut = Int32.Parse(Request.QueryString["Rut"]); lblTitulo.Text = "Editar Organizador"; ClienteBLL cliBLL = new ClienteBLL(); OrganizadorBLL orgBLL = new OrganizadorBLL(); OrganizadorBEL orgBEL = orgBLL.MostrarOrganizador(rut); txtRut.Text = orgBEL.Rut.ToString() + "-" + orgBEL.Dv; txtRut.Enabled = false; txtNombre.Text = orgBEL.NombreRazonSocial; txtGiro.Text = orgBEL.Giro; txtDireccion.Text = orgBEL.Direccion; txtCorreo.Text = orgBEL.Correo; lblEstado.Text = orgBEL.IdEstado.ToString(); comuna = orgBEL.IdComuna; clicomuna = cliBLL.traerComuna(comuna); cliregion = cliBLL.traerRegion(clicomuna.IdRegion); } RegionBLL regionBLL = new RegionBLL(); List <RegionBEL> regBEL = regionBLL.traerRegiones(); ddlRegion.DataSource = regBEL; ddlRegion.DataValueField = "IdRegion"; ddlRegion.DataTextField = "Nombre"; ddlRegion.DataBind(); ddlRegion.Items.Insert(0, new ListItem(cliregion.Nombre, clicomuna.IdRegion.ToString())); ddlComuna.Items.Insert(0, new ListItem(clicomuna.Nombre, clicomuna.IdComuna.ToString())); } }
/// <summary> /// Guarda los nuevo datos de Cliente u Organizador conectado /// </summary> protected void btnGuardar_Click(object sender, EventArgs e) { String[] separadorRut = txtRut.Text.Split('-'); PerfilBEL usuario = (PerfilBEL)Session["usuarioConectado"]; int perfil = (usuario.IdTipoPerfil); if (perfil == 4) { ClienteBEL cliBEL = new ClienteBEL(); cliBEL.Rut = Int32.Parse(separadorRut[0]); cliBEL.Dv = Char.Parse(separadorRut[1]); cliBEL.Nombre = txtNombre.Text; cliBEL.Apellido = txtApellidos.Text; //cliBEL.Direccion = txtDireccion.Text; cliBEL.Correo = txtCorreo.Text; cliBEL.Celular = Int32.Parse(txtCelular.Text); //cliBEL.IdComuna = Int32.Parse(ddlComuna.SelectedItem.Value); ClienteBLL cliBLL = new ClienteBLL(); //cliBEL.IdEstado = estado; cliBLL.actualizarCliente(cliBEL); } else { OrganizadorBEL orgBEL = new OrganizadorBEL(); orgBEL.Rut = Int32.Parse(separadorRut[0]); orgBEL.Dv = Char.Parse(separadorRut[1]); orgBEL.NombreRazonSocial = txtNombre.Text; orgBEL.Giro = txtApellidos.Text; orgBEL.Direccion = txtDireccion.Text; orgBEL.Correo = txtCorreo.Text; //orgBEL.Celular = Int32.Parse(txtCelular.Text); orgBEL.IdComuna = Int32.Parse(ddlComuna.SelectedItem.Value); OrganizadorBLL orgBLL = new OrganizadorBLL(); orgBEL.IdEstado = estado; orgBLL.editarOrganizador(orgBEL); } Response.Write("<script>alert('Datos modificados correctamente');window.location='Perfil_datos.aspx';</script></script>"); }
/// <summary> /// Habilita, Modifica o Elimina al organizador seleccionado /// </summary> protected void grvOrganizadores_RowCommand(object sender, GridViewCommandEventArgs e) { OrganizadorBLL organizadorBLL = new OrganizadorBLL(); if (e.CommandName.Equals("modificarOrganizador")) { Response.Redirect(string.Format("AgregarOrganizador.aspx?Rut={0}", e.CommandArgument.ToString()), false); } else if (e.CommandName.Equals("EliminarOrganizador")) { organizadorBLL.eliminarOrganizador(Int32.Parse(e.CommandArgument.ToString())); grvOrganizadores.DataSource = organizadorBLL.listaOrganizador(); grvOrganizadores.DataBind(); } else if (e.CommandName.Equals("habilitar")) { OrganizadorBEL org = organizadorBLL.MostrarOrganizador(Int32.Parse(e.CommandArgument.ToString())); org.IdEstado = 1; organizadorBLL.editarOrganizador(org); grvOrganizadores.DataSource = organizadorBLL.listaOrganizador(); grvOrganizadores.DataBind(); } }
/// <summary> /// Genera un contrato al arganizador seleccionado el la grilla /// </summary> protected void btnContrato_Click(object sender, EventArgs e) { /// <summary> /// Crea la carpeta si no existe para guardar los pdf generados /// </summary> OrganizadorBLL org = new OrganizadorBLL(); if (!Directory.Exists(@"C:\PDF\")) { Directory.CreateDirectory(@"C:\PDF\"); } /// <summary> /// Genera los pdf con iTextSharp dll y referencia ya importadas /// </summary> foreach (GridViewRow row in grvContrato.Rows) { CheckBox check = row.Cells[2].FindControl("chkGenerar") as CheckBox; if (check.Checked) { int folio = Int32.Parse(row.Cells[0].Text); string nombre = row.Cells[1].Text; string giro = row.Cells[4].Text; string rut = row.Cells[2].Text; string direccion = row.Cells[3].Text; Document doc = new Document(iTextSharp.text.PageSize.LETTER, 10, 10, 42, 35); PdfWriter writer = PdfWriter.GetInstance(doc, new FileStream(@"C:\PDF\" + folio + ".pdf", FileMode.Create)); doc.Open(); Paragraph paragraph = new Paragraph("Contrato Numero de Folio: " + folio + "\n\n Sr/a " + nombre + " representante de la Empresa, Promotora o Colectivo " + giro + " RUT " + rut + " con Direccion " + direccion + " \n Los (Artistas/DJ/Productor) declaran que todos los integrantes del grupo son mayores de 16 años. Y reconociéndose ambas partes mutua capacidad legal para obligarse en cuanto en derecho fuera menester acerca del contenido del presente contrato libremente. \n PACTAN, CONVIENEN Y OTORGAN."); doc.Add(paragraph); doc.Close(); Response.Write("<script>alert('Contrato ID " + folio + " Generado'); window.location='InicioOper.aspx';</script>"); } } //Response.Write("<script>alert('Seleccione para generar contrato')</script>"); }
protected void Page_Load(object sender, EventArgs e) { UsuarioBEL usuario = (UsuarioBEL)Session["usuarioConectado"]; /// <summary> /// Carga los datos del cliente u organizador a modificar /// </summary> if (!IsPostBack) { int rut = (usuario.Rut); //ru = ru.Substring(0, ru.Length - 2); //int rut = Int32.Parse(ru); ClienteBLL cliBLL = new ClienteBLL(); ClienteBEL cliBEL = new ClienteBEL(); cliBEL = cliBLL.traerClientePorRut(rut); if (cliBEL != null) { txtGiro.Visible = false; txtApellidos.Visible = true; lblCambiante.Text = "Apellidos"; lblCambian.Text = "Nombre"; reqApellido.Enabled = true; regApellido.Enabled = true; reqGiro.Enabled = false; regGiro.Enabled = false; txtRut.Text = cliBEL.Rut.ToString() + "-" + cliBEL.Dv; txtRut.Enabled = false; txtNombre.Text = cliBEL.Nombre; txtApellidos.Text = cliBEL.Apellido; //txtDireccion.Text = cliBEL.Direccion; txtCorreo.Text = cliBEL.Correo; txtCelular.Text = cliBEL.Celular.ToString(); //comuna = cliBEL.IdComuna; clicomuna = cliBLL.traerComuna(comuna); cliregion = cliBLL.traerRegion(clicomuna.IdRegion); //estado = cliBEL.IdEstado; } else { txtGiro.Visible = true; txtApellidos.Visible = false; txtCelular.Visible = false; lblCelular.Visible = false; lblCambiante.Text = "Giro"; lblCambian.Text = "Nombre o Razón Social"; reqGiro.Enabled = true; regGiro.Enabled = true; reqApellido.Enabled = false; regApellido.Enabled = false; OrganizadorBLL orgBLL = new OrganizadorBLL(); OrganizadorBEL orgBEL = new OrganizadorBEL(); orgBEL = orgBLL.MostrarOrganizador(rut); txtRut.Text = orgBEL.Rut.ToString() + "-" + orgBEL.Dv; txtRut.Enabled = false; txtNombre.Text = orgBEL.NombreRazonSocial; txtGiro.Text = orgBEL.Giro; txtDireccion.Text = orgBEL.Direccion; txtCorreo.Text = orgBEL.Correo; comuna = orgBEL.IdComuna; clicomuna = cliBLL.traerComuna(comuna); cliregion = cliBLL.traerRegion(clicomuna.IdRegion); estado = orgBEL.IdEstado; } /// <summary> /// Carga los select de region y comuna con sus datos correspondientes /// </summary> RegionBLL regionBLL = new RegionBLL(); List <RegionBEL> regBEL = regionBLL.traerRegiones(); ddlRegion.DataSource = regBEL; ddlRegion.DataValueField = "IdRegion"; ddlRegion.DataTextField = "Nombre"; ddlRegion.DataBind(); ddlRegion.Items.Insert(0, new ListItem(cliregion.Nombre, clicomuna.IdRegion.ToString())); ddlComuna.Items.Insert(0, new ListItem(clicomuna.Nombre, clicomuna.IdComuna.ToString())); } }