Exemple #1
0
        /// <summary>
        ///   does first example already exist in the list specified by listType.
        /// </summary>
        /// <param name="firstExample">first example to compare</param>
        /// <param name="listType">type of list</param>
        /// <returns>is cop flag</returns>
        public bool IsCopLocation(
            string location,
            IJnyId jnyId,
            LocalListType listType)
        {
            switch (listType)
            {
            case LocalListType.allPurpose:
                this.LoadAllPurposeList(jnyId.Date.Year.ToString());
                foreach (FirstExampleType example in m_listLocation)
                {
                    if (location == example.Item &&
                        jnyId.Date == example.Date &&
                        jnyId.JnyNumber == example.Index)
                    {
                        return(true);
                    }
                }

                return(false);

            case LocalListType.complete:
                foreach (FirstExampleType example in m_completeListLocation)
                {
                    if (location == example.Item &&
                        jnyId.Date == example.Date &&
                        jnyId.JnyNumber == example.Index)
                    {
                        return(true);
                    }
                }

                return(false);

            case LocalListType.annual:
                foreach (FirstExampleType example in m_annualListLocation)
                {
                    if (location == example.Item &&
                        jnyId.Date == example.Date &&
                        jnyId.JnyNumber == example.Index)
                    {
                        return(true);
                    }
                }

                return(false);

            default:
                return(false);
            }
        }
Exemple #2
0
        /// <summary>
        ///   does first example already exist in the list specified by
        ///   listType.
        /// </summary>
        /// <param name="firstExample">example to compare</param>
        /// <param name="listType">type of list</param>
        /// <returns>is cop flag</returns>
        public bool IsCopNumber(FirstExampleType firstExample,
                                LocalListType listType)
        {
            switch (listType)
            {
            case LocalListType.allPurpose:
                return(!m_listNumber.Any(localExample => localExample.Compare(firstExample)));

            case LocalListType.complete:
                return(!m_completeListNumber.Any(localExample => localExample.Compare(firstExample)));

            case LocalListType.annual:
                return(!m_annualListNumber.Any(localExample => localExample.Compare(firstExample)));

            default:
                return(false);
            }
        }
Exemple #3
0
        // ---------- ---------- ---------- ---------- ---------- ----------
        // The following methods are used to determine if the argument
        //   item already exists in the list defined by listType
        // ---------- ---------- ---------- ---------- ---------- ----------

        /// <summary>
        ///   does number already exist in the list specified by listType.
        /// </summary>
        /// <param name="number">number to compare</param>
        /// <param name="listType">type of list</param>
        /// <returns>success flag</returns>
        public bool IsCopNumber(string number,
                                LocalListType listType)
        {
            switch (listType)
            {
            case LocalListType.allPurpose:
                return(!CompareFirstExample(number, m_listNumber));

            case LocalListType.complete:
                return(!CompareFirstExample(number, m_completeListNumber));

            case LocalListType.annual:
                return(!CompareFirstExample(number, m_annualListNumber));

            default:
                return(true);
            }
        }
Exemple #4
0
        /// <summary>
        ///   does number already exist in the list specified by listType.
        /// </summary>
        /// <param name="location">location to compare</param>
        /// <param name="listType">type of list</param>
        /// <returns>is cop flag</returns>
        public bool IsCopLocation(
            string location,
            LocalListType listType)
        {
            switch (listType)
            {
            case LocalListType.allPurpose:
                return(!m_listLocation.Any(firstExample => firstExample.Item == location));

            case LocalListType.complete:
                return(!m_completeListLocation.Any(firstExample => firstExample.Item == location));

            case LocalListType.annual:
                return(!m_annualListLocation.Any(firstExample => firstExample.Item == location));

            default:
                return(true);
            }
        }
Exemple #5
0
        /// <summary>
        /// Appends first example to the relevant list and file. localList
        /// determines which list/file. If looking at a specific year, then
        /// this is defined by the year argument.
        /// </summary>
        /// <param name="firstExamples">first example to append</param>
        /// <param name="localList">type of list</param>
        /// <param name="year">current year</param>
        public void AppendNumber(FirstExampleType firstExamples,
                                 LocalListType localList,
                                 string year = "1970")
        {
            FirstExampleIOController firstExampleController;

            switch (localList)
            {
            case LocalListType.complete:
                m_completeListNumber.Add(firstExamples);
                firstExampleController = FirstExampleIOController.GetInstance();
                firstExampleController.AppendFileNumber(firstExamples);
                break;

            case LocalListType.annual:
                m_annualListNumber.Add(firstExamples);
                firstExampleController = FirstExampleIOController.GetInstance();
                firstExampleController.AppendFileNumber(firstExamples, year);
                break;
            }
        }