Exemplo n.º 1
0
        public override void InnerRun(Dictionary <string, object> vars, Dictionary <string, object> outputVars, Dictionary <string, object> InvertedInputVars, Message message)
        {
            DBConnection db = COREobject.i.Entitron;

            string hostname   = TapestryUtils.GetServerHostName();
            string appName    = db.Application.Name;
            string blockName  = (string)vars["Block"];
            string button     = vars.ContainsKey("Button") ? (string)vars["Button"] : "";
            int    modelId    = vars.ContainsKey("ModelId") ? (int)vars["ModelId"] : -1;
            string serverName = HttpContext.Current.Request.ServerVariables["SERVER_NAME"];

            string systemAccName = WebConfigurationManager.AppSettings["SystemAccountName"];
            string systemAccPass = WebConfigurationManager.AppSettings["SystemAccountPass"];

            string targetUrl;

            if (serverName == "localhost")
            {
                targetUrl = $"https://omnius-as.azurewebsites.net/{appName}/{blockName}/Get?modelId={modelId}&User={systemAccName}&Password={systemAccPass}";
            }
            else
            {
                targetUrl = $"{hostname}/{appName}/{blockName}/Get?modelId={modelId}&User={systemAccName}&Password={systemAccPass}";
            }

            if (button != "")
            {
                targetUrl += $"&button={button}";
            }

            HttpWebRequest  request  = (HttpWebRequest)WebRequest.Create(targetUrl);
            HttpWebResponse response = (HttpWebResponse)request.GetResponse();
        }
Exemplo n.º 2
0
        public static void OpenUrl(COREobject core, string Block, string Button = "", int ModelId = -1)
        {
            DBConnection db = core.Entitron;

            string hostname   = TapestryUtils.GetServerHostName();
            string appName    = db.Application.Name;
            string serverName = HttpContext.Current.Request.ServerVariables["SERVER_NAME"];

            string systemAccName = WebConfigurationManager.AppSettings["SystemAccountName"];
            string systemAccPass = WebConfigurationManager.AppSettings["SystemAccountPass"];

            string targetUrl;

            if (serverName == "localhost")
            {
                targetUrl = $"https://omnius-as.azurewebsites.net/{appName}/{Block}/Get?modelId={ModelId}&User={systemAccName}&Password={systemAccPass}";
            }
            else
            {
                targetUrl = $"{hostname}/{appName}/{Block}/Get?modelId={ModelId}&User={systemAccName}&Password={systemAccPass}";
            }

            if (Button != "")
            {
                targetUrl += $"&button={Button}";
            }

            HttpWebRequest  request  = (HttpWebRequest)WebRequest.Create(targetUrl);
            HttpWebResponse response = (HttpWebResponse)request.GetResponse();
        }
Exemplo n.º 3
0
        public override void InnerRun(Dictionary <string, object> vars, Dictionary <string, object> outputVars, Dictionary <string, object> invertedVars, Message message)
        {
            COREobject core = COREobject.i;

            string hostname = TapestryUtils.GetServerHostName();
            string appName  = core.Application.Name;

            outputVars["Result"] = $"{hostname}/{appName}";
        }
Exemplo n.º 4
0
        public override void InnerRun(Dictionary <string, object> vars, Dictionary <string, object> outputVars, Dictionary <string, object> invertedVars, Message message)
        {
            COREobject core      = COREobject.i;
            string     hostname  = TapestryUtils.GetServerHostName();
            string     appName   = core.Application.Name;
            string     blockName = (string)vars["BlockName"];
            int        modelId   = (int)vars["Id"];

            outputVars["Result"] = $"{hostname}/{appName}/{blockName}?modelId={modelId}";
        }
Exemplo n.º 5
0
        public static int RegisterTask(COREobject core, string Block, string TaskName, string Button = "", int ModelId = -1, DateTime?StartTime = null, int Minutes = -1)
        {
            string hostname   = TapestryUtils.GetServerHostName();
            string appName    = core.Application.Name;
            string serverName = HttpContext.Current.Request.ServerVariables["SERVER_NAME"];

            string systemAccName = WebConfigurationManager.AppSettings["SystemAccountName"];
            string systemAccPass = WebConfigurationManager.AppSettings["SystemAccountPass"];

            string targetUrl;

            if (serverName == "localhost")
            {
                targetUrl = $"https://omnius-as.azurewebsites.net/{appName}/{Block}/Get?modelId={ModelId}&User={systemAccName}&Password={systemAccPass}";
            }
            else
            {
                targetUrl = $"{hostname}/{appName}/{Block}/Get?modelId={ModelId}&User={systemAccName}&Password={systemAccPass}";
            }

            if (Button != "")
            {
                targetUrl += $"&button={Button}";
            }

            DateTime time;

            if (StartTime != null)
            {
                time = TimeZoneInfo.ConvertTimeToUtc(DateTime.SpecifyKind(StartTime.Value, DateTimeKind.Unspecified),
                                                     TimeZoneInfo.FindSystemTimeZoneById("Central European Standard Time"));
            }
            else
            {
                time = DateTime.Now.AddMinutes(Minutes);
            }

            var newTask = new Task
            {
                AppId      = core.Application.Id,
                Active     = true,
                Name       = TaskName,
                Type       = ScheduleType.ONCE,
                Url        = targetUrl,
                Repeat     = false,
                Start_Time = new TimeSpan(time.Hour, time.Minute, 0),
                Start_Date = time
            };
            var cortex = new Cortex.Cortex();

            cortex.Save(newTask);

            return(newTask.Id.Value);
        }
Exemplo n.º 6
0
        public static void UnregisterTask(COREobject core, string Block, string Button = "", int ModelId = -1)
        {
            string hostname   = TapestryUtils.GetServerHostName();
            string appName    = core.Application.Name;
            string serverName = HttpContext.Current.Request.ServerVariables["SERVER_NAME"];

            string targetUrl;

            targetUrl = $"{hostname}/{appName}/{Block}/Get?modelId={ModelId}&User=Scheduler&Password=194GsQwd/AgB4ZZnf_uF";

            if (Button != "")
            {
                targetUrl += $"&button={Button}";
            }

            var cortex = new Cortex.Cortex();

            cortex.Delete(targetUrl);
        }
Exemplo n.º 7
0
        public override void InnerRun(Dictionary <string, object> vars, Dictionary <string, object> outputVars, Dictionary <string, object> InvertedInputVars, Message message)
        {
            COREobject core = COREobject.i;

            string hostname   = TapestryUtils.GetServerHostName();
            string appName    = core.Application.Name;
            string blockName  = (string)vars["Block"];
            string button     = vars.ContainsKey("Button") ? (string)vars["Button"] : "";
            int    modelId    = vars.ContainsKey("ModelId") ? (int)vars["ModelId"] : -1;
            string serverName = HttpContext.Current.Request.ServerVariables["SERVER_NAME"];

            string targetUrl;

            targetUrl = $"{hostname}/{appName}/{blockName}/Get?modelId={modelId}&User=Scheduler&Password=194GsQwd/AgB4ZZnf_uF";

            if (button != "")
            {
                targetUrl += $"&button={button}";
            }

            var cortex = new Cortex.Cortex();

            cortex.Delete(targetUrl);
        }
Exemplo n.º 8
0
        public override void InnerRun(Dictionary <string, object> vars, Dictionary <string, object> outputVars, Dictionary <string, object> InvertedInputVars, Message message)
        {
            Application app = COREobject.i.Application;

            bool   isutc      = vars.ContainsKey("InputIsUtc") ? (bool)vars["InputIsUtc"] : false;
            string hostname   = TapestryUtils.GetServerHostName();
            string appName    = app.Name;
            string blockName  = (string)vars["Block"];
            string button     = vars.ContainsKey("Button") ? (string)vars["Button"] : "";
            int    modelId    = vars.ContainsKey("ModelId") ? (int)vars["ModelId"] : -1;
            string serverName = HttpContext.Current.Request.ServerVariables["SERVER_NAME"];

            string systemAccName = WebConfigurationManager.AppSettings["SystemAccountName"];
            string systemAccPass = WebConfigurationManager.AppSettings["SystemAccountPass"];

            string targetUrl;

            if (serverName == "localhost")
            {
                targetUrl = $"https://omnius-as.azurewebsites.net/{appName}/{blockName}/Get?modelId={modelId}&User={systemAccName}&Password={systemAccPass}";
            }
            else
            {
                targetUrl = $"{hostname}/{appName}/{blockName}/Get?modelId={modelId}&User={systemAccName}&Password={systemAccPass}";
            }

            if (button != "")
            {
                targetUrl += $"&button={button}";
            }

            string   taskName = (string)vars["TaskName"];
            DateTime time;

            if (vars.ContainsKey("StartTime"))
            {
                var localTime = (DateTime)vars["StartTime"];
                if (!isutc)
                {
                    time = TimeZoneInfo.ConvertTimeToUtc(DateTime.SpecifyKind(localTime, DateTimeKind.Unspecified),
                                                         TimeZoneInfo.FindSystemTimeZoneById("Central European Standard Time"));
                }
                else
                {
                    time = localTime;
                }
            }
            else
            {
                int minutes = Convert.ToInt32(vars["Minutes"]);
                time = DateTime.Now.AddMinutes(minutes);
            }

            var newTask = new Task
            {
                AppId      = app.Id,
                Active     = true,
                Name       = taskName,
                Type       = ScheduleType.ONCE,
                Url        = targetUrl,
                Repeat     = false,
                Start_Time = new TimeSpan(time.Hour, time.Minute, 0),
                Start_Date = time
            };
            var cortex = new Cortex.Cortex();

            cortex.Save(newTask);

            outputVars["TaskId"] = newTask.Id;
        }
Exemplo n.º 9
0
 public static string GetHostUrl(COREobject core)
 {
     return(TapestryUtils.GetServerHostName());
 }
Exemplo n.º 10
0
        public override void InnerRun(Dictionary <string, object> vars, Dictionary <string, object> outputVars, Dictionary <string, object> invertedVars, Message message)
        {
            string hostname = TapestryUtils.GetServerHostName();

            outputVars["Result"] = $"{hostname}";
        }