public bool IsReaderInReaderGroup(Reader reader, ReaderGroup group)
 {
     var query = GenerateQuery(new Guid("{097E4D46-49DA-4BEC-B9ED-DE4684F3AC67}"), reader.ItemId, group.ItemId);
     var content = ExecScalar<int>(query);
     var result = content == 1;
     return result;
 }
 public IList<ReaderGroup> GetReaderGroupsOfReader(Reader reader)
 {
     //var query = GenerateQuery(new Guid("{3F966D32-FA71-4946-A4DC-645573E790CA}"), reader.ItemId); Benutzergruppen von Lesergruppen
     //var query = GenerateQuery(new Guid("{2D8D4867-03B3-4ADD-A0F7-6C362EF52E85}"), reader.ItemId); Möglichen Benutzergruppen von Lesergruppen
     var query = GenerateQuery(new Guid("{28833FB8-5C91-4AA6-95C8-DE075D63A01A}"), reader.ItemId);
     var result = GetManyItems<ReaderGroup>(query, ReadGroup<ReaderGroup>);
     return result;
 }
        public bool Edit(Guid readerid, Reader reader)
        {
            var newReader = dataAccess.GetReaderById(readerid);
            newReader.FriendlyName = string.IsNullOrWhiteSpace(reader.FriendlyName) ? newReader.FriendlyName : reader.FriendlyName.Trim();
            newReader.Parameter = reader.Parameter == null ? string.Empty : reader.Parameter.Trim();
            newReader.SerialNr = reader.SerialNr == null ? string.Empty : reader.SerialNr.Trim();

            return dataAccess.UpdateReader(newReader);
        }
 public bool LinkReaderToReaderType(Reader reader, ReaderType readerType)
 {
     var query = GenerateQuery(new Guid("{1EB20D7B-401A-4533-9CAD-54931EDFF3CF}"), reader.ItemId, readerType.ItemId);
     var result = ExecChangeLineQuery(query);
     return result;
 }
 public bool LinkReaderToReaderGroup(Reader reader, ReaderGroup readerGroup)
 {
     var query = GenerateQuery(new Guid("{DDA62089-BA76-4EDA-A415-90241BF061BA}"), reader.ItemId, readerGroup.ItemId);
     var result = ExecChangeLineQuery(query);
     return result;
 }
 public ReaderType GetReaderTypeOfReader(Reader reader)
 {
     var query = GenerateQuery(new Guid("{732E04B4-202E-4852-9CD3-6B226B4C1259}"), reader.ItemId);
     var result = GetSingleItem<ReaderType>(query, ReadReaderType);
     return result;
 }
 public IList<ReaderGroup> GetPossibleReaderGroupsOfReader(Reader reader)
 {
     var query = GenerateQuery(new Guid("{71E83841-15F0-4DC3-BC43-33A155BA4297}"), reader.ItemId);
     var result = GetManyItems<ReaderGroup>(query, ReadGroup<ReaderGroup>);
     return result;
 }
 public int GetCountReaderGroupsOfReader(Reader reader)
 {
     var query = GenerateQuery(new Guid("{53DE0796-5C1A-4B92-B44D-87B36939598E}"), reader.ItemId);
     var result = ExecScalar<int>(query);
     return result;
 }
 public bool UpdateReader(Reader reader)
 {
     var query = GenerateQuery(new Guid("{D10AD033-4355-487B-89E1-2B818E42EA29}"),
         reader.ItemId,
         reader.FriendlyName,
         reader.SerialNr,
         reader.Parameter);
     var result = ExecChangeLineQuery(query);
     return result;
 }
 public bool UnlinkReaderFromReaderType(Reader reader)
 {
     var query = GenerateQuery(new Guid("{212791B1-74E3-4711-A22D-4C619C334171}"), reader.ItemId);
     var result = ExecChangeLineQuery(query);
     return result;
 }
 public bool UnlinkReaderFromReaderGroup(Reader reader, ReaderGroup readerGroup)
 {
     var query = GenerateQuery(new Guid("{95DF6D6B-7A26-451E-A56A-113520112A25}"), reader.ItemId, readerGroup.ItemId);
     var result = ExecChangeLineQuery(query);
     return result;
 }
        public bool LinkReaderToReaderGroup(Reader reader, Guid readerGroupId)
        {
            var group = dataAccess.GetReaderGroupById(readerGroupId);
            if (group == null)
            {
                return false;
            }

            if (dataAccess.IsReaderInReaderGroup(reader, group))
            {
                // If the reader is already in reader group cancel it
                return false;
            }

            return dataAccess.LinkReaderToReaderGroup(reader, group);
        }
 public bool UnlinkReaderFromReaderType(Reader reader)
 {
     return dataAccess.UnlinkReaderFromReaderType(reader);
 }
        public bool UnlinkReaderFromReaderGroup(Reader reader, Guid readerGroupId)
        {
            var group = dataAccess.GetReaderGroupById(readerGroupId);
            if (group == null)
            {
                return false;
            }

            return dataAccess.UnlinkReaderFromReaderGroup(reader, group);
        }
        public bool LinkReaderToReaderType(Reader reader, Guid readerTypeId)
        {
            var readerType = dataAccess.GetReaderTypeById(readerTypeId);
            if (readerType == null)
            {
                return false;
            }

            return dataAccess.LinkReaderToReaderType(reader, readerType);
        }