public async Task <JsonResult> SaveEvent(EmployeeEventViewModel e) { var status = false; IFormatProvider culture = new CultureInfo("en-US", true); EmployeeEvent eve = new EmployeeEvent() { CompanyID = CurrentCompanyId, Username = e.Username, Overtime = e.Overtime ?? 0, Start = DateTime.ParseExact(e.Start, "dd/MM/yyyy HH:mm tt", culture), End = DateTime.ParseExact(e.End, "dd/MM/yyyy HH:mm tt", culture), Description = e.Description ?? "No description", Color = e.Color, Status = StatusColor.MapColorToStatus(e.Color), IsFullDay = e.IsFullDay, EventID = e.EventID }; if (ModelState.IsValid) { status = await _employeeRepository.CreateEmployeeEventAsync(eve); } return(new JsonResult { Data = new { status = status } }); }
public ReservationStatusColors( StatusColor tentativeColorIndividual, StatusColor tentativeColorGroup, StatusColor guaranteedColorIndividual, StatusColor guaranteedColorGroup, StatusColor depositedColorIndividual, StatusColor depositedColorGroup, StatusColor arrivalColorIndividual, StatusColor arrivalColorGroup, StatusColor inhouseColorIndividual, StatusColor inhouseColorGroup, StatusColor departureColorIndividual, StatusColor departureColorGroup, StatusColor checkedOutColorIndividual, StatusColor checkedOutColorGroup, StatusColor noShowColorIndividual, StatusColor noShowColorGroup, StatusColor canceledColorIndividual, StatusColor canceledColorGroup) { UnguaranteedNotDueIndividual = tentativeColorIndividual; UnguaranteedNotDueGroup = tentativeColorGroup; GuaranteedColorIndividual = guaranteedColorIndividual; GuaranteedColorGroup = guaranteedColorGroup; UnguaranteedOverdueIndividual = depositedColorIndividual; UnguaranteedOverdueGroup = depositedColorGroup; ArrivalColorIndividual = arrivalColorIndividual; ArrivalColorGroup = arrivalColorGroup; InhouseColorIndividual = inhouseColorIndividual; InhouseColorGroup = inhouseColorGroup; DepartureColorIndividual = departureColorIndividual; DepartureColorGroup = departureColorGroup; CheckedOutColorIndividual = checkedOutColorIndividual; CheckedOutColorGroup = checkedOutColorGroup; NoShowColorIndividual = noShowColorIndividual; NoShowColorGroup = noShowColorGroup; CanceledColorIndividual = canceledColorIndividual; CanceledColorGroup = canceledColorGroup; }
private void FillRectangle(Rectangle rect, StatusColor color) { if (rect != null) { switch (color) { case StatusColor.Green: rect.Fill = _Brushes[(int)StatusColor.Green]; break; case StatusColor.Gray: rect.Fill = _Brushes[(int)StatusColor.Gray]; break; case StatusColor.Yellow: rect.Fill = _Brushes[(int)StatusColor.Yellow]; break; case StatusColor.Red: rect.Fill = _Brushes[(int)StatusColor.Red]; break; case StatusColor.White: rect.Fill = _Brushes[(int)StatusColor.White]; break; } } }
public ControlData(bool disabled, string content, StatusColor color = StatusColor.Neutral, double?progress = null) { Disabled = disabled; Content = content; Color = color; Progress = progress; }
public DeviceStatusCache(int id, string status, string description, StatusColor color, string ip) { this.Id = id; this.Status = status; this.Description = description; this.Color = color; this.IPAddress = ip; }
public void Execute(StatusColor statusColor) { try { InsertStatus(statusColor); } catch (Exception exc) { logger.WriteLine($"Error executing {nameof(InsertStatusCommand)}", exc); } }
public void red2green() { DispatcherTimer ColorTimer = new DispatcherTimer(); ColorTimer.Interval = TimeSpan.FromSeconds(7); ColorTimer.Tick += async(Sender, args) => { await StatusColor.Fade(duration : 1000, delay : 0, value : 0).StartAsync(); StatusColor.Fill = GreenBrush; await StatusColor.Fade(duration : 1200, delay : 0, value : 1).StartAsync(); ColorTimer.Stop(); }; ColorTimer.Start(); }
public void YellowindIcatorColorToGreenIndicatorColor() { DispatcherTimer ColorTimer2 = new DispatcherTimer(); ColorTimer2.Interval = TimeSpan.FromSeconds(7); ColorTimer2.Tick += async(Zender, Args) => { await StatusColor.Fade(duration : 1000, delay : 0, value : 0).StartAsync(); StatusColor.Fill = YellowBrush; await StatusColor.Fade(duration : 1200, delay : 0, value : 1).StartAsync(); red2green(); ColorTimer2.Stop(); }; ColorTimer2.Start(); }
public RoomStatusColors(StatusColor cleanColor, StatusColor dirtyColor, StatusColor deepCleanColor, StatusColor inspectColor, StatusColor dustColor, StatusColor outOfOrderColor, StatusColor blockedColor, StatusColor maidInRoomColor, StatusColor showRoomColor, StatusColor leftDirtyColor, StatusColor holdsColor) { CleanColor = cleanColor; DirtyColor = dirtyColor; DeepCleanColor = deepCleanColor; InspectColor = inspectColor; DustColor = dustColor; OutOfOrderColor = outOfOrderColor; BlockedColor = blockedColor; MaidInRoomColor = maidInRoomColor; ShowRoomColor = showRoomColor; LeftDirtyColor = leftDirtyColor; HoldsColor = holdsColor; }
private void SearchRectForFill(StatusColor color, string Name) { char trimSymbol = ' '; for (int i = 0; i < _Rectangles.Count; ++i) { foreach (var rt in _Rectangles) { for (int j = 0; j < rt.Count; ++j) { if (rt[j].Count > 0) { FillRectangle(rt[j].Find(x => x.Name == Name.Trim(trimSymbol)), color); } } } } }
/// <summary> /// Builds "Status" macro block. /// </summary> public static XElement BuildStatus(string title, StatusColor color, bool outline) { return Element( "ac:structured-macro", Attribute("ac:name", "status"), Element( "ac:parameter", Attribute("ac:name", "subtle"), outline.ToString().ToLowerInvariant()), Element( "ac:parameter", Attribute("ac:name", "colour"), color.ToString()), Element( "ac:parameter", Attribute("ac:name", "title"), title)); }
public void RedIndicatorColorToYellowIndicatorColor() { StatusColor.Fill = GreenBrush; DispatcherTimer ColorTimer = new DispatcherTimer(); ColorTimer.Interval = TimeSpan.FromSeconds(7); ColorTimer.Tick += async(Sender, args) => { await StatusColor.Fade(duration : 1000, delay : 0, value : 0).StartAsync(); StatusColor.Fill = RedBrush; await StatusColor.Fade(duration : 1200, delay : 0, value : 1).StartAsync(); YellowindIcatorColorToGreenIndicatorColor(); ColorTimer.Stop(); }; ColorTimer.Start(); }
/// <summary> /// Builds "Status" macro block. /// </summary> public static XElement BuildStatus(string title, StatusColor color, bool outline) { return(Element( "ac:structured-macro", Attribute("ac:name", "status"), Element( "ac:parameter", Attribute("ac:name", "subtle"), outline.ToString().ToLowerInvariant()), Element( "ac:parameter", Attribute("ac:name", "colour"), color.ToString()), Element( "ac:parameter", Attribute("ac:name", "title"), title))); }
private void showStatus(String msg, StatusColor color) { toolStripStatusLabel2.Text = msg; switch (color) { case StatusColor.failed: toolStripStatusLabel2.ForeColor = Color.Red; break; case StatusColor.success: toolStripStatusLabel2.ForeColor = Color.Green; break; default: toolStripStatusLabel2.ForeColor = Color.Black; break; } }
public void SearchRectForFill(StatusColor color, string Name) { lock (locker) { char trimSymbol = ' '; for (int i = 0; i < _Rectangles.Count; ++i) { foreach (var rt in _Rectangles) { for (int j = 0; j < rt.Count; ++j) { if (rt[j].Count > 0) { Application.Current.Dispatcher.Invoke(() => FillRectangle(rt[j].Find(x => x.Name == Name.Trim(trimSymbol)), color)); } } } } } }
//- public static int notifyCounter; public NotificationPanel(string title, string message, StatusColor color, int second) { //- notifyCounter++; #region Initialize InitializeComponent(); NotificationComponents.Title = title; NotificationComponents.Message = message; NotificationComponents.StatusColor = color; NotificationComponents.TimerInterval = second; #endregion int openNotificationCount = Application.Current.Windows.OfType <NotificationPanel>().Count(); #region NotificationPanel Location var desktopWorkingArea = System.Windows.SystemParameters.WorkArea; this.Top = desktopWorkingArea.Bottom - this.Height - 25; sb_SlideWindow.To = desktopWorkingArea.Right - this.Width;; #endregion #region Information Parameters switch (NotificationComponents.StatusColor) { case StatusColor.Success: gd_Content.Background = new SolidColorBrush(Color.FromRgb(92, 184, 92)); // Green break; case StatusColor.Warning: gd_Content.Background = new SolidColorBrush(Color.FromRgb(235, 163, 61)); // Yellow break; case StatusColor.Error: gd_Content.Background = new SolidColorBrush(Color.FromRgb(217, 83, 79)); // Red break; default: gd_Content.Background = new SolidColorBrush(Color.FromRgb(29, 29, 29)); // Darken break; } lbl_title.Content = NotificationComponents.Title; tb_message.Text = NotificationComponents.Message; #endregion #region Timer DispatcherTimer timer = new DispatcherTimer() { Interval = TimeSpan.FromSeconds(NotificationComponents.TimerInterval) }; timer.Tick += delegate(object sender, EventArgs e) { ((DispatcherTimer)timer).Stop(); if (this.ShowActivated) { this.Close(); } }; timer.Start(); #endregion #region Animation //Storyboard sb = new Storyboard(); //DoubleAnimation da = new DoubleAnimation(-100, 100, new Duration(new TimeSpan(0, 0, 5))); //Storyboard.SetTargetProperty(da, new PropertyPath("(Canvas.Right)")); //sb.Children.Add(da); //NotificationWindow.BeginStoryboard(sb); #endregion }
private void InsertStatus(StatusColor statusColor) { using (var manager = new ApplicationManager()) { var page = new Page(manager.CurrentPage()); var ns = page.Namespace; var elements = page.Root.Descendants(ns + "T") .Where(e => e.Attribute("selected")?.Value == "all"); if (elements != null) { string color = "black"; string background = "yellow"; switch (statusColor) { case StatusColor.Gray: color = "white"; background = "#42526E"; break; case StatusColor.Red: color = "white"; background = "#BF2600"; break; case StatusColor.Yellow: color = "172B4D"; background = "#FF991F"; break; case StatusColor.Green: color = "white"; background = "#00875A"; break; case StatusColor.Blue: color = "white"; background = "#0052CC"; break; } var colors = $"color:{color};background:{background}"; var text = " STATUS "; var content = new XElement(ns + "T", new XCData( new XElement("span", new XAttribute("style", $"font-family:'Segoe UI';font-size:10.0pt;font-weight:bold;{colors}"), text ).ToString(SaveOptions.DisableFormatting) + " ") ); page.ReplaceSelectedWithContent(content); manager.UpdatePageContent(page.Root); } } }
public DeviceStatusHistoryForGrid(int id, string ip, string status, string description, StatusColor color, DateTime date) { this.Id = id; this.IPAddress = ip; this.Status = status; this.Description = description; this.StatusColor = color; this.Date = date; }
/// <summary> /// 以指定的值,单位和颜色初始化一个 <see cref="Status"/> 类的新实例。 /// </summary> /// <param name="value">状态的值。</param> /// <param name="unit">状态的单位。</param> /// <param name="color">状态的颜色。</param> /// <exception cref="ArgumentNullException"><paramref name="value"/> 为 <see langword="null"/>。</exception> /// <exception cref="ArgumentNullException"><paramref name="unit"/> 为 <see langword="null"/>。</exception> public Status(string value, string unit, StatusColor color) { Value = value ?? throw new ArgumentNullException(nameof(value)); Unit = unit ?? throw new ArgumentNullException(nameof(unit)); Color = color; }