public IList <TagDTO> Get_Tags_By_Element_Tag_Type(string element_tag_type) { TagType tag_type; if (Enum.TryParse(element_tag_type, out tag_type)) { switch (tag_type) { case TagType.site: return(TagDTO.ConvertTableToDTO(_dbcontext.tblTags.Where(tag => tag.Is_Disabled == false && tag.Tag_Type != TagType.equip.ToString() && tag.Tag_Type != TagType.point.ToString()))); case TagType.equip: return(TagDTO.ConvertTableToDTO(_dbcontext.tblTags.Where(tag => tag.Is_Disabled == false && tag.Tag_Type != TagType.site.ToString() && tag.Tag_Type != TagType.point.ToString()))); case TagType.point: return(TagDTO.ConvertTableToDTO(_dbcontext.tblTags.Where(tag => tag.Is_Disabled == false && tag.Tag_Type != TagType.site.ToString() && tag.Tag_Type != TagType.equip.ToString()))); default: return(null); } } else { return(null); } }
/// <summary> /// The same function is also in the tag respository, but we can not call it, becuase can not initialze another dbcontext inside the dbcontext. /// </summary> /// <param name="tags"></param> /// <returns></returns> private IList <TagDTO> SelectAll_Tag_By_TagIDs(IList <Tag> tags) { IEnumerable <long> tagIDs = tags.Select(n => n.TagID); List <tblTag> result = _dbcontext.tblTags.Where(c => tagIDs.Contains(c.ID)).ToList(); return(TagDTO.ConvertTableToDTO(result)); }
public IList <TagDTO> SelectAll() { try { return(TagDTO.ConvertTableToDTO(_dbcontext.tblTags)); } catch (Exception ex) { throw ex; } }
/// <summary> /// its mean return all the tags where container id is not null /// </summary> /// <param name=""></param> /// <returns></returns> public IList <TagDTO> SelectAll_By_User_Define_Tags() { return(TagDTO.ConvertTableToDTO(_dbcontext.tblTags.Where(tags => tags.Container_ID != null))); }
public TagDTO SelectByID(long Id) { return(TagDTO.ConvertTableToDTO(_dbcontext.tblTags.Find(Id))); }
public IList <TagDTO> SelectAllBy_IsDisable(bool isdisable) { return(TagDTO.ConvertTableToDTO(_dbcontext.tblTags.Where(tag => tag.Is_Disabled == isdisable && tag.Tag_Value != null))); }
/// <summary> /// Return all the tag filerter by container id, /// container_id can be null, when container_id null its mean return all the where container_id == null /// </summary> /// <param name="container_id"></param> /// <returns></returns> public IList <TagDTO> SelectAll_By_Container_Id(int?container_id) { return(TagDTO.ConvertTableToDTO(_dbcontext.tblTags.Where(tags => tags.Container_ID == container_id))); }