Exemplo n.º 1
0
        /// <summary>
        /// Implementa Save_button_Click
        /// </summary>
        protected override void SubmitAction()
        {
            AlumnoInfo    alumno    = TodosAlumno_CkB.Checked ? null : _alumno;
            PromocionInfo promocion = TodosPromocion_CkB.Checked ? null : _promocion;

            string filtro = GetFilterValues();

            AlumnoReportMng reportMng = new AlumnoReportMng(AppContext.ActiveSchema, string.Empty, filtro);

            AlumnoList    alumnos = GetAlumnoList(alumno, promocion);
            PromocionList promos  = GetPromocionList(promocion);

            if (Documentos_CLB.GetItemCheckState(0) == CheckState.Checked)
            {
                MatriculaPromocionRpt rpt = reportMng.GetMatriculaPromocionReport(alumnos, promos);

                if (rpt != null)
                {
                    ReportViewer.SetReport(rpt);
                    ReportViewer.ShowDialog();
                }
                else
                {
                    MessageBox.Show(moleQule.Face.Resources.Messages.NO_DATA_REPORTS);
                }
            }

            /*if (Documentos_CLB.GetItemCheckState(1) == CheckState.Checked)
             * {
             *  MatriculaPromocionRpt rpt = reportMng.GetMatriculaPromocionReport(list, promocion);
             *
             *  if (rpt != null)
             *  {
             *      ReportViewer.SetReport(rpt);
             *      ReportViewer.ShowDialog();
             *  }
             *  else
             *      MessageBox.Show(moleQule.Face.Resources.Messages.NO_DATA_REPORTS);
             * }*/

            if (Documentos_CLB.GetItemCheckState(2) == CheckState.Checked)
            {
                DocumentacionRpt rpt = reportMng.GetDocumentacionReport(alumnos, promos);

                if (rpt != null)
                {
                    ReportViewer.SetReport(rpt);
                    ReportViewer.ShowDialog();
                }
                else
                {
                    MessageBox.Show(moleQule.Face.Resources.Messages.NO_DATA_REPORTS);
                }
            }
            _action_result = DialogResult.OK;
        }
        private void FormatReport(MatriculaPromocionRpt rpt)
        {
            string path = CompanyInfo.GetLogoPath(Schema.Oid);

            if (File.Exists(path))
            {
                Image image  = Image.FromFile(path);
                int   width  = rpt.Section1.ReportObjects["Logo"].Width;
                int   height = rpt.Section1.ReportObjects["Logo"].Height;

                rpt.Section1.ReportObjects["Logo"].Width  = 15 * image.Width;
                rpt.Section1.ReportObjects["Logo"].Height = 15 * image.Height;
                rpt.Section1.ReportObjects["Logo"].Left  += (width - 15 * image.Width) / 2;
                rpt.Section1.ReportObjects["Logo"].Top   += (height - 15 * image.Height) / 2;
            }
        }
        public MatriculaPromocionRpt GetMatriculaPromocionReport(AlumnoList list, PromocionList promociones)
        {
            if (list == null)
            {
                return(null);
            }

            MatriculaPromocionRpt doc         = new MatriculaPromocionRpt();
            List <MatriculaPrint> pList       = new List <MatriculaPrint>();
            List <TIdioma>        idiomas     = new List <TIdioma>();
            List <TFormacion>     formaciones = new List <TFormacion>();
            PromocionInfo         promo;
            MatriculaPrint        print;

            foreach (AlumnoInfo item in list)
            {
                //promo = promociones.GetItem(item.OidPromocion);
                if (promociones != null)
                {
                    print = MatriculaPrint.New(item);//, promo);
                    pList.Add(print);
                    foreach (TIdioma item2 in print.IdiomasList)
                    {
                        idiomas.Add(item2);
                    }
                    foreach (TFormacion item3 in print.FormacionList)
                    {
                        formaciones.Add(item3);
                    }
                }
            }

            doc.SetDataSource(pList);
            doc.Subreports["IdiomasRpt"].SetDataSource(idiomas);
            doc.Subreports["FormacionRpt"].SetDataSource(formaciones);

            FormatReport(doc);

            return(doc);
        }