public AssignmentBatchAlterModel(DateTime watchPoint, ITimeBoxRepository timeBoxRepository, ITermStyleRepository termStyleRepository) : base(watchPoint, timeBoxRepository, termStyleRepository) { _title = LanguageReader.GetValue("BatchAlterExistsOfAssignemnt"); _filters = new ICustomFilter[] { new CustomFilter("EqAssignmentType", this, (t) => { return(t.Start.Date == SearchDate.Date && t.Text.Equals(QueryType.Text)); }), new CustomFilter("EqTermStart", this, (t) => { return(t.Start == SearchDate); }), new CustomFilter("EqTermEnd", this, (t) => { return(t.End == SearchDate); }), new CustomFilter("Any", this, (t) => { return(t.Start.Date == SearchDate.Date); }) }; }
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); }
protected void ValidateTermGapHasMatched() { if (!TermGapHasMatched) { Applier.Message.AppendLine(LanguageReader.GetValue("Shifts_BoxPairSwap_TermGapHasMatched")); } }
public EmployeeProperty(string name, bool isSelected) { Name = LanguageReader.GetValue(name); IsSelected = isSelected; WhereClause = _propertyClause.ContainsKey(name) ? _propertyClause[name] : (o, text) => true; }
public void Execute(IRoutedMessage message, IInteractionNode handlingNode, MessageProcessingOutcome outcome) { var content = LanguageKey.IsNullOrEmpty() ? Message : LanguageReader.GetValue(LanguageKey); ServiceLocator.Current.GetInstance <IAuditLogModel>().Write(new AuditLog { Action = content, CurrentUser = ApplicationCache.Get <string>(Global.LoggerId) }); }
public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) { TimeSpan timeSpan = (TimeSpan)value; if (timeSpan.TotalMinutes < 60) { return(string.Format("{0:00}:{1:00}", timeSpan.Minutes, timeSpan.Seconds)); } return(string.Format("{0:00}{1}", (int)timeSpan.TotalMinutes, LanguageReader.GetValue("Minute"))); }
public void ChangePassword(Employee employee, bool needLog) { employee.Password = Cryptographer.CreateHash("SHA512Managed", employee.Password); _loginRepository.MakePersistent(employee); if (needLog) { AuditLoginLog(new AuditLog { Action = LanguageReader.GetValue("Administration_Login_ChangePassword"), CurrentUser = employee.AgentId }); } }
protected void ValidateHasTimeOff() { if (Applier.HasTimeOff) { Applier.Message.AppendLine(LanguageReader.GetValue("Shifts_BoxPairSwap_HasTimeOff")); } if (Replier.HasTimeOff) { Replier.Message.AppendLine(LanguageReader.GetValue("Shifts_BoxPairSwap_HasTimeOff")); } }
protected void ValidateHasLocked() { if (Applier.Lockeds.Count != 0) { Applier.Message.AppendLine(LanguageReader.GetValue("Shifts_BoxPairSwap_HasLocked")); } if (Replier.Lockeds.Count != 0) { Replier.Message.AppendLine(LanguageReader.GetValue("Shifts_BoxPairSwap_HasLocked")); } }
protected void ValidateHasAbsentEvent() { if (Applier.HasAbsentEvent) { Applier.Message.AppendLine(LanguageReader.GetValue("Shifts_BoxPairSwap_HasAbsentEvent")); } if (Replier.HasAbsentEvent) { Replier.Message.AppendLine(LanguageReader.GetValue("Shifts_BoxPairSwap_HasAbsentEvent")); } }
public bool AskDeleteShift(IQuestionPresenter p) { if (SelectedTerm == null) { return(false); } p.DisplayName = LanguageReader.GetValue("Shifts_ShiftDispatcher_AskDeleteShift"); p.Editable = false; p.Text = string.Format(LanguageReader.GetValue("Shifts_ShiftDispatcher_AskDeleteShiftText"), SelectedAgent.Profile.Name, SelectedTerm.Start, SelectedTerm.Text); return(true); }
public string Submit() { var session = ServiceLocator.Current.GetInstance <ISessionFactory>().GetCurrentSession(); if (Applier.Message.Length == 0 && Replier.Message.Length == 0) { Applier.Submit(); Replier.Submit(); return(LanguageReader.GetValue("Shifts_BoxPairSwap_Success")); } session.Transaction.Rollback(); return(WithMessage()); }
private void ShowDialog(Exception exception) { if (Message.IsNotNullOrEmpty()) { ServiceLocator.Current.GetInstance <IMessagePresenter>() .Self(q => { //q.DisplayName = LanguageReader.GetValue(Title); q.Text = LanguageReader.GetValue(Message); q.Details = string.Format("{0}:{1}\r\n{2}", exception.GetType(), exception.Message, exception.StackTrace); ServiceLocator.Current.GetInstance <IWindowManager>().ShowDialog(q); }); } }
protected internal void SetTimeOff(Term timeOff, Term term) { if (TimeOff != null) { TimeBox.SetTime(timeOff, term.Start.Date, term.Start.AddDays(1).Date, (terms, success) => { if (!success) { Message.AppendLine(LanguageReader.GetValue("Shifts_BoxPairSwap_SetTimeOff")); return; } }, true); } }
public void Login(Employee employee, string role) { ApplicationCache.Set(Global.LoginEmployee, employee); ApplicationCache.Set(Global.LoggerId, employee.AgentId); if (role.IsNotNullOrEmpty()) { //Set Rules SetFunctionKeys(role); } //Log AuditLoginLog(new AuditLog { Action = LanguageReader.GetValue("Logging_Admin_Login"), CurrentUser = employee.AgentId }); }
public bool BeforeAssignSeat(IQuestionPresenter p) { var shift = SelectedTerm; if (shift == null) { return(false); } var selectedSeat = _seatDispatcherPresenter.Property <SeatBox>("SelectedSeat"); p.DisplayName = LanguageReader.GetValue("Shifts_ShiftDispatcher_AskAssignSeat"); p.Editable = false; p.Text = string.Format(LanguageReader.GetValue("Shifts_ShiftDispatcher_AskAssignSeatText"), selectedSeat.Seat.Area.Name, selectedSeat.Seat.Number, SelectedAgent.Profile.Name, shift.Start, shift.Text); return(true); }
public object Convert(object value, Type targetType, object parameter, CultureInfo culture) { if (value == null) { return(value); } if (parameter != null && parameter.ToString() == "obj") { return(LanguageReader.GetValue(value)); } var text = LanguageReader.GetValue(value.ToString()); return(string.IsNullOrEmpty(text) ? value : text); }
public void Login(string agentId, Guid roleId) { var employee = _loginRepository.FirstOrDefault(o => o.AgentId == agentId); ApplicationCache.Set(Global.LoginEmployee, employee); ApplicationCache.Set(Global.LoggerId, employee.AgentId); if (roleId != Guid.Empty) { //Set Rules SetFunctionKeys(roleId); } //Log AuditLoginLog(new AuditLog { Action = LanguageReader.GetValue("Logging_Admin_Login"), CurrentUser = employee.AgentId }); }
protected void VaildateSwapMessage() { if (Applier.FailedTerm.Count > 0) { Applier.HasExchanged = true; Applier.Message.AppendLine(LanguageReader.GetValue("Shifts_BoxPairSwap_CreateTermFail")); //foreach (var term in Applier.FailedTerm) //{ // Applier.Message.Append(term).Append(","); //} } if (Replier.FailedTerm.Count > 0) { Replier.HasExchanged = true; Replier.Message.AppendLine(LanguageReader.GetValue("Shifts_BoxPairSwap_CreateTermFail")); //foreach (var term in Replier.FailedTerm) //{ // Replier.Message.Append(term).Append(","); //} } }
internal static string GenerateDisplay(IList list) { var display = new StringBuilder(); if (list.Count == 0) { return(LanguageReader.GetValue("ApplicationFramework_Controls_PopupButtonBehavior_Text")); } for (int i = 0; i < list.Count; i++) { var item = list[i]; var itemText = new Reflector(item).Property <string>("Name") ?? item.ToString(); display.Append(itemText); if (i != list.Count - 1) { display.Append(", "); } } return(display.ToString()); }
public EventBatchAlterModel(DateTime watchPoint, ITimeBoxRepository timeBoxRepository, ITermStyleRepository termStyleRepository) : base(watchPoint, timeBoxRepository, termStyleRepository) { _title = LanguageReader.GetValue("BatchAlterExistsOfSubEvent"); OptionalFilters = new ICustomFilter[] { new CustomFilter("EqEventType", this, (t) => { return(t.Text.Equals(QueryType.Text)); }), new CustomFilter("EqParentType", this, (t) => { var bottomStyle = t.GetBottomStyle(); if (bottomStyle == null) { return(false); } return(bottomStyle.Equals(QueryParentType.Text)); }) }; _filters = new ICustomFilter[] { new CustomFilter("InTermRange", this, (t) => { return(t.IsInTheRange(SearchDate, End)); }), new CustomFilter("EqTermStart", this, (t) => t.Start == SearchDate), new CustomFilter("EqTermEnd", this, (t) => t.End == SearchDate) }; End = _searchDate.Date.AddDays(1).AddMinutes(-5); }
private static void SetActriproResource() { Application.Current.Dispatcher.BeginInvoke( () => ThemeManager.CurrentTheme = CommonThemeName.AeroNormalColor.ToString(), DispatcherPriority.ApplicationIdle); if (!ConfigurationManager.AppSettings["Language"].Contains("en")) { //Docking Resources.Culture = CultureInfo.CurrentCulture; string[] names = Enum.GetNames(typeof(SRName)); foreach (string name in names) { string fullKeyName = string.Format(ActriproLanguageKey, "Docking", name); if (LanguageReader.ContainsKey(fullKeyName)) { SR.SetCustomString(name, LanguageReader.GetValue(fullKeyName)); } } //Editors ActiproSoftware.Products.Editors.Resources.Culture = CultureInfo.CurrentCulture; names = Enum.GetNames(typeof(ActiproSoftware.Products.Editors.SRName)); foreach (string name in names) { string fullKeyName = string.Format(ActriproLanguageKey, "Editors", name); if (LanguageReader.ContainsKey(fullKeyName)) { ActiproSoftware.Products.Editors.SR.SetCustomString(name, LanguageReader.GetValue(fullKeyName)); } } } }
public ShiftGapException(string agentId, DateTime start, DateTime end, TimeSpan timespan, LaborRuleCategory category) : base(agentId, start, end, category, string.Format(LanguageReader.GetValue("Shifts_ShiftGapException"), timespan.TotalHours)) { _timespan = timespan; TimeRangeDisplayText = string.Format("{0:MM/dd HH:mm} - {1:MM/dd HH:mm}", start, end); }
public PWException(string agentId, DateTime start, DateTime end, int pw, DayOffRule rule) : base(agentId, start, end, LaborRuleCategory.Gap, string.Format(LanguageReader.GetValue("Shifts_PWException"), pw, rule.MinFWTimes, rule.MaxFWTimes)) { TimeRangeDisplayText = string.Format("{0:yyyy MM/dd} - {1:yyyy MM/dd}", start, end); }
private IEnumerable <ITerm> Method1(DateTime start, DateTime end, IList <RtaaSlicedTerm> blocks, IList <IAgentStatus> statuses, DateTime watchPoint) { List <ITerm> results = new List <ITerm>(); var agentAdherenceList = GetACDEvents(statuses, start, end, 0, watchPoint); int minAbnormalBufferSeconds; if (Application.Current == null) { // 晚下班 DelayOffLineBuffer = LanguageReader.GetValue <int>("OffLineLaterBufferSeconds"); // 早上線 PrematureOnLineBuffer = LanguageReader.GetValue <int>("OnLineEarlierBufferSeconds"); // 晚上線 DelayOnLineBuffer = LanguageReader.GetValue <int>("OnLineLaterBufferSeconds"); // 早下線 PrematureOffLineBuffer = LanguageReader.GetValue <int>("OffLineEarlierBufferSeconds"); // 通用 minAbnormalBufferSeconds = LanguageReader.GetValue <int>("MinAbnormalBufferSeconds"); } else { // 晚下班 DelayOffLineBuffer = Convert.ToInt32(Application.Current.Resources["OffLineLaterBufferSeconds"]); // 早上線 PrematureOnLineBuffer = Convert.ToInt32(Application.Current.Resources["OnLineEarlierBufferSeconds"]); // 晚上線 DelayOnLineBuffer = Convert.ToInt32(Application.Current.Resources["OnLineLaterBufferSeconds"]); // 早下線 PrematureOffLineBuffer = Convert.ToInt32(Application.Current.Resources["OffLineEarlierBufferSeconds"]); // 通用 minAbnormalBufferSeconds = Convert.ToInt32(Application.Current.Resources["MinAbnormalBufferSeconds"]); } int j = 0; for (int i = 0; i < agentAdherenceList.Count; i++) { //并交行走 for (; j < blocks.Count && i < agentAdherenceList.Count; j++) {//两个相交才确定 if (blocks[j].Start <= agentAdherenceList[i].End && agentAdherenceList[i].Start <= blocks[j].End) { #region CrossOver // if 相交部分OnService的情況相同 Or 這個班塊是Ignore if (blocks[j].OnService == agentAdherenceList[i].OnService || blocks[j].Ignore) { // i // Adh |===========|---------- // Block |===========|------ // j // Block 已經比 Adh 更晚了 // Block idx不變 Adh 換到下一個 if (agentAdherenceList[i].End <= blocks[j].End) { j--; i++; } continue; } DateRangeRef centerDateRange = new DateRangeRef(); // 找出相交部分的區域 centerDateRange.Start = blocks[j].Start < agentAdherenceList[i].Start ? agentAdherenceList[i].Start : blocks[j].Start; centerDateRange.End = blocks[j].End > agentAdherenceList[i].End ? agentAdherenceList[i].End : blocks[j].End; //if (exceptionBlock.End.Subtract(exceptionBlock.Start).TotalMinutes < unitmin) continue; #region 找出leftBlock, leftDateRange, rightBlock, rightDateRange // 找出前一個Block 如果是第一個(inx = 0)Block ,建立一個Gap,時間是從DateTime.Min~第一個Block的開始 RtaaSlicedTerm leftBlock = j > 0 ? blocks[j - 1] : new RtaaSlicedTerm() { Start = DateTime.MinValue, End = blocks[j].Start, OnService = false, Text = "Gap" }; //Gap DateRangeRef leftDateRange = new DateRangeRef(leftBlock.Start, leftBlock.End); if (j > 0) { leftDateRange.Start = blocks[j - 1].Start; leftDateRange.End = blocks[j - 1].End; } // 找出下一個Block 如果是最後一個Block ,建立一個Gap,時間是最後一個Block結束~DateTime.Max RtaaSlicedTerm rightBlock = j < (blocks.Count - 1) ? blocks[j + 1] : new RtaaSlicedTerm() { Start = blocks[j].End, End = DateTime.MaxValue, OnService = false, Text = "Gap" }; //Gap DateRangeRef rightDateRange = new DateRangeRef(rightBlock.Start, rightBlock.End); if (j < (blocks.Count - 1)) { rightDateRange.Start = blocks[j + 1].Start; rightDateRange.End = blocks[j + 1].End; } #endregion // 決定這個相交段是 "LateToWork"(應上未上) Or "LateToLeave"(應下未下) Or ""(被Buff忽略) string style = ShiftCheckAdherence(leftBlock, blocks[j], rightBlock, leftDateRange, centerDateRange, rightDateRange); // if 是 "LateToWork"(應上未上) Or "LateToLeave"(應下未下) if (style.Length > 0) { // 如果是不在start~end間, 換看下一個Block if (centerDateRange.End <= start || centerDateRange.Start >= end) { // i i+1 // Adh |===========|----------| // Block |===========|------- // j // Block 已經比 Adh 更晚了 // Block idx不變 Adh 換到下一個 if (agentAdherenceList[i].End <= blocks[j].End) { j--; i++; } // i i+1 // Adh |===========|----------| // Block |===========|---------|-------- // j J+1 // Adh 已經比 Block 更晚了 // Adh idx不變 Block 換到下一個 //else { } continue; } var exceptionBlock = new AdherenceTerm(centerDateRange.Start, centerDateRange.End, new DateRange(start, end)) { Text = style }; //exceptionBlock.BackgroundColor = blockBrushColors[style]; // 檢查產生的長度是否大過 minAbnormalBufferSeconds,否則就不加入Result if (exceptionBlock.End.Subtract(exceptionBlock.Start).TotalSeconds >= minAbnormalBufferSeconds) { results.Add(exceptionBlock); } } // i i+1 // Adh |===========|----------| // Block |===========|------- // j // Block 已經比 Adh 更晚了 // Block idx不變 Adh 換到下一個 if (agentAdherenceList[i].End <= blocks[j].End) { j--; i++; } // i i+1 // Adh |===========|----------| // Block |===========|---------|-------- // j J+1 // Adh 已經比 Block 更晚了 // Adh idx不變 Block 換到下一個 //else { } #endregion } else { // i i+1 // Adh |===========|--------------------| // Block |===========|------ // j // Block 已經比 Adh 更晚了 // Block idx不變 Adh 換到下一個 if (blocks[j].Start > agentAdherenceList[i].End) { if (j > 0) { j--; } break; } // i // Adh |===========|---------- // Block |===========|------------|------------ // j j+1 // Adh 已經比 Block 更晚了 // Adh idx不變 Block 換到下一個 //else { } } } } // 切掉超出start和end之外的片段 if (results.Count > 0 && results[0].Start < start) //Henry: modified @ 2010/3/31 13:50 if (results.Count > 0 && results[0].Start <= start) { results.RemoveAt(0); } if (results.Count > 0 && results[results.Count - 1].End > end) { results[results.Count - 1].SaftyInvoke <AdherenceTerm>(o => { o.End = end; if (o.End.Subtract(o.Start).TotalSeconds < minAbnormalBufferSeconds) { results.Remove(o); } }); } return(results); }
public OvertimeWorkingException(string agentId, DateTime start, DateTime end, TimeSpan timeSpan, LaborRuleCategory category) : base(agentId, start, end, category, string.Format(LanguageReader.GetValue("Shifts_OvertimeWorkingException"), timeSpan.Days, timeSpan.Hours, timeSpan.Minutes)) { _timeSpan = timeSpan; TimeRangeDisplayText = string.Format("{0:yyyy MM/dd HH:mm} - {1:yyyy MM/dd HH:mm}", start, end); }
public static object GetLanguageValue(this object key) { return(LanguageReader.GetValue(key)); }
public void BeforeCancelSeat(IQuestionPresenter p) { p.DisplayName = LanguageReader.GetValue("Shifts_ShiftDispatcher_AskCancelSeat"); p.Editable = false; p.Text = string.Format(LanguageReader.GetValue("Shifts_ShiftDispatcher_AskCancelSeatText"), GetWatchPoint()); }
public DayOffException(string agentId, DateTime start, DateTime end, double dayOffDays, LaborRuleCategory category) : base(agentId, start, end, category, string.Format(LanguageReader.GetValue("Shifts_DayOffException"), dayOffDays)) { _dayOffDays = dayOffDays; TimeRangeDisplayText = string.Format("{0:yyyy MM/dd} - {1:yyyy MM/dd}", start, end); }
public static string GetLanguageValue(this string key) { return(LanguageReader.GetValue(key)); }