Beispiel #1
0
        public static BoardMeetingList Load(String iFromFile)
        {
            StreamReader     lReader = null;
            XmlDocument      lXmlDoc = null;
            BoardMeetingList RetVal  = null;

            try
            {
                if (!String.IsNullOrEmpty(iFromFile) && File.Exists(iFromFile))
                {
                    lReader = new StreamReader(iFromFile);
                    lXmlDoc = new XmlDocument();
                    lXmlDoc.LoadXml(lReader.ReadToEnd());
                    RetVal = BoardMeetingList.Load(lXmlDoc);
                }
            }
            finally
            {
                if (lReader != null)
                {
                    lReader.Close();
                }
            }
            return(RetVal);
        }
Beispiel #2
0
        private void btnBoard_Click(object sender, EventArgs e)
        {
            String           lFilename         = Path.GetDirectoryName(Application.ExecutablePath) + "\\misc\\board.xml";
            BoardMeetingList lBoardMeetingList = BoardMeetingList.Load(lFilename);

            if (lBoardMeetingList != null)
            {
                FrequencyCounter lCounter = lBoardMeetingList.EffectiveDateTillPublication();
                lCounter = lBoardMeetingList.MeetingDateTillPublication();

                String lResult = "Mean time " + lCounter.MeanValue.ToString("##0.0") + Environment.NewLine;
                lResult = lResult + "Max. time " + lCounter.MaxValue.ToString() + Environment.NewLine;
                lResult = lResult + "Min. time " + lCounter.MinValue.ToString() + Environment.NewLine;
                FrequencyCounter lCounterMissing = lBoardMeetingList.MissingConstituencyAnnouncements();
                lResult = lResult + "No constituency: " + lCounterMissing.NumberOfValues.ToString() + Environment.NewLine + Environment.NewLine;

                var lSorted = new List <Int32>();
                foreach (Int32 lKey in lCounter.Data.Keys)
                {
                    lSorted.Add(lKey);
                }
                lSorted.Sort(delegate(Int32 p1, Int32 p2)
                {
                    return(p2.CompareTo(p1));
                });

                foreach (int lEntry in lSorted)
                {
                    String lLine = lEntry.ToString() + ": ";
                    foreach (int lGeocode in lCounter.Data[lEntry])
                    {
                        lLine = lLine + lGeocode.ToString() + ',';
                    }
                    lLine   = lLine.Remove(lLine.Length - 1);
                    lResult = lResult + lLine + Environment.NewLine;
                }

                var lForm = new StringDisplayForm("Board meeting to constituency", lResult);
                lForm.Show();
            }
        }