Exemple #1
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 }));
        }
Exemple #2
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 }));
        }
Exemple #3
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 }));
        }