예제 #1
0
        public static void CleanData()
        {
            accionWebCEN.Borrar(accionWebId);
            accionWebCEN.Borrar(accionWebId2);

            tipoAccionCEN.Borrar(tipoAccionId);
        }
        public HttpResponseMessage Borrar(int p_tipoaccion_oid)
        {
            // CAD, CEN
            TipoAccionRESTCAD tipoAccionRESTCAD = null;
            TipoAccionCEN     tipoAccionCEN     = null;

            try
            {
                SessionInitializeTransaction();
                string token = "";
                if (Request.Headers.Authorization != null)
                {
                    token = Request.Headers.Authorization.ToString();
                }
                int id = new UsuarioCEN().CheckToken(token);



                tipoAccionRESTCAD = new TipoAccionRESTCAD(session);
                tipoAccionCEN     = new TipoAccionCEN(tipoAccionRESTCAD);

                tipoAccionCEN.Borrar(p_tipoaccion_oid);
                SessionCommit();
            }

            catch (Exception e)
            {
                SessionRollBack();

                if (e.GetType() == typeof(HttpResponseException))
                {
                    throw e;
                }
                else if (e.GetType() == typeof(ReciclaUAGenNHibernate.Exceptions.ModelException) && e.Message.Equals("El token es incorrecto"))
                {
                    throw new HttpResponseException(HttpStatusCode.Forbidden);
                }
                else if (e.GetType() == typeof(ReciclaUAGenNHibernate.Exceptions.ModelException) || e.GetType() == typeof(ReciclaUAGenNHibernate.Exceptions.DataLayerException))
                {
                    throw new HttpResponseException(HttpStatusCode.BadRequest);
                }
                else
                {
                    throw new HttpResponseException(HttpStatusCode.InternalServerError);
                }
            }
            finally
            {
                SessionClose();
            }

            // Return 204 - No Content
            return(this.Request.CreateResponse(HttpStatusCode.NoContent));
        }
예제 #3
0
 public static void CleanData()
 {
     tipoAccionCEN.Borrar(tipoAccionId);
 }