예제 #1
0
        public void WindowScheduleCompareToEqual()
        {
            var t1 = TriggerWindow.Parse("10:22-12:22");
            var t2 = TriggerWindow.Parse("10:22-12:22");

            Assert.AreEqual(0, t1.CompareTo(t2));
        }
예제 #2
0
        public void WindowScheduleCompareToDifferent()
        {
            var t1 = TriggerWindow.Parse("10:22-12:22");
            var t2 = TriggerWindow.Parse("10:23-12:23");

            Assert.LessOrEqual(t1.CompareTo(t2), 0);
            Assert.GreaterOrEqual(t2.CompareTo(t1), 0);
        }
예제 #3
0
        public void WindowScheduleTriggerParse()
        {
            var t = TriggerWindow.Parse("10:22-12:22");

            Assert.AreEqual(new TimeSpan(0, 10, 22, 0), t.Start);
            Assert.AreEqual(new TimeSpan(0, 12, 22, 0), t.End);
            Assert.AreEqual(TimeSpan.FromHours(2), t.Window);
        }
예제 #4
0
        public void PointScheduleTriggerParse()
        {
            var t = TriggerWindow.Parse("10:22");

            Assert.AreEqual(new TimeSpan(0, 10, 22, 0), t.Start);
            Assert.AreEqual(new TimeSpan(0, 10, 22, 0), t.End);
            Assert.AreEqual(TimeSpan.Zero, t.Window);
        }
예제 #5
0
        protected void PoPuPClass(object sender, DirectEventArgs e)
        {
            ruleSelector.Disabled = true;
            string classId        = e.ExtraParams["classId"];
            string ClassNameParam = e.ExtraParams["className"];

            classSelectedId.Text = classId;
            className.Text       = ClassNameParam;
            //   ruleSelectorStore.Reload();
            TriggerWindow.Show();
        }
예제 #6
0
        public void NextSchedulePointExpirationExpireWindow()
        {
            var t = new TriggerWindow("10:22");

            var reference = new DateTime(1986, 4, 18, 10, 22, 0);
            var after     = reference.AddDays(30);

            var nextTriggerTime = t.GetNextTriggerTime(reference, after, true, null);

            Assert.AreEqual(TimeSpan.FromDays(31), nextTriggerTime.ReferenceTillTrigger);
            Assert.AreEqual(null, nextTriggerTime.Expiration);
        }
예제 #7
0
        public void NextSchedulePointExpirationExpireWindow()
        {
            var t = TriggerWindow.Parse("10:22");

            var from  = new DateTime(1986, 4, 18, 10, 22, 0);
            var after = from.AddDays(30);

            var nextTriggerTime = t.GetNextTriggerTime(from, after, true, null);

            Assert.AreEqual(TimeSpan.FromDays(31), nextTriggerTime.TimeTill);
            Assert.AreEqual(DateTime.MaxValue, nextTriggerTime.Expiration);
        }
예제 #8
0
        protected void PoPuP(object sender, DirectEventArgs e)
        {
            string accessTypeParam = e.ExtraParams["accessType"];
            string ruleId          = e.ExtraParams["ruleId"];
            string classId         = e.ExtraParams["classId"];
            string ClassNameParam  = e.ExtraParams["className"];
            string seqNo           = e.ExtraParams["seqNo"];


            string type = e.ExtraParams["type"];

            CurrentRuleId.Text = ruleId;
            switch (type)
            {
            case "imgEdit":
                //Step 1 : get the object from the Web Service

                ruleSelector.Disabled = false;
                accessType.Select(accessTypeParam);
                classSelectedId.Text = classId;
                className.Text       = ClassNameParam;
                ruleSelectorStore.Reload();
                TriggerWindow.Show();


                break;

            case "imgDelete":
                X.Msg.Confirm(Resources.Common.Confirmation, Resources.Common.DeleteOneRecord, new MessageBoxButtonsConfig
                {
                    Yes = new MessageBoxButtonConfig
                    {
                        //We are call a direct request metho for deleting a record
                        Handler = String.Format("App.direct.DeleteRecord({0},{1},{2},{3})", ruleId, classId, accessTypeParam, seqNo),
                        Text    = Resources.Common.Yes
                    },
                    No = new MessageBoxButtonConfig
                    {
                        Text = Resources.Common.No
                    }
                }).Show();
                break;

            case "imgAttach":

                //Here will show up a winow relatice to attachement depending on the case we are working on
                break;

            default:
                break;
            }
        }
예제 #9
0
        public void NextSchedulePointNoExpiration()
        {
            var t = new TriggerWindow("10:22");

            var reference = new DateTime(1986, 4, 18, 10, 22, 0);
            var after     = new DateTime(1986, 4, 25, 10, 22, 0);

            for (var i = 0; i < 100; i++)
            {
                var nextTriggerTime = t.GetNextTriggerTime(reference, after, false, null);

                Assert.AreEqual(TimeSpan.FromDays(8), nextTriggerTime.ReferenceTillTrigger);
                Assert.AreEqual(null, nextTriggerTime.Expiration);
            }
        }
예제 #10
0
        public void NextSchedulePointExpirationNotTooBig()
        {
            var t = TriggerWindow.Parse("10:22");

            var reference = new DateTime(1986, 4, 18, 10, 22, 0);
            var after     = reference.AddDays(30);

            for (var i = 0; i < 100; i++)
            {
                var nextTriggerTime = t.GetNextTriggerTime(reference, after, false, null);

                Assert.AreEqual(TimeSpan.FromDays(31), nextTriggerTime.ReferenceTillTrigger);
                Assert.AreEqual(null, nextTriggerTime.Expiration);
            }
        }
예제 #11
0
        public void NextSchedulePointNoExpiration()
        {
            var t = TriggerWindow.Parse("10:22");

            var from  = new DateTime(1986, 4, 18, 10, 22, 0);
            var after = new DateTime(1986, 4, 25, 10, 22, 0);

            for (var i = 0; i < 100; i++)
            {
                var nextTriggerTime = t.GetNextTriggerTime(from, after, false, null);

                Assert.AreEqual(TimeSpan.FromDays(8), nextTriggerTime.TimeTill);
                Assert.AreEqual(DateTime.MaxValue, nextTriggerTime.Expiration);
            }
        }
예제 #12
0
        public void NextScheduleWindowNoExpiration()
        {
            var t = new TriggerWindow("10:22-12:22");

            var reference = new DateTime(1986, 4, 18, 10, 22, 0);
            var after     = new DateTime(1986, 4, 25, 10, 22, 0);

            for (var i = 0; i < 100; i++)
            {
                var nextTriggerTime = t.GetNextTriggerTime(reference, after, false, null);

                Assert.GreaterOrEqual(nextTriggerTime.ReferenceTillTrigger, TimeSpan.FromDays(8));
                Assert.LessOrEqual(nextTriggerTime.ReferenceTillTrigger, TimeSpan.FromDays(8).Add(TimeSpan.FromHours(2)));
                Assert.AreEqual(null, nextTriggerTime.Expiration);
            }
        }
예제 #13
0
        public void NextScheduleWindowExpireWindow()
        {
            var t = TriggerWindow.Parse("10:22-12:22");

            var from  = new DateTime(1986, 4, 18, 10, 22, 0);
            var after = new DateTime(1986, 4, 25, 10, 22, 0);

            for (var i = 0; i < 100; i++)
            {
                var nextTriggerTime = t.GetNextTriggerTime(from, after, true, null);

                Assert.GreaterOrEqual(nextTriggerTime.TimeTill, TimeSpan.FromDays(8));
                Assert.LessOrEqual(nextTriggerTime.TimeTill, TimeSpan.FromDays(8).Add(TimeSpan.FromHours(2)));
                Assert.AreEqual(from.AddDays(8).AddHours(2), nextTriggerTime.Expiration);
            }
        }
예제 #14
0
        public void NextScheduleWindowWithExpireWindow()
        {
            var t = new TriggerWindow("10:22-12:22");

            var reference = new DateTime(1986, 4, 18, 10, 22, 0);
            var after     = new DateTime(1986, 4, 25, 10, 22, 0);

            for (var i = 0; i < 100; i++)
            {
                var nextTriggerTime = t.GetNextTriggerTime(reference, after, true, null);

                Assert.True(nextTriggerTime.ReferenceTillTrigger >= TimeSpan.FromDays(8));
                Assert.True(nextTriggerTime.ReferenceTillTrigger <= TimeSpan.FromDays(8).Add(TimeSpan.FromHours(2)));
                Assert.AreEqual(reference.AddDays(8).AddHours(2), nextTriggerTime.Expiration);
            }
        }
예제 #15
0
        public void NextScheduleWindowWithExpirationTime()
        {
            var t = new TriggerWindow("10:22-12:22");

            var reference = new DateTime(1986, 4, 18, 10, 22, 0);
            var after     = new DateTime(1986, 4, 25, 10, 22, 0);
            var expire    = TimeSpan.FromMinutes(1);

            for (var i = 0; i < 100; i++)
            {
                var nextTriggerTime = t.GetNextTriggerTime(reference, after, false, expire);

                Assert.GreaterOrEqual(nextTriggerTime.ReferenceTillTrigger, TimeSpan.FromDays(8));
                Assert.LessOrEqual(nextTriggerTime.ReferenceTillTrigger, TimeSpan.FromDays(8).Add(TimeSpan.FromHours(2)));
                Assert.That(nextTriggerTime.Expiration, Is.EqualTo(reference + nextTriggerTime.ReferenceTillTrigger + expire).Within(TimeSpan.FromSeconds(1)));
            }
        }
예제 #16
0
        public void NextScheduleWindowExpireAge()
        {
            var t = new TriggerWindow("10:22-12:22");

            var reference = new DateTime(1986, 4, 18, 10, 22, 0);
            var after     = new DateTime(1986, 4, 25, 10, 22, 0);
            var expire    = TimeSpan.FromMinutes(10);

            for (var i = 0; i < 100; i++)
            {
                var nextTriggerTime = t.GetNextTriggerTime(reference, after, false, expire);

                Assert.True(nextTriggerTime.ReferenceTillTrigger >= TimeSpan.FromDays(8));
                Assert.True(nextTriggerTime.ReferenceTillTrigger <= TimeSpan.FromDays(8).Add(TimeSpan.FromHours(2)));
                Assert.AreEqual(reference + nextTriggerTime.ReferenceTillTrigger + expire, nextTriggerTime.Expiration);
            }
        }
예제 #17
0
        public void NextScheduleWindowExpireAge()
        {
            var t = TriggerWindow.Parse("10:22-12:22");

            var from  = new DateTime(1986, 4, 18, 10, 22, 0);
            var after = new DateTime(1986, 4, 25, 10, 22, 0);
            var expir = TimeSpan.FromMinutes(10);

            for (var i = 0; i < 100; i++)
            {
                var nextTriggerTime = t.GetNextTriggerTime(from, after, false, expir);

                Assert.GreaterOrEqual(nextTriggerTime.TimeTill, TimeSpan.FromDays(8));
                Assert.LessOrEqual(nextTriggerTime.TimeTill, TimeSpan.FromDays(8).Add(TimeSpan.FromHours(2)));
                Assert.AreEqual(from + nextTriggerTime.TimeTill + expir, nextTriggerTime.Expiration);
            }
        }
예제 #18
0
        private void BtnAddTrigger_MouseUp(object sender, MouseButtonEventArgs e)
        {
            if (editjob == null)
            {
                return;
            }
            var trigger       = new CustomTrigger();
            var triggerWindow = new TriggerWindow(trigger, true);

            triggerWindow.Owner  = this;
            triggerWindow.OnSave = (trg) =>
            {
                editjob.Triggers.Add(trg);
                dgTriggers.ItemsSource = null;
                dgTriggers.ItemsSource = editjob.Triggers;
                QuartzJsonContext.Instance.Update(editjob);
                QuartzJsonContext.Instance.Commit();
                QuartzJsonContext.Instance.Reload();
            };
            triggerWindow.ShowDialog();
        }
예제 #19
0
        private void BtnEditTrigger_MouseUp(object sender, MouseButtonEventArgs e)
        {
            if (editjob == null)
            {
                return;
            }
            var trigger       = ((FrameworkElement)sender).DataContext as ICustomTrigger;
            var triggerWindow = new TriggerWindow(trigger, false);

            triggerWindow.Owner  = this;
            triggerWindow.OnSave = (trg) => {
                var _trg = editjob.Triggers.FirstOrDefault(x => x.Name == trg.Name && x.Group == trg.Group);
                editjob.Triggers.Remove(_trg);
                editjob.Triggers.Add(trg);
                dgTriggers.ItemsSource = null;
                dgTriggers.ItemsSource = editjob.Triggers;
                QuartzJsonContext.Instance.Update(editjob);
                QuartzJsonContext.Instance.Commit();
                QuartzJsonContext.Instance.Reload();
            };
            triggerWindow.ShowDialog();
        }
예제 #20
0
        public void WindowScheduleToString()
        {
            var t = TriggerWindow.Parse("10:22-12:22");

            Assert.AreEqual("10:22-12:22", t.ToString());
        }