Пример #1
0
        public ActionResult ToPublish(string AppId, string AppName, string AppOldName, string OverwriteRequired, string StreamID, string StreamName, string AppToOverwriteId, string checkOverwrite, string AmbitoList)
        {
            string path   = Server.MapPath("~/cert/client.pfx");
            var    ambito = AmbitiUtility.GetAmbitoById(GetCookie("AmbitoId"));

            if (OverwriteRequired.ToLower() == "false")
            {
                // Duplico l'app
                QRSSenseApp newApp       = new QRSSenseApp();
                string      errorMessage = "";
                QRSQlikAPI  QRSqlikAPI   = new QRSQlikAPI(AmbitiUtility.GetAmbitoNode(GetCookie("AmbitoId"), GetCookie("NodeId")).Server, path);
                QRSqlikAPI.CopyApp(GetCookie("UserID"), GetCookie("UserDirectory"), AppId, AppOldName, out newApp, out errorMessage);

                // Pubblico l'app
                QlikAPI qlikAPI = new QlikAPI(AmbitiUtility.GetAmbitoNode(GetCookie("AmbitoId"), GetCookie("NodeId")).Link, ambito.superuserid, ambito.superuserdom, path);
                qlikAPI.PublishApp(AppId, AppName, StreamID);
            }
            else
            {
                string  errorMessage = "";
                QlikAPI qlikAPI      = new QlikAPI(AmbitiUtility.GetAmbitoNode(GetCookie("AmbitoId"), GetCookie("NodeId")).Link, ambito.superuserid, ambito.superuserdom, path);
                qlikAPI.ReplaceApp(AppId, AppToOverwriteId);
            }

            return(RedirectToAction("Hub", "Home", new { AmbitoList = AmbitoList }));
        }
Пример #2
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));
        }
Пример #3
0
        public ActionResult CreateReport(string Name, string Description, string AmbitoList, string SelectedTemplate)
        {
            ViewBag.PageType = "InternalAction";

            string appId = "";

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

            if (string.IsNullOrEmpty(SelectedTemplate) || SelectedTemplate == "void")
            {
                QlikAPI qlikAPI = new QlikAPI(AmbitiUtility.GetAmbitoNode(GetCookie("AmbitoId"), GetCookie("NodeId")).Link, GetCookie("UserID"), GetCookie("UserDirectory"), path);
                qlikAPI.CreateApp(Name, Description, out appId);
            }
            else
            {
                // Duplico l'app
                QRSSenseApp newApp       = new QRSSenseApp();
                string      errorMessage = "";
                QRSQlikAPI  QRSqlikAPI   = new QRSQlikAPI(AmbitiUtility.GetAmbitoNode(GetCookie("AmbitoId"), GetCookie("NodeId")).Server, path);
                QRSqlikAPI.CopyApp(GetCookie("UserID"), GetCookie("UserDirectory"), SelectedTemplate, Name, out newApp, out errorMessage);
                QlikAPI qlikAPI = new QlikAPI(AmbitiUtility.GetAmbitoNode(GetCookie("AmbitoId"), GetCookie("NodeId")).Link, GetCookie("UserID"), GetCookie("UserDirectory"), path);
                qlikAPI.RenameApp(newApp.id, Description);
            }
            return(RedirectToAction("Hub", "Home", new { AmbitoList = AmbitoList }));
        }
Пример #4
0
        public ActionResult ToShare(string AppId, string AppName, string OverwriteRequired, string StreamID, string StreamName, string AppToOverwriteId, string checkOverwrite, string AmbitoList)
        {
            string path = Server.MapPath("~/cert/client.pfx");

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

            // Duplico l'app
            QRSSenseApp newApp       = new QRSSenseApp();
            string      errorMessage = "";
            QRSQlikAPI  QRSqlikAPI   = new QRSQlikAPI(AmbitiUtility.GetAmbitoNode(GetCookie("AmbitoId"), GetCookie("NodeId")).Server, path);

            QRSqlikAPI.CopyApp(GetCookie("UserID"), GetCookie("UserDirectory"), AppId, AppName, out newApp, out errorMessage);
            bool publishResult = true;

            if (OverwriteRequired.ToLower() == "false")
            {
                // Pubblico l'app
                QlikAPI qlikAPI = new QlikAPI(AmbitiUtility.GetAmbitoNode(GetCookie("AmbitoId"), GetCookie("NodeId")).Link, ambito.superuserid, ambito.superuserdom, path);
                publishResult = qlikAPI.PublishApp(newApp.id, AppName, StreamID, out errorMessage);
            }
            else
            {
                // Rimpiazzo l'app
                QlikAPI qlikAPI = new QlikAPI(ambito.centralnode, ambito.superuserid, ambito.superuserdom, path);
                publishResult = qlikAPI.ReplaceApp(newApp.id, AppToOverwriteId, out errorMessage);

                qlikAPI.DeleteApp(newApp.id);
            }

            return(RedirectToAction("Hub", "Home", new { AmbitoList = AmbitoList }));
        }
Пример #5
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));
        }
Пример #6
0
        // GET: CreateReport
        public ActionResult CreateReport()
        {
            ViewBag.PageType = "InternalAction";

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

            CreateReport model = new CreateReport()
            {
                Name = "", Description = ""
            };

            model.TemplateItems = new List <ReportTemplate>();
            string             path       = Server.MapPath("~/cert/client.pfx");
            var                ambito     = AmbitiUtility.GetAmbitoById(GetCookie("AmbitoId"));
            QRSQlikAPI         qrsQlikApi = new QRSQlikAPI(AmbitiUtility.GetAmbitoNode(GetCookie("AmbitoId"), GetCookie("NodeId")).Server, path);
            List <SenseStream> myStreams;
            string             errorMessage = "";

            qrsQlikApi.GetStreamsByCustomProperty(GetCookie("UserID"), GetCookie("UserDirectory"), "StreamType", "Template", ambito.customproperty, out myStreams, out errorMessage);
            if (myStreams != null && myStreams.Count > 0)
            {
                QlikAPI qlikApi = new QlikAPI(AmbitiUtility.GetAmbitoNode(GetCookie("AmbitoId"), GetCookie("NodeId")).Link, ambito.superuserid, ambito.superuserdom, path);
                List <SenseApplication> apps = new List <SenseApplication>();
                if (qlikApi.GetPublishedAppsInSelectedStreams(myStreams.Select(s => s.Id).ToList(), out apps))
                {
                    if (apps != null && apps.Count > 0)
                    {
                        foreach (var app in apps)
                        {
                            model.TemplateItems.Add(new ReportTemplate()
                            {
                                TemplateStreamID = app.StreamID, TemplateID = app.AppId, TemplateDescription = app.Name
                            });
                        }
                    }
                }
            }
            return(View(model));
        }
Пример #7
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));
        }