Beispiel #1
0
        public static object ExecuteSentence(List <VALUE> l)
        {
            if (l == null || l.Count != 1)
            {
                return(null);
            }

            var v = l[0];

            VALUE find = null;

            find = v.FindValueByTravarse(FuncUtil.get_type(YDEF.sx_screen_sentence));
            if (find != null)
            {
                sys.logline("Exec Screen Sentence");
                return(null);
            }
            find = v.FindValueByTravarse(FuncUtil.get_type(YDEF.sx_layer_sentence));
            if (find != null)
            {
                sys.logline("Exec Layer Sentence");
                return(null);
            }
            find = v.FindValueByTravarse(FuncUtil.get_type(YDEF.sx_display_sentence));
            if (find != null)
            {
                sys.logline("Exec Display Sentence");
                return(null);
            }

            return(null);
        }
Beispiel #2
0
        public static bool Execute(VALUE v)
        {
            var func = FuncUtil.get_funcname(v);

            if (func == "DATE")
            {
                var p = FuncUtil.get_parameters(v);
                if (p == null || p.Length == 0)
                {
                    sys.error("Runtime/PreProcessFunction.Execute", v);
                }
                var s = FuncUtil.del_dq(p[0].ToString());
                try
                {
                    var date = DateTime.Parse(s);
                    if (date.Year == DateTime.Now.Year && date.Month == DateTime.Now.Month && date.Day == DateTime.Now.Day)
                    {
                        return(true);
                    }
                }
                catch {
                    sys.error("Runtime / PreProcessFunction.Execute", v);
                }
                return(false);
            }
            if (func == "DATEAFTER")
            {
                var p = FuncUtil.get_parameters(v);
                if (p == null || p.Length == 0)
                {
                    sys.error("Runtime/PreProcessFunction.Execute", v);
                }
                var s = FuncUtil.del_dq(p[0].ToString());
                try
                {
                    var date  = DateTime.Parse(s);
                    var today = new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day);
                    if (today >= date)
                    {
                        return(true);
                    }
                }
                catch
                {
                    sys.error("Runtime / PreProcessFunction.Execute", v);
                }
                return(false);
            }
            if (func == "DATEBETWEEN")
            {
                var p = FuncUtil.get_parameters(v);
                if (p == null || p.Length < 2)
                {
                    sys.error("Runtime/PreProcessFunction.Execute", v);
                }
                var s1 = FuncUtil.del_dq(p[0].ToString());
                var s2 = FuncUtil.del_dq(p[1].ToString());
                try
                {
                    var date1 = DateTime.Parse(s1);
                    var date2 = DateTime.Parse(s2);
                    var today = new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day);
                    if (today >= date1 && today <= date2)
                    {
                        return(true);
                    }
                }
                catch
                {
                    sys.error("Runtime / PreProcessFunction.Execute", v);
                }
                return(false);
            }

            return(true);
        }