Example #1
0
        public List <Models.AccionT> Catalogo(int t600_idasunto)
        {
            OpenDbConn();

            DAL.AccionT cConsulta = new DAL.AccionT(cDblib);
            return(cConsulta.Catalogo(t600_idasunto));
        }
Example #2
0
        public void BorrarAcciones(List <Models.AccionT> lista)
        {
            Guid methodOwnerID = new Guid("3BC30F92-578A-4551-807F-74019A4DE66F");

            OpenDbConn();

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

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

                throw ex;
            }
        }
Example #3
0
        public Models.AccionT Select(Int32 t601_idaccion)
        {
            OpenDbConn();

            DAL.AccionT cAccionTarea = new DAL.AccionT(cDblib);
            return(cAccionTarea.Select(t601_idaccion));
        }
Example #4
0
        public int grabar(Models.AccionT DatosGenerales, List <Models.AccionRecursosT> Integrantes)
        {
            int  idReferencia;
            bool bConTransaccion = false;
            Guid methodOwnerID   = new Guid("9BA8A99E-6FE6-41EC-BDA6-1A123F0E7C9A");

            OpenDbConn();
            if (cDblib.Transaction.ownerID.Equals(new Guid()))
            {
                bConTransaccion = true;
            }
            if (bConTransaccion)
            {
                cDblib.beginTransaction(methodOwnerID);
            }
            try
            {
                DAL.AccionT         oAccion     = new DAL.AccionT(cDblib);
                DAL.AccionRecursosT oRecursoDAL = new DAL.AccionRecursosT(cDblib);

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

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

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

                    case "U":
                        //update
                        oRecursoDAL.Update(oRecurso);
                        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();
            }
        }