コード例 #1
0
ファイル: PiimaToostusService.svc.cs プロジェクト: ekople/VR2
        public StandardResponse RemoveOsakond(string sessionHandle, int osakond)
        {
            _connContext = _connContext.CheckDBConn();
            var resp = new StandardResponse();
            resp.AuthResponse = validateAuth(sessionHandle);
            if (resp.AuthResponse.IsAuthenticated == false)
            {
                resp.Successful = false;
                resp.Exception = new AuthenticationException(authFailedMsg);
                return resp;
            }

            try
            {
                if (osakond == 0)
                {
                    throw new Exception("Osakonna eemaldamiseks peab osakonna ID olema sisestatud!");
                }
                var osakondToDel =
                    _connContext._OsakondDAO.Load(osakond, typeof (PtService.NhibernateImpl.DAOs.Impl.Osakond))
                    as PtService.NhibernateImpl.DAOs.Impl.Osakond;
                _connContext._OsakondDAO.Delete(osakondToDel);
                resp.Successful = true;
            }
            catch (Exception e)
            {
                resp = new StandardResponse();
                resp.Successful = false;
                resp.Exception = e;
            }

            return resp;
        }
コード例 #2
0
ファイル: PiimaToostusService.svc.cs プロジェクト: ekople/VR2
        public StandardResponse RemoveAtribuutika(string sessionHandle, int atribuutikaId)
        {
            _connContext = _connContext.CheckDBConn();
            var resp = new StandardResponse();
            resp.AuthResponse = validateAuth(sessionHandle);
            if (resp.AuthResponse.IsAuthenticated == false)
            {
                resp.Successful = false;
                resp.Exception = new AuthenticationException(authFailedMsg);
                return resp;
            }

            try
            {
                if (atribuutikaId == 0)
                {
                    throw new Exception("Atribuutika eemaldamiseks peab atribuutika ID olema sisestatud!");
                }
                var AtribuutikaToDel =
                    _connContext._AtribuutikaDao.Load(atribuutikaId,
                                                      typeof (PtService.NhibernateImpl.DAOs.Impl.Atribuutika))
                    as PtService.NhibernateImpl.DAOs.Impl.Atribuutika;
                _connContext._AtribuutikaDao.Delete(AtribuutikaToDel);
                resp.Successful = true;
            }
            catch (Exception e)
            {
                resp = new StandardResponse();
                resp.Successful = false;
                resp.Exception = e;
            }

            return resp;
        }
コード例 #3
0
ファイル: PiimaToostusService.svc.cs プロジェクト: ekople/VR2
        public StandardResponse RemoveIsikGraafik(string sessionHandle, int isikGraafikId)
        {
            _connContext = _connContext.CheckDBConn();
            var resp = new StandardResponse();
            resp.AuthResponse = validateAuth(sessionHandle);
            if (resp.AuthResponse.IsAuthenticated == false)
            {
                resp.Successful = false;
                resp.Exception = new AuthenticationException(authFailedMsg);
                return resp;
            }

            try
            {
                if (isikGraafikId == 0)
                {
                    throw new Exception("Isiku graafiku eemaldamiseks peab isiku graafiku ID olema sisestatud!");
                }
                var isikGraafikToDel =
                    _connContext._IsikGraafikDAO.Load(isikGraafikId,
                                                      typeof (PtService.NhibernateImpl.DAOs.Impl.IsikGraafik))
                    as PtService.NhibernateImpl.DAOs.Impl.IsikGraafik;
                _connContext._IsikGraafikDAO.Delete(isikGraafikToDel);
                resp.Successful = true;
            }
            catch (Exception e)
            {
                resp = new StandardResponse();
                resp.Successful = false;
                resp.Exception = e;
            }

            return resp;
        }
コード例 #4
0
ファイル: PiimaToostusService.svc.cs プロジェクト: ekople/VR2
        public StandardResponse RemoveUser(string sessionHandle, int userId)
        {
            _connContext = _connContext.CheckDBConn();
            var resp = new StandardResponse();
            resp.AuthResponse = validateAuth(sessionHandle);
            if (resp.AuthResponse.IsAuthenticated == false)
            {
                resp.Successful = false;
                resp.Exception = new AuthenticationException(authFailedMsg);
                return resp;
            }

            try
            {
                if (userId == 0)
                {
                    throw new Exception("Kasutaja eemaldamiseks peab kasutaja ID olema sisestatud!");
                }
                var UserToDel =
                    _connContext._KasutajaDAO.Load(userId, typeof (PtService.NhibernateImpl.DAOs.Impl.Kasutaja))
                    as PtService.NhibernateImpl.DAOs.Impl.Kasutaja;
                _connContext._KasutajaDAO.Delete(UserToDel);
                resp.Successful = true;
            }
            catch (Exception e)
            {
                resp = new StandardResponse();
                resp.Successful = false;
                resp.Exception = e;
            }

            return resp;
        }