/// <summary>
 /// Constructor
 /// </summary>
 /// <param name="cacheDatas">array of cache data from sECURE</param>
 public CacheViewerForm(params object[] cacheDatas) : this()
 {
     this._DataCache = new Hashtable(new Dictionary <Type, object[]>());
     foreach (object cacheData in cacheDatas)
     {
         if (cacheData != null)
         {
             Type cacheDataType = cacheData.GetType();
             if (cacheDataType == typeof(IndexOptionDetail))
             {
                 IndexOptionDetail indexOptionDetail = (IndexOptionDetail)cacheData;
                 this._DataTypeList.Add(typeof(IndexOptionDetail));
                 this._DataCache.Add(typeof(IndexOptionDetail), new IndexOptionDetail[] { indexOptionDetail });
             }
             else if (cacheDataType == typeof(IndexOptionDetail[]))
             {
                 IndexOptionDetail[] indexOptionDetail = (IndexOptionDetail[])cacheData;
                 this._DataTypeList.Add(typeof(IndexOptionDetail));
                 this._DataCache.Add(typeof(IndexOptionDetail), indexOptionDetail);
             }
             else if (cacheDataType == typeof(CountiesInfo))
             {
                 CountiesInfo countiesInfo = (CountiesInfo)cacheData;
                 this._DataTypeList.Add(typeof(CountyInfo));
                 this._DataCache.Add(typeof(CountyInfo), countiesInfo.County);
             }
             else if (cacheDataType == typeof(CitiesDetail))
             {
                 CitiesDetail citiesDetail = (CitiesDetail)cacheData;
                 this._DataTypeList.Add(typeof(CityDetail));
                 this._DataCache.Add(typeof(CityDetail), citiesDetail.City);
             }
             else if (cacheDataType == typeof(ProcessQueuesDetail))
             {
                 ProcessQueuesDetail processQueueDetail = (ProcessQueuesDetail)cacheData;
                 this._DataTypeList.Add(typeof(ProcessQueueDetail));
                 this._DataCache.Add(typeof(ProcessQueueDetail), processQueueDetail.ProcessQueue);
             }
             else if (cacheDataType == typeof(TitlesDetail))
             {
                 TitlesDetail titleDetail = (TitlesDetail)cacheData;
                 this._DataTypeList.Add(typeof(TitleDetail));
                 this._DataCache.Add(typeof(TitleDetail), titleDetail.Title);
             }
             else if (cacheDataType == typeof(RequestingPartiesInfo))
             {
                 RequestingPartiesInfo requestingParty = (RequestingPartiesInfo)cacheData;
                 this._DataTypeList.Add(typeof(RequestingPartyInfo));
                 this._DataCache.Add(typeof(RequestingPartyInfo), requestingParty.RequestingParty);
             }
             else if (cacheDataType == typeof(SubmittingPartiesInfo))
             {
                 SubmittingPartiesInfo submittingPartiesInfo = (SubmittingPartiesInfo)cacheData;
                 this._DataTypeList.Add(typeof(SubmittingPartyInfo));
                 this._DataCache.Add(typeof(SubmittingPartyInfo), submittingPartiesInfo.SubmittingParty);
             }
         }
     }
     this.PopulateDataType();
 }
 /// <summary>
 /// Event method for when the selection within a listbox changes
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void lstDataIndex_SelectedIndexChanged(object sender, EventArgs e)
 {
     if (this.lstDataIndex.SelectedItem != null)
     {
         string title      = this.lstDataIndex.SelectedItem.ToString();
         object cachedData = this._currentData[title];
         this.flpDataContents.Visible = false;
         this.flpDataContents.Controls.Clear();
         Type selectedType = cachedData.GetType();
         if (selectedType == typeof(IndexOptionDetail))
         {
             IndexOptionDetail indexOptionDetail = ((IndexOptionDetail)cachedData);
             this.flpDataContents.Controls.AddRange(new Control[]
             {
                 new IndexOptionDetailControl()
                 {
                     IndexOptionDetail = indexOptionDetail
                 }
             });
         }
         else if (selectedType == typeof(CountyInfo))
         {
             CountyInfo countyInfo = ((CountyInfo)cachedData);
             this.flpDataContents.Controls.AddRange(new Control[]
             {
                 new CountyInfoControl()
                 {
                     CountyInfo = countyInfo
                 },
                 new PictureBox()
                 {
                     Image    = this.GetImageFromCounty(countyInfo),
                     SizeMode = PictureBoxSizeMode.AutoSize
                 }
             });
         }
         else if (selectedType == typeof(CityDetail))
         {
             CityDetail cityDetail = ((CityDetail)cachedData);
             this.flpDataContents.Controls.AddRange(new Control[]
             {
                 new CityDetailControl()
                 {
                     CityDetail = cityDetail
                 }
             });
         }
         else if (selectedType == typeof(ProcessQueueDetail))
         {
             ProcessQueueDetail pqDetail = ((ProcessQueueDetail)cachedData);
             this.flpDataContents.Controls.AddRange(new Control[]
             {
                 new ProcessQueueDetailControl()
                 {
                     ProcessQueueDetail = pqDetail
                 }
             });
         }
         else if (selectedType == typeof(TitleDetail))
         {
             TitleDetail titleDetail = ((TitleDetail)cachedData);
             this.flpDataContents.Controls.AddRange(new Control[]
             {
                 new TitleDetailControl()
                 {
                     TitleDetail = titleDetail
                 }
             });
         }
         else if (selectedType == typeof(RequestingPartyInfo))
         {
             RequestingPartyInfo rpInfo = ((RequestingPartyInfo)cachedData);
             this.flpDataContents.Controls.AddRange(new Control[]
             {
                 new RequestingPartyInfoControl()
                 {
                     RequestingPartyInfo = rpInfo
                 }
             });
         }
         else if (selectedType == typeof(SubmittingPartyInfo))
         {
             SubmittingPartyInfo spInfo = ((SubmittingPartyInfo)cachedData);
             this.flpDataContents.Controls.AddRange(new Control[]
             {
                 new SubmittingPartyInfoControl()
                 {
                     SubmittingPartyInfo = spInfo
                 }
             });
         }
         foreach (Control control in this.flpDataContents.Controls)
         {
             control.Width = this.flpDataContents.Width - 10;
             this.RecursiveReadOnlySet(control);
         }
         this.flpDataContents.Visible = true;
     }
 }
        /// <summary>
        /// Perform validation on batch detail
        /// </summary>
        /// <param name="batchDetail">BatchDetail object, containing information on Batch and Documents</param>
        /// <param name="indexOptionDetail">IndexOptionDetail object, containing the validation rules for the accompanying BatchDetail</param>
        /// <returns>List containing validation error messages. Returns empty list if BatchDetail passed validation</returns>
        public static List <string> ValidateSECURE(BatchDetail batchDetail, IndexOptionDetail indexOptionDetail)
        {
            List <string> ValidationMessages = new List <string>();

            // Validate BatchDetail
            if (indexOptionDetail.RequireRequestingParty && batchDetail.RequestingParty == null)
            {
                ValidationMessages.Add(string.Format("Batch [{0}]: RequestingParty is required.", batchDetail._ID));
            }
            if (indexOptionDetail.RequireConcurrentIndex && !batchDetail.IsConcurrent)
            {
                ValidationMessages.Add(string.Format("Batch [{0}]: IsConcurrnent is required.", batchDetail._ID));
            }

            foreach (DocumentInfo documentInfo in batchDetail.Documents)
            {
                // Validate DocumentInfo
                if (indexOptionDetail.RequireTitleIndex)
                {
                    if (documentInfo.Titles == null)
                    {
                        ValidationMessages.Add(string.Format("Document [{0}]: Titles are required.", documentInfo._ID));
                    }
                    else if (documentInfo.Titles.Length == 0)
                    {
                        ValidationMessages.Add(string.Format("Document [{0}]: Titles are required.", documentInfo._ID));
                    }
                }
                if (indexOptionDetail.RequireNamesIndex)
                {
                    if (documentInfo.Names == null)
                    {
                        ValidationMessages.Add(string.Format("Document [{0}]: Names are required.", documentInfo._ID));
                    }
                    else if (documentInfo.Names.Length == 0)
                    {
                        ValidationMessages.Add(string.Format("Document [{0}]: Names are required.", documentInfo._ID));
                    }
                }
                if (indexOptionDetail.RequireAPNIndex && (documentInfo.AssessorParcelNumber == null || documentInfo.AssessorParcelNumber == string.Empty))
                {
                    ValidationMessages.Add(string.Format("Document [{0}]: Assessor Parcel Number is required.", documentInfo._ID));
                }
                if (indexOptionDetail.RequireTransferTaxIndex && !documentInfo.TransferTaxAmountSpecified)
                {
                    ValidationMessages.Add(string.Format("Document [{0}]: Transfer Tax is required.", documentInfo._ID));
                }
                if (indexOptionDetail.RequireAmountSaleIndex && !documentInfo.SaleAmountSpecified)
                {
                    ValidationMessages.Add(string.Format("Document [{0}]: Sale Amount is required.", documentInfo._ID));
                }
                if (indexOptionDetail.RequireCityIndex)
                {
                    if (documentInfo.Cities == null)
                    {
                        ValidationMessages.Add(string.Format("Document [{0}]: Cities are required.", documentInfo._ID));
                    }
                    else if (documentInfo.Cities.Length == 0)
                    {
                        ValidationMessages.Add(string.Format("Document [{0}]: Cities are required.", documentInfo._ID));
                    }
                }
            }
            return(ValidationMessages);
        }