コード例 #1
0
ファイル: Validation.cs プロジェクト: jakedw7/iAM
        /// <summary>
        /// Load PCI Methods for validation
        /// </summary>
        public static void LoadAttributesPCI()
        {
            m_hashMethodDistress = GetPCIDistresses();
            m_listPCIMethods     = new List <PCIMethodObject>();

            List <String> listSeverity = new List <String>();

            listSeverity.Add("L");
            listSeverity.Add("M");
            listSeverity.Add("H");
            listSeverity.Add("-");

            List <String> listNone = new List <String>();

            foreach (String key in m_hashMethodDistress.Keys)
            {
                PCIMethodObject method       = new PCIMethodObject(key);
                Hashtable       hashDistress = (Hashtable)m_hashMethodDistress[key];
                foreach (String keyDistress in hashDistress.Keys)
                {
                    method.AddDistress(new PCIDistressObject(keyDistress, int.Parse(hashDistress[keyDistress].ToString()), listSeverity));
                }
                m_listPCIMethods.Add(method);
            }
            m_listPCISurveyTypes = new List <String>();
            m_listPCISurveyTypes.Add("Random");
            m_listPCISurveyTypes.Add("Additional");
            m_listPCISurveyTypes.Add("Ignore");
        }
コード例 #2
0
ファイル: Validation.cs プロジェクト: jakedw7/iAM
        /// <summary>
        /// Checks row entry from PCI Bulkload for valid Section PCI distress entry.
        /// </summary>
        /// <param name="pci"></param>
        /// <param name="strError"></param>
        /// <returns></returns>
        public static bool ValidatePCIDetail(SRSObjectPCI pci, out String strError)
        {
            if (m_listPCIMethods == null)
            {
                LoadAttributesPCI();
            }

            strError = "";
            //Check to make sure area is greater than 0
            if (pci.Area <= 0)
            {
                strError = "Error: PCI area must be greater than 0";
                return(false);
            }

            //Make sure method is included in Roadcare
            PCIMethodObject pciMethod = m_listPCIMethods.Find(delegate(PCIMethodObject method) { return(method.Method == pci.Method); });

            if (pciMethod == null)
            {
                strError = "Error: PCI Method: " + pci.Method + " not defined in RoadCare.";
                return(false);
            }

            //Make sure the type of survey is included
            if (!m_listPCISurveyTypes.Contains(pci.Type))
            {
                strError = "Error: Survey type: " + pci.Type.ToString() + " is not recognized. Random, Additional and Ignore allowed.";
                return(false);
            }
            if (pci.Distress != "No Distress")
            {
                //Make sure distress is entered
                if (!pciMethod.CheckDistress(pci.Distress, pci.Severity, out strError))
                {
                    return(false);
                }
            }

            //Make sure distress amount is greater than 0;
            if (pci.Amount <= 0 && pci.Distress != "No Distress")
            {
                strError = "Error: Distress amount must be greater than 0.";
                return(false);
            }

            if (pci.Amount > pci.Area)
            {
                strError = "Error:Distress amount must be less than or equal to Survey area.";
                return(false);
            }

            return(true);
        }