Ejemplo n.º 1
0
        // GET: AppointmentResources/Create
        public ActionResult Create()
        {
            if (!caSession.AuthoriseSession())
            {
                return(Redirect((string)Session["ErrorUrl"]));
            }

            // get properties of current tenant
            var tenant = caCurrent.CurrentTenant();

            // get properties of user
            caUser user = caCurrent.CurrentUser();

            var wareh = _activityServices.GetAllPermittedWarehousesForUser(user.UserId, user.TenantId, user.SuperUser == true, false);

            var jTypes = LookupServices.GetAllJobTypes(CurrentTenantId).Select(m => new { m.JobTypeId, m.Name }).ToList();

            ViewBag.JobTypes        = new MultiSelectList(jTypes, "JobTypeId", "Name");
            ViewBag.RolesList1      = new SelectList(_rolesServices.GetAllRoles(tenant.TenantId), "Id", "RoleName");
            ViewBag.GroupsList1     = new SelectList(_groupsServices.GetAllGroups(tenant.TenantId), "Id", "GroupName");
            ViewBag.Countries       = new SelectList(LookupServices.GetAllGlobalCountries(), "CountryID", "CountryName");
            ViewBag.TenantLocations = new MultiSelectList(_tenantLocationsServices.GetAllTenantLocations(tenant.TenantId).Where(x => wareh.Any(a => a.WId == x.WarehouseId)), "WarehouseId", "WarehouseName");
            ViewBag.Users           = new SelectList(_userService.GetAllAuthUsers(CurrentTenantId), "UserId", "UserName");
            return(View());
        }
        public ActionResult Index(string message = "")
        {
            if (!caSession.AuthoriseSession())
            {
                return(Redirect((string)Session["ErrorUrl"]));
            }

            // get properties of current tenant
            var tenant = caCurrent.CurrentTenant();

            // get properties of user
            caUser user = caCurrent.CurrentUser();

            try
            {
                if (!String.IsNullOrWhiteSpace(message))
                {
                    ViewBag.Message = message;
                }

                return(View("_Listing", Mapper.Map(_rolesServices.GetAllRoles(tenant.TenantId), new List <RolesViewModel>())));
            }
            catch (Exception e)
            {
                //log exception
                var err = e.Message;

                return(View("_EmptyResult"));
            }
        }