Exemplo n.º 1
0
        public JsonResult GetLocationsActions(string groupName, long?userId)
        {
            var path = System.Web.HttpContext.Current.Server.MapPath("~/Content/Images/UserImages/");

            var            conn = new InforConnection(reportServerAddress: $"{ReportserverUrl}", tu: _tu, tup: _tup);
            InforLocations locs;

            if (string.IsNullOrEmpty(groupName))
            {
                locs = (InforLocations)LocationService.GetLocations(AppUserState.Wgs, AppUserState.Ds,
                                                                    AppUserState.UserName, LocationSearchType.ActiveValid, 0, "", path).ReturnObject;
            }
            else
            {
                locs = conn.GetLocationsForGroup(AppUserState.UserName, AppUserState.Wgs, AppUserState.Ds, groupName,
                                                 path);
            }

            if (userId == null)
            {
                return(this.Jsonp(locs));
            }
            if (locs.All(id => id.UserId != userId))
            {
                locs.Add((InforLocation)LocationService
                         .GetSpecificLocation(AppUserState.Wgs, AppUserState.Ds, AppUserState.UserName, (long)userId)
                         .ReturnObject);
            }
            return(this.Jsonp(locs));
        }