private void SetState(TSCEvents tscevent, List <TSCEvents> list) { if (tscevent.EventKey == null || tscevent.EventKey.Trim().Length == 0) { return; } bool bFound = false; foreach (TSCEvents s in list) { if (s.KeyEquals(tscevent)) { bFound = true; if (s == tscevent) { tscevent.state = '='; } else { tscevent.state = 'U'; } } } if (bFound == false) { tscevent.state = 'I'; } }
public void ReloadEvents() { TSCEvents currentEvent = null; controlTag.eventsXml = InitEvents(); if (cmbEvent.SelectedIndex >= 0 && cmbEvent.SelectedIndex < cmbEvent.Items.Count) { currentEvent = cmbEvent.Items[cmbEvent.SelectedIndex] as TSCEvents; } LoadEventsCombo(controlTag.eventsXml); if (currentEvent != null && currentEvent.EventKey != null && currentEvent.EventKey.Trim().Length > 0) { foreach (object o in cmbEvent.Items) { TSCEvents tsce = o as TSCEvents; if (tsce != null) { if (tsce.EventKey.Trim().ToLower() == currentEvent.EventKey.Trim().ToLower()) { cmbEvent.SelectedItem = tsce; break; } } } } }
private void SetState(TSCEvents tscevent, BindingList <TSCEvents> list) { bool bFound = false; if (tscevent.EventKey != null && tscevent.EventKey.Trim().Length > 0) { foreach (TSCEvents s in list) { if (s.EventKey != null && s.EventKey.Trim().Length > 0 && s.KeyEquals(tscevent)) { bFound = true; if (s == tscevent) { tscevent.state = '='; } else { tscevent.state = 'U'; } } } } else { tscevent.state = '?'; return; } if (bFound == false) { tscevent.state = 'D'; } }
public bool Equals(TSCEvents a) { if ((object)a == null) { return(false); } return(FieldsEqual(this, a)); }
public bool KeyEquals(TSCEvents a) { if ((object)a == null) { return(false); } return( (a.EventKey.Trim().ToLower() == EventKey.Trim().ToLower()) ); }
public TSCEvents(TSCEvents tscevents) : this() { EventKey = new string(tscevents.EventKey.ToArray()); EventName = new string(tscevents.EventName.ToArray()); VenueKey = new string(tscevents.VenueKey.ToArray()); EventDate = tscevents.EventDate; EventEmail = new string(tscevents.EventEmail.ToArray()); EventAddress = new string(tscevents.EventAddress.ToArray()); }
private static bool FieldsEqual(TSCEvents a, TSCEvents b) { return( (a.EventKey == b.EventKey) && (a.EventName == b.EventName) && (a.VenueKey == b.VenueKey) && (a.EventDate == b.EventDate) && (a.EventEmail == b.EventEmail) && (a.EventAddress == b.EventAddress) && (true) ); }
public override bool Equals(object obj) { if (obj == null) { return(false); } TSCEvents a = obj as TSCEvents; if (a == null) { return(false); } return(FieldsEqual(this, a)); }
private void LoadTSCEvents(string xml) { gd_tscevents = new BindingList <TSCEvents>(); db_tscevents = new List <TSCEvents>(); if (xml != null && xml.Trim().Length > 0) { if (Utility.IsValidXml(xml)) { XmlDocument doc = new XmlDocument(); doc.LoadXml(xml); XmlNodeList nodelist = doc.SelectNodes("/Root/Data"); if (nodelist != null) { foreach (XmlNode node in nodelist) { TSCEvents tscevents = new TSCEvents(); tscevents.EventKey = Utility.GetXmlString(node, "EventKey"); tscevents.EventName = Utility.GetXmlString(node, "EventName"); tscevents.VenueKey = Utility.GetXmlString(node, "VenueKey"); tscevents.EventDate = Utility.GetXmlDateTime(node, "EventDate"); tscevents.EventEmail = Utility.GetXmlString(node, "EventEmail"); tscevents.EventAddress = Utility.GetXmlString(node, "EventAddress"); gd_tscevents.Add(tscevents); } foreach (TSCEvents tscevents in gd_tscevents) { db_tscevents.Add(new TSCEvents(tscevents)); } } } else { MessageBox.Show(xml); } } else { } dataGridViewEvents.DataSource = gd_tscevents; dataGridViewEvents.Columns["EventKey"].DataPropertyName = "EventKey"; dataGridViewEvents.Columns["EventName"].DataPropertyName = "EventName"; dataGridViewEvents.Columns["VenueKey"].DataPropertyName = "VenueKey"; dataGridViewEvents.Columns["EventDate"].DataPropertyName = "EventDate"; dataGridViewEvents.Columns["EventEmail"].DataPropertyName = "EventEmail"; dataGridViewEvents.Columns["EventAddress"].DataPropertyName = "EventAddress"; SetHeaders(); }
private void LoadEventsCombo(string xml) { _loadingEvents = true; try { if (xml != null && xml.Trim().Length > 0) { XmlDocument doc = new XmlDocument(); doc.LoadXml(xml); XmlNodeList nodelist = doc.SelectNodes("/Root/Data"); if (nodelist != null) { cmbEvent.Items.Clear(); cmbEvent.DisplayMember = "EventKey"; foreach (XmlNode node in nodelist) { TSCEvents events = new TSCEvents(); events.EventKey = Utility.GetXmlString(node, "EventKey"); events.EventName = Utility.GetXmlString(node, "EventName"); events.EventDate = Utility.GetXmlDateTime(node, "EventDate"); events.EventEmail = Utility.GetXmlString(node, "EventEmail"); events.EventAddress = Utility.GetXmlString(node, "EventAddress"); events.VenueKey = Utility.GetXmlString(node, "VenueKey"); cmbEvent.Items.Add(events); } } } } catch (Exception ex) { MessageBox.Show(ex.Message); } finally { _loadingEvents = false; } }