Example #1
0
 public static LivePoint_DTO Convert_Tbl_Element_To_LivePoint_DTO(tblElement element) => new LivePoint_DTO()
 {
     Point_Id             = element.ID,
     Element_Parent_Child = Element_Hierarchy_Convert.Get_Element_Hierarchy(element),
     Point_Type           = (TagType)Enums.TryParse(typeof(TagType), element.Element_Tag_Type),
     Unit = Unit_Of_Measurement_DTO.Convert_Table_To_DTO(element.tblUnit),
     // Parent_Name = element.tblElement2?.Element_Name, //tblElement2 for parent
     HasChildren = element.tblElement1.Any(), //tblElement1 for children
     Address     = element.tblElement_Extension.FirstOrDefault() != null?ElementExtension_Conversion.Convert_Tbl_Element_To_ElementExtension_DTO(element.tblElement_Extension.FirstOrDefault()).Complete_Address : "",
     IsRead_Only = element.IsRead_Only
 };
Example #2
0
        //public static LivePoint_DTO Convert_Tbl_Element_To_LivePoint_DTO(Tbl_Element_Note_DTO element) => new LivePoint_DTO()
        //{
        //    Point_Id = element.tbl_Element.ID,
        //    Point_Name = element.tbl_Element.Element_Name,
        //    Point_Type = (TagType)Enums.TryParse(typeof(TagType), element.tbl_Element.Element_Tag_Type),
        //    Parent_Name = element.tbl_Element.tblElement2?.Element_Name, //tblElement2 for parent
        //    HasChildren = element.tbl_Element.tblElement1.Any(), //tblElement1 for children
        //    Address = element.tbl_Element.tblElement_Extension.FirstOrDefault() != null ? ElementExtension_Conversion.Convert_Tbl_Element_To_ElementExtension_DTO(element.tbl_Element.tblElement_Extension.FirstOrDefault()).Complete_Address : "",

        //};

        public static LivePoint_DTO Convert_Tbl_Element_To_LivePoint_DTO(Tbl_Element_Note_DTO element)
        {
            LivePoint_DTO livepoint_dto = new LivePoint_DTO();

            livepoint_dto.Point_Id             = element.tbl_Element.ID;
            livepoint_dto.Element_Parent_Child = Element_Hierarchy_Convert.Get_Element_Hierarchy(element.tbl_Element);
            livepoint_dto.Point_Type           = (TagType)Enums.TryParse(typeof(TagType), element.tbl_Element.Element_Tag_Type);
            livepoint_dto.Unit = Unit_Of_Measurement_DTO.Convert_Table_To_DTO(element.tbl_Element.tblUnit);
            // livepoint_dto.Parent_Name = element.tbl_Element.tblElement2?.Element_Name; //tblElement2 for parent
            livepoint_dto.HasChildren = element.tbl_Element.tblElement1.Any(); //tblElement1 for children
            livepoint_dto.Address     = element.tbl_Element.tblElement_Extension.FirstOrDefault() != null?ElementExtension_Conversion.Convert_Tbl_Element_To_ElementExtension_DTO(element.tbl_Element.tblElement_Extension.FirstOrDefault()).Complete_Address : "";

            livepoint_dto.Last_Comment.Comment      = element.tbl_Single_Last_Note == null ? "No Comments" : element.tbl_Single_Last_Note?.Comments;
            livepoint_dto.Last_Comment.Last_Updated = element.tbl_Single_Last_Note?.Last_Updated;
            livepoint_dto.IsRead_Only = element.tbl_Element.IsRead_Only;
            return(livepoint_dto);
        }