示例#1
0
        public override void PrintObject()
        {
            CronogramaReportMng reportMng = new CronogramaReportMng(AppContext.ActiveSchema);
            bool        defecto           = moleQule.Library.Instruction.ModulePrincipal.GetImpresionEmpresaDefaultBoolSetting();
            CompanyInfo empresa           = null;

            if (defecto)
            {
                empresa = CompanyInfo.Get(moleQule.Library.Instruction.ModulePrincipal.GetImpresionEmpresaDefaultOidSetting(), false);
            }
            while (empresa == null)
            {
                moleQule.Face.Common.CompanySelectForm form = new Common.CompanySelectForm(this);
                DialogResult result = form.ShowDialog();

                try
                {
                    if (result == DialogResult.OK)
                    {
                        empresa = form.Selected as CompanyInfo;
                    }
                }
                catch
                { empresa = null; }
            }

            Library.Instruction.Reports.Horario.ClasesRpt rpt = reportMng.GetDetailReport(_lista, empresa);
            rpt.SetParameterValue("Empresa", empresa.Name);
            if (empresa.Oid == 2)
            {
                ((CrystalDecisions.CrystalReports.Engine.TextObject)(rpt.Section5.ReportObjects["Text1"])).Color = System.Drawing.Color.FromArgb(13, 176, 46);
            }
            ReportViewer.SetReport(rpt);
            ReportViewer.ShowDialog();
        }
        protected override void PrintFaltasAsistencia()
        {
            InformesReportMng reportMng = new InformesReportMng(AppContext.ActiveSchema);

            FaltasByAlumnoRpt report = null;

            bool        defecto = moleQule.Library.Instruction.ModulePrincipal.GetImpresionEmpresaDefaultBoolSetting();
            CompanyInfo empresa = null;

            if (defecto)
            {
                empresa = CompanyInfo.Get(moleQule.Library.Instruction.ModulePrincipal.GetImpresionEmpresaDefaultOidSetting(), false);
            }
            while (empresa == null)
            {
                moleQule.Face.Common.CompanySelectForm form = new Common.CompanySelectForm(this);
                DialogResult result = form.ShowDialog();

                try
                {
                    if (result == DialogResult.OK)
                    {
                        empresa = form.Selected as CompanyInfo;
                    }
                }
                catch
                { empresa = null; }
            }

            string promos = string.Empty;

            foreach (Alumno_Promocion ap in _entity.Promociones)
            {
                promos += ap.Promocion + "; ";
            }

            FaltaAlumnoList list = FaltaAlumnoList.GetListByAlumno(false, _entity.Oid);

            report = reportMng.GetDetailReport(empresa, EntityInfo.GetPrintObject(), promos, list);

            if (report != null)
            {
                report.SetParameterValue("Empresa", empresa.Name);
                report.SetParameterValue("Alumno", _entity.Nombre + "  " + _entity.Apellidos);
                report.SetParameterValue("Promocion", promos);
                if (empresa.Oid == 2)
                {
                    ((CrystalDecisions.CrystalReports.Engine.TextObject)(report.Section5.ReportObjects["Text1"])).Color = System.Drawing.Color.FromArgb(13, 176, 46);
                }
                ReportViewer.SetReport(report);
                ReportViewer.ShowDialog();
            }
            else
            {
                MessageBox.Show(Resources.Messages.NO_DATA_REPORTS,
                                moleQule.Face.Resources.Labels.ADVISE_TITLE,
                                MessageBoxButtons.OK,
                                MessageBoxIcon.Exclamation);
            }
        }
示例#3
0
        /// <summary>Imprime la lista del objetos
        /// <returns>void</returns>
        /// </summary>
        public override void PrintList()
        {
            PromocionReportMng reportMng = new PromocionReportMng(AppContext.ActiveSchema);

            ClasesPracticasImpartidasRpt report = null;

            bool        defecto = moleQule.Library.Instruction.ModulePrincipal.GetImpresionEmpresaDefaultBoolSetting();
            CompanyInfo empresa = null;

            if (defecto)
            {
                empresa = CompanyInfo.Get(moleQule.Library.Instruction.ModulePrincipal.GetImpresionEmpresaDefaultOidSetting(), false);
            }
            while (empresa == null)
            {
                moleQule.Face.Common.CompanySelectForm form = new Common.CompanySelectForm(this);
                DialogResult result = form.ShowDialog();

                try
                {
                    if (result == DialogResult.OK)
                    {
                        empresa = form.Selected as CompanyInfo;
                    }
                }
                catch
                { empresa = null; }
            }

            switch (FilterType)
            {
            case IFilterType.None:
                report = reportMng.GetDetailImpartidasReport(empresa, _promocion, _sorted_list);
                break;

            case IFilterType.Filter:
                report = reportMng.GetDetailImpartidasReport(empresa, _promocion, _filter_results);
                break;
            }

            if (report != null)
            {
                report.SetParameterValue("Empresa", empresa.Name);
                if (empresa.Oid == 2)
                {
                    ((CrystalDecisions.CrystalReports.Engine.TextObject)(report.Section5.ReportObjects["Text1"])).Color = System.Drawing.Color.FromArgb(13, 176, 46);
                }
                ReportViewer.SetReport(report);
                ReportViewer.ShowDialog();
            }
            else
            {
                MessageBox.Show(Resources.Messages.NO_DATA_REPORTS,
                                moleQule.Face.Resources.Labels.ADVISE_TITLE,
                                MessageBoxButtons.OK,
                                MessageBoxIcon.Exclamation);
            }
        }
        protected override void ResumenPreguntasAction()
        {
            if (_entity.MemoPreguntas == string.Empty)
            {
                return;
            }

            ExamenReportMng reportMng = new ExamenReportMng(AppContext.ActiveSchema);

            string lista = _entity.MemoPreguntas.Replace(';', ',');

            lista = lista.Substring(0, lista.Length - 1);
            bool        defecto = moleQule.Library.Instruction.ModulePrincipal.GetImpresionEmpresaDefaultBoolSetting();
            CompanyInfo empresa = null;

            if (defecto)
            {
                empresa = CompanyInfo.Get(moleQule.Library.Instruction.ModulePrincipal.GetImpresionEmpresaDefaultOidSetting(), false);
            }
            while (empresa == null)
            {
                moleQule.Face.Common.CompanySelectForm form = new Common.CompanySelectForm(this);
                DialogResult result = form.ShowDialog();

                try
                {
                    if (result == DialogResult.OK)
                    {
                        empresa = form.Selected as CompanyInfo;
                    }
                }
                catch
                { empresa = null; }
            }

            ISchemaInfo schema = AppContext.ActiveSchema;

            try
            {
                schema = empresa as ISchemaInfo;
                if (schema == null)
                {
                    schema = AppContext.ActiveSchema;
                }
            }
            catch
            {
            }

            ReportViewer.SetReport(reportMng.GetDetailResumenExamenReport(EntityInfo,
                                                                          PreguntaList.GetListaExamen(lista),
                                                                          null,
                                                                          empresa));
            ReportViewer.ShowDialog();
        }
        protected override void PrintAction()
        {
            if (_modulo == null || _promociones.Count == 0)
            {
                return;
            }

            PgMng.Reset(3, 1, Face.Resources.Messages.RETRIEVING_DATA, this);

            Alumno_PromocionList list = Alumno_PromocionList.GetListaAdmitidos(_modulo.Oid, FechaExamen_DTP.Value, _promociones, false);

            PgMng.Grow(Face.Resources.Messages.BUILDING_REPORT);

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

            bool        defecto = moleQule.Library.Instruction.ModulePrincipal.GetImpresionEmpresaDefaultBoolSetting();
            CompanyInfo empresa = null;

            if (defecto)
            {
                empresa = CompanyInfo.Get(moleQule.Library.Instruction.ModulePrincipal.GetImpresionEmpresaDefaultOidSetting(), false);
            }
            while (empresa == null)
            {
                moleQule.Face.Common.CompanySelectForm form = new Common.CompanySelectForm(this);
                DialogResult result = form.ShowDialog();

                try
                {
                    if (result == DialogResult.OK)
                    {
                        empresa = form.Selected as CompanyInfo;
                    }
                }
                catch
                { empresa = null; }
            }

            AlumnosAdmitidosExamenRpt rpt = reportMng.GetAlumnosAdmitidosReport(list, _modulo, empresa);

            PgMng.FillUp();

            rpt.SetParameterValue("Empresa", empresa.Name);
            if (empresa.Oid == 2)
            {
                ((CrystalDecisions.CrystalReports.Engine.TextObject)(rpt.Section5.ReportObjects["Text1"])).Color = System.Drawing.Color.FromArgb(13, 176, 46);
            }
            ShowReport(rpt);

            _action_result = DialogResult.Ignore;
        }
示例#6
0
 private void ImprimirEmpresaDefault_BT_Click(object sender, EventArgs e)
 {
     Common.CompanySelectForm          form   = new Common.CompanySelectForm(this);
     System.Windows.Forms.DialogResult result = form.ShowDialog();
     if (result == DialogResult.OK)
     {
         try
         {
             CompanyInfo selected = form.Selected as CompanyInfo;
             Library.Instruction.ModulePrincipal.SetImpresionEmpresaDefaultOidSetting(selected.Oid);
             ImpresionEmpresaDefault_TB.Text = selected.Name;
         }
         catch { }
     }
 }
示例#7
0
        protected virtual void PrintDisponiblesAction()
        {
            SelectFechaDisponibilidadForm select_form = new SelectFechaDisponibilidadForm();

            if (select_form.ShowDialog() == DialogResult.OK)
            {
                InformePlantillaList List = InformePlantillaList.GetDisponiblesList(EntityInfo.Oid, select_form.FechaDisponibilidad_DTP.Value.Date);

                ExamenReportMng reportMng = new ExamenReportMng(AppContext.ActiveSchema);

                if (List.Count > 0)
                {
                    bool        defecto = moleQule.Library.Instruction.ModulePrincipal.GetImpresionEmpresaDefaultBoolSetting();
                    CompanyInfo empresa = null;

                    if (defecto)
                    {
                        empresa = CompanyInfo.Get(moleQule.Library.Instruction.ModulePrincipal.GetImpresionEmpresaDefaultOidSetting(), false);
                    }
                    while (empresa == null)
                    {
                        moleQule.Face.Common.CompanySelectForm form = new Common.CompanySelectForm(this);
                        DialogResult result = form.ShowDialog();

                        try
                        {
                            if (result == DialogResult.OK)
                            {
                                empresa = form.Selected as CompanyInfo;
                            }
                        }
                        catch
                        { empresa = null; }
                    }

                    moleQule.Library.Instruction.Reports.Examen.InformeDisponiblesPlantillaRpt report = reportMng.GetInformeDisponiblesPlantillaReport(EntityInfo, List);
                    report.SetParameterValue("Empresa", empresa.Name);
                    report.SetParameterValue("FechaDisponibilidad", select_form.FechaDisponibilidad_DTP.Value.Date);
                    if (empresa.Oid == 2)
                    {
                        ((CrystalDecisions.CrystalReports.Engine.TextObject)(report.Section5.ReportObjects["Text1"])).Color = System.Drawing.Color.FromArgb(13, 176, 46);
                    }
                    ReportViewer.SetReport(report);
                    ReportViewer.ShowDialog();
                }
            }
        }
        protected override void PrintAction()
        {
            ExamenReportMng reportMng = new ExamenReportMng(AppContext.ActiveSchema);

            bool        defecto = moleQule.Library.Instruction.ModulePrincipal.GetImpresionEmpresaDefaultBoolSetting();
            CompanyInfo empresa = null;

            if (defecto)
            {
                empresa = CompanyInfo.Get(moleQule.Library.Instruction.ModulePrincipal.GetImpresionEmpresaDefaultOidSetting(), false);
            }
            while (empresa == null)
            {
                moleQule.Face.Common.CompanySelectForm form = new Common.CompanySelectForm(this);
                DialogResult result = form.ShowDialog();

                try
                {
                    if (result == DialogResult.OK)
                    {
                        empresa = form.Selected as CompanyInfo;
                    }
                }
                catch
                { empresa = null; }
            }

            ISchemaInfo schema = AppContext.ActiveSchema;

            try
            {
                schema = empresa as ISchemaInfo;
                if (schema == null)
                {
                    schema = AppContext.ActiveSchema;
                }
            }
            catch
            {
            }

            ReportViewer.SetReport(reportMng.GetDetailResumenExamenReport(_examen,
                                                                          lista, null, empresa));
            ReportViewer.ShowDialog();
        }
        protected override void PrintAction()
        {
            if (Ficha_TP.SelectedTab == Capacitacion_TP)
            {
                Submodulo_Instructor_PromocionList List = Submodulo_Instructor_PromocionList.GetListByInstructor(_entity.Oid);

                InstructorReportMng reportMng = new InstructorReportMng(AppContext.ActiveSchema);

                if (List.Count > 0)
                {
                    bool        defecto = moleQule.Library.Instruction.ModulePrincipal.GetImpresionEmpresaDefaultBoolSetting();
                    CompanyInfo empresa = null;

                    if (defecto)
                    {
                        empresa = CompanyInfo.Get(moleQule.Library.Instruction.ModulePrincipal.GetImpresionEmpresaDefaultOidSetting(), false);
                    }
                    while (empresa == null)
                    {
                        moleQule.Face.Common.CompanySelectForm form = new Common.CompanySelectForm(this);
                        DialogResult result = form.ShowDialog();

                        try
                        {
                            if (result == DialogResult.OK)
                            {
                                empresa = form.Selected as CompanyInfo;
                            }
                        }
                        catch
                        { empresa = null; }
                    }

                    moleQule.Library.Instruction.Reports.Instructor.CapacitacionInstructorRpt report = reportMng.GetDetailReport(empresa, EntityInfo, List);
                    report.SetParameterValue("Empresa", empresa.Name);
                    if (empresa.Oid == 2)
                    {
                        ((CrystalDecisions.CrystalReports.Engine.TextObject)(report.Section5.ReportObjects["Text1"])).Color = System.Drawing.Color.FromArgb(13, 176, 46);
                    }
                    ReportViewer.SetReport(report);
                    ReportViewer.ShowDialog();
                }
            }
        }
        private void PrintCertificado_BT_Click(object sender, EventArgs e)
        {
            AlumnoReportMng reportMng = new AlumnoReportMng(AppContext.ActiveSchema);

            bool        defecto = moleQule.Library.Instruction.ModulePrincipal.GetImpresionEmpresaDefaultBoolSetting();
            CompanyInfo empresa = null;

            if (defecto)
            {
                empresa = CompanyInfo.Get(moleQule.Library.Instruction.ModulePrincipal.GetImpresionEmpresaDefaultOidSetting(), false);
            }
            while (empresa == null)
            {
                moleQule.Face.Common.CompanySelectForm form = new Common.CompanySelectForm(this);
                DialogResult result = form.ShowDialog();

                try
                {
                    if (result == DialogResult.OK)
                    {
                        empresa = form.Selected as CompanyInfo;
                    }
                }
                catch
                { empresa = null; }
            }

            Library.Instruction.Reports.Alumno.CertificadoNotasRpt rpt = reportMng.GetDetailReport(_entity, empresa);
            rpt.SetParameterValue("Empresa", empresa.Name);
            if (empresa.Oid == 2)
            {
                ((CrystalDecisions.CrystalReports.Engine.TextObject)(rpt.Section5.ReportObjects["Text1"])).Color = System.Drawing.Color.FromArgb(13, 176, 46);
            }
            ReportViewer.SetReport(rpt);
            ReportViewer.ShowDialog();
        }
        private void Imprimir_BT_Click(object sender, EventArgs e)
        {
            InsertarRegistros();
            ExamenInfo      EntityInfo = _entity.GetInfo(true);
            ExamenReportMng reportMng  = new ExamenReportMng(AppContext.ActiveSchema);

            //List<Alumno_ExamenInfo> lista = new List<Alumno_ExamenInfo>();

            //foreach (AlumnoInfo alumno in _alumnos)
            //{
            //    Alumno_ExamenInfo item = EntityInfo.Alumnos.GetItemByProperty("OidAlumno", alumno.Oid);
            //    if (item != null)
            //        lista.Add(item);
            //}

            foreach (TreeNode promocion in Arbol_TV.Nodes)
            {
                List <Alumno_ExamenInfo> lista = new List <Alumno_ExamenInfo>();

                foreach (TreeNode alumno in promocion.Nodes)
                {
                    if (alumno.Checked)
                    {
                        long oid = ((AlumnoInfo)alumno.Tag).Oid;
                        Alumno_ExamenInfo item = EntityInfo.Alumnos.GetItemByProperty("OidAlumno", oid);
                        if (item != null)
                        {
                            lista.Add(item);
                        }
                    }
                }

                if (lista.Count > 0)
                {
                    bool        defecto = moleQule.Library.Instruction.ModulePrincipal.GetImpresionEmpresaDefaultBoolSetting();
                    CompanyInfo empresa = null;

                    if (defecto)
                    {
                        empresa = CompanyInfo.Get(moleQule.Library.Instruction.ModulePrincipal.GetImpresionEmpresaDefaultOidSetting(), false);
                    }
                    while (empresa == null)
                    {
                        moleQule.Face.Common.CompanySelectForm form = new Common.CompanySelectForm(this);
                        DialogResult result = form.ShowDialog();

                        try
                        {
                            if (result == DialogResult.OK)
                            {
                                empresa = form.Selected as CompanyInfo;
                            }
                        }
                        catch
                        { empresa = null; }
                    }

                    ISchemaInfo schema = AppContext.ActiveSchema;
                    try
                    {
                        schema = empresa as ISchemaInfo;
                        if (schema == null)
                        {
                            schema = AppContext.ActiveSchema;
                        }
                    }
                    catch
                    {
                    }

                    ReportViewer.SetReport(reportMng.GetDetailAsistenciaExamenReport(EntityInfo,
                                                                                     _promociones, lista,
                                                                                     empresa,
                                                                                     ((PromocionInfo)promocion.Tag).Nombre));
                    ReportViewer.ShowDialog();
                }
            }

            /*foreach (Alumno_ExamenInfo item in EntityInfo.Alumnos)
             * {
             *  AlumnoInfo alumno = _alumnos.GetItem(item.OidAlumno);
             *  if (alumno != null)
             *  {
             *      //item.OidPromocion = alumno.OidPromocion;
             *      lista.Add(item);
             *  }
             * }*/

            //if (lista.Count > 0)
            //{
            //    ReportViewer.SetReport(reportMng.GetDetailAsistenciaExamenReport(EntityInfo,
            //                                                                    _promociones, lista,
            //                                                                    moleQule.Library.Common.EmpresaInfo.Get(AppContext.ActiveSchema.Oid)));
            //    ReportViewer.ShowDialog();
            //}
        }
        /// <summary>Imprime la lista del objetos
        /// <returns>void</returns>
        /// </summary>
        public override void PrintList()
        {
            ETipoImpresionCronograma tipo = ETipoImpresionCronograma.Lista;
            SelectEnumInputForm      form = new SelectEnumInputForm(true);

            form.SetDataSource(Library.Instruction.EnumText <ETipoImpresionCronograma> .GetList(false, false, false));
            form.ShowDialog(this);

            if (form.ActionResult == DialogResult.OK)
            {
                ComboBoxSource combo = form.Selected as ComboBoxSource;
                tipo = (ETipoImpresionCronograma)combo.Oid;
            }

            ClaseTeoricaList         teoricas        = ClaseTeoricaList.GetList();
            ClasePracticaList        practicas       = ClasePracticaList.GetList(false);
            List <ClasePracticaList> lista_practicas = new List <ClasePracticaList>();

            lista_practicas.Add(null);
            lista_practicas.Add(practicas);
            lista_practicas.Add(practicas);
            ModuloList modulos = ModuloList.GetList(false);

            CronogramaReportMng reportMng = new CronogramaReportMng(AppContext.ActiveSchema);
            CronogramaRpt       report    = null;

            switch (FilterType)
            {
            case IFilterType.None:
                if (tipo == ETipoImpresionCronograma.Lista)
                {
                    bool        defecto = moleQule.Library.Instruction.ModulePrincipal.GetImpresionEmpresaDefaultBoolSetting();
                    CompanyInfo empresa = null;

                    if (defecto)
                    {
                        empresa = CompanyInfo.Get(moleQule.Library.Instruction.ModulePrincipal.GetImpresionEmpresaDefaultOidSetting(), false);
                    }
                    while (empresa == null)
                    {
                        moleQule.Face.Common.CompanySelectForm sform = new Common.CompanySelectForm(this);
                        DialogResult result = sform.ShowDialog();

                        try
                        {
                            if (result == DialogResult.OK)
                            {
                                empresa = form.Selected as CompanyInfo;
                            }
                        }
                        catch
                        { empresa = null; }
                    }

                    report = reportMng.GetCronogramaReport(_cronograma, empresa, modulos, teoricas, practicas, _sorted_list);

                    if (report != null)
                    {
                        report.SetParameterValue("Empresa", empresa.Name);
                        if (empresa.Oid == 2)
                        {
                            ((CrystalDecisions.CrystalReports.Engine.TextObject)(report.Section5.ReportObjects["Text1"])).Color = System.Drawing.Color.FromArgb(13, 176, 46);
                        }
                        ReportViewer.SetReport(report);
                        ReportViewer.ShowDialog();
                    }
                    else
                    {
                        MessageBox.Show(Resources.Messages.NO_DATA_REPORTS,
                                        moleQule.Face.Resources.Labels.ADVISE_TITLE,
                                        MessageBoxButtons.OK,
                                        MessageBoxIcon.Exclamation);
                    }
                }
                else
                {
                    Dictionary <Horario, ListaSesiones> horarios = Cronograma.GetHorarios(_sorted_list, teoricas, practicas);

                    if (horarios.Count > 0)
                    {
                        PgMng.Reset(horarios.Count + 5, 1, Resources.Messages.LOADING_DATA, this);

                        try
                        {
                            InstructorList instructores = InstructorList.GetList(false);
                            PgMng.Grow();

                            //EntidadInfo entidad = EntidadInfo.Get(typeof(Promocion), true);
                            //Agente agente = null;

                            //PromocionInfo promocion = PromocionInfo.Get(_cronograma.OidPromocion, true);

                            //if (entidad.Agentes.GetItemByProperty("OidAgenteExt", promocion.Oid) != null)
                            //    agente = Agente.Get(typeof(Promocion), promocion);
                            //else
                            //{
                            //    agente = Agente.New();
                            //    agente.CopyFrom(entidad, promocion);
                            //    agente.Codigo = agente.GetCode();
                            //}

                            PgMng.Grow();

                            string       sFile = "C:\\cronograma.pdf";
                            FileStream   fs    = new FileStream(sFile, FileMode.Create, FileAccess.Write, FileShare.None);
                            Document     doc   = new Document();
                            PdfSmartCopy copy  = new PdfSmartCopy(doc, fs);

                            doc.Open();

                            foreach (KeyValuePair <Horario, ListaSesiones> item in horarios)
                            {
                                item.Key.OidPlan      = _cronograma.OidPlan;
                                item.Key.OidPromocion = _cronograma.OidPromocion;
                                HorarioRpt rpt    = reportMng.GetHorarioReport(item.Key.GetInfo(false), true, teoricas, lista_practicas, null, instructores, modulos, item.Value, false, DateTime.Now);
                                PdfReader  reader = new PdfReader(rpt.ExportToStream(ExportFormatType.PortableDocFormat));
                                copy.AddPage(copy.GetImportedPage(reader, 1));
                                rpt.Close();
                                rpt.Dispose();
                                PgMng.Grow();
                            }

                            doc.Close();

                            System.Diagnostics.Process process = new System.Diagnostics.Process();
                            process.StartInfo.FileName = sFile;
                            process.Start();
                            try
                            {
                                process.WaitForExit();
                            }
                            catch { }
                            PgMng.Grow();

                            //Documento documento = Documento.New();
                            //documento.Fecha = DateTime.Now;
                            //documento.FechaAlta = DateTime.Now;
                            //documento.Nombre = documento.Fecha.ToString("yyyyMMdd") + "_CRONOGRAMA";
                            //documento.Ruta = "C:\\";
                            //documento.Tipo = "PDF";


                            //AgenteDocumento agente_documento = agente.Documentos.NewItem(agente);
                            //agente_documento.OidDocumento = documento.Oid;

                            //agente.Save();
                        }
                        catch (Exception ex) { throw ex; }
                        finally { PgMng.FillUp(); }
                    }
                }
                break;

            case IFilterType.Filter:
                if (tipo == ETipoImpresionCronograma.Lista)
                {
                    bool        defecto = moleQule.Library.Instruction.ModulePrincipal.GetImpresionEmpresaDefaultBoolSetting();
                    CompanyInfo empresa = null;

                    if (defecto)
                    {
                        empresa = CompanyInfo.Get(moleQule.Library.Instruction.ModulePrincipal.GetImpresionEmpresaDefaultOidSetting(), false);
                    }
                    while (empresa == null)
                    {
                        moleQule.Face.Common.CompanySelectForm sform = new Common.CompanySelectForm(this);
                        DialogResult result = sform.ShowDialog();

                        try
                        {
                            if (result == DialogResult.OK)
                            {
                                empresa = form.Selected as CompanyInfo;
                            }
                        }
                        catch
                        { empresa = null; }
                    }

                    report = reportMng.GetCronogramaReport(_cronograma, empresa, modulos, teoricas, practicas, _filter_results);

                    if (report != null)
                    {
                        report.SetParameterValue("Empresa", empresa.Name);
                        if (empresa.Oid == 2)
                        {
                            ((CrystalDecisions.CrystalReports.Engine.TextObject)(report.Section5.ReportObjects["Text1"])).Color = System.Drawing.Color.FromArgb(13, 176, 46);
                        }
                        ReportViewer.SetReport(report);
                        ReportViewer.ShowDialog();
                    }
                    else
                    {
                        MessageBox.Show(Resources.Messages.NO_DATA_REPORTS,
                                        moleQule.Face.Resources.Labels.ADVISE_TITLE,
                                        MessageBoxButtons.OK,
                                        MessageBoxIcon.Exclamation);
                    }
                }
                else
                {
                    Dictionary <Horario, ListaSesiones> horarios = Cronograma.GetHorarios(_filter_results, teoricas, practicas);

                    if (horarios.Count > 0)
                    {
                        PgMng.Reset(horarios.Count + 5, 1, Resources.Messages.LOADING_DATA, this);

                        try
                        {
                            InstructorList instructores = InstructorList.GetList(false);
                            PgMng.Grow();

                            //EntidadInfo entidad = EntidadInfo.Get(typeof(Promocion), true);
                            //Agente agente = null;

                            //PromocionInfo promocion = PromocionInfo.Get(_cronograma.OidPromocion, true);

                            //if (entidad.Agentes.GetItemByProperty("OidAgenteExt", promocion.Oid) != null)
                            //    agente = Agente.Get(typeof(Promocion), promocion);
                            //else
                            //{
                            //    agente = Agente.New();
                            //    agente.CopyFrom(entidad, promocion);
                            //    agente.Codigo = agente.GetCode();
                            //}

                            PgMng.Grow();

                            string       sFile = "C:\\cronograma.pdf";
                            FileStream   fs    = new FileStream(sFile, FileMode.Create, FileAccess.Write, FileShare.None);
                            Document     doc   = new Document();
                            PdfSmartCopy copy  = new PdfSmartCopy(doc, fs);

                            doc.Open();

                            foreach (KeyValuePair <Horario, ListaSesiones> item in horarios)
                            {
                                item.Key.OidPlan      = _cronograma.OidPlan;
                                item.Key.OidPromocion = _cronograma.OidPromocion;
                                HorarioRpt rpt    = reportMng.GetHorarioReport(item.Key.GetInfo(false), true, teoricas, lista_practicas, null, instructores, modulos, item.Value, false, DateTime.Now);
                                PdfReader  reader = new PdfReader(rpt.ExportToStream(ExportFormatType.PortableDocFormat));
                                copy.AddPage(copy.GetImportedPage(reader, 1));
                                rpt.Close();
                                rpt.Dispose();
                                PgMng.Grow();
                            }

                            doc.Close();

                            System.Diagnostics.Process process = new System.Diagnostics.Process();
                            process.StartInfo.FileName = sFile;
                            process.Start();
                            try
                            {
                                process.WaitForExit();
                            }
                            catch { }
                            PgMng.Grow();

                            //Documento documento = Documento.New();
                            //documento.Fecha = DateTime.Now;
                            //documento.FechaAlta = DateTime.Now;
                            //documento.Nombre = documento.Fecha.ToString("yyyyMMdd") + "_CRONOGRAMA";
                            //documento.Ruta = "C:\\";
                            //documento.Tipo = "PDF";


                            //AgenteDocumento agente_documento = agente.Documentos.NewItem(agente);
                            //agente_documento.OidDocumento = documento.Oid;

                            //agente.Save();
                        }
                        catch (Exception ex) { throw ex; }
                        finally { PgMng.FillUp(); }
                    }
                }
                break;
            }
        }
        /// <summary>
        /// Implementa Save_button_Click
        /// </summary>
        protected override void SubmitAction()
        {
            this.Enabled = false;

            bool        defecto = moleQule.Library.Instruction.ModulePrincipal.GetImpresionEmpresaDefaultBoolSetting();
            CompanyInfo empresa = null;

            if (defecto)
            {
                empresa = CompanyInfo.Get(moleQule.Library.Instruction.ModulePrincipal.GetImpresionEmpresaDefaultOidSetting(), false);
            }
            while (empresa == null)
            {
                moleQule.Face.Common.CompanySelectForm form = new Common.CompanySelectForm(this);
                DialogResult result = form.ShowDialog();

                try
                {
                    if (result == DialogResult.OK)
                    {
                        empresa = form.Selected as CompanyInfo;
                    }
                }
                catch
                { empresa = null; }
            }

            try
            {
                if (CReports_CkB.CheckState == CheckState.Checked)
                {
                    if (Portada_CB.Checked)
                    {
                        ExportaCR(ETipoPagina.Portada, empresa);
                    }

                    if (Preguntas_CB.Checked)
                    {
                        ExportaCR(ETipoPagina.Preguntas, empresa);
                    }
                }
                else if (PDF_CkB.CheckState == CheckState.Checked)
                {
                    if (Portada_CB.Checked)
                    {
                        ExportaPDF(ETipoPagina.Portada, empresa);
                    }

                    if (Preguntas_CB.Checked)
                    {
                        ExportaPDF(ETipoPagina.Preguntas, empresa);
                    }
                }
                else if (Doc_CkB.CheckState == CheckState.Checked)
                {
                    if (Portada_CB.Checked)
                    {
                        ExportaCR(ETipoPagina.Portada, empresa);
                    }

                    if (Preguntas_CB.Checked)
                    {
                        ExportaDOC(empresa);
                    }
                }

                if (ModeloRespuesta_CB.Checked)
                {
                    foreach (PreguntaExamenInfo item in _entity.PreguntaExamenes)
                    {
                        if (_entity.Emitido)
                        {
                            System.Diagnostics.Process.Start(item.ModeloRespuestaPath);
                        }
                        else
                        {
                            System.Diagnostics.Process.Start(moleQule.Library.Application.AppController.MODELOS_PREGUNTAS_PATH + item.ModeloRespuesta);
                        }
                    }
                }
            }
            catch (Exception ex) { MessageBox.Show(ex.Message); }
            finally { this.Enabled = true; }

            _action_result = DialogResult.Ignore;
            Close();
        }
        /// <summary>
        /// Implementa Save_button_Click
        /// </summary>
        protected override void SubmitAction()
        {
            this.Enabled = false;

            bool        defecto = moleQule.Library.Instruction.ModulePrincipal.GetImpresionEmpresaDefaultBoolSetting();
            CompanyInfo empresa = null;

            if (defecto)
            {
                empresa = CompanyInfo.Get(moleQule.Library.Instruction.ModulePrincipal.GetImpresionEmpresaDefaultOidSetting(), false);
            }
            while (empresa == null)
            {
                moleQule.Face.Common.CompanySelectForm form = new Common.CompanySelectForm(this);
                DialogResult result = form.ShowDialog();

                try
                {
                    if (result == DialogResult.OK)
                    {
                        empresa = form.Selected as CompanyInfo;
                    }
                }
                catch
                { empresa = null; }
            }

            try
            {
                if (CReports_CkB.CheckState == CheckState.Checked)
                {
                    if (Portada_CB.Checked)
                    {
                        ExportaCR(ETipoPagina.Portada, empresa);
                    }

                    if (Preguntas_CB.Checked)
                    {
                        ExportaCR(ETipoPagina.Preguntas, empresa);
                    }

                    if (Respuestas_CB.Checked)
                    {
                        ExportaCR(ETipoPagina.Respuestas, empresa);
                    }

                    if (Correctora_CB.Checked)
                    {
                        ExportaCR(ETipoPagina.PlantillaCorrectora, empresa);
                    }
                }
                else if (PDF_CkB.CheckState == CheckState.Checked)
                {
                    if (Portada_CB.Checked)
                    {
                        ExportaPDF(ETipoPagina.Portada, empresa);
                    }

                    if (Preguntas_CB.Checked)
                    {
                        ExportaPDF(ETipoPagina.Preguntas, empresa);
                    }

                    if (Respuestas_CB.Checked)
                    {
                        ExportaPDF(ETipoPagina.Respuestas, empresa);
                    }

                    if (Correctora_CB.Checked)
                    {
                        ExportaPDF(ETipoPagina.PlantillaCorrectora, empresa);
                    }
                }
                else if (Doc_CkB.CheckState == CheckState.Checked)
                {
                    if (Portada_CB.Checked)
                    {
                        ExportaCR(ETipoPagina.Portada, empresa);
                    }

                    if (Preguntas_CB.Checked)
                    {
                        ExportaDOC(empresa);
                    }

                    if (Respuestas_CB.Checked)
                    {
                        ExportaCR(ETipoPagina.Respuestas, empresa);
                    }

                    if (Correctora_CB.Checked)
                    {
                        ExportaCR(ETipoPagina.PlantillaCorrectora, empresa);
                    }
                }
            }
            catch (Exception ex) { MessageBox.Show(ex.Message); }
            finally { this.Enabled = true; }

            _action_result = DialogResult.Ignore;
            Close();
        }
        protected override void PrintAction()
        {
            bool        defecto = moleQule.Library.Instruction.ModulePrincipal.GetImpresionEmpresaDefaultBoolSetting();
            CompanyInfo empresa = null;

            if (defecto)
            {
                empresa = CompanyInfo.Get(moleQule.Library.Instruction.ModulePrincipal.GetImpresionEmpresaDefaultOidSetting(), false);
            }
            while (empresa == null)
            {
                moleQule.Face.Common.CompanySelectForm form = new Common.CompanySelectForm(this);
                DialogResult result = form.ShowDialog();

                try
                {
                    if (result == DialogResult.OK)
                    {
                        empresa = form.Selected as CompanyInfo;
                    }
                }
                catch
                { empresa = null; }
            }

            switch (Resumen_TC.SelectedTab.Name)
            {
            case "Teoricas_TP":
            {
                if (_lista_teoricas != null && _lista_teoricas.Count > 0)
                {
                    CronogramaReportMng reportMng = new CronogramaReportMng(AppContext.ActiveSchema);
                    Library.Instruction.Reports.PlanEstudios.ResumenRpt rpt = reportMng.GetDetailReport(_lista_teoricas, empresa);
                    rpt.SetParameterValue("Empresa", empresa.Name);
                    if (empresa.Oid == 2)
                    {
                        ((CrystalDecisions.CrystalReports.Engine.TextObject)(rpt.Section5.ReportObjects["Text1"])).Color = System.Drawing.Color.FromArgb(13, 176, 46);
                    }
                    ReportViewer.ShowDialog();
                }
            }
            break;

            case "Practicas_TP":
            {
                if (_lista_practicas != null && _lista_practicas.Count > 0)
                {
                    CronogramaReportMng reportMng = new CronogramaReportMng(AppContext.ActiveSchema);
                    Library.Instruction.Reports.PlanEstudios.ResumenRpt rpt = reportMng.GetDetailReport(_lista_practicas, empresa);
                    rpt.SetParameterValue("Empresa", empresa.Name);
                    if (empresa.Oid == 2)
                    {
                        ((CrystalDecisions.CrystalReports.Engine.TextObject)(rpt.Section5.ReportObjects["Text1"])).Color = System.Drawing.Color.FromArgb(13, 176, 46);
                    }
                    ReportViewer.SetReport(rpt);
                    ReportViewer.ShowDialog();
                }
            }
            break;
            }
        }
        public override void PrintList()
        {
            //Separamos las preguntas tipo test de las de desarrollo
            //PreguntaList _all = null;
            SelectPreguntasReportForm select_report = new SelectPreguntasReportForm();

            DialogResult select_result = select_report.ShowDialog();

            if (select_result == DialogResult.OK)
            {
                if (select_report.Source == PrintSource.All)
                {
                    PreguntaList List = PreguntaList.GetList(Datos.List as IList <Pregunta>);
                    //_all = List;

                    //PreguntaList test = PreguntaList.SeparaPreguntasTest(_all);
                    //PreguntaList desarrollo = PreguntaList.SeparaPreguntasDesarrollo(_all);

                    //PreguntaExamens p_test = PreguntaExamens.NewChildList();
                    //PreguntaExamens p_desarrollo = PreguntaExamens.NewChildList();

                    //Preguntas preguntas = Preguntas.NewChildList();

                    //long orden = 1;

                    bool        defecto = moleQule.Library.Instruction.ModulePrincipal.GetImpresionEmpresaDefaultBoolSetting();
                    CompanyInfo empresa = null;

                    if (defecto)
                    {
                        empresa = CompanyInfo.Get(moleQule.Library.Instruction.ModulePrincipal.GetImpresionEmpresaDefaultOidSetting(), false);
                    }
                    while (empresa == null)
                    {
                        moleQule.Face.Common.CompanySelectForm form = new Common.CompanySelectForm(this);
                        DialogResult result = form.ShowDialog();

                        try
                        {
                            if (result == DialogResult.OK)
                            {
                                empresa = form.Selected as CompanyInfo;
                            }
                        }
                        catch
                        { empresa = null; }
                    }

                    //foreach (PreguntaInfo item in test)
                    //{
                    //    PreguntaExamen pexamen = PreguntaExamen.New();
                    //    Pregunta pregunta_examen = Pregunta.New();
                    //    pexamen.CopyValues(item);
                    //    pregunta_examen.Base.CopyValues(item);
                    //    pexamen.Orden = orden;
                    //    orden++;
                    //    p_test.AddItem(pexamen);
                    //    pregunta_examen.MarkItemChild();
                    //    preguntas.AddItem(pregunta_examen);
                    //    foreach (RespuestaInfo res in item.Respuestas)
                    //    {
                    //        if (res.OidPregunta == item.Oid)
                    //        {
                    //            RespuestaExamen rexamen = RespuestaExamen.NewChild(pexamen);
                    //            rexamen.CopyValues(res);
                    //            pexamen.RespuestaExamens.AddItem(rexamen);
                    //        }
                    //    }
                    //}

                    //foreach (PreguntaInfo item in desarrollo)
                    //{
                    //    PreguntaExamen pexamen = PreguntaExamen.New();
                    //    Pregunta pregunta_examen = Pregunta.New();
                    //    pexamen.CopyValues(item);
                    //    pregunta_examen.Base.CopyValues(item);
                    //    pexamen.Orden = orden;
                    //    orden++;
                    //    p_desarrollo.AddItem(pexamen);
                    //    pregunta_examen.MarkItemChild();
                    //    preguntas.AddItem(pregunta_examen);
                    //}

                    ExamenReportMng reportMng = new ExamenReportMng(AppContext.ActiveSchema);

                    if (List.Count > 0)
                    {
                        Library.Instruction.Reports.Preguntas.PreguntasListRpt report = reportMng.GetPreguntasListReport(List);
                        report.SetParameterValue("Empresa", empresa.Name);
                        if (empresa.Oid == 2)
                        {
                            ((CrystalDecisions.CrystalReports.Engine.TextObject)(report.Section5.ReportObjects["Text1"])).Color = System.Drawing.Color.FromArgb(13, 176, 46);
                        }
                        ReportViewer.SetReport(report);
                        ReportViewer.ShowDialog();
                    }

                    /*if (p_test.Count > 0)
                     * {
                     *  Library.Instruction.Reports.Examen.PreguntasTestRpt r_test = reportMng.GetDetailPreguntasTestReport(p_test, preguntas);
                     *  r_test.SetParameterValue("Empresa", empresa.Name);
                     *  if (empresa.Oid == 2) ((CrystalDecisions.CrystalReports.Engine.TextObject)(r_test.Section5.ReportObjects["Text1"])).Color = System.Drawing.Color.FromArgb(13, 176, 46);
                     *  ReportViewer.SetReport(r_test);
                     *  ReportViewer.ShowDialog();
                     * }
                     *
                     * if (p_desarrollo.Count > 0)
                     * {
                     *  Library.Instruction.Reports.Examen.PreguntasDesarrolloRpt r_desarrollo = reportMng.GetDetailPreguntasDesarrolloReport(p_desarrollo, preguntas);
                     *  r_desarrollo.SetParameterValue("Empresa", empresa.Name);
                     *  if (empresa.Oid == 2) ((CrystalDecisions.CrystalReports.Engine.TextObject)(r_desarrollo.Section5.ReportObjects["Text1"])).Color = System.Drawing.Color.FromArgb(13, 176, 46);
                     *  ReportViewer.SetReport(r_desarrollo);
                     *  ReportViewer.ShowDialog();
                     * }*/
                }
                else
                {
                    PreguntaList preguntas       = PreguntaList.GetList(Datos.List as IList <Pregunta>);
                    string       lista_preguntas = "(";
                    foreach (PreguntaInfo item in preguntas)
                    {
                        lista_preguntas += item.Oid.ToString() + ",";
                    }
                    if (lista_preguntas.IndexOf(",") > 0)
                    {
                        lista_preguntas = lista_preguntas.Substring(0, lista_preguntas.LastIndexOf(","));
                    }
                    lista_preguntas += ")";

                    InformePreguntasList List = InformePreguntasList.GetList(lista_preguntas);

                    ExamenReportMng reportMng = new ExamenReportMng(AppContext.ActiveSchema);

                    if (List.Count > 0)
                    {
                        bool        defecto = moleQule.Library.Instruction.ModulePrincipal.GetImpresionEmpresaDefaultBoolSetting();
                        CompanyInfo empresa = null;

                        if (defecto)
                        {
                            empresa = CompanyInfo.Get(moleQule.Library.Instruction.ModulePrincipal.GetImpresionEmpresaDefaultOidSetting(), false);
                        }
                        while (empresa == null)
                        {
                            moleQule.Face.Common.CompanySelectForm form = new Common.CompanySelectForm(this);
                            DialogResult result = form.ShowDialog();

                            try
                            {
                                if (result == DialogResult.OK)
                                {
                                    empresa = form.Selected as CompanyInfo;
                                }
                            }
                            catch
                            { empresa = null; }
                        }

                        moleQule.Library.Instruction.Reports.Preguntas.InformePreguntasRpt report = reportMng.GetInformePreguntasReport(List);
                        report.SetParameterValue("Empresa", empresa.Name);
                        if (empresa.Oid == 2)
                        {
                            ((CrystalDecisions.CrystalReports.Engine.TextObject)(report.Section5.ReportObjects["Text1"])).Color = System.Drawing.Color.FromArgb(13, 176, 46);
                        }
                        ReportViewer.SetReport(report);
                        ReportViewer.ShowDialog();
                    }
                }
            }
        }