public static Services.AddressBook.SearchUsers.SearchUsersResponse SearchUsers(Services.AddressBook.SearchUsers.SearchUsersRequest request) { Services.AddressBook.SearchUsers.SearchUsersResponse response = new Services.AddressBook.SearchUsers.SearchUsersResponse(); try { DocsPaVO.utente.Utente utente = null; DocsPaVO.utente.InfoUtente infoUtente = null; //Inizio controllo autenticazione utente infoUtente = Utils.CheckAuthentication(request, "SearchUsers"); utente = BusinessLogic.Utenti.UserManager.getUtenteById(infoUtente.idPeople); if (utente == null) { //Utente non trovato throw new PisException("USER_NO_EXIST"); } //Fine controllo autenticazione utente if (request.Filters == null || request.Filters.Length == 0) { throw new PisException("REQUIRED_FILTER"); } //Chiamata al metodo CheckFilterType(request.Filters) Utils.CheckFilterTypes(request.Filters); //Filtri ricerca rubrica DocsPaVO.rubrica.ParametriRicercaRubrica qco = new DocsPaVO.rubrica.ParametriRicercaRubrica(); BusinessLogic.Rubrica.DPA3_RubricaSearchAgent ccs = new BusinessLogic.Rubrica.DPA3_RubricaSearchAgent(infoUtente); DocsPaVO.rubrica.SmistamentoRubrica smistamentoRubrica = new DocsPaVO.rubrica.SmistamentoRubrica(); qco.caller = new DocsPaVO.rubrica.ParametriRicercaRubrica.CallerIdentity(); qco.caller.IdUtente = infoUtente.idPeople; qco.caller.IdRuolo = infoUtente.idGruppo; qco.caller.filtroRegistroPerRicerca = null; qco.doUtenti = true; qco.calltype = DocsPaVO.rubrica.ParametriRicercaRubrica.CallType.CALLTYPE_PROTO_IN; // bool filterFound = false; foreach (VtDocsWS.Domain.Filter fil in request.Filters) { if (fil != null && !string.IsNullOrEmpty(fil.Value)) { if (fil.Name.ToUpper().Equals("NATIONAL_IDENTIFICATION_NUMBER")) { filterFound = true; qco.cf_piva = fil.Value; } if (fil.Name.ToUpper().Equals("USER_MAIL")) { filterFound = true; qco.email = fil.Value; } if (fil.Name.ToUpper().Equals("USER_NAME")) { filterFound = true; qco.descrizione = fil.Value; } if (fil.Name.ToUpper().Equals("USER_SURNAME")) { filterFound = true; qco.descrizione = fil.Value; } if (!filterFound) { throw new PisException("FILTER_NOT_FOUND"); } } } Domain.User[] userResponse = null; ArrayList objElementiRubrica = ccs.Search(qco, smistamentoRubrica); if (objElementiRubrica != null && objElementiRubrica.Count > 0) { userResponse = new Domain.User[objElementiRubrica.Count]; for (int i = 0; i < objElementiRubrica.Count; i++) { Domain.User userTemp = new Domain.User(); userTemp.Id = ((DocsPaVO.rubrica.ElementoRubrica)objElementiRubrica[i]).idPeople; userTemp.Description = ((DocsPaVO.rubrica.ElementoRubrica)objElementiRubrica[i]).descrizione; userTemp.UserId = ((DocsPaVO.rubrica.ElementoRubrica)objElementiRubrica[i]).codice; userTemp.Name = ((DocsPaVO.rubrica.ElementoRubrica)objElementiRubrica[i]).nome; userTemp.Surname = ((DocsPaVO.rubrica.ElementoRubrica)objElementiRubrica[i]).cognome; userTemp.NationalIdentificationNumber = ((DocsPaVO.rubrica.ElementoRubrica)objElementiRubrica[i]).cf_piva; userResponse[i] = userTemp; } response.Users = userResponse; } else { //throw new PisException("USERS_NOT_FOUND"); userResponse = new Domain.User[0]; response.Users = userResponse; } response.Success = true; } catch (PisException pisEx) { logger.ErrorFormat("PISException: {0}, {1}", pisEx.ErrorCode, pisEx.Description); response.Error = new Services.ResponseError { Code = pisEx.ErrorCode, Description = pisEx.Description }; response.Success = false; } catch (Exception ex) { logger.ErrorFormat("Eccezione Generica: APPLICATION_ERROR, {0}", ex.Message); response.Error = new Services.ResponseError { Code = "APPLICATION_ERROR", Description = ex.Message }; response.Success = false; } return(response); }
/// <summary> /// MEV SMISTAMENTO /// Metodo per l'esecuzione della ricerca da mobile /// E' seguita la stessa logica della versione desktop /// </summary> /// <param name="descrizione"></param> /// <param name="infoUtente"></param> /// <param name="idRegistro"></param> /// <param name="idRuolo"></param> /// <param name="ragione"></param> /// <param name="numMaxResults"></param> /// <returns></returns> public static List <RicercaSmistamentoElement> GetListaCorrispondentiVeloce(string descrizione, InfoUtente infoUtente, string idRegistro, string idRuolo, string ragione, int numMaxResults) { DocsPaVO.rubrica.ParametriRicercaRubrica qco = new DocsPaVO.rubrica.ParametriRicercaRubrica(); List <RicercaSmistamentoElement> elements = new List <RicercaSmistamentoElement>(); qco.caller = new DocsPaVO.rubrica.ParametriRicercaRubrica.CallerIdentity(); qco.parent = ""; qco.caller.IdRuolo = idRuolo; qco.caller.IdRegistro = idRegistro; qco.descrizione = descrizione; #region RAGIONE DI TRASMISSIONE DocsPaVO.amministrazione.InfoAmministrazione amm = BusinessLogic.Amministrazione.AmministraManager.AmmGetInfoAmmCorrente(infoUtente.idAmministrazione); string idRagione = string.Empty; switch (ragione) { case "comp": idRagione = amm.IDRagioneCompetenza; break; case "con": idRagione = amm.IDRagioneConoscenza; break; } DocsPaVO.trasmissione.RagioneTrasmissione ragTrasm = BusinessLogic.Trasmissioni.QueryTrasmManager.getRagioneById(idRagione); switch (ragTrasm.tipoDestinatario.ToString("g").Substring(0, 1)) { case "T": qco.calltype = DocsPaVO.rubrica.ParametriRicercaRubrica.CallType.CALLTYPE_TRASM_ALL; break; case "I": qco.calltype = DocsPaVO.rubrica.ParametriRicercaRubrica.CallType.CALLTYPE_TRASM_INF; break; case "S": qco.calltype = DocsPaVO.rubrica.ParametriRicercaRubrica.CallType.CALLTYPE_TRASM_SUP; break; case "P": qco.calltype = DocsPaVO.rubrica.ParametriRicercaRubrica.CallType.CALLTYPE_TRASM_PARILIVELLO; break; } #endregion bool abilitazioneRubricaComune = BusinessLogic.RubricaComune.Configurazioni.GetConfigurazioni(infoUtente).GestioneAbilitata; Registro[] regTemp = (Registro[])BusinessLogic.Utenti.RegistriManager.getListaRegistriRfRuolo(idRuolo, "", "").ToArray(typeof(Registro)); //Prendo soltanto i corrispondenti del mio registro e di tutti i miei rf se presenti #region registro Registro[] regOnliyTemp = null; if (regTemp != null && regTemp.Length > 0) { int countReg = 0; regOnliyTemp = new Registro[regTemp.Length]; for (int y = 0; y < regTemp.Length; y++) { if ((!string.IsNullOrEmpty(regTemp[y].chaRF) && regTemp[y].chaRF.Equals("1")) || regTemp[y].systemId.Equals(qco.caller.IdRegistro)) { regOnliyTemp[countReg] = regTemp[y]; countReg++; } } } string retValue = string.Empty; foreach (Registro item in regOnliyTemp) { if (item != null) { retValue += " " + item.systemId + ","; } } if (retValue.EndsWith(",")) { retValue = retValue.Remove(retValue.LastIndexOf(",")); } qco.caller.filtroRegistroPerRicerca = retValue; #endregion qco.tipoIE = DocsPaVO.addressbook.TipoUtente.INTERNO; qco.doRuoli = true; qco.doUo = true; qco.doUtenti = true; qco.doListe = true; qco.doRF = false; qco.doRubricaComune = false; qco.ObjectType = string.Empty; string[] res = GetElementiRubricaVeloce(infoUtente, qco); int i = 0; //filtro i risultati cone nel frontend //response if (res != null && res.Count() > 0) { foreach (string s in res) { RicercaSmistamentoElement el = new RicercaSmistamentoElement(); string desc = s.Split('§')[0]; string sysId = s.Split('§')[1]; string tipo = s.Split('§')[2]; string idPeople = s.Split('§')[3]; // UTENTE if (tipo.Equals("P")) { el = AggiungiElementoRicerca(idPeople, tipo, infoUtente, idRegistro); if (el != null) { el.DescrizioneUtente = desc; //el.IdUtente = sysId; el.Type = SmistamentoNodeType.UTENTE; } } // RUOLO else if (tipo.Equals("R")) { el = AggiungiElementoRicerca(sysId, tipo, infoUtente, idRegistro); if (el != null) { el.DescrizioneRuolo = desc; //el.IdRuolo = sysId; el.Type = SmistamentoNodeType.RUOLO; } } // UO else { if (el != null) { el.DescrizioneUO = desc; el.IdUO = sysId; el.Type = SmistamentoNodeType.UO; } } if (i < numMaxResults) { if (el != null) { elements.Add(el); i++; } } else { break; } } } return(elements); }
public static Services.AddressBook.SearchCorrespondents.SearchCorrespondentsResponse SearchCorrespondents(Services.AddressBook.SearchCorrespondents.SearchCorrespondentsRequest request) { Services.AddressBook.SearchCorrespondents.SearchCorrespondentsResponse response = new Services.AddressBook.SearchCorrespondents.SearchCorrespondentsResponse(); try { DocsPaVO.utente.Utente utente = null; DocsPaVO.utente.InfoUtente infoUtente = null; //Inizio controllo autenticazione utente infoUtente = Utils.CheckAuthentication(request, "SearchCorrespondents"); utente = BusinessLogic.Utenti.UserManager.getUtenteById(infoUtente.idPeople); if (utente == null) { //Utente non trovato throw new PisException("USER_NO_EXIST"); } //Fine controllo autenticazione utente if (request.Filters == null || request.Filters.Length == 0) { throw new PisException("REQUIRED_FILTER"); } bool idFromRC = false; Domain.Filter filtroIDRC = (from filtro in request.Filters where (filtro != null && !string.IsNullOrEmpty(filtro.Name) && filtro.Name.ToUpper() == "EXTRACT_ID_COMMONADDRESSBOOK") select filtro).FirstOrDefault(); if (filtroIDRC != null && filtroIDRC.Value.ToUpper() == "TRUE") { idFromRC = true; } //Chiamata al metodo CheckFilterType(request.Filters) Utils.CheckFilterTypes(request.Filters); DocsPaVO.rubrica.ParametriRicercaRubrica qco = Utils.GetParametriRicercaRubricaFromPis(request.Filters, infoUtente); BusinessLogic.Rubrica.DPA3_RubricaSearchAgent corrSearcher = new BusinessLogic.Rubrica.DPA3_RubricaSearchAgent(infoUtente); // DocsPaDB.Query_DocsPAWS.Rubrica query = new DocsPaDB.Query_DocsPAWS.Rubrica(infoUtente); DocsPaVO.rubrica.SmistamentoRubrica smistamentoRubrica = new DocsPaVO.rubrica.SmistamentoRubrica(); ArrayList objElementiRubrica = corrSearcher.Search(qco, smistamentoRubrica); //ArrayList objElementiRubrica = query.GetElementiRubrica(qco); Domain.Correspondent[] correspondentsRespone = null; if (objElementiRubrica != null && objElementiRubrica.Count > 0) { correspondentsRespone = new Domain.Correspondent[objElementiRubrica.Count]; for (int i = 0; i < objElementiRubrica.Count; i++) { Domain.Correspondent userTemp = new Domain.Correspondent(); DocsPaVO.rubrica.ElementoRubrica elementoRubrica = ((DocsPaVO.rubrica.ElementoRubrica)objElementiRubrica[i]); userTemp.Id = elementoRubrica.systemId; userTemp.Description = elementoRubrica.descrizione; userTemp.Code = elementoRubrica.codice; userTemp.Name = elementoRubrica.nome; userTemp.Surname = elementoRubrica.cognome; userTemp.NationalIdentificationNumber = elementoRubrica.cf_piva; userTemp.IsCommonAddress = elementoRubrica.isRubricaComune; userTemp.Type = (elementoRubrica.interno ? "I" : "E"); if (!String.IsNullOrEmpty(elementoRubrica.tipo)) { userTemp.CorrespondentType = elementoRubrica.tipo; } if (idFromRC && string.IsNullOrEmpty(elementoRubrica.systemId)) { DocsPaVO.utente.Corrispondente userTemp2 = BusinessLogic.Utenti.UserManager.getCorrispondenteByCodRubricaRubricaComune(elementoRubrica.codice, infoUtente); userTemp.Id = userTemp2.systemId; } correspondentsRespone[i] = userTemp; } response.Correspondents = correspondentsRespone; } else { //throw new PisException("CORRESPONDENTS_NOT_FOUND"); correspondentsRespone = new Domain.Correspondent[0]; response.Correspondents = correspondentsRespone; } response.Success = true; } catch (PisException pisEx) { logger.ErrorFormat("PISException: {0}, {1}", pisEx.ErrorCode, pisEx.Description); response.Error = new Services.ResponseError { Code = pisEx.ErrorCode, Description = pisEx.Description }; response.Success = false; } catch (Exception ex) { logger.ErrorFormat("Eccezione Generica: APPLICATION_ERROR, {0}", ex.Message); response.Error = new Services.ResponseError { Code = "APPLICATION_ERROR", Description = ex.Message }; response.Success = false; } return(response); }
public void filtra_trasmissioni(DocsPaVO.rubrica.ParametriRicercaRubrica qr, ref ArrayList ers) { ArrayList a = new ArrayList(); ArrayList ruoli_autorizzati = new ArrayList(); DocsPaVO.trasmissione.TipoOggetto tipo_oggetto; tipo_oggetto = (qr.ObjectType.StartsWith("F:")) ? DocsPaVO.trasmissione.TipoOggetto.FASCICOLO : DocsPaVO.trasmissione.TipoOggetto.DOCUMENTO; string id_nodo_titolario = (tipo_oggetto == DocsPaVO.trasmissione.TipoOggetto.FASCICOLO) ? qr.ObjectType.Substring(2) : null; DocsPaVO.utente.Ruolo r = BusinessLogic.Utenti.UserManager.getRuolo(qr.caller.IdRuolo); DocsPaDB.Utils.Gerarchia g = new DocsPaDB.Utils.Gerarchia(); switch (qr.calltype) { case DocsPaVO.rubrica.ParametriRicercaRubrica.CallType.CALLTYPE_MODELLI_TRASM_ALL: case DocsPaVO.rubrica.ParametriRicercaRubrica.CallType.CALLTYPE_TRASM_ALL: ruoli_autorizzati = g.getRuoliAut(r, qr.caller.IdRegistro, id_nodo_titolario, tipo_oggetto); break; case DocsPaVO.rubrica.ParametriRicercaRubrica.CallType.CALLTYPE_MODELLI_TRASM_SUP: case DocsPaVO.rubrica.ParametriRicercaRubrica.CallType.CALLTYPE_TRASM_SUP: ruoli_autorizzati = g.getGerarchiaSup(r, qr.caller.IdRegistro, id_nodo_titolario, tipo_oggetto); break; case DocsPaVO.rubrica.ParametriRicercaRubrica.CallType.CALLTYPE_MODELLI_TRASM_INF: case DocsPaVO.rubrica.ParametriRicercaRubrica.CallType.CALLTYPE_TRASM_INF: ruoli_autorizzati = g.getGerarchiaInf(r, qr.caller.IdRegistro, id_nodo_titolario, tipo_oggetto); break; case DocsPaVO.rubrica.ParametriRicercaRubrica.CallType.CALLTYPE_MODELLI_TRASM_PARILIVELLO: case DocsPaVO.rubrica.ParametriRicercaRubrica.CallType.CALLTYPE_TRASM_PARILIVELLO: ruoli_autorizzati = g.getGerarchiaPariLiv(r, qr.caller.IdRegistro, id_nodo_titolario, tipo_oggetto); break; case DocsPaVO.rubrica.ParametriRicercaRubrica.CallType.CALLTYPE_PROTO_INT_DEST: DocsPaVO.trasmissione.RagioneTrasmissione rTo = BusinessLogic.Trasmissioni.RagioniManager.GetRagione("TO", _user.idAmministrazione); DocsPaVO.trasmissione.TipoGerarchia gTo = rTo.tipoDestinatario; switch (gTo) { case DocsPaVO.trasmissione.TipoGerarchia.INFERIORE: ruoli_autorizzati = g.getGerarchiaInf(r, qr.caller.IdRegistro, id_nodo_titolario, tipo_oggetto); break; case DocsPaVO.trasmissione.TipoGerarchia.PARILIVELLO: ruoli_autorizzati = g.getGerarchiaPariLiv(r, qr.caller.IdRegistro, id_nodo_titolario, tipo_oggetto); break; case DocsPaVO.trasmissione.TipoGerarchia.SUPERIORE: ruoli_autorizzati = g.getGerarchiaSup(r, qr.caller.IdRegistro, id_nodo_titolario, tipo_oggetto); break; case DocsPaVO.trasmissione.TipoGerarchia.TUTTI: ruoli_autorizzati = g.getRuoliAut(r, qr.caller.IdRegistro, null, tipo_oggetto); break; } break; default: return; } string[] c_ruoli_aut = new string[ruoli_autorizzati.Count]; for (int i = 0; i < ruoli_autorizzati.Count; i++) { c_ruoli_aut[i] = ((DocsPaVO.utente.Ruolo)ruoli_autorizzati[i]).codiceRubrica; } Array.Sort(c_ruoli_aut); foreach (DocsPaVO.rubrica.ElementoRubrica er in ers) { try { switch (er.tipo) { case "U": if (uo_is_autorizzata((er.interno ? "I" : "E") + @"\" + er.codice, r, c_ruoli_aut) || (qr.ObjectType == "G")) { a.Add(er); } break; case "R": if (ruolo_is_autorizzato(er.codice, c_ruoli_aut) || (qr.ObjectType == "G")) { a.Add(er); } break; case "P": if (utente_is_autorizzato((er.interno ? "I" : "E") + @"\" + er.codice, c_ruoli_aut) || (qr.ObjectType == "G")) { a.Add(er); } break; case "L": case "F": //if (utente_is_autorizzato ((er.interno ? "I" : "E") + @"\" + er.codice, c_ruoli_aut) || (qr.ObjectType == "G")) a.Add(er); break; } } catch (Exception ex) { Console.WriteLine(ex.Message); } } ers = a; }
private static string[] GetElementiRubricaVeloce(DocsPaVO.utente.InfoUtente infoUtente, DocsPaVO.rubrica.ParametriRicercaRubrica qco) { string[] listaTemp = null; DocsPaDB.Query_DocsPAWS.Rubrica query = new DocsPaDB.Query_DocsPAWS.Rubrica(infoUtente); ArrayList ers = query.GetElementiRubrica(qco); Mobile_RubricaSearchAgent SearchFilter = new Mobile_RubricaSearchAgent(infoUtente); if (SearchFilter != null) { SearchFilter.filtra_trasmissioni(qco, ref ers); } string tempStringElemento = null; if (ers.Count > 0 && ers != null) { listaTemp = new string[ers.Count]; } for (int i = 0; i < ers.Count; i++) { DocsPaVO.rubrica.ElementoRubrica tempElement = (DocsPaVO.rubrica.ElementoRubrica)ers[i]; //tempStringElemento = tempElement.descrizione + " (" + tempElement.codice + ")" + codRegTemp; tempStringElemento = tempElement.descrizione + "§" + tempElement.systemId + "§" + tempElement.tipo + "§" + tempElement.idPeople; listaTemp[i] = tempStringElemento; } return(listaTemp); }
/// <summary> /// Il metodo principale per l'esecuzione delle ricerche /// </summary> /// <param name="ParametriRicerca">Un'istanza della classe <see cref="DocsPaVo.rubrica.ParametriRicercaRubrica"/> /// contenente i parametri di ricerca</param> /// <returns>Un <see cref="System.Collections.ArrayList">ArrayList</see> contenente il risultato</returns> /// <remarks> /// <para> /// Le classi che implementano questo metodo devono restituire un /// <see cref="System.Collections.ArrayList">ArrayList</see> contenente i /// risultati della ricerca. </para> /// Ogni elemento restituito è un'istanza della classe /// <see cref="DocsPaVO.rubrica.ElementoRubrica">ElementoRubrica</see> /// </remarks> public abstract ArrayList SearchPaging(DocsPaVO.rubrica.ParametriRicercaRubrica ParametriRicerca, DocsPaVO.rubrica.SmistamentoRubrica smistamentoRubrica, int firstRowNum, int maxRowForPage, out int totale);
/// <summary> /// Il metodo principale per l'esecuzione delle ricerche /// </summary> /// <param name="ParametriRicerca">Un'istanza della classe <see cref="DocsPaVo.rubrica.ParametriRicercaRubrica"/> /// contenente i parametri di ricerca</param> /// <returns>Un <see cref="System.Collections.ArrayList">ArrayList</see> contenente il risultato</returns> /// <remarks> /// <para> /// Le classi che implementano questo metodo devono restituire un /// <see cref="System.Collections.ArrayList">ArrayList</see> contenente i /// risultati della ricerca. </para> /// Ogni elemento restituito è un'istanza della classe /// <see cref="DocsPaVO.rubrica.ElementoRubrica">ElementoRubrica</see> /// </remarks> public abstract ArrayList Search(DocsPaVO.rubrica.ParametriRicercaRubrica ParametriRicerca, DocsPaVO.rubrica.SmistamentoRubrica smistamentoRubrica);
public GetElementiResponse GetElementi(GetElementiRequest request) { GetElementiResponse response = new GetElementiResponse(); try { using (DocsPaWS.DocsPaWebService ws = new DocsPaWebService()) { string filtroRegistroPerRicerca = string.Empty; foreach (string id in request.IdRegistri) { if (!string.IsNullOrEmpty(filtroRegistroPerRicerca)) { filtroRegistroPerRicerca += ","; } filtroRegistroPerRicerca += id; } var searchParameters = new DocsPaVO.rubrica.ParametriRicercaRubrica { caller = new DocsPaVO.rubrica.ParametriRicercaRubrica.CallerIdentity { IdRuolo = request.InfoUtente.idGruppo, filtroRegistroPerRicerca = filtroRegistroPerRicerca }, calltype = DocsPaVO.rubrica.ParametriRicercaRubrica.CallType.CALLTYPE_MANAGE, tipoIE = request.TipoUtente, codice = request.FiltroPerCodice, descrizione = request.FiltroPerDescrizione, citta = request.FiltroPerCitta, localita = request.FiltroPerLocalita, doUtenti = request.FiltraUtenti, doRuoli = request.FiltraRuoli, doUo = request.FiltraUO, doListe = request.FiltraListe, doRF = request.FiltraRF, doRubricaComune = request.FiltraRubricaComune }; var list = ws.rubricaGetElementiRubrica(searchParameters, request.InfoUtente, null); if (list == null) { throw new ApplicationException("Errore nel reperimento degli elementi in rubrica"); } response.Elementi = (DocsPaVO.rubrica.ElementoRubrica[]) list.ToArray(typeof(DocsPaVO.rubrica.ElementoRubrica)); } response.Success = true; } catch (Exception ex) { response = new GetElementiResponse(); response.Success = false; if (request.TrowOnError) { throw DocsPaUtils.Exceptions.SoapExceptionFactory.Create(ex); } else { response.Exception = ex.Message; } } return(response); }