Exemplo n.º 1
0
        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);
            }
        }
Exemplo n.º 2
0
        /// <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);
            }
        }
Exemplo n.º 3
0
        public List <CompartSearchViewModel> GetComponentsByCompartType(CompartTypeEnum compartType)
        {
            var comparts = _context.LU_COMPART.Where(c => c.comparttype_auto == (int)compartType).ToList();

            return(ConvertToCompartViewModels(comparts));
        }
Exemplo n.º 4
0
 public static bool IsMainComponentType(this CompartTypeEnum value)
 {
     return(((int)value).IsMainComponentType());
 }