private void cmbYear_SelectedIndexChanged(object sender, EventArgs e) { if (cmbYear.Enabled) { ready = false; cmbCurso.Enabled = false; cmbCurso.DataSource = CursoDAL.getCursosByIdSucursal(Inicio.CurrentSucursal.Id, cmbYear.SelectedItem as Year); cmbCurso.ValueMember = "Id"; cmbCurso.DisplayMember = "Nombre"; cmbCurso.Enabled = true; ready = true; } if (ready && cmbCurso.Items.Count > 0) { Curso curso = CursoDAL.getCursoById((Int64)cmbCurso.SelectedValue); lblTeacher.Text = curso.Contrato.Empleado.Persona.Nombre; lblDuracion.Text = Convert.ToDateTime(curso.Desde).ToString("dd \"de\" MMMM", new CultureInfo("es-ES")) + " hasta el " + Convert.ToDateTime(curso.Hasta).ToString("dd \"de\" MMMM", new CultureInfo("es-ES")); flpHorario.Controls.Clear(); foreach (Dia dia in curso.Horario) { string horario = (dia.HEntrada + " a " + dia.HSalida); flpHorario.Controls.Add(new Label() { Text = dia.Nombre + " " + horario, AutoSize = true, Name = "lbl" + dia.Nombre + curso.Id }); } } }
private void dgvCursos_CurrentCellChanged(object sender, EventArgs e) { if (dgvCursos.Rows.Count != 0 && dgvCursos.CurrentRow != null) { flpHorario.Controls.Clear(); Curso curso = CursoDAL.getCursoById((Int64)dgvCursos.CurrentRow.Cells[0].Value); lblSeccion.Text = curso.Seccion; lblDesde.Text = Convert.ToDateTime(curso.Desde).ToString("dd \"de\" MMMM", new CultureInfo("es-ES")); lblHasta.Text = Convert.ToDateTime(curso.Hasta).ToString("dd \"de\" MMMM", new CultureInfo("es-ES")); foreach (Dia dia in curso.Horario) { } foreach (Dia dia in curso.Horario) { string horario = (dia.HEntrada + " a " + dia.HSalida); flpHorario.Controls.Add(new Label() { Text = dia.Nombre + " " + horario, Width = flpHorario.Width - 10, Name = "lbl" + dia.Nombre + curso.Id }); } chkEstado.Checked = curso.Estado == "A"; } }
private void btnAnularCurso_Click(object sender, EventArgs e) { if (dgvCursos.CurrentRow != null) { bool result = true; if (CursoDAL.getCursoById((Int64)dgvCursos.CurrentRow.Cells[0].Value).Estado != "A") { result = false; MessageBox.Show("El curso ya ha sido inhabilitado anteriormente.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } if (result) { if (MessageBox.Show("¿Esta Seguro de inhabilitar el curso seleccionado? podra reactivarlo editando el registro desde el formulario correspondiente.", "Confirmación", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No) { result = false; } } if (result) { if (CursoDAL.inhabilitarCurso(CursoDAL.getCursoById((Int64)dgvCursos.CurrentRow.Cells[0].Value), Inicio.CurrentUser)) { MessageBox.Show("El curso seleccionado ha sido inhabilitado exitosamente.", "Operación realizada", MessageBoxButtons.OK, MessageBoxIcon.Information); txtBuscar.Text = ""; dgvCursos.Rows.Clear(); FillDgv(CursoDAL.getCursosByIdSucursal(Inicio.CurrentSucursal.Id, (cbxYear.SelectedItem as Year))); } } } }
private void dgvCursos_DoubleClick(object sender, EventArgs e) { if (dgvCursos.CurrentRow != null) { FrmCurso frmcurso = new FrmCurso(); frmcurso.opc = "updObject"; frmcurso.CurrentObject = CursoDAL.getCursoById((Int64)dgvCursos.CurrentRow.Cells[0].Value); frmcurso.EditingObject = CursoDAL.getCursoById((Int64)dgvCursos.CurrentRow.Cells[0].Value); frmcurso.ShowDialog(); FillDgv(CursoDAL.getCursosByIdSucursal(Inicio.CurrentSucursal.Id, (cbxYear.SelectedItem as Year))); } }
private void frmBuscarProducto_Load(object sender, EventArgs e) { try { switch (opc) { case "Mensualidad": checkBecado.Checked = Matricula.Becado == 1; Curso curso = CursoDAL.getCursoById(Matricula.IdCurso); FillDgv_Mensualidades(CuotaDAL.getCuotasByIdMatricula(Matricula.Id, 1000)); lblEstudiante.Text = Matricula.Estudiante.Persona.Nombre; lblCurso.Text = curso.Nombre; lblDocente.Text = curso.Contrato.Empleado.Persona.Nombre; btnRegistrarProducto.Visible = false; btnRegistrarProducto.Enabled = false; lblTituloDgv.Text = "Mensualidades pendientes"; break; case "Cancelacion": pnlParamMensualidad.Visible = false; pnlParamMensualidad.Enabled = false; checkBecado.Visible = false; FillDgv_Reservaciones(DetFacturaDAL.getDetsfacturaByIdPersona(IdPersona)); break; case "Contado": pnlParamMensualidad.Visible = false; pnlParamMensualidad.Enabled = false; checkBecado.Visible = false; FillDgv_Productos(ProductoDAL.getProductos(1000)); if (dgvProductos.CurrentRow != null) { Producto producto = ProductoDAL.getProductoById((Int64)dgvProductos.CurrentRow.Cells[0].Value); lblPrecio.Text = "$" + producto.Precio; txtAporte.Text = (producto.Precio).ToString(); } break; default: break; } ready = true; } catch (Exception ex) { string folderName = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments) + "\\Errores_" + Assembly.GetExecutingAssembly().GetName().Name + "_V_" + Assembly.GetExecutingAssembly().GetName().Version.ToString(); string fileName = "Exeptions_" + Name + ".txt"; Validation.FormManager frmManager = new Validation.FormManager(); frmManager.writeException(folderName, fileName, ex, "Ha ocurrido un error al intentar cargar la información de este control"); MessageBox.Show("Ha ocurrido un error al intentar cargar la información de este control, por favor comuniquese con el desarrollador al correo " + Properties.Settings.Default.developerEmail, "Error fatal", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private bool Val_NewObject() { bool result = true; NewObject = new Desersion(); if (!Validation.Validation.Val_StringsLength(txtNota.Text, 1)) { errNota.SetError(txtNota, "La descripcion de la dersesion esta vacia, este valor es obligatorio."); valNota.BackColor = Color.Red; result = false; } else { if (!Validation.Validation.Val_StringsLength(txtNota.Text, 20)) { errNota.SetError(txtNota, "La descripcion de la dersesion debe tener al menos 20 caracteres, este valor es obligatorio."); valNota.BackColor = Color.Red; result = false; } else { valNota.BackColor = Color.FromArgb(0, 100, 182); errNota.Clear(); NewObject.Nota = txtNota.Text; } } Curso curso = CursoDAL.getCursoById(CurrentMatricula.IdCurso); if (dtpFhRegistro.Value < Convert.ToDateTime(curso.FhRegistro)) { errFhRegistro.SetError(dtpFhRegistro, "La fecha de la dersesion especificada debe ser mayor a la fecha de inicio del curso, este valor es obligatorio."); valFhRegistro.BackColor = Color.Red; result = false; } else { valFhRegistro.BackColor = Color.FromArgb(0, 100, 182); errFhRegistro.Clear(); NewObject.Nota = txtNota.Text; } NewObject.IdMatricula = CurrentMatricula.Id; return(result); }
private void cmbCurso_SelectedIndexChanged(object sender, EventArgs e) { if (ready && cmbCurso.Items.Count > 0) { Curso curso = CursoDAL.getCursoById((Int64)cmbCurso.SelectedValue); lblTeacher.Text = curso.Contrato.Empleado.Persona.Nombre; lblDuracion.Text = Convert.ToDateTime(curso.Desde).ToString("dd \"de\" MMMM", new CultureInfo("es-ES")) + " hasta el " + Convert.ToDateTime(curso.Hasta).ToString("dd \"de\" MMMM", new CultureInfo("es-ES")); flpHorario.Controls.Clear(); foreach (Dia dia in curso.Horario) { string horario = (dia.HEntrada + " a " + dia.HSalida); flpHorario.Controls.Add(new Label() { Text = dia.Nombre + " " + horario, AutoSize = true, Name = "lbl" + dia.Nombre + curso.Id }); } } }
private void FillDgv(List <Matricula> lista) { dgvBuscar.Rows.Clear(); List <Curso> cursos = new List <Curso>(); foreach (Matricula obj in lista) { if (cursos.Where(a => a.Id == obj.IdCurso).ToList().Count == 0) { cursos.Add(CursoDAL.getCursoById(obj.IdCurso)); } dgvBuscar.Rows.Add( obj.Id, obj.Estudiante.Persona.Nombre, cursos.Where(a => a.Id == obj.IdCurso).FirstOrDefault().Nombre + " " + cursos.Where(a => a.Id == obj.IdCurso).FirstOrDefault().Contrato.Empleado.Persona.Nombre, obj.Estudiante.Telefono ); } lblNoResults.Visible = dgvBuscar.RowCount == 0; lastParam = txtBuscar.Text; }
public void GenerarRepMorosos(AxAcroPDFLib.AxAcroPDF VisorPDF, Int64 IdYear, Int64 IdCurso) { try { EliminarTemporal(); VisorPDF.src = ""; getDatos(); Document pdf1 = new Document(PageSize.LETTER, 36.6929f, 36.6929f, 36.6929f, 36.6929f); string title = "Reporte de alumnos con mora" + "_" + DateTime.Now.ToString("yyyy_MM_dd_mm_hh_ss") + ".pdf"; RutaArchivo = Path.GetTempPath() + "/" + title; PdfWriter wri = PdfWriter.GetInstance(pdf1, new FileStream(RutaArchivo, FileMode.Create)); PageEventHelper eventHelper = new PageEventHelper(); eventHelper.Reporte = 1; wri.PageEvent = eventHelper; iTextSharp.text.Font fontEncabezado = FontFactory.GetFont("Calibri", 11, iTextSharp.text.Font.BOLD, BaseColor.BLACK); iTextSharp.text.Font fontCuerpoSmall = FontFactory.GetFont("Calibri", 8, iTextSharp.text.Font.NORMAL, BaseColor.BLACK); iTextSharp.text.Font fontHeaderTabla = FontFactory.GetFont("Calibri", 10, iTextSharp.text.Font.BOLD, BaseColor.BLACK); iTextSharp.text.Font fontHeaderTablaSmall = FontFactory.GetFont("Calibri", 8, iTextSharp.text.Font.BOLD, BaseColor.BLACK); iTextSharp.text.Font fontMotivo = FontFactory.GetFont("Calibri", 8, iTextSharp.text.Font.NORMAL, BaseColor.BLACK); pdf1.Open(); pdf1.AddTitle(title); DocActual = pdf1; //encabezado float[] medCellsEncabezado = new float[] { 150.0394f, 400.0394f, 150.0394f }; PdfPTable tblEcabezado = new PdfPTable(3); tblEcabezado.WidthPercentage = 100; tblEcabezado.SetWidths(medCellsEncabezado); iTextSharp.text.Image imagenLogo = iTextSharp.text.Image.GetInstance(Properties.Resources.goll_Logo_png, BaseColor.WHITE); imagenLogo.BorderWidth = 0; imagenLogo.Alignment = Element.ALIGN_LEFT; float percentage = 0.0f; percentage = 150 / imagenLogo.Width; imagenLogo.ScalePercent(percentage * 40); PdfPCell cImagenLogo = new PdfPCell(imagenLogo); cImagenLogo.BorderWidth = 0; tblEcabezado.AddCell(cImagenLogo); Paragraph myheader1 = new Paragraph("\n\nACADEMIA DE INGLES Y COMPUTACIÓN GOLL", fontEncabezado); Paragraph myheader2 = new Paragraph("\nREPORTE DE ALUMNOS CON PAGOS PENDIENTES", fontEncabezado); Paragraph myheader3 = new Paragraph("\n" + CursoDAL.getCursoById(IdCurso).Nombre.ToUpper() + " " + Convert.ToDateTime(YearDAL.getYearById(IdYear).Desde).ToString("yyyy") + "\n\n", fontEncabezado); myheader1.Alignment = Element.ALIGN_CENTER; myheader2.Alignment = Element.ALIGN_CENTER; myheader3.Alignment = Element.ALIGN_CENTER; myheader1.SetLeading(0, 0.8f); myheader2.SetLeading(0, 0.8f); myheader3.SetLeading(0, 0.8f); PdfPCell clEncabezado = new PdfPCell(myheader1); clEncabezado.AddElement(myheader1); clEncabezado.AddElement(myheader2); clEncabezado.AddElement(myheader3); clEncabezado.BorderWidth = 0; tblEcabezado.AddCell(clEncabezado); iTextSharp.text.Image imagenSV = iTextSharp.text.Image.GetInstance(Properties.Resources.Goll_Logo, BaseColor.WHITE); imagenSV.BorderWidth = 0; imagenSV.Alignment = Element.ALIGN_TOP; float percentageSV = 0.0f; percentageSV = 150 / imagenSV.Width; imagenSV.ScalePercent(percentageSV * 70); PdfPCell cImagenSV = new PdfPCell(imagenSV); cImagenSV.BorderWidth = 0; tblEcabezado.AddCell(cImagenSV); DocActual.Add(tblEcabezado); //header de tabla PdfPTable tabla = new PdfPTable(3); PdfPCell celda = new PdfPCell(); celda.HorizontalAlignment = 1; celda.VerticalAlignment = 5; tabla.WidthPercentage = 100; celda.BackgroundColor = BaseColor.LIGHT_GRAY; List <Matricula> matriculas = MatriculaDAL.searchMatriculasParametro("", IdYear, IdCurso); DateTime serverDate = YearDAL.getServerDate(); foreach (Matricula matricula in matriculas) { float[] medColumnas = new float[] { 180f, 180f, 80f, 140f }; tabla = new PdfPTable(4); tabla.WidthPercentage = 100; tabla.SetWidths(medColumnas); tabla.AddCell(GetCellHeaderTable("Alumno", 1, 1, fontHeaderTabla)); tabla.AddCell(GetCellHeaderTable("Dirección", 1, 1, fontHeaderTabla)); tabla.AddCell(GetCellHeaderTable("Teléfono", 1, 1, fontHeaderTabla)); tabla.AddCell(GetCellHeaderTable("Total Pendiente", 1, 1, fontHeaderTablaSmall)); List <Cuota> atrasadas = matricula.Cuotas.Where(a => (Convert.ToDateTime(a.FhRegistro) < serverDate.AddDays(Properties.Settings.Default.DaysMora)) && a.Total < a.Precio).ToList(); if (atrasadas.Count > 0) { tabla.AddCell(GetCellBodyTable("" + matricula.Estudiante.Persona.Nombre.ToUpper(), fontCuerpoSmall)); tabla.AddCell(GetCellBodyTable("" + matricula.Estudiante.Persona.Direccion.ToUpper(), fontCuerpoSmall)); tabla.AddCell(GetCellBodyTable("" + matricula.Estudiante.Telefono.ToUpper(), fontCuerpoSmall)); string pendiente = ""; string totales = ""; decimal mensualiades = 0; foreach (Cuota cuota in atrasadas) { pendiente += Convert.ToDateTime(cuota.FhRegistro).ToString("MMMM", new CultureInfo("ES-es")) + " $" + Decimal.Round((cuota.Precio - cuota.Total), 2) + "\n"; mensualiades += Decimal.Round((cuota.Precio - cuota.Total)); } totales += "TOTAL EN CUOTAS $" + mensualiades; totales += " TOTAL EN MORA $" + Decimal.Round(Properties.Settings.Default.Mora * atrasadas.Count, 2); totales += " TOTAL A PAGAR $" + Decimal.Round((mensualiades + Properties.Settings.Default.Mora * atrasadas.Count), 2); tabla.AddCell(GetCellBodyTable(pendiente.ToUpper(), fontMotivo)); tabla.AddCell(GetCellBodyTable(totales.ToUpper(), 4, 1, fontHeaderTabla)); DocActual.Add(tabla); DocActual.Add(new Paragraph("\n", fontEncabezado)); // DocActual.Add(new Chunk("\n")); } } pdf1.Close(); DocActual.Close(); VisorPDF.src = RutaArchivo; VisorPDF.setZoom(95); } catch (Exception ex) { throw ex; } }