Beispiel #1
0
        public List <TestPointImageEntity> GetTestPointImages(string equipmentList)
        {
            List <TestPointImageEntity> resultList = new List <TestPointImageEntity>();
            var equipmentArray = equipmentList.Split(',');
            List <DAL.COMPART_TOOL_IMAGE> resultListRaw = new List <DAL.COMPART_TOOL_IMAGE>();

            foreach (var s in equipmentArray)
            {
                int equipmentId = 0;
                Int32.TryParse(s, out equipmentId);
                if (equipmentId == 0)
                {
                    continue;
                }
                BLL.Core.Domain.Equipment LogicalEquipment = new BLL.Core.Domain.Equipment(new DAL.UndercarriageContext(), equipmentId);
                var k = LogicalEquipment.GetEquipmentCompartToolImageList();
                resultListRaw.AddRange(k);
            }
            resultListRaw = resultListRaw.GroupBy(m => m.Id).Select(m => m.First()).ToList();
            foreach (var img in resultListRaw)
            {
                TestPointImageEntity ent = new TestPointImageEntity();
                ent.CompartType    = img.CompartId;
                ent.TestPointImage = img.ImageData;
                ent.Tool           = img.Tool.tool_code;
                resultList.Add(ent);
            }
            return(resultList);
        }
Beispiel #2
0
        /// <summary>
        /// Get all Test Point Images. This is used in the Equipment Search screen for the Mobile App.
        /// </summary>
        /// <returns>List of TestPointImageEntity</returns>
        public List <TestPointImageEntity> GetTestPointImages()
        {
            var result = new List <TestPointImageEntity>();

            using (var dataEntities = new InfoTrakDataEntities())
            {
                var testPointImages = from images in dataEntities.COMPART_ATTACH_FILESTREAM
                                      join testPointType in dataEntities.COMPART_ATTACH_TYPE on images.compart_attach_type_auto equals testPointType.compart_attach_type_auto
                                      where testPointType.compart_attach_type_name == "compart_testing_point_image"
                                      select
                                      new
                {
                    images.comparttype_auto,
                    images.tool_auto,
                    images.attachment
                };


                foreach (var testPointImage in testPointImages)
                {
                    var newTpi = new TestPointImageEntity
                    {
                        CompartType    = (long)testPointImage.comparttype_auto,
                        Tool           = GetToolCode(testPointImage.tool_auto),
                        TestPointImage = testPointImage.attachment
                                         //TestPointImage = null
                    };

                    result.Add(newTpi);
                }
            }
            return(result);
        }