コード例 #1
0
 public static void Merge(this T_E_Lock iEntity, Lock iObj)
 {
     iEntity.DossierId   = iObj.DossierId;
     iEntity.LockDate    = iObj.LockDate;
     iEntity.LockId      = iObj.LockId;
     iEntity.SessionGUID = iObj.SessionGUID;
     iEntity.UserId      = iObj.UserId;
 }
コード例 #2
0
        public static Lock Convert(this T_E_Lock iEntity)
        {
            if (iEntity == null)
            {
                return(null);
            }

            return(new Lock
            {
                DossierId = iEntity.DossierId,
                LockDate = iEntity.LockDate,
                LockId = iEntity.LockId,
                SessionGUID = iEntity.SessionGUID,
                UserId = iEntity.UserId,
            });
        }
コード例 #3
0
        public long NewLock(EquinoxeExtend.Shared.Object.Record.Lock iNewLock)
        {
            if (iNewLock.DossierId < 1)
            {
                throw new Exception("L'id du dossier est invalide");
            }

            if (iNewLock.LockDate == null)
            {
                throw new Exception("La date du lock n'est pas valide");
            }

            if (iNewLock.LockId != -1)
            {
                throw new Exception("L'id du lock est invalide");
            }

            if (iNewLock.SessionGUID == null)
            {
                throw new Exception("Le GUID de session est invalide");
            }

            if (iNewLock.UserId == null)
            {
                throw new Exception("L'id du user est invalide");
            }

            if (DBRecordDataService.Any <T_E_Lock>(x => x.DossierId == iNewLock.DossierId))
            {
                throw new Exception("Un lock est déjà posé sur le dossier '{0}'".FormatString(iNewLock.DossierId.ToString()));
            }

            //Création de l'enregistrement
            var newEntity = new T_E_Lock();

            newEntity.Merge(iNewLock);

            return(DBRecordDataService.Add <T_E_Lock>(newEntity).LockId);
        }