private void UpdateFields(CFADataSet.IncidentsRow incidentRow, string description) { Regex regex = new Regex( @".*Region:\</strong\> (?<region>..).*Location:\</strong\> (?<location>[^,\<]*),?(?<name>[^\<]*).*Date/Time:\</strong\> (?<timeStamp>[^\<]+).*Type\:\</strong\> (?<type>[^\<]*).*Status:</strong> (?<status>[^\<]*).*Size:</strong> (?<size>[^\<]*).*Vehicles:</strong> (?<appliances>[^\<]*).*"); Match match = regex.Match(description); incidentRow.Region = GetInteger(match.Groups["region"].Value); incidentRow.Location = match.Groups["location"].Value.Trim(); incidentRow.Time = DateTime.Parse(match.Groups["timeStamp"].Value); string name = match.Groups["name"].Value.Trim(); string incidentType = match.Groups["type"].Value; string status = match.Groups["status"].Value; string size = match.Groups["size"].Value; short appliances = GetInteger(match.Groups["appliances"].Value); if (incidentRow.Name != name || incidentRow.Type != incidentType || incidentRow.Status != status || incidentRow.Size != size || incidentRow.Appliances != appliances) { incidentRow.UpdateTime = clock.Now; incidentRow.Name = name; incidentRow.Type = incidentType; incidentRow.Status = status; incidentRow.Size = size; incidentRow.Appliances = appliances; } }
private CFADataSet.IncidentsRow GetNewIncidentsRow(CFADataSet.IncidentsDataTable incidents) { string guid = incidentRSSNode.SelectSingleNode("guid").InnerText; CFADataSet.IncidentsRow incidentRow = incidents.FindByGUID(guid); string description = incidentRSSNode.SelectSingleNode("description").InnerText; if (incidentRow == null) { incidentRow = incidents.NewIncidentsRow(); incidentRow.GUID = guid; UpdateFields(incidentRow, description); if (FilterRow(incidentRow)) // TODO: This is a view issue { incidents.Rows.Add(incidentRow); } } else { UpdateFields(incidentRow, description); } return(incidentRow); }
private static bool FilterRow(CFADataSet.IncidentsRow incidentRow) { return (incidentRow.Type != "INCIDENT" && incidentRow.Type != "HAZMAT INCIDENT" && incidentRow.Type != "OTHER" && incidentRow.Type != "FALSE ALARM"); }
private void dataGridView_CellDoubleClick(object sender, DataGridViewCellEventArgs e) { if (e.RowIndex >= 0) { DataGridViewRow viewRow = dataGridView.CurrentRow; if (viewRow != null) { DataRowView rowView = (DataRowView)viewRow.DataBoundItem; CFADataSet.IncidentsRow incidentRow = (CFADataSet.IncidentsRow)rowView.Row; presenter.OnDoubleClick(incidentRow); } } }
private void RemoveUpdatedIncidents(XmlNode xmlNode, ICollection <CFADataSet.IncidentsRow> incidentRows) { XmlNodeList incidentNodes = xmlNode.SelectNodes("/rss/channel/item"); foreach (XmlNode incidentNode in incidentNodes) { IRSSIncidentItem incident = rssIncidentItemFactory.Create(incidentNode); incident.Update(incidents); CFADataSet.IncidentsRow updatedRow = incident.Update(dataSet.Incidents); if (incidentRows.Contains(updatedRow)) { incidentRows.Remove(updatedRow); } } }
private void UpdatePanel() { if (incidents.Rows.Count > 0) { if (currentIndicentIndex >= incidents.Rows.Count) { currentIndicentIndex = incidents.Rows.Count - 1; } CFADataSet.IncidentsRow incident = GetIncident(); panel.SetGuid(incident.GUID); panel.SetName(incident.Name); panel.SetLocation(incident.Location); panel.SetType(incident.Type); panel.SetStatus(incident.Status); panel.SetSize(incident.Size); panel.SetPublicationTime(incident.Time); panel.SetUpdateTime(incident.UpdateTime); panel.SetRegion(incident.Region); panel.SetVehicles(incident.Appliances); } }
public void OnDoubleClick(CFADataSet.IncidentsRow row) { controller.OnShowOnMap(row.Location); }