Пример #1
0
 public static void CleanData()
 {
     if (id > 0)
     {
         puntoReciclajeCEN.Borrar(id);
     }
 }
 public static void CleanData()
 {
     if (contenedor_id > 0 && punto_id > 0)
     {
         contenedorCEN.Borrar(contenedor_id);
         puntoCEN.Borrar(punto_id);
     }
 }
Пример #3
0
        public HttpResponseMessage Borrar(int p_puntoreciclaje_oid)
        {
            // CAD, CEN
            PuntoReciclajeRESTCAD puntoReciclajeRESTCAD = null;
            PuntoReciclajeCEN     puntoReciclajeCEN     = null;

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



                puntoReciclajeRESTCAD = new PuntoReciclajeRESTCAD(session);
                puntoReciclajeCEN     = new PuntoReciclajeCEN(puntoReciclajeRESTCAD);

                puntoReciclajeCEN.Borrar(p_puntoreciclaje_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));
        }
 public static void CleanData()
 {
     // Console.WriteLine("Destroy");
     foreach (int id in changed_ids)
     {
         PuntoReciclajeEN p = puntoCEN.BuscarPorId(id);
         puntoCEN.Modificar(id, p.Latitud, p.Longitud, EstadoEnum.enProceso);
         // Console.WriteLine("Recover " + id);
     }
     foreach (int id in ids)
     {
         puntoCEN.Borrar(id);
         // Console.WriteLine("Deleted " + id);
     }
 }
 public static void CleanData()
 {
     puntoCEN.Borrar(id);
 }
 public void WhenEliminoElPunto()
 {
     puntoReciclajeCEN.Borrar(punto_id);
 }