示例#1
0
        public void BorrarUnReporte(int p_oid)
        {
            /*PROTECTED REGION ID(WhateverGenNHibernate.CP.Whatever_Reporte_borrarUnReporte) ENABLED START*/

            IReporteCAD reporteCAD = null;
            ReporteCEN  reporteCEN = null;



            try
            {
                SessionInitializeTransaction();
                reporteCAD = new ReporteCAD(session);
                reporteCEN = new  ReporteCEN(reporteCAD);



                // Write here your custom transaction ...

                EventoEN even = new EventoEN();
                even = reporteCAD.GetID(p_oid).Evento;
                RetoEN reten = new RetoEN();
                reten = reporteCAD.GetID(p_oid).Reto;
                GymkanaEN gymen = new GymkanaEN();
                gymen = reporteCAD.GetID(p_oid).Gymkana;

                if (even != null)
                {
                    reporteCAD.UnrelationerReporteEvento(p_oid, even.ID);
                    reporteCAD.Destroy(p_oid);
                }
                else if (reten != null)
                {
                    reporteCAD.UnrelationerReporteReto(p_oid, reten.ID);
                    reporteCAD.Destroy(p_oid);
                }
                else if (gymen != null)
                {
                    reporteCAD.UnrelationerReporteGymkana(p_oid, gymen.ID);
                    reporteCAD.Destroy(p_oid);
                }


                SessionCommit();
            }
            catch (Exception ex)
            {
                SessionRollBack();
                throw ex;
            }
            finally
            {
                SessionClose();
            }


            /*PROTECTED REGION END*/
        }
示例#2
0
        public void BorrarReportesReto(int id_reto)
        {
            /*PROTECTED REGION ID(WhateverGenNHibernate.CP.Whatever_Reporte_BorrarReportesReto) ENABLED START*/

            IReporteCAD reporteCAD = null;
            ReporteCEN  reporteCEN = null;



            try
            {
                SessionInitializeTransaction();
                reporteCAD = new ReporteCAD(session);
                reporteCEN = new  ReporteCEN(reporteCAD);



                // Write here your custom transaction ...

                System.Collections.Generic.IList <ReporteEN> reportes = new System.Collections.Generic.List <ReporteEN>();
                reportes = reporteCAD.FiltrarReportesPorReto(id_reto);
                foreach (ReporteEN element in reportes)
                {
                    reporteCAD.UnrelationerReporteReto(element.ID, id_reto);
                    reporteCAD.Destroy(element.ID);
                }


                SessionCommit();
            }
            catch (Exception ex)
            {
                SessionRollBack();
                throw ex;
            }
            finally
            {
                SessionClose();
            }


            /*PROTECTED REGION END*/
        }