public List <DesinatorTypeValuePair> Translate_Servicelocationdesignator_Array_To_StronglyTyped_List(Primaryservicelocationdesignator objPrimaryServiceLocationDesignators, string strMasterServiceLocationID) { // Instantiate the return list List <DesinatorTypeValuePair> lstDesignatorTypeValuePairs = new List <DesinatorTypeValuePair>(); try { if (objPrimaryServiceLocationDesignators != null) { // Set the designator type for the FIRST, SECOND, and THIRD Designators // First DesignatorType enmDesignatorType_First = Translate_DesignatorTypeIDString_To_Enum(objPrimaryServiceLocationDesignators?.FirstDesignatorTypeId?.Trim().ToUpper()); string strDesignatorValue_First = objPrimaryServiceLocationDesignators?.FirstDesignatorValue?.Trim(); if (IsPertinantDesignatorType(enmDesignatorType_First)) { lstDesignatorTypeValuePairs.Add(new DesinatorTypeValuePair { DesignatorType = enmDesignatorType_First, DesignatorValue = strDesignatorValue_First, SLNumber = strMasterServiceLocationID?.Trim().ToUpper() }); } // Second DesignatorType enmDesignatorType_Second = Translate_DesignatorTypeIDString_To_Enum(objPrimaryServiceLocationDesignators?.SecondDesignatorTypeId?.Trim().ToUpper()); string strDesignatorValue_Second = objPrimaryServiceLocationDesignators?.SecondDesignatorValue?.Trim(); if (IsPertinantDesignatorType(enmDesignatorType_Second)) { lstDesignatorTypeValuePairs.Add(new DesinatorTypeValuePair { DesignatorType = enmDesignatorType_Second, DesignatorValue = strDesignatorValue_Second, SLNumber = strMasterServiceLocationID?.Trim().ToUpper() }); } // Third DesignatorType enmDesignatorType_Third = Translate_DesignatorTypeIDString_To_Enum(objPrimaryServiceLocationDesignators?.ThirdDesignatorTypeId?.Trim().ToUpper()); string strDesignatorValue_Third = objPrimaryServiceLocationDesignators?.ThirdDesignatorValue?.Trim(); if (IsPertinantDesignatorType(enmDesignatorType_Third)) { lstDesignatorTypeValuePairs.Add(new DesinatorTypeValuePair { DesignatorType = enmDesignatorType_Third, DesignatorValue = strDesignatorValue_Third, SLNumber = strMasterServiceLocationID?.Trim().ToUpper() }); } } } catch (Exception ex) { string strError = ex.Message; throw; } return(lstDesignatorTypeValuePairs); }
public bool IsPertinantDesignatorType(DesignatorType enmDesignatorType) { switch (enmDesignatorType) { case DesignatorType.Suite: return(true); case DesignatorType.Floor: return(true); case DesignatorType.Room: return(true); case DesignatorType.Other: return(false); case DesignatorType.Blank: return(false); default: return(false); } }