Exemple #1
0
        public bool HasRight(BaseQrDoc doc)
        {
            Role role = new Role();
            try
            {
                role = Entities.Roles.FirstOrDefault(rol => rol.DocType.id == doc.docType && rol.statusId == doc.ActionId);
                if (role == null)
                    return false;

                var right = Entities.Rights.FirstOrDefault(righ => righ.Role.id == role.id && righ.userId == doc.ActionUser.id);
                if (right == null)
                    return false;
                else
                {
                    return true;
                }

            }
            catch (Exception)
            {

                throw;
            }

            return false;
        }
Exemple #2
0
        public void CreateTrack(BaseQrDoc doc)
        {
            int docId = GetDocumentId(doc);
            Track track = new Track();
            track.docId = docId;

            track.statDate = DateTime.Now;
            track.userId = doc.ActionUser.id;
            track.statId = doc.ActionId;
            Entities.Tracks.AddObject(track);
            Save();
            //AddActionToBuffer(track);
        }
Exemple #3
0
        public bool HasChance(BaseQrDoc doc)
        {
            Role role = new Role();
            try
            {
                role = Entities.Roles.FirstOrDefault(rol => rol.DocType.id == doc.docType && rol.statusId == doc.ActionId);
                if (role != null)
                    return true;
            }
            catch (Exception exc)
            {

            }
            return false;
        }
Exemple #4
0
        public int AddDocument(BaseQrDoc doc)
        {
            Document docu = new Document();
            docu.hash = doc.Hash;
            docu.typeId = doc.docType;
            docu.docNum = doc.docNum;
            Entities.Documents.AddObject(docu);
            Save();
            Track track = new Track();
            track.statId = 1;
            track.docId = docu.id;
            track.userId = doc.userId;
            track.statDate = doc.creationDate;
            Entities.Tracks.AddObject(track);
            Save();
            //AddActionToBuffer(track);

            return docu.id;
        }
Exemple #5
0
 public bool DocExist(BaseQrDoc doc)
 {
     var eDoc = Entities.Documents.FirstOrDefault(docu => docu.hash == doc.Hash);
     if (eDoc == null)
         return false;
     else
         return true;
 }
Exemple #6
0
 public void Create(BaseQrDoc doc)
 {
 }
Exemple #7
0
 public bool RecordExist(BaseQrDoc doc)
 {
     return true;
 }
Exemple #8
0
        /// <summary>
        /// Получает массив qrExtenden
        /// </summary>
        /// <param name="doc"></param>
        /// <returns></returns>
        public List<TrackExtend> GetTracksByQrDoc(BaseQrDoc doc)
        {
            Document document = Entities.Documents.FirstOrDefault(docu => docu.hash == doc.Hash);
            if (document == null)
            {
               int id = AddDocument(doc);
               document = Entities.Documents.FirstOrDefault(docu => docu.id == id);
            }

            bool isManager = new UserService().IsManager(doc.ActionUser.id);
            var tracks = Entities.Tracks.Where(tr => tr.docId == document.id).Select(trac => new TrackExtend() {Track = trac,AllowAction = (doc.ActionUser.id == trac.userId) || isManager }).ToList();
            return tracks;
        }
Exemple #9
0
        public TrackModel GetTracks(BaseQrDoc doc)
        {
            TrackModel tracks = new TrackModel();
            tracks.qrDoc = doc;
            int docId = GetDocumentId(doc);
            bool isManager = new UserService().IsManager(doc.ActionUser.id);
            tracks.Tracks = Entities.Tracks.Where(tr => tr.docId == docId).OrderBy(doct => doct.statDate).Select(tra => new TrackExtend { Track = tra, AllowAction = (doc.ActionUser.id == tra.userId) || isManager }).ToList();

            return tracks;
        }
Exemple #10
0
 public int GetDocumentId(BaseQrDoc doc)
 {
     var eDoc = Entities.Documents.FirstOrDefault(docu => docu.hash == doc.Hash);
     if (eDoc != null)
         return eDoc.id;
     else
     {
         return AddDocument(doc);
     }
     return 0;
 }
Exemple #11
0
        public bool ExistTrack(BaseQrDoc doc)
        {
            var document = Entities.Documents.FirstOrDefault(docu => docu.hash == doc.Hash);
            var track =
                Entities.Tracks.FirstOrDefault(
                    trac => (trac.docId == document.id) && (trac.Status.id == doc.ActionId)&&(trac.deleted==null));
            if (track!=null)

                return true;
            else
            {
                return false;
            }
        }
Exemple #12
0
 public bool AllowedAction(BaseQrDoc doc)
 {
     return false;
 }