///<summary>Deletes everything from the SiteLink table. Does not truncate the table so that PKs are not reused on accident.</summary> public static void ClearSiteLinkTable() { string command = "DELETE FROM sitelink WHERE SiteLinkNum > 0"; DataCore.NonQ(command); SiteLinks.RefreshCache(); }
///<summary></summary> public static SiteLink CreateSiteLink(long siteNum, string octetStart = "", string connectionSettingsHQOverrides = "") { SiteLink siteLink = new SiteLink() { SiteNum = siteNum, OctetStart = octetStart, ConnectionSettingsHQOverrides = connectionSettingsHQOverrides }; siteLink.SiteLinkNum = SiteLinks.Insert(siteLink); SiteLinks.RefreshCache(); return(siteLink); }
private void FormMapHQ_Load(object sender, EventArgs e) { _siteCur = SiteLinks.GetSiteByIP(); if (_siteCur == null) { MessageBox.Show("Error. No sites found in the cache."); DialogResult = DialogResult.Abort; Close(); return; } FormOpenDental.AddMapToList(this); FillMaps(); FillTabs(); FillCombo(); FillMapAreaPanel(); FillTriageLabelColors(); }
private void butOK_Click(object sender, EventArgs e) { _siteLink.OctetStart = PIn.Int(textOctet1.Text, false) + "." + PIn.Int(textOctet2.Text, false) + "." + PIn.Int(textOctet3.Text, false) + ".";//End with a period so that the matching algorithm in other parts of the program are accurate. if (comboTriageCoordinator.SelectedIndex > -1) { _siteLink.EmployeeNum = ((ODBoxItem <Employee>)comboTriageCoordinator.SelectedItem).Tag.EmployeeNum; } _siteLink.SiteColor = panelSiteColor.BackColor; _siteLink.ForeColor = panelForeColor.BackColor; _siteLink.InnerColor = panelInnerColor.BackColor; _siteLink.OuterColor = panelOuterColor.BackColor; SiteLinks.Upsert(_siteLink); DialogResult = DialogResult.OK; }
/// <summary> /// Processes all the spide's links. It ignores external links. /// </summary> /// <param name="spider">Spider to process</param> public void ProcessSpider(Spider spider) { foreach (var url in spider.PageLinks) { if (!SiteLinks.ContainsKey(url)) { if (new Uri(url).Host == RootUri.Host) { SiteLinks.Add(url, false); } else { SiteLinks.Add(url, true); } } } this.RemoveDuplicateUrls(); }
private Contracts.Entity ToContract() { var obj = new Contracts.Entity { Id = Id, Type = ToString(Type), Labels = ToContract(_Labels), Aliases = ToContract(_Aliases), Descriptions = ToContract(_Descriptions), Sitelinks = SiteLinks.ToDictionary(link => link.Site, link => new Contracts.SiteLink { Site = link.Site, Title = link.Title, Badges = link.Badges.ToList() }), Claims = Claims.GroupBy(c => c.MainSnak.PropertyId).ToDictionary(g => g.Key, g => (ICollection <Contracts.Claim>)g.Select(c => c.ToContract(false)).ToList()) }; return(obj); }
public async Task <MessageModel <bool> > Put([FromBody] SiteLinks siteLinks) { if (siteLinks == null || !(siteLinks.Id > 0)) { return(new MessageModel <bool>() { msg = "参数异常", response = false }); } var isSuc = await _siteLinksRepository.Update(siteLinks); return(new MessageModel <bool>() { msg = isSuc ? "更新成功" : "更新失败", success = isSuc, response = isSuc }); }
private void butSiteLink_Click(object sender, EventArgs e) { SiteLink siteLink = SiteLinks.GetFirstOrDefault(x => x.SiteNum == SiteCur.SiteNum); if (siteLink == null) { siteLink = new SiteLink() { SiteNum = SiteCur.SiteNum, ForeColor = Color.Black, InnerColor = Color.LightCyan, OuterColor = Color.Blue }; } FormSiteLinkEdit FormSE = new FormSiteLinkEdit(siteLink); FormSE.ShowDialog(); if (FormSE.DialogResult == DialogResult.OK) { DataValid.SetInvalid(InvalidType.Sites); } }
public async Task <MessageModel <int> > Post([FromBody] SiteLinks siteLinks) { if (siteLinks == null) { return(new MessageModel <int>() { msg = "参数异常", response = 0 }); } var blogId = await _siteLinksRepository.Add(siteLinks); return(new MessageModel <int>() { msg = "添加成功", success = true, response = blogId }); }
private void SetEscalationList(List <PhoneEmpDefault> peds, List <Phone> phones) { try { escalationView.BeginUpdate(); escalationView.Items.Clear(); escalationView.DictProximity.Clear(); escalationView.DictShowExtension.Clear(); escalationView.DictExtensions.Clear(); escalationView.DictColors.Clear(); if (escalationView.Tag == null || (((int)escalationView.Tag) != tabMain.SelectedIndex)) { escalationView.IsNewItems = true; escalationView.Tag = tabMain.SelectedIndex; } List <PhoneEmpDefault> listFiltered = peds.FindAll(x => DoAddToEscalationView(x, phones)); List <PhoneEmpDefault> listSorted = SortForEscalationView(listFiltered, phones); for (int i = 0; i < listSorted.Count; i++) { PhoneEmpDefault ped = listSorted[i]; Phone phone = ODMethodsT.Coalesce(Phones.GetPhoneForEmployeeNum(phones, ped.EmployeeNum)); escalationView.Items.Add(ped.EmpName); //Only show the proximity icon if the phone.IsProxVisible AND the employee is at the same site as our currently selected room. escalationView.DictProximity.Add(ped.EmpName, (_mapCur.SiteNum == ped.SiteNum && phone.IsProxVisible)); //Extensions will always show for both locations unless the employee is not proximal. escalationView.DictShowExtension.Add(ped.EmpName, phone.IsProxVisible); escalationView.DictExtensions.Add(ped.EmpName, ped.PhoneExt); if (_mapCur.SiteNum != ped.SiteNum) { escalationView.DictColors.Add(ped.EmpName, SiteLinks.GetSiteColorBySiteNum(ped.SiteNum, escalationView.BackColor)); } } } catch { } finally { escalationView.EndUpdate(); } }
private void butOK_Click(object sender, EventArgs e) { _siteLink.OctetStart = PIn.Int(textOctet1.Text, false) + "." + PIn.Int(textOctet2.Text, false) + "." + PIn.Int(textOctet3.Text, false) + ".";//End with a period so that the matching algorithm in other parts of the program are accurate. if (comboTriageCoordinator.SelectedIndex > -1) { _siteLink.EmployeeNum = ((ODBoxItem <Employee>)comboTriageCoordinator.SelectedItem).Tag.EmployeeNum; } _siteLink.SiteColor = panelSiteColor.BackColor; _siteLink.ForeColor = panelForeColor.BackColor; _siteLink.InnerColor = panelInnerColor.BackColor; _siteLink.OuterColor = panelOuterColor.BackColor; //There is no such thing as an empty grid of connection overrides (we show the defaults at minimum). //The only explanation for an empty grid is if the defaults could not be loaded correctly so do not save ConnectionSettingsHQOverrides. if (gridConnections.ListGridRows.Count > 0) { _siteLink.ConnectionSettingsHQOverrides = GetConnectionOverrides(); } SiteLinks.Upsert(_siteLink); DialogResult = DialogResult.OK; }
///<summary>Attempts to connect and get connection settings from the database that is used by DataAction.RunCustomers(). ///Returns true and sets text boxes to the corresponding connectino setting values if a successful connection was made. ///Otherwise; displays an error message to the user and returns false. Assumes a connection to a 'customers' db has already been made.</summary> private bool TryDatabaseConnectionSettings() { //Assume that we have a guaranteed connection to HQ's 'customers' database. //Look and see what connection settings this computer should use via DataAction.RunCustomers(). _timerDatabase.Stop(); try { //Clear out the currently cached HQ database connections and refresh both the preference and site link caches. DataAction.ClearDictHqCentralConnections(); Prefs.RefreshCache(); SiteLinks.RefreshCache(); string serverName = ""; string databaseName = ""; string mySqlUser = ""; string mySqlPassword = ""; Action action = () => { serverName = DataConnection.GetServerName(); databaseName = DataConnection.GetDatabaseName(); mySqlUser = DataConnection.GetMysqlUser(); mySqlPassword = DataConnection.GetMysqlPass(); }; DataAction.RunCustomers(action, useConnectionStore: false); //Display the settings to the user so that we can easily tell what database this instance is pointing to. textServerName.Text = serverName; textDatabaseName.Text = databaseName; textMySQLUser.Text = mySqlUser; textMySQLPassword.Text = mySqlPassword; } catch (Exception ex) { labelError.Visible = true; MessageBox.Show(this, "There was an error making a connection to the database.\r\n" + "Please correct the database connection settings then click Reconnect.\r\n\r\n" + ex.Message); return(false); } _timerDatabase.Start(); return(true); }
internal override void Plus(XDocument xdoc) { foreach (var element in xdoc.Root.Elements()) { var val = element.Value; int valI; int.TryParse(val, out valI); switch (element.Name.LocalName) { case "id": break; case "race_id": if (valI != -1 && World.Races.ContainsKey(valI)) { Race = World.Races[valI]; } break; case "type": if (!Types.Contains(val)) { Types.Add(val); } _entityType = (short)Types.IndexOf(val); break; case "site_link": var newSl = new EntitySiteLink(element, this); if (SiteLinks == null) { SiteLinks = new Dictionary <int, List <EntitySiteLink> >(); } if (!SiteLinks.ContainsKey(newSl.LinkType)) { SiteLinks.Add(newSl.LinkType, new List <EntitySiteLink>()); } SiteLinks[newSl.LinkType].Add(newSl); break; case "entity_link": var newEl = new EntityEntityLink(element, this); if (EntityLinks == null) { EntityLinks = new Dictionary <int, List <EntityEntityLink> >(); } if (!EntityLinks.ContainsKey(newEl.LinkType)) { EntityLinks.Add(newEl.LinkType, new List <EntityEntityLink>()); } EntityLinks[newEl.LinkType].Add(newEl); break; case "children": ChildrenIDs = val.Split(new[] { ',' }, StringSplitOptions.RemoveEmptyEntries).Select(x => Convert.ToInt32(x)).ToList(); break; case "worship_id": WorshipHfid = valI; break; case "coords": if (Coords == null) { Coords = new List <Point>(); } foreach (var coordSplit in val.Split(new[] { '|' }, StringSplitOptions.RemoveEmptyEntries).Select(coord => coord.Split(',')).Where(coordSplit => coordSplit.Length == 2)) { Coords.Add(new Point(Convert.ToInt32(coordSplit[0]), Convert.ToInt32(coordSplit[1]))); } break; case "claims": Claims = val.Split(new[] { '|' }, StringSplitOptions.RemoveEmptyEntries) .Select(coord => coord.Split(',')) .Where(coordSplit => coordSplit.Length == 2) .Select(split => new Point(Convert.ToInt32(split[0]), Convert.ToInt32(split[1]))) .ToList(); break; case "entity_position": var newPosition = new EntityPosition(element, this); if (Positions == null) { Positions = new List <EntityPosition>(); } Positions.Add(newPosition); break; case "entity_position_assignment": var newPositionAssignment = new EntityPositionAssignment(element, this); if (PositionAssignments == null) { PositionAssignments = new List <EntityPositionAssignment>(); } PositionAssignments.Add(newPositionAssignment); break; case "histfig_id": if (MemberHfids == null) { MemberHfids = new List <int>(); } MemberHfids.Add(valI); break; case "histfig_ids": MemberHfids = val.Split(new[] { ',' }, StringSplitOptions.RemoveEmptyEntries).Select(x => Convert.ToInt32(x)).ToList(); break; case "occasion": var newOccasion = new EntityOccasion(element, this); if (Occasions == null) { Occasions = new List <EntityOccasion>(); } Occasions.Add(newOccasion); break; default: DFXMLParser.UnexpectedXmlElement(xdoc.Root.Name.LocalName + "\t", element, xdoc.Root.ToString()); break; } } }
/// <summary> /// Returns true is there is any pending URL to process yet /// </summary> /// <returns></returns> public bool HasPendingUrls() { return(SiteLinks.Any(url => url.Value == false)); }
/// <summary> /// Remove duplocated links /// </summary> private void RemoveDuplicateUrls() { SiteLinks = SiteLinks.GroupBy(url => url.Key) .Select(group => group.First()) .ToDictionary(url => url.Key, url => url.Value); }
///<summary>Refresh the phone panel every X seconds after it has already been setup. Make sure to call FillMapAreaPanel before calling this the first time.</summary> public void SetPhoneList(List <PhoneEmpDefault> peds, List <Phone> phones, List <PhoneEmpSubGroup> listSubGroups, List <ChatUser> listChatUsers) { try { string title = "Call Center Map - Triage Coord. - "; try { //get the triage coord label but don't fail just because we can't find it SiteLink siteLink = SiteLinks.GetFirstOrDefault(x => x.SiteNum == _mapCur.SiteNum); title += Employees.GetNameFL(Employees.GetEmp(siteLink.EmployeeNum)); } catch { title += "Not Set"; } labelTriageCoordinator.Text = title; labelCurrentTime.Text = DateTime.Now.ToShortTimeString(); #region Triage Counts //The triage count used to only count up the triage operators within the currently selected room. //Now we want to count all operators at the selected site (local) and then all operators across all sites (total). int triageStaffCountLocal = 0; int triageStaffCountTotal = 0; foreach (PhoneEmpDefault phoneEmpDefault in peds.FindAll(x => x.IsTriageOperator && x.HasColor)) { Phone phone = phones.FirstOrDefault(x => x.Extension == phoneEmpDefault.PhoneExt); if (phone == null) { continue; } if (phone.ClockStatus.In(ClockStatusEnum.None, ClockStatusEnum.Home, ClockStatusEnum.Lunch, ClockStatusEnum.Break, ClockStatusEnum.Off , ClockStatusEnum.Unavailable, ClockStatusEnum.NeedsHelp, ClockStatusEnum.HelpOnTheWay)) { continue; } //This is a triage operator who is currently here and on the clock. if (phoneEmpDefault.SiteNum == _mapCur.SiteNum) { triageStaffCountLocal++; } triageStaffCountTotal++; } labelTriageOpsCountLocal.Text = triageStaffCountLocal.ToString(); labelTriageOpsCountTotal.Text = triageStaffCountTotal.ToString(); #endregion for (int i = 0; i < this.mapAreaPanelHQ.Controls.Count; i++) //loop through all of our cubicles and labels and find the matches { try { if (!(this.mapAreaPanelHQ.Controls[i] is MapAreaRoomControl)) { continue; } MapAreaRoomControl room = (MapAreaRoomControl)this.mapAreaPanelHQ.Controls[i]; if (room.MapAreaItem.Extension == 0) //This cubicle has not been given an extension yet. { room.Empty = true; continue; } Phone phone = Phones.GetPhoneForExtension(phones, room.MapAreaItem.Extension); if (phone == null) //We have a cubicle with no corresponding phone entry. { room.Empty = true; continue; } ChatUser chatuser = listChatUsers.Where(x => x.Extension == phone.Extension).FirstOrDefault(); PhoneEmpDefault phoneEmpDefault = PhoneEmpDefaults.GetEmpDefaultFromList(phone.EmployeeNum, peds); if (phoneEmpDefault == null) //We have a cubicle with no corresponding phone emp default entry. { room.Empty = true; continue; } //we got this far so we found a corresponding cubicle for this phone entry room.EmployeeNum = phone.EmployeeNum; room.EmployeeName = phone.EmployeeName; if (phone.DateTimeNeedsHelpStart.Date == DateTime.Today) //if they need help, use that time. { TimeSpan span = DateTime.Now - phone.DateTimeNeedsHelpStart + _timeDelta; DateTime timeOfDay = DateTime.Today + span; room.Elapsed = timeOfDay.ToString("H:mm:ss"); } else if (phone.DateTimeStart.Date == DateTime.Today && phone.Description != "") //else if in a call, use call time. { TimeSpan span = DateTime.Now - phone.DateTimeStart + _timeDelta; DateTime timeOfDay = DateTime.Today + span; room.Elapsed = timeOfDay.ToString("H:mm:ss"); } else if (phone.Description == "" && chatuser != null && chatuser.CurrentSessions > 0) //else if in a chat, use chat time. { TimeSpan span = TimeSpan.FromMilliseconds(chatuser.SessionTime) + _timeDelta; room.Elapsed = span.ToStringHmmss(); } else if (phone.DateTimeStart.Date == DateTime.Today) //else available, use that time. { TimeSpan span = DateTime.Now - phone.DateTimeStart + _timeDelta; DateTime timeOfDay = DateTime.Today + span; room.Elapsed = timeOfDay.ToString("H:mm:ss"); } else //else, whatever. { room.Elapsed = ""; } if (phone.IsProxVisible) { room.ProxImage = Properties.Resources.Figure; } else if (phone.DateTProximal.AddHours(8) > DateTime.Now) { room.ProxImage = Properties.Resources.NoFigure; //TODO: replace image with one from Nathan } else { room.ProxImage = null; } room.IsAtDesk = phone.IsProxVisible; string status = Phones.ConvertClockStatusToString(phone.ClockStatus); //Check if the user is logged in. if (phone.ClockStatus == ClockStatusEnum.None || phone.ClockStatus == ClockStatusEnum.Home) { status = "Home"; } room.Status = status; if (phone.Description == "") { room.PhoneImage = null; if (chatuser != null && chatuser.CurrentSessions != 0) { room.ChatImage = Properties.Resources.gtaicon3; } else { room.ChatImage = null; } } else { room.PhoneImage = Properties.Resources.phoneInUse; } Color outerColor; Color innerColor; Color fontColor; bool isTriageOperatorOnTheClock; //get the cubicle color and triage status Phones.GetPhoneColor(phone, phoneEmpDefault, true, out outerColor, out innerColor, out fontColor, out isTriageOperatorOnTheClock); if (!room.IsFlashing) //if the control is already flashing then don't overwrite the colors. this would cause a "spastic" flash effect. { room.OuterColor = outerColor; room.InnerColor = innerColor; } room.ForeColor = fontColor; if (phone.ClockStatus == ClockStatusEnum.NeedsHelp) //turn on flashing { room.StartFlashing(); } else //turn off flashing { room.StopFlashing(); } room.Invalidate(true); } catch (Exception e) { e.DoNothing(); } } refreshCurrentTabHelper(peds, phones, listSubGroups); } catch { //something failed unexpectedly } }
public void SetTriageColors(long siteNum = 0) { SetColors(SiteLinks.GetSiteForeColorBySiteNum(siteNum, Color.Black) , SiteLinks.GetSiteOuterColorBySiteNum(siteNum, Phones.PhoneColorScheme.COLOR_DUAL_OuterTriage) , SiteLinks.GetSiteInnerColorBySiteNum(siteNum, Phones.PhoneColorScheme.COLOR_DUAL_InnerTriageHere)); }