public JsonResult Guardar(EmpleadoViewModel oEmpleadoViewModel)
        {
            List <String> resultado = new List <String>();

            resultado.Add("true");
            resultado.Add(Constantes.GuardadoExitoso);

            EmpleadoServicesController oServices = new EmpleadoServicesController();

            try
            {
                if (Constantes.Cero != oEmpleadoViewModel.EntityEmpleado.Key.IDEmpleado)
                {
                    oServices.Update(oEmpleadoViewModel.EntityEmpleado);
                }
                else
                {
                    oServices.Insert(oEmpleadoViewModel.EntityEmpleado);
                }
            }
            catch (Exception)
            {
                resultado[0] = "false";
                resultado[1] = Constantes.GuardadoNoExitoso;
            }


            return(Json(resultado, JsonRequestBehavior.AllowGet));
        }
        public ActionResult EmpleadoGridPV(EmpleadoViewModel oEmpleadoViewModel, Int32 pageIndex)
        {
            EmpleadoServicesController oServices = new EmpleadoServicesController();

            if (null == oEmpleadoViewModel.EntityEmpleadoPaginacion.EntityPaginacion)
            {
                oEmpleadoViewModel.EntityEmpleadoPaginacion.EntityPaginacion             = new SGI.Proxy.Services.EmpleadoServices.EntityPaginacion();
                oEmpleadoViewModel.EntityEmpleadoPaginacion.EntityPaginacion.PageIndex   = (pageIndex != Constantes.Cero) ? pageIndex : Constantes.PageIndex;
                oEmpleadoViewModel.EntityEmpleadoPaginacion.EntityPaginacion.RowsPerPage = Constantes.RowsPerPage;
            }

            EntityEmpleadoPaginacion oEntityEmpleadoPaginacion = oEmpleadoViewModel.EntityEmpleadoPaginacion;

            IList <EntityEmpleadoPaginacion> oListEmpleado = oServices.SelectPagging(ref oEntityEmpleadoPaginacion);

            oEmpleadoViewModel.ListEmpleadoPaginado     = oListEmpleado;
            oEmpleadoViewModel.EntityEmpleadoPaginacion = oEntityEmpleadoPaginacion;

            return(PartialView(Constantes.EmpleadoGridPV, oEmpleadoViewModel));
        }
        public ActionResult Edit(KeyEmpleado oKey)
        {
            EmpleadoServicesController oServices        = new EmpleadoServicesController();
            UsuarioServicesController  oUsuarioServices = new UsuarioServicesController();
            CargoServicesController    oCargoServices   = new CargoServicesController();
            TiendaServicesController   oTiendaServices  = new TiendaServicesController();

            EmpleadoViewModel oEmpleadoViewModel = new EmpleadoViewModel();

            EntityEmpleado oEntityEmpleado = oServices.SelectByKey(oKey);

            oEmpleadoViewModel.ListCargo = oCargoServices.Select
                                               (new EntityCargo
            {
                Key = new KeyCargo {
                    IDCargo = -1
                },
                Estado = Constantes.Activo
            });
            oEmpleadoViewModel.ListTienda = oTiendaServices.Select
                                                (new EntityTienda
            {
                Key = new KeyTienda {
                    CodTienda = Constantes.CadenaVacio
                },
                Estado = Constantes.Activo
            });

            oEmpleadoViewModel.EntityEmpleado = oEntityEmpleado;

            KeyUsuario oKeyUsuario = new KeyUsuario {
                IDUsuario = oEntityEmpleado.Key.IDEmpleado
            };

            oEmpleadoViewModel.EntityUsuarioEmpleado = oUsuarioServices.SelectByKey(oKeyUsuario);


            return(PartialView(Constantes.EmpleadoUsuarioEditPV, oEmpleadoViewModel));
        }