예제 #1
0
        public ActionResult EliminarEnvio(Envio model)
        {
            string name    = TempData["username"].ToString();
            string nameRol = TempData["rol"].ToString();
            int    codUser = Int32.Parse(TempData["codUser"].ToString());

            ViewBag.name         = name;
            ViewBag.rol          = nameRol;
            TempData["username"] = name;
            TempData["rol"]      = nameRol;
            TempData["codUser"]  = codUser;

            DAOUsuario dataU  = DAOUsuario.getInstance();
            string     today  = DateTime.Now.ToString("dd/MM/yyyy HH:mm:ss tt");
            string     accion = "Elimino Envio " + model.cod
            ;

            dataU.insertarAccion(codUser, 2, today, accion);

            //int cod = Int32.Parse(model.cod);
            DAOPago data1 = DAOPago.getInstance();

            data1.eliminarPago(model.cod);
            DAOPaquete data2 = DAOPaquete.getInstance();

            data2.eliminarPaquete(model.cod);
            DAOEnvio data3 = DAOEnvio.getInstance();

            data3.eliminarTraslado(model.cod);
            DAOEnvio data = DAOEnvio.getInstance();

            data.eliminarEnvio(model.cod);
            List <Envio> envios = data.obtenerEnvio();

            foreach (var item in envios)
            {
                DAOPago data4 = DAOPago.getInstance();
                Pago    pago  = data4.buscarPagoEnvio(item.cod);
                item.codPago = pago.cod;
            }
            return(View("~/Views/EnviarPaquete/IndexEnvio.cshtml", envios));
        }