Esempio n. 1
0
 void GetQuestionAnswerData(TermKind termKind, QuestionData qd, out TermStyle termStyle, out string termString)
 {
     if (termKind == TermKind.ChineseCharacter)
     {
         if (string.IsNullOrWhiteSpace(qd.ChineseImageFileName))
         {
             termStyle  = TermStyle.Text;
             termString = qd.ChineseText;
         }
         else
         {
             termStyle  = TermStyle.Picture;
             termString = Path.Combine(directory, qd.ChineseImageFileName);
         }
     }
     else if (termKind == TermKind.ChineseSound)
     {
         termStyle  = TermStyle.Sound;
         termString = Path.Combine(directory, qd.SoundFileName);
     }
     else if (termKind == TermKind.EnglishWord)
     {
         termStyle  = TermStyle.Text;
         termString = qd.EnglishText;
     }
     else
     {
         throw new ArgumentException("termKind");
     }
 }
Esempio n. 2
0
        public bool DuplicationChecking(TermStyle entity, string name)
        {
            var example = Activator.CreateInstance(entity.GetType()).As <TermStyle>();

            example.Name = name;
            var count = _termStyleRepository.Count(example);

            return(0 < count);
        }
Esempio n. 3
0
 public void Reload(ref TermStyle entity)
 {
     if (entity.SaftyGetProperty <bool, IEditingObject>(o => o.IsNew))
     {
         _termStyleRepository.Evict(entity);
     }
     else
     {
         _termStyleRepository.Refresh(ref entity);
     }
 }
Esempio n. 4
0
 public void Reload(ref TermStyle entity)
 {
     if (entity.SaftyGetProperty<bool, IEditingObject>(o => o.IsNew))
     {
         _termStyleRepository.Evict(entity);
     }
     else
     {
         _termStyleRepository.Refresh(ref entity);
     }
     
 }
Esempio n. 5
0
        public void SetAsAbsent(TermStyle type, string kind)
        {
            //SelectedAgent.Schedule.Operator = string.Format("{0}@{1:yyyy/MM/dd HH:mm:ss.fff}", Core.ApplicationCache.Get<string>(Keys.AgentId), DateTime.Now);
            _shiftDispatcherModel.ApplyAbsent(SelectedAgent, SelectedTerm as AssignmentBase, type,
                                              kind == "Fully" ? SelectedTerm.GetLength() : TimeSpan.FromHours(1));
            Refresh(new[] { SelectedAgent }); //also might include rtaa reload

            if (_seatDispatcherPresenter != null)
            {
                _seatDispatcherPresenter.Proc("FastReloadData")();
            }
        }
Esempio n. 6
0
 protected override void OnShutdown()
 {
     if (WhenClosed != null)
     {
         WhenClosed(this, _applyFailException);
     }
     Invoker            = null;
     MeasureEventWidth  = null;
     GetSelectedAgents  = null;
     AvailableTypes     = null;
     _selectedEventType = null;
     RefreshDelegate    = null;
     CurrentAgent       = null;
     WhenClosed         = null;
     OnActivateDelegate = null;
     base.OnShutdown();
 }
Esempio n. 7
0
        public bool ApplyAbsent(IAgent agent, AssignmentBase assignment, TermStyle type, TimeSpan length)
        {
            TermAlteringListener.Manually();

            var newAbsent = new AbsentEvent(assignment.Start, length, type);
            var success   = false;

            agent.Schedule.Create(newAbsent,
                                  (t, result) =>
            {
                success = result;

                //if (success)
                //    assignment.OccupyStatus = "A";
            }, false);

            return(success);
        }
Esempio n. 8
0
        public void AddSubEvent(DateTime start, TermStyle style, int rowIndex)
        {
            BindableAgents[rowIndex].SaftyInvoke <IAgent>(o =>
            {
                var applied = false;
                var timeBox = o.Schedule;
                timeBox.Create(Term.New(start, style, style.CustomLength), (t, success) =>
                {
                    if (success)
                    {
                        //((Term)t).Tag = Comments;
                        applied = true;
                    }

                    o.OperationFail = !success;
                }, false);
                AddingTermPresenterCallback(new[] { o }, applied);
            });
        }
Esempio n. 9
0
 void GetQuestionAnswerData(TermKind termKind, QuestionData qd, out TermStyle termStyle, out string termString)
 {
     if (termKind == TermKind.ChineseCharacter) {
         if (string.IsNullOrWhiteSpace(qd.ChineseImageFileName)) {
             termStyle = TermStyle.Text;
             termString = qd.ChineseText;
         }
         else {
             termStyle = TermStyle.Picture;
             termString = Path.Combine(directory, qd.ChineseImageFileName);
         }
     }
     else if (termKind == TermKind.ChineseSound) {
         termStyle = TermStyle.Sound;
         termString = Path.Combine(directory, qd.SoundFileName);
     }
     else if (termKind == TermKind.EnglishWord) {
         termStyle = TermStyle.Text;
         termString = qd.EnglishText;
     }
     else {
         throw new ArgumentException("termKind");
     }
 }
        public void AddSubEvent(DateTime start, TermStyle style, int rowIndex)
        {
            BindableAgents[rowIndex].SaftyInvoke<IAgent>(o =>
                                                             {
                                                                 var applied = false;
                                                                 var timeBox = o.Schedule;
                                                                 timeBox.Create(Term.New(start, style, style.CustomLength), (t, success) =>
                                                                    {
                                                                        if (success)
                                                                        {
                                                                            //((Term)t).Tag = Comments;
                                                                            applied = true;
                                                                        }

                                                                        o.OperationFail = !success;

                                                                    }, false);
                                                                 AddingTermPresenterCallback(new[] { o }, applied);
                                                             });
        }
Esempio n. 11
0
 public void Delete(TermStyle entity)
 {
     _termStyleRepository.MakeTransient(entity);
 }
Esempio n. 12
0
 public void Save(TermStyle entity)
 {
     _termStyleRepository.MakePersistent(entity);
 }
Esempio n. 13
0
 protected override void OnShutdown()
 {
     if (WhenClosed != null)
         WhenClosed(this, _applyFailException);
     Invoker = null;
     MeasureEventWidth = null;
     GetSelectedAgents = null;
     AvailableTypes = null;
     _selectedEventType = null;
     RefreshDelegate = null;
     CurrentAgent = null;
     WhenClosed = null;
     OnActivateDelegate = null;
     base.OnShutdown();
 }
        public void SetAsAbsent(TermStyle type, string kind)
        {
            //SelectedAgent.Schedule.Operator = string.Format("{0}@{1:yyyy/MM/dd HH:mm:ss.fff}", Core.ApplicationCache.Get<string>(Keys.AgentId), DateTime.Now);
            _shiftDispatcherModel.ApplyAbsent(SelectedAgent, SelectedTerm as AssignmentBase, type,
                                              kind == "Fully" ? SelectedTerm.GetLength() : TimeSpan.FromHours(1));
            Refresh(new[] { SelectedAgent }); //also might include rtaa reload

            if (_seatDispatcherPresenter != null)
                _seatDispatcherPresenter.Proc("FastReloadData")();
        }
Esempio n. 15
0
 public void Delete(TermStyle entity)
 {
     _termStyleRepository.MakeTransient(entity);
 }
Esempio n. 16
0
 public void Save(TermStyle entity)
 {
     _termStyleRepository.MakePersistent(entity);
 }
Esempio n. 17
0
        public bool ApplyAbsent(IAgent agent, AssignmentBase assignment, TermStyle type, TimeSpan length)
        {
            TermAlteringListener.Manually();

            var newAbsent = new AbsentEvent(assignment.Start, length, type);
            var success = false;
            agent.Schedule.Create(newAbsent,
                (t, result) =>
                {
                    success = result;

                    //if (success)
                    //    assignment.OccupyStatus = "A";
                }, false);

            return success;
        }
Esempio n. 18
0
 public AbsentEvent(DateTime start, TimeSpan length, TermStyle style)
     : base(start, length)
 {
     _level = 3;
     this.MAssign(new { style.Background, Text = style.Name, IsNeedSeat = style.Occupied });
 }
Esempio n. 19
0
        public bool DuplicationChecking(TermStyle entity,string name)
        {
            var example = Activator.CreateInstance(entity.GetType()).As<TermStyle>();
            example.Name = name;
            var count =  _termStyleRepository.Count(example);

            return 0 < count;
        }