示例#1
0
        //OK
        public ArrayList getCorrispondentiByCodRF(string codiceRF)
        {
            ArrayList corr = new ArrayList();

            DocsPaDB.DBProvider dbProvider = new DocsPaDB.DBProvider();

            try
            {
                //semaforo.WaitOne();
                DocsPaUtils.Query queryMng = DocsPaUtils.InitQuery.getInstance().getQuery("GET_CORRISPONDENTE_BY_RF");
                queryMng.setParam("param1", codiceRF.ToUpper().Replace("'", "''"));
                string commandText = queryMng.getSQL();
                System.Diagnostics.Debug.WriteLine("SQL - getCorrispondentiByCodRF - RF.cs - QUERY : " + commandText);
                logger.Debug("SQL - getCorrispondentiByCodRF - RF.cs - QUERY : " + commandText);

                DataSet ds = new DataSet();
                dbProvider.ExecuteQuery(ds, commandText);

                DocsPaDB.Query_DocsPAWS.Utenti u = new DocsPaDB.Query_DocsPAWS.Utenti();
                for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
                {
                    DocsPaVO.utente.Corrispondente c = u.GetCorrispondenteBySystemID(ds.Tables[0].Rows[i][0].ToString());
                    string ii = c.codiceRubrica;
                    // corr.Add(c);
                    if (c.tipoIE == "I")
                    {
                        corr.Add(u.GetCorrispondenteByCodRubrica(ds.Tables[0].Rows[i][1].ToString(), c.codiceRubrica, DocsPaVO.addressbook.TipoUtente.INTERNO));
                    }
                    if (c.tipoIE == "E")
                    {
                        corr.Add(u.GetCorrispondenteByCodRubrica(ds.Tables[0].Rows[i][1].ToString(), c.codiceRubrica, DocsPaVO.addressbook.TipoUtente.ESTERNO));
                    }
                }
            }
            catch
            {
                return(null);
            }
            finally
            {
                dbProvider.Dispose();
                //semaforo.ReleaseMutex();
            }

            return(corr);
        }
示例#2
0
        /// <summary>
        /// Reperimento dell'esito della spedizione di un documento ad un destinatario
        /// </summary>
        /// <param name="destinatario"></param>
        /// <returns></returns>
        public SendDocumentResponse.SendDocumentMailResponse FindDocumentResponse(DocsPaVO.utente.Corrispondente destinatario)
        {
            foreach (SendDocumentResponse.SendDocumentMailResponse response in this.SendDocumentMailResponseList)
            {
                DocsPaVO.utente.Corrispondente[] destinatari = (DocsPaVO.utente.Corrispondente[])response.Destinatari.ToArray(typeof(DocsPaVO.utente.Corrispondente));

                // Ricerca del destinatario tra i corrispondenti cui è stato inviato il documento
                //if (destinatari.Where(e => e.systemId == destinatario.systemId) != null)
                //    return response;
                foreach (DocsPaVO.utente.Corrispondente destX in destinatari)
                {
                    if (destX.systemId == destinatario.systemId)
                    {
                        return(response);
                    }
                }
            }

            return(null);
        }
示例#3
0
        public static Services.Authentication.Authenticate.AuthenticateResponse Authenticate(Services.Authentication.Authenticate.AuthenticateRequest request)
        {
            Services.Authentication.Authenticate.AuthenticateResponse response = new Services.Authentication.Authenticate.AuthenticateResponse();
            try
            {
                DocsPaVO.utente.Utente utente = null;
                if (request == null || string.IsNullOrEmpty(request.UserName))
                {
                    throw new PisException("MISSING_PARAMETER");
                }

                if (string.IsNullOrEmpty(request.Password))
                {
                    throw new PisException("MISSING_PARAMETER");
                }

                DocsPaVO.utente.UserLogin    userlog    = new UserLogin(request.UserName, request.Password, null);
                System.Collections.ArrayList listaAmmin = BusinessLogic.Utenti.UserManager.getListaIdAmmUtente(userlog);

                if (listaAmmin != null && listaAmmin.Count > 0)
                {
                    if (listaAmmin.Count == 1)
                    {
                        userlog.IdAmministrazione = listaAmmin[0].ToString();
                    }
                    else
                    {
                        throw new PisException("APPLICATION_ERROR");
                    }
                }
                if (listaAmmin == null)
                {
                    throw new PisException("APPLICATION_ERROR");
                }
                utente = BusinessLogic.Utenti.UserManager.getUtente(request.UserName, userlog.IdAmministrazione);
                if (utente == null)
                {
                    //Utente non trovato
                    throw new PisException("APPLICATION_ERROR");
                }
                string encPass = BusinessLogic.Amministrazione.AmministraManager.GetPasswordUtenteMultiAmm(request.UserName.ToUpper());
                encPass = encPass.Split('^')[0];
                if (DocsPaUtils.Security.CryptographyManager.CalcolaImpronta(System.Text.Encoding.Unicode.GetBytes(request.Password)) != encPass)
                {
                    throw new PisException("APPLICATION_ERROR");
                }


                DocsPaVO.utente.Ruolo ruolo = Utils.GetRuoloPreferito(utente.idPeople);
                if (ruolo == null)
                {
                    //L'utente non ha ruoli
                    throw new PisException("APPLICATION_ERROR");
                }

                DocsPaVO.utente.InfoUtente infoUtente = new DocsPaVO.utente.InfoUtente(utente, ruolo);


                utente.ruoli = new System.Collections.ArrayList();
                utente.ruoli.Add(ruolo);

                response.AuthenticationToken = CreateAuthToken(utente, ruolo);
                DocsPaVO.utente.Corrispondente corr = BusinessLogic.Utenti.UserManager.getCorrispondenteBySystemID(utente.systemId);
                response.User = Utils.GetCorrespondent(corr, infoUtente);

                //response.User = new Domain.Correspondent();
                //response.User.Name = utente.nome;
                //response.User.Surname = utente.cognome;
                //response.User.Location = utente.sede;
                //response.User.Email = utente.email;
                //response.User.Id = utente.systemId;
                //response.User.CorrespondentType = utente.tipoCorrispondente;
                //response.User.Type = "I";
                //response.User.Description = utente.descrizione;
                //response.User.Code = utente.userId;


                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);
        }