Пример #1
0
        public List <Models.Accion> Catalogo(int t382_idasunto)
        {
            OpenDbConn();

            DAL.Accion cConsulta = new DAL.Accion(cDblib);
            return(cConsulta.Catalogo(t382_idasunto));
        }
Пример #2
0
        public void BorrarAcciones(List <Models.Accion> lista)
        {
            Guid methodOwnerID = new Guid("74122BF0-F33B-48BE-B665-9C1A70AF00BC");

            OpenDbConn();

            if (cDblib.Transaction.ownerID.Equals(new Guid()))
            {
                cDblib.beginTransaction(methodOwnerID);
            }

            try
            {
                DAL.Accion cAccion = new DAL.Accion(cDblib);
                foreach (Models.Accion oAccion in lista)
                {
                    cAccion.Delete(oAccion.t383_idaccion);
                }
                //Finalizar transacción
                if (cDblib.Transaction.ownerID.Equals(methodOwnerID))
                {
                    cDblib.commitTransaction(methodOwnerID);
                }
            }
            catch (Exception ex)
            {//rollback
                if (cDblib.Transaction.ownerID.Equals(new Guid()))
                {
                    cDblib.rollbackTransaction(methodOwnerID);
                }

                throw ex;
            }
        }
Пример #3
0
        public Models.Accion Select(Int32 t383_idaccion)
        {
            OpenDbConn();

            DAL.Accion cAccionPE = new DAL.Accion(cDblib);
            return(cAccionPE.Select(t383_idaccion));
        }
Пример #4
0
        public int grabar(Models.Accion DatosGenerales, List <Models.AccionRecursos> Integrantes, List <Models.AccionTareas> 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.Accion         oAccion     = new DAL.Accion(cDblib);
                DAL.AccionRecursos oRecursoDAL = new DAL.AccionRecursos(cDblib);
                DAL.AccionTareas   oTareaDAL   = new DAL.AccionTareas(cDblib);

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

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

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

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

                foreach (Models.AccionTareas 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(new Guid()))
                {
                    cDblib.rollbackTransaction(methodOwnerID);
                }
                throw new Exception(ex.Message);
            }
            finally
            {
                //nota.Dispose();
            }
        }