Exemplo n.º 1
0
        public ActionResult Details(int?id)
        {
            ServiceDepartamento _serviceDepartamento = new ServiceDepartamento();
            DEPARTAMENTO        oDepartamento        = null;

            try
            {
                // Si va null
                if (id == null)
                {
                    return(RedirectToAction("Index"));
                }

                oDepartamento = _serviceDepartamento.GetDepartamentoActivoByID(id.Value);
                if (oDepartamento == null)
                {
                    TempData["Message"]         = "No existe el Departamento solicitado";
                    TempData["Redirect"]        = "Home";
                    TempData["Redirect-Action"] = "Index";

                    return(RedirectToAction("Default", "Error"));
                }
                return(View(oDepartamento));
            }
            catch (Exception ex)
            {
                Log.Error(ex, MethodBase.GetCurrentMethod());
                TempData["Message"]         = "Error al procesar los datos" + ex.Message;
                TempData["Redirect"]        = "Departamento";
                TempData["Redirect-Action"] = "Departamentos";

                return(RedirectToAction("Default", "Error"));
            }
        }
        public ActionResult Save(DEPARTAMENTO departamento, string [] selectedExtra)
        {
            ServiceDepartamento _serviceDepartamento = new ServiceDepartamento();

            try
            {
                if (ModelState.IsValid)
                {
                    DEPARTAMENTO oDepartamento = _serviceDepartamento.Save(departamento, selectedExtra);
                }
                else
                {
                    Util.Util.ValidateErrors(this);
                    ViewBag.IdUbicacion = listUbicacion();
                    ViewBag.IdExtra     = listaExtras(departamento.EXTRA);

                    return(View("Create", departamento));
                }

                return(RedirectToAction("Departamentos"));
            }
            catch (Exception ex)
            {
                Log.Error(ex, MethodBase.GetCurrentMethod());
                TempData["Message"]         = "Error al procesar los datos" + ex.Message;
                TempData["Redirect"]        = "Departamento";
                TempData["Redirect-Action"] = "Departamentos";

                return(RedirectToAction("Default", "Error"));
            }
        }
Exemplo n.º 3
0
        public viewModelReservaDetalle(int IdDepartamento)
        {
            ServiceDepartamento _ServiceDepartamento = new ServiceDepartamento();

            this.IdDepartamento = IdDepartamento;
            this.Departamento   = _ServiceDepartamento.GetDepartamentoActivoByID(IdDepartamento);
        }
Exemplo n.º 4
0
        public ActionResult buscarUbicacionActivo(String filtro)
        {
            IEnumerable <DEPARTAMENTO> listaDepartamento    = null;
            ServiceDepartamento        _serviceDepartamento = new ServiceDepartamento();

            if (string.IsNullOrEmpty(filtro))
            {
                listaDepartamento = _serviceDepartamento.GetDepartamentos();
            }
            else
            {
                listaDepartamento = _serviceDepartamento.GetDepartamentoActivoByUbicacion(filtro);
            }

            return(PartialView("_PartialViewIndexCatalogo", listaDepartamento));
        }
Exemplo n.º 5
0
        public ActionResult Index()
        {
            IEnumerable <DEPARTAMENTO> lista = null;

            try
            {
                ServiceDepartamento _serviceDepartamento = new ServiceDepartamento();
                lista = _serviceDepartamento.GetDepartamentosActivos();
            }
            catch (Exception ex)
            {
                Log.Error(ex, MethodBase.GetCurrentMethod());
                TempData["Message"] = "Error al procesar los datos" + ex.Message;
                TempData.Keep();
            }
            return(View(lista));
        }
        public ActionResult Edit(int id)
        {
            ServiceDepartamento _serviceDepartamento = new ServiceDepartamento();
            DEPARTAMENTO        oDepartamento        = null;

            try
            {
                // Si va null
                if (id == null)
                {
                    return(RedirectToAction("Departamentos"));
                }

                oDepartamento = _serviceDepartamento.GetDepartamentoByID(id);
                if (oDepartamento == null)
                {
                    //return RedirectToAction("Departamentos");
                    TempData["Message"]         = "No existe el Departamento solicitado";
                    TempData["Redirect"]        = "Home";
                    TempData["Redirect-Action"] = "Index";

                    return(RedirectToAction("Default", "Error"));
                }
                ViewBag.IdUbicacion = listUbicacion(oDepartamento.IdUbicacion);
                ViewBag.IdExtra     = listaExtras(oDepartamento.EXTRA);
                return(View(oDepartamento));
            }
            catch (Exception ex)
            {
                Log.Error(ex, MethodBase.GetCurrentMethod());
                TempData["Message"]         = "Error al procesar los datos" + ex.Message;
                TempData["Redirect"]        = "Departamento";
                TempData["Redirect-Action"] = "Departamentos";

                return(RedirectToAction("Default", "Error"));
            }
        }
 public DepartamentoController(IRepositoryWrapper repo)
 {
     serviceDepartment = new ServiceDepartamento();
     // _Departamento = new Departamento();
     _repo = repo;
 }
Exemplo n.º 8
0
 public VendedoresController(VendasWebMvcContext vendasWebMvcContext)
 {
     _serviceVendedores   = new ServiceVendedores(vendasWebMvcContext);
     _serviceDepartamento = new ServiceDepartamento(vendasWebMvcContext);
 }
Exemplo n.º 9
0
 public VendedoresController(ServiceVendedor serviceVendedor, ServiceDepartamento serviceDepartamento)
 {
     _serviceVendedor     = serviceVendedor;
     _serviceDepartamento = serviceDepartamento;
 }