Пример #1
0
        public JsonResult Guardar(CargoViewModel oCargoViewModel)
        {
            List <String> resultado = new List <String>();

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

            CargoServicesController oServices = new CargoServicesController();

            try
            {
                EntityCargo oEntityCargoExists = oServices.SelectByKey(oCargoViewModel.EntityCargo.Key);

                if (Constantes.Cero != oEntityCargoExists.Key.IDCargo)
                {
                    oServices.Update(oCargoViewModel.EntityCargo);
                }
                else
                {
                    oServices.Insert(oCargoViewModel.EntityCargo);
                }
            }
            catch (Exception)
            {
                resultado[0] = "false";
                resultado[1] = Constantes.GuardadoNoExitoso;
            }


            return(Json(resultado, JsonRequestBehavior.AllowGet));
        }
Пример #2
0
        public ActionResult Edit(KeyCargo oKey)
        {
            CargoServicesController   oServices        = new CargoServicesController();
            UsuarioServicesController oUsuarioServices = new UsuarioServicesController();

            CargoViewModel oCargoViewModel = new CargoViewModel();

            EntityCargo oEntityCargo = oServices.SelectByKey(oKey);

            oCargoViewModel.EntityCargo = oEntityCargo;

            return(PartialView(Constantes.CargoEdit, oCargoViewModel));
        }
Пример #3
0
        public ActionResult CargoGridPV(CargoViewModel oCargoViewModel, Int32 pageIndex)
        {
            CargoServicesController oServices = new CargoServicesController();

            if (null == oCargoViewModel.EntityCargoPaginacion.EntityPaginacion)
            {
                oCargoViewModel.EntityCargoPaginacion.EntityPaginacion             = new SGI.Proxy.Services.CargoServices.EntityPaginacion();
                oCargoViewModel.EntityCargoPaginacion.EntityPaginacion.PageIndex   = (pageIndex != Constantes.Cero) ? pageIndex : Constantes.PageIndex;
                oCargoViewModel.EntityCargoPaginacion.EntityPaginacion.RowsPerPage = Constantes.RowsPerPage;
            }

            EntityCargoPaginacion oEntityCargoPaginacion = oCargoViewModel.EntityCargoPaginacion;

            IList <EntityCargoPaginacion> oListCargo = oServices.SelectPagging(ref oEntityCargoPaginacion);

            oCargoViewModel.ListCargoPaginado     = oListCargo;
            oCargoViewModel.EntityCargoPaginacion = oEntityCargoPaginacion;

            return(PartialView(Constantes.CargoGridPV, oCargoViewModel));
        }
Пример #4
0
        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));
        }