예제 #1
0
        // GET: Publish
        public ActionResult Index()
        {
            ViewBag.PageType = "InternalAction";

            ViewBag.AmbitoName   = GetCookie("AmbitoName");
            ViewBag.UserIdentity = GetCookie("UserIdentity");
            ViewBag.AmbitoList   = GetCookie("AmbitoId") + "|" + GetCookie("NodeId");

            string path = Server.MapPath("~/cert/client.pfx");

            ReportViewModel    model = new ReportViewModel();
            List <SenseStream> myStreams;

            QRSQlikAPI QRSqlikAPI = new QRSQlikAPI(AmbitiUtility.GetAmbitoNode(GetCookie("AmbitoId"), GetCookie("NodeId")).Server, path);
            List <SenseApplication> notPublishedApps = new List <SenseApplication>();
            string errorMessage = "";

            ViewBag.Error = "";
            var ambito = AmbitiUtility.GetAmbitoById(GetCookie("AmbitoId"));

            if (QRSqlikAPI.GetStreamsByCustomProperty(GetCookie("UserID"), GetCookie("UserDirectory"), "StreamType", "Self-Service", ambito.customproperty, out myStreams, out errorMessage))
            {
                model = ReportViewModel.CreateReportViewModel(notPublishedApps, myStreams);
            }
            else
            {
                ViewBag.Error = "Errore nel reperimento degli streams. " + errorMessage;
            }
            if (string.IsNullOrEmpty(ViewBag.Error) && (myStreams == null || myStreams.Count == 0))
            {
                ViewBag.Error = "Non sei abilitato a nessuno stream dell'ambito Report Self-Service BI su cui distribuire il report.";
            }
            return(View(model));
        }
예제 #2
0
        public ActionResult GetReportsGrid(string idStream, string desStream)
        {
            ViewBag.idStream  = idStream;
            ViewBag.desStream = desStream;
            string          path  = Server.MapPath("~/cert/client.pfx");
            ReportViewModel model = new ReportViewModel();

            QlikAPI qlikAPI = new QlikAPI(AmbitiUtility.GetAmbitoNode(GetCookie("AmbitoId"), GetCookie("NodeId")).Link, GetCookie("UserID"), GetCookie("UserDirectory"), path);
            List <SenseApplication> notPublishedApps;
            List <SenseStream>      myStreams = new List <SenseStream>();

            if (qlikAPI.GetMyReportsNotPublished(out notPublishedApps))
            {
                model = ReportViewModel.CreateReportViewModel(notPublishedApps, myStreams);
            }
            return(PartialView("ReportsGrid", model));
        }
예제 #3
0
        public ActionResult GetReportsGrid(string idStream, string desStream)
        {
            ViewBag.idStream  = idStream;
            ViewBag.desStream = desStream;

            string          path  = Server.MapPath("~/cert/client.pfx");
            ReportViewModel model = new ReportViewModel();

            List <SenseApplication> publishedApps;
            List <SenseStream>      streams = new List <SenseStream>();

            string errorMessage = "";

            // Prendo gli stream di self-service e creo una lista
            QRSQlikAPI QRSqlikAPIMaster = new QRSQlikAPI(AmbitiUtility.GetAmbitoNode(GetCookie("AmbitoId"), GetCookie("NodeId")).Server, path);

            var ambito = AmbitiUtility.GetAmbitoById(GetCookie("AmbitoId"));

            QRSqlikAPIMaster.GetStreamsByCustomProperty(GetCookie("UserID"), GetCookie("UserDirectory"), "StreamType", "Self-Service", ambito.customproperty, out streams, out errorMessage);
            List <string> streamIdList = new List <string>();

            if (streams != null)
            {
                streamIdList = (from s in streams select s.Id).ToList();
            }
            //

            // Prendo le app pubblicate in self-service controllando che siano nella lista creata prima
            QlikAPI qlikAPIMaster = new QlikAPI(AmbitiUtility.GetAmbitoNode(GetCookie("AmbitoId"), GetCookie("NodeId")).Link, GetCookie("UserID"), GetCookie("UserDirectory"), path);

            if (qlikAPIMaster.GetPublishedAppsInSelectedStreams(streamIdList, out publishedApps))
            {
                foreach (var app in publishedApps)
                {
                    errorMessage = "";
                    QRSSenseAppDetail appDetail = new QRSSenseAppDetail();
                    //if (QRSqlikAPIMaster.GetAppDetail(ConfigurationManager.AppSettings["QlikUser"], ConfigurationManager.AppSettings["QlikUserDirectory"], app.AppId, out appDetail, out errorMessage))
                    if (QRSqlikAPIMaster.GetAppDetail(GetCookie("UserID"), GetCookie("UserDirectory"), app.AppId, out appDetail, out errorMessage))
                    {
                        app.OwnerUserName = appDetail.owner.name;
                    }
                }
                model = ReportViewModel.CreateReportViewModel(publishedApps, streams);
            }
            return(PartialView("ReportsGrid", model));
        }
예제 #4
0
        // GET: Share
        public ActionResult Index()
        {
            ViewBag.PageType = "InternalAction";

            ViewBag.AmbitoName   = GetCookie("AmbitoName");
            ViewBag.UserIdentity = GetCookie("UserIdentity");
            ViewBag.AmbitoList   = GetCookie("AmbitoId") + "|" + GetCookie("NodeId");

            string          path  = Server.MapPath("~/cert/client.pfx");
            ReportViewModel model = new ReportViewModel();

            // Prendo il nodo dei Report Distribuiti
            var ambito = AmbitiUtility.GetAmbitoById(new List <string>()
            {
                GetCookie("AmbitoId")
            }).FirstOrDefault();
            var distrNode = (from f in ambito.Nodes where f.NodeType == "D" select f).FirstOrDefault();
            //

            // Prendo tutti gli stream del nodo dei report distribuiti
            QRSQlikAPI QRSqlikAPIMaster           = new QRSQlikAPI(AmbitiUtility.GetAmbitoNode(GetCookie("AmbitoId"), distrNode.Id.ToString()).Server, path);
            List <SenseApplication> publishedApps = new List <SenseApplication>();
            List <SenseStream>      streams;
            string errorMessage = "";

            //if (QRSqlikAPIMaster.GetStreamsBuCustomProperty(ConfigurationManager.AppSettings["QlikUser"], ConfigurationManager.AppSettings["QlikUserDirectory"], "StreamType", "Production", out streams, out errorMessage))
            if (QRSqlikAPIMaster.GetStreamsByCustomProperty(GetCookie("UserID"), GetCookie("UserDirectory"), "StreamType", "Production", ambito.customproperty, out streams, out errorMessage))
            {
                model = ReportViewModel.CreateReportViewModel(publishedApps, streams);
            }
            else
            {
                ViewBag.Error = "Errore nel reperimento degli stream di distribuzione." + errorMessage;
            }
            if (string.IsNullOrEmpty(ViewBag.Error) && (streams == null || streams.Count == 0))
            {
                ViewBag.Error = "Non sei abilitato a nessuno stream dell'ambito Report Distribuiti su cui distribuire il report.";
            }
            return(View(model));
        }