Ejemplo n.º 1
0
        public void SetNewTime(RoutedEventArgs e)
        {
            var source        = new Luna.Core.Reflector(e.OriginalSource);
            var newPlacement  = source.Property <ITerm>("DropedPlacement");
            var agent         = BindableAgents[source.Property <int>("PointOutDataRowIndex")];
            var pointOutBlock = source.Property <ITerm>("PointOutBlock");

            var newStart = newPlacement.Start;
            var newEnd   = newPlacement.End;

            if ((pointOutBlock.Start == newStart && pointOutBlock.End == newEnd))
            {
                return;
            }

            pointOutBlock.SaftyInvoke <Term>(x =>
            {
                if (!x.Locked)
                {
                    agent.SaftyInvoke <IAgent>(o =>
                                               o.Schedule.SetTime(x, newStart, newEnd,
                                                                  (t, success) =>
                    {
                        if (success)
                        {
                            x.Tag   = _alterComments;
                            IsDirty = true;
                        }

                        o.OperationFail = !success;
                    }, false)
                                               );
                }
            });
        }
Ejemplo n.º 2
0
        public bool Ask(RoutedEventArgs e, IQuestionPresenter p)
        {
            var source        = new Luna.Core.Reflector(e.OriginalSource);
            var newPlacement  = source.Property <ITerm>("DropedPlacement");
            var agent         = (IAgent)BindableAgents[source.Property <int>("PointOutDataRowIndex")];
            var pointOutBlock = source.Property <ITerm>("PointOutBlock");

            var newStart = newPlacement.Start;
            var newEnd   = newPlacement.End;

            if (pointOutBlock.Start == newStart && pointOutBlock.End == newEnd)
            {
                return(false);
            }

            p.DisplayName = LanguageReader.GetValue("Shifts_ShiftDispatcher_AskEditShift");
            p.Editable    = true;

            pointOutBlock.SaftyInvoke <Term>(x =>
            {
                p.Text = string.Format(LanguageReader.GetValue("Shifts_ShiftDispatcher_AskEditShiftText"),
                                       agent.Profile.Name, x.Start, x.Text);
                p.Comments = x.Tag;
            });
            return(true);
        }
Ejemplo n.º 3
0
        private void InvokerPropertyChanged(object sender, PropertyChangedEventArgs e)
        {
            var invoker = new Luna.Core.Reflector(sender);

            if (e.PropertyName == "AgentAdherences" && invoker.Property <IList <IEnumerable> >("AgentAdherences").Count > 0)
            {
                //if (invoker.Property<bool>("RtaaIsAutoRunning")) return;
                Refresh();
            }

            if (e.PropertyName == "EnableRtaa" && sender.SaftyGetProperty <bool, IShiftDispatcherPresenter>(p => p.EnableRtaa == false))
            {
                this.Close();
                sender.SaftyInvoke <INotifyPropertyChanged>(p => p.PropertyChanged -= InvokerPropertyChanged);
            }
        }
Ejemplo n.º 4
0
        private void InvokerPropertyChanged(object sender, PropertyChangedEventArgs e)
        {
            var invoker = new Luna.Core.Reflector(sender);

            if (e.PropertyName == "AgentAdherences" && invoker.Property<IList<IEnumerable>>("AgentAdherences").Count > 0)
            {
                //if (invoker.Property<bool>("RtaaIsAutoRunning")) return;
                Refresh();
            }

            if (e.PropertyName == "EnableRtaa" && sender.SaftyGetProperty<bool, IShiftDispatcherPresenter>(p => p.EnableRtaa == false))
            {
                this.Close();
                sender.SaftyInvoke<INotifyPropertyChanged>(p => p.PropertyChanged -= InvokerPropertyChanged);
            }
        }
        public void SetNewTime(RoutedEventArgs e)
        {
            var source = new Luna.Core.Reflector(e.OriginalSource);
            var newPlacement = source.Property<ITerm>("DropedPlacement");
            var agent = BindableAgents[source.Property<int>("PointOutDataRowIndex")];
            var pointOutBlock = source.Property<ITerm>("PointOutBlock");

            var newStart = newPlacement.Start;
            var newEnd = newPlacement.End;

            if ((pointOutBlock.Start == newStart && pointOutBlock.End == newEnd))
                return;

            pointOutBlock.SaftyInvoke<Term>(x =>
                                {
                                    if (!x.Locked)
                                        agent.SaftyInvoke<IAgent>(o=>
                                            o.Schedule.SetTime(x, newStart, newEnd,
                                            (t, success) =>
                                            {
                                                if (success)
                                                {
                                                    x.Tag = _alterComments;
                                                    IsDirty = true;
                                                }

                                                o.OperationFail = !success;
                                            }, false)
                                        );
                                });
        }
        public bool Ask(RoutedEventArgs e, IQuestionPresenter p)
        {
            var source = new Luna.Core.Reflector(e.OriginalSource);
            var newPlacement = source.Property<ITerm>("DropedPlacement");
            var agent = (IAgent)BindableAgents[source.Property<int>("PointOutDataRowIndex")];
            var pointOutBlock = source.Property<ITerm>("PointOutBlock");

            var newStart = newPlacement.Start;
            var newEnd = newPlacement.End;

            if (pointOutBlock.Start == newStart && pointOutBlock.End == newEnd)
                return false;

            p.DisplayName = LanguageReader.GetValue("Shifts_ShiftDispatcher_AskEditShift");
            p.Editable = true;

            pointOutBlock.SaftyInvoke<Term>(x =>
                                                {
                                                    p.Text = string.Format(LanguageReader.GetValue("Shifts_ShiftDispatcher_AskEditShiftText"),
                                                    agent.Profile.Name, x.Start, x.Text);
                                                    p.Comments = x.Tag;
                                                });
            return true;
        }