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 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); }
public void Reload(ref TermStyle entity) { if (entity.SaftyGetProperty <bool, IEditingObject>(o => o.IsNew)) { _termStyleRepository.Evict(entity); } else { _termStyleRepository.Refresh(ref entity); } }
public void Reload(ref TermStyle entity) { if (entity.SaftyGetProperty<bool, IEditingObject>(o => o.IsNew)) { _termStyleRepository.Evict(entity); } else { _termStyleRepository.Refresh(ref entity); } }
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")(); } }
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 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); }
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); }); }
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); }); }
public void Delete(TermStyle entity) { _termStyleRepository.MakeTransient(entity); }
public void Save(TermStyle entity) { _termStyleRepository.MakePersistent(entity); }
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")(); }
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; }
public AbsentEvent(DateTime start, TimeSpan length, TermStyle style) : base(start, length) { _level = 3; this.MAssign(new { style.Background, Text = style.Name, IsNeedSeat = style.Occupied }); }
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; }