public static bool IsMainComponentType(this int value) { CompartTypeEnum compartType = CompartTypeEnum.Unknown; try { compartType = (CompartTypeEnum)value; } catch { return(false); } if (compartType == CompartTypeEnum.Unknown) { return(false); } switch (compartType) { case CompartTypeEnum.Link: case CompartTypeEnum.Idler: return(true); default: return(false); } }
/// <summary> /// Checks if the system serial number (chain or frame) should be displayed next to the component. /// This is used on the old undercarriage interpretation and inspection details pages. /// </summary> /// <param name="componentType">CompartType_Auto - ID of component type Link, Bushing, Shoe, etc.</param> /// <param name="position">Position the component is in. (we only want to show the serial if it is in the first position)</param> /// <returns>True if serial number should be displayed. </returns> public static bool ShouldDisplaySystemSerialNextToComponentType(this int componentType, int position) { if (position > 1) { return(false); } CompartTypeEnum compartType = CompartTypeEnum.Unknown; try { compartType = (CompartTypeEnum)componentType; } catch { return(false); } if (compartType == CompartTypeEnum.Unknown) { return(false); } switch (compartType) { case CompartTypeEnum.Link: case CompartTypeEnum.Idler: return(true); default: return(false); } }
public List <CompartSearchViewModel> GetComponentsByCompartType(CompartTypeEnum compartType) { var comparts = _context.LU_COMPART.Where(c => c.comparttype_auto == (int)compartType).ToList(); return(ConvertToCompartViewModels(comparts)); }
public static bool IsMainComponentType(this CompartTypeEnum value) { return(((int)value).IsMainComponentType()); }