Esempio n. 1
0
        private void AddNode(OddsFilename ofn)
        {
            TreeNode parentNode = null;

            if (_trackTreeNode.ContainsKey(ofn.TrackCode))
            {
                parentNode = _trackTreeNode[ofn.TrackCode];
            }
            else
            {
                parentNode = _tree.Nodes.Add(RaceTracks.GetNameFromBrisAbrv(ofn.TrackCode));
                _trackTreeNode.Add(ofn.TrackCode, parentNode);

            }

            foreach (TreeNode n in parentNode.Nodes)
            {
                if (null != n.Tag &&  ((int)n.Tag) == ofn.Year)
                {
                    AddFilenameToTree(n, ofn);
                    return;
                }
            }

            TreeNode yearNode = parentNode.Nodes.Add(ofn.Year.ToString());
            yearNode.Tag = ofn.Year;
            AddAllMonthsToNode(yearNode);
            AddFilenameToTree(yearNode, ofn);
        }
Esempio n. 2
0
        void AddFilenameToTree(TreeNode parent, OddsFilename ofn)
        {
            var monthNode = GetNodeForTheMonth(parent, ofn);

            if(null == monthNode)
                return;

            TreeNode newNode = monthNode.Nodes.Add(Utilities.GetFullDateString(ofn.DateAsYYYYMMDD));
            newNode.Tag = ofn;
        }
Esempio n. 3
0
 private TreeNode GetNodeForTheMonth(TreeNode treeNode, OddsFilename ofn)
 {
     string month = ofn.MonthFullName;
     foreach (TreeNode n in treeNode.Nodes)
     {
         if(month == n.Text)
         {
             return n;
         }
     }
     return null;
 }
Esempio n. 4
0
 public void AddDate(OddsFilename fn)
 {
     int index = _listboxDate.Items.Add(fn);
 }
Esempio n. 5
0
        public void DisplayCards(DisplayType dt)
        {
            RemoveAllControls();

            try
            {
                _trackCodeList.Clear();
                List<string> filename = DailyCard.ExistingFilesOnlyForFuture;

                string txt = "";
                for (int i = filename.Count - 1; i >= 0; --i)
                {
                    string s = filename[i];

                    if(FileHasDateInThePast(s))
                        continue;

                    var ofn = new OddsFilename(s);

                    if (dt == DisplayType.All)
                    {
                        txt = "Displaying All Available Cards";
                        AddFilenameToCorrespondingControl(ofn);
                    }
                    else if (dt == DisplayType.Today && ofn.IsTodaysCard)
                    {
                        txt = "Displaying Only Today's Cards";
                        AddFilenameToCorrespondingControl(ofn);
                    }
                    else if (dt == DisplayType.Future && ofn.IsFutureCard)
                    {
                        txt = "Displaying Future's Cards";
                        AddFilenameToCorrespondingControl(ofn);
                    }
                }

                _labelDisplayType.Text = string.Format("{0}        (Total Number of Races: {1})       ", txt, _totalNumberOfRacesInTheDataBase);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
Esempio n. 6
0
 private void AddFilenameToCorrespondingControl(OddsFilename ofn)
 {
     if (_ctrls.ContainsKey(ofn.Track) == false)
     {
         var sfc = new SelectFileControl(ofn.Track, ofn.TrackCode);
         _panel.Controls.Add(sfc);
         _ctrls.Add(ofn.Track, sfc);
         sfc.FileSelectedEvent += OnFileSelected;
         _trackCodeList.Add(ofn.TrackCode);
     }
     _ctrls[ofn.Track].AddDate(ofn);
 }