public List <Models.AccionTareasPT> Catalogo(Int32 idAccion)
        {
            OpenDbConn();

            DAL.AccionTareasPT           cAccionTareas = new DAL.AccionTareasPT(cDblib);
            List <Models.AccionTareasPT> oLista        = cAccionTareas.Catalogo(idAccion);

            return(oLista);
        }
Ejemplo n.º 2
0
        public int grabar(Models.AccionPT DatosGenerales, List <Models.AccionRecursosPT> Integrantes, List <Models.AccionTareasPT> Tareas)
        {
            int  idReferencia;
            bool bConTransaccion = false;
            Guid methodOwnerID   = new Guid("5590F1B4-7073-4B5F-A4DB-9F301648D151");

            OpenDbConn();
            if (cDblib.Transaction.ownerID.Equals(new Guid()))
            {
                bConTransaccion = true;
            }
            if (bConTransaccion)
            {
                cDblib.beginTransaction(methodOwnerID);
            }
            try
            {
                DAL.AccionPT         oAccion     = new DAL.AccionPT(cDblib);
                DAL.AccionRecursosPT oRecursoDAL = new DAL.AccionRecursosPT(cDblib);
                DAL.AccionTareasPT   oTareaDAL   = new DAL.AccionTareasPT(cDblib);

                if (DatosGenerales.T410_idaccion == -1)
                {
                    DatosGenerales.T410_fcreacion = System.DateTime.Now;
                    idReferencia = oAccion.Insert(DatosGenerales);
                }
                else
                {
                    oAccion.Update(DatosGenerales);
                    idReferencia = DatosGenerales.T410_idaccion;
                }

                foreach (Models.AccionRecursosPT oRecurso in Integrantes)
                {
                    switch (oRecurso.accionBD)
                    {
                    case "I":
                        //Inserción
                        oRecurso.t410_idaccion = idReferencia;
                        oRecursoDAL.Insert(oRecurso);
                        break;

                    case "D":
                        //delete
                        oRecursoDAL.Delete(oRecurso);
                        break;

                    case "U":
                        //update
                        oRecursoDAL.Update(oRecurso);
                        break;
                    }
                }

                foreach (Models.AccionTareasPT oTarea in Tareas)
                {
                    switch (oTarea.accionBD)
                    {
                    case "I":
                        //Inserción
                        oTareaDAL.Insert(oTarea);
                        break;

                    case "D":
                        //delete
                        oTareaDAL.Delete(oTarea);
                        break;
                    }
                }

                if (bConTransaccion)
                {
                    cDblib.commitTransaction(methodOwnerID);
                }

                return(idReferencia);
            }
            catch (Exception ex)
            {
                //rollback
                if (cDblib.Transaction.ownerID.Equals(methodOwnerID))
                {
                    cDblib.rollbackTransaction(methodOwnerID);
                }
                throw new Exception(ex.Message);
            }
            finally
            {
                //nota.Dispose();
            }
        }