/// <summary> /// UndoCheckout di un documento in stato checkout /// </summary> /// <param name="checkOutStatus"></param> /// <param name="library"></param> /// <returns></returns> public bool UndoCheckOut(DocsPaVO.CheckInOut.CheckOutStatus checkOutStatus) { bool retValue = false; try { long idOCS = OCSDocumentHelper.getDocumentIdOCS(checkOutStatus.DocumentNumber, null, OCSUtils.getApplicationUserCredentials()); CorteContentServices.ItemIdRequestType requestId = new DocsPaDocumentale_OCS.CorteContentServices.ItemIdRequestType(); requestId.userCredentials = OCSServices.OCSUtils.getApplicationUserCredentials(); requestId.itemId = idOCS; // id del documento CorteContentServices.ResultType result = this.WsDocumentInstance.UnlockDocument(requestId); OCSUtils.throwExceptionIfInvalidResult(result); retValue = true; } catch (Exception ex) { retValue = false; logger.Debug("Errore in OCS.UndoCheckOut", ex); } return(retValue); }
/// <summary> /// Modifica dei metadati di un ruolo /// </summary> /// <param name="ruolo"></param> /// <returns></returns> public EsitoOperazione ModificaRuolo(OrgRuolo ruolo) { EsitoOperazione ret = new EsitoOperazione(); string logMsg; // test sui campi obbligatori if (string.IsNullOrEmpty(ruolo.Codice) || string.IsNullOrEmpty(ruolo.Descrizione)) { ret.Codice = -1; logMsg = ERR_HEADER + "ModificaRuolo: dati insufficienti"; ret.Descrizione = logMsg; logger.Debug(logMsg); return(ret); } // il campo Codice corrisponde a: // (ETDOCS) DPA_CORR_GLOBALI.VAR_COD_RUBRICA varchar(128) // (OCS) try { CorteContentServices.GroupRequestType groupReq = new CorteContentServices.GroupRequestType(); groupReq.userCredentials = OCSServices.OCSUtils.getApplicationUserCredentials(); groupReq.group = new CorteContentServices.GroupType(); groupReq.group.name = ruolo.Codice; groupReq.group.description = ruolo.Descrizione; groupReq.group.users = new DocsPaDocumentale_OCS.CorteContentServices.UserType[0]; CorteContentServices.ResultType result = this.WsGroupInstance.ModifyGroup(groupReq); if (OCSUtils.isValidServiceResult(result)) { ret.Codice = 0; } else { logger.Debug(DEBUG_HEADER + "ModificaRuolo operazione con ERRORE su OCS: " + ret.Descrizione); ret.Codice = -1; ret.Descrizione = result.message.Replace("'", " "); } return(ret); } catch (Exception ex) { string st = ex.ToString(); logger.Debug(DEBUG_HEADER + "ModificaRuolo FALLITA, Exception=" + st); ret.Codice = -1; ret.Descrizione = ERR_HEADER + "ModificaRuolo"; return(ret); } }
/// <summary> /// Login al sistema documentale /// </summary> /// <param name="utente"></param> /// <param name="loginResult"></param> /// <returns></returns> public bool LoginUser(DocsPaVO.utente.UserLogin userLogin, out DocsPaVO.utente.Utente utente, out DocsPaVO.utente.UserLogin.LoginResult loginResult) { bool retValue = false; utente = null; loginResult = UserLogin.LoginResult.UNKNOWN_USER; try { utente = new Utente(); CorteContentServices.UserCredentialsRequestType userCred = new CorteContentServices.UserCredentialsRequestType(); CorteContentServices.ResultType result = new CorteContentServices.ResultType(); userCred.userCredentials = new CorteContentServices.UserCredentialsType(); userCred.userCredentials.userId = userLogin.UserName; userCred.userCredentials.password = userLogin.Password; result = this.WsUserInstance.Login(userCred); if (OCSUtils.isValidServiceResult(result)) { //definizione del dst // il dst tiene in memoria le informazioni necessarie per l'autenticazione dell'utente // ci sono operazioni in cui non viene utilizzato l'utente applicativo ma è necessario // utilizzare le credenziali effettive dell'utente che si connette al sistema. // Per esempio nelle ricerche utente = new Utente(); utente.dst = this.GetAuthenticationToken(userLogin.UserName, userLogin.Password); retValue = true; loginResult = DocsPaVO.utente.UserLogin.LoginResult.OK; logger.Debug(string.Format("OCS.LoginUser: utente {0} connesso", userLogin.UserName)); } else { retValue = false; utente = null; loginResult = UserLogin.LoginResult.UNKNOWN_USER; logger.Debug(string.Format("Errore in OCS.Login:\n{0}", result.message)); } } catch (Exception ex) { retValue = false; utente = null; loginResult = UserLogin.LoginResult.UNKNOWN_USER; logger.Error(string.Format("Errore in OCS.Login:\n{0}", ex.ToString())); } return(retValue); }