Beispiel #1
0
        public void Delete(ElementoRubrica elemento)
        {
            try
            {
                SecurityHelper.Login(this.Credentials);

                Rubrica.Library.RubricaServices.Delete(elemento);
            }
            catch (Exception ex)
            {
                throw SoapExceptionFactory.Create(ex);
            }
        }
Beispiel #2
0
        public ElementoRubrica UpdateMulticasella(ElementoRubrica elemento)
        {
            try
            {
                SecurityHelper.Login(this.Credentials);

                // Nuova gestione, corrispondente multicasella
                return(Rubrica.Library.RubricaServices.Update(elemento, true));
            }
            catch (Exception ex)
            {
                throw SoapExceptionFactory.Create(ex);
            }
        }
Beispiel #3
0
 private static void SetRfDetails(ElementoRubrica elementoRubrica, DocsPaWR.ElementoRubricaRF elementoDaInviare)
 {
     if (elementoDaInviare.RF != null)
     {
         // Impostazione dei dati aggiuntivi
         elementoRubrica.Indirizzo     = elementoDaInviare.RF.indirizzo;
         elementoRubrica.Nazione       = elementoDaInviare.RF.nazionalita;
         elementoRubrica.Telefono      = elementoDaInviare.RF.telefono1;
         elementoRubrica.Fax           = elementoDaInviare.RF.fax;
         elementoRubrica.Citta         = elementoDaInviare.RF.citta;
         elementoRubrica.Cap           = elementoDaInviare.RF.cap;
         elementoRubrica.Provincia     = elementoDaInviare.RF.prov;
         elementoRubrica.CodiceFiscale = elementoDaInviare.RF.codfisc;
         elementoRubrica.PartitaIva    = elementoDaInviare.RF.partitaiva;
     }
 }
Beispiel #4
0
 private static void SetUoDetails(ElementoRubrica elementoRubrica, DocsPaWR.ElementoRubricaUO elementoDaInviare)
 {
     if (elementoDaInviare.UO != null && elementoDaInviare.UO.DettagliUo != null)
     {
         // Impostazione dei dati aggiuntivi
         elementoRubrica.Indirizzo     = elementoDaInviare.UO.DettagliUo.Indirizzo;
         elementoRubrica.Nazione       = elementoDaInviare.UO.DettagliUo.Nazione;
         elementoRubrica.Telefono      = elementoDaInviare.UO.DettagliUo.Telefono1;
         elementoRubrica.Fax           = elementoDaInviare.UO.DettagliUo.Fax;
         elementoRubrica.Citta         = elementoDaInviare.UO.DettagliUo.Citta;
         elementoRubrica.Cap           = elementoDaInviare.UO.DettagliUo.Cap;
         elementoRubrica.Provincia     = elementoDaInviare.UO.DettagliUo.Provincia;
         elementoRubrica.CodiceFiscale = elementoDaInviare.UO.DettagliUo.CodiceFiscale;
         elementoRubrica.PartitaIva    = elementoDaInviare.UO.DettagliUo.PartitaIva;
     }
 }
Beispiel #5
0
        /// <summary>
        /// Ricerca di un singolo elemento a partire dal codice
        /// </summary>
        /// <param name="codice"></param>
        /// <param name="tipoRicerca"></param>
        /// <returns></returns>
        public ElementoRubrica SearchSingle(string codice, TipiRicercaParolaEnum tipoRicerca)
        {
            //   DocsPaUtils.LogsManagement.Debugger.Write("SearchSingle(string codice, TipiRicercaParolaEnum tipoRicerca) START");
            ElementoRubrica retValue = null;
            // DocsPaUtils.LogsManagement.Debugger.Write("istanza opzione ricerca");
            OpzioniRicerca opzioniRicerca = new OpzioniRicerca();
            // DocsPaUtils.LogsManagement.Debugger.Write("istanza criterio");
            CriterioRicerca criterio = new CriterioRicerca();

            criterio.Nome        = "Codice";
            criterio.Valore      = codice.Replace("'", "''");
            criterio.TipoRicerca = tipoRicerca;
            //if(criterio != null)
            //    DocsPaUtils.LogsManagement.Debugger.Write("ho valorizzato criterio con: "+criterio.Nome+";"+criterio.Valore+";"+criterio.TipoRicerca );
            //else
            //    DocsPaUtils.LogsManagement.Debugger.Write("creiterio è null");
            //DocsPaUtils.LogsManagement.Debugger.Write("istazione criteri");
            CriteriRicerca criteri = new CriteriRicerca();

            criteri.Criteri = new CriterioRicerca[1] {
                criterio
            };

            //if(criteri != null)
            //    DocsPaUtils.LogsManagement.Debugger.Write("creiterii non è null");
            //else
            //    DocsPaUtils.LogsManagement.Debugger.Write("creiterio è null non ci sono criteri di ricerca");
            opzioniRicerca.CriteriRicerca = criteri;
            //if(opzioniRicerca.CriteriRicerca != null)
            //    DocsPaUtils.LogsManagement.Debugger.Write("opzioniRicerca.CriteriRicerca non è null");
            //else
            //    DocsPaUtils.LogsManagement.Debugger.Write("opzioniRicerca.CriteriRicerca è null");
            //DocsPaUtils.LogsManagement.Debugger.Write("sto per esguire la ricerca");
            ElementoRubrica[] result = this.Search(ref opzioniRicerca);

            //if(result.Length >0)
            //    DocsPaUtils.LogsManagement.Debugger.Write("sono stati trovati dei corrispondenti in rubrica comune");
            //else
            //    DocsPaUtils.LogsManagement.Debugger.Write("non sono stati trovati dei corrispondenti in rubrica comune");

            if (result.Length > 0)
            {
                retValue = result[0];
            }

            return(retValue);
        }
        /// <summary>
        /// Apertura della rubrica per la selezione di un ruolo interno all'amministrazione
        /// </summary>
        protected void btnRubricaRuoloResp_Click(object sender, ImageClickEventArgs e)
        {
            // Se è stato selezionato un corrispondente, ne vengono visualizzate le informazioni
            if (Session["RuoloResponsabile"] != null && Session["RuoloResponsabile"] is ElementoRubrica[])
            {
                ElementoRubrica el = ((ElementoRubrica[])Session["RuoloResponsabile"])[0];

                // Recupero del dettaglio del corrispondente
                Ruolo corr = UserManager.getCorrispondenteByCodRubricaIE(
                    this.Page,
                    el.codice,
                    SAAdminTool.DocsPaWR.AddressbookTipoUtente.INTERNO) as Ruolo;

                this.RoleSystemId = corr.idGruppo;
                Session.Remove("RuoloResponsabile");
            }
        }
Beispiel #7
0
        /// <summary>
        /// Validazione dati per l'aggiornamento
        /// </summary>
        /// <param name="elemento"></param>
        private static void ValidateForUpdate(ElementoRubrica elemento)
        {
            Utils.Validator.CheckProperty <int>(elemento, "Id", true, 0);
            Utils.Validator.CheckProperty <string>(elemento, "Codice", true, 255);
            Utils.Validator.CheckProperty <string>(elemento, "Descrizione", true, 255);
            Utils.Validator.CheckProperty <string>(elemento, "Indirizzo", false, 255);
            Utils.Validator.CheckProperty <string>(elemento, "Telefono", false, 20);
            Utils.Validator.CheckProperty <string>(elemento, "Fax", false, 20);

            Utils.Validator.CheckProperty <string>(elemento, "Citta", false, 50);
            Utils.Validator.CheckProperty <string>(elemento, "Cap", false, 5);
            Utils.Validator.CheckProperty <string>(elemento, "Provincia", false, 2);
            Utils.Validator.CheckProperty <string>(elemento, "Nazione", false, 50);
            Utils.Validator.CheckProperty <Tipo>(elemento, "TipoCorrispondente", false, 5);

            // Validazione campi per interoperabilità;
            // sono obbligatori solo se la proprietà interoperante è true
            Utils.Validator.CheckProperty <string>(elemento, "Email", false, 100);
            Utils.Validator.CheckProperty <string>(elemento, "Amministrazione", false, 255);
            Utils.Validator.CheckProperty <string>(elemento, "AOO", false, 255);
            elemento.Urls.ForEach(u => Utils.Validator.CheckUrl(u.Url));

            if (!string.IsNullOrEmpty(elemento.CodiceFiscale))
            {
                if (elemento.CodiceFiscale.Length == 16)
                {
                    Utils.Validator.CheckTaxCode(elemento.CodiceFiscale);
                }
                else
                {
                    Utils.Validator.CheckVatNumber(elemento.CodiceFiscale, Properties.Resources.CodiceFiscaleException);
                }
            }
            if (!string.IsNullOrEmpty(elemento.PartitaIva))
            {
                Utils.Validator.CheckVatNumber(elemento.PartitaIva, Properties.Resources.PartitaIvaException);
            }

            // Validazione indirizzo mail
            //if (!string.IsNullOrEmpty(elemento.Email)) Utils.Validator.CheckMailAddress(elemento.Email);
            elemento.Emails.ForEach(e => Utils.Validator.CheckMailAddress(e.Email));

            Utils.Validator.CheckProperty <string>(elemento, "UtenteCreatore", true, 50);
            Utils.Validator.CheckProperty <DateTime>(elemento, "DataCreazione", true, 0);
            Utils.Validator.CheckProperty <DateTime>(elemento, "DataUltimaModifica", true, 0);
        }
Beispiel #8
0
        private bool filtra_ruoli_utenti_smistamento(SAAdminTool.DocsPaWR.ElementoRubrica er)
        {
            string pcode = null;

            DocsPaWR.Corrispondente rcorr = UserManager.GetCorrispondenteInterno(_page, er.codice, true);
            if (rcorr == null)
            {
                return(false);
            }

            if (er.tipo == "R")
            {
                pcode = ((SAAdminTool.DocsPaWR.Ruolo)rcorr).uo.codiceRubrica;
                if (IsInSmistamento(pcode))
                {
                    return(false);
                }
            }
            else
            {
                DocsPaWR.Ruolo[] ruoli = ((SAAdminTool.DocsPaWR.Utente)rcorr).ruoli;
                if (ruoli == null || ruoli.Length == 0)
                {
                    return(false);
                }

                foreach (Ruolo r in ruoli)
                {
                    DocsPaWR.ElementoRubrica err = new ElementoRubrica();
                    err.codice       = r.codiceRubrica;
                    err.interno      = true;
                    err.tipo         = "R";
                    err.descrizione  = "";
                    err.has_children = false;
                    bool filtra = filtra_ruoli_utenti_smistamento(err);
                    if (filtra)
                    {
                        return(true);
                    }
                }
                return(false);
            }
            bool result = filtra_smistamento(pcode);

            return(result);
        }
Beispiel #9
0
        /// <summary>
        /// Funzione per la risoluzione di un codice corrispondente
        /// </summary>
        /// <param name="code">Codice da risolvere</param>
        /// <param name="searchOnlyRoles">True se bisogna ricercare solo nei ruoli</param>
        /// <param name="callType">Call type da utilizzare</param>
        /// <returns>Array di oggetti con le informazioni sul corrispondenti trovati</returns>
        private ElementoRubrica[] ResolveCode(String code, bool searchOnlyRoles, RubricaCallType callType)
        {
            ElementoRubrica[] corrSearch = null;
            if (!String.IsNullOrEmpty(code))
            {
                ParametriRicercaRubrica qco = new ParametriRicercaRubrica();
                UserManager.setQueryRubricaCaller(ref qco);
                qco.codice            = code.Trim();
                qco.tipoIE            = DocsPAWA.DocsPaWR.AddressbookTipoUtente.INTERNO;
                qco.calltype          = callType;
                qco.caller.IdRegistro = this.ddlRegistry.SelectedValue;

                //cerco su tutti i tipi utente:
                if (ConfigurationManager.AppSettings["LISTE_DISTRIBUZIONE"] != null &&
                    ConfigurationManager.AppSettings["LISTE_DISTRIBUZIONE"] == "1")
                {
                    qco.doListe = true;
                }
                qco.doRuoli = true;
                if (searchOnlyRoles)
                {
                    qco.doUtenti = false;
                    qco.doUo     = false;
                }
                else
                {
                    qco.doUtenti = true;
                    qco.doUo     = true;
                }

                qco.queryCodiceEsatta = true;

                corrSearch = UserManager.getElementiRubrica(this.Page, qco);


                // Se il calltype è relativo a ruolo da utilizzare per la sostituzione,
                // vengono esclusi i corrispondenti inibiti
                if (callType == RubricaCallType.CALLTYPE_REPLACE_ROLE && corrSearch != null && corrSearch.Length == 1 && corrSearch[0].disabledTrasm)
                {
                    corrSearch = new ElementoRubrica[0];
                }
            }

            return(corrSearch);
        }
Beispiel #10
0
        /// <summary>
        /// Validazione dati per l'inserimento
        /// </summary>
        /// <param name="elemento"></param>
        private static void ValidateForInsert(ElementoRubrica elemento)
        {
            Utils.Validator.CheckProperty <string>(elemento, "Codice", true, 255);
            Utils.Validator.CheckProperty <string>(elemento, "Descrizione", true, 255);
            Utils.Validator.CheckProperty <string>(elemento, "Indirizzo", false, 255);
            Utils.Validator.CheckProperty <string>(elemento, "Telefono", false, 20);
            Utils.Validator.CheckProperty <string>(elemento, "Fax", false, 20);
            Utils.Validator.CheckProperty <string>(elemento, "Citta", false, 50);
            Utils.Validator.CheckProperty <string>(elemento, "Cap", false, 5);
            Utils.Validator.CheckProperty <string>(elemento, "Provincia", false, 2);
            Utils.Validator.CheckProperty <string>(elemento, "Nazione", false, 50);
            Utils.Validator.CheckProperty <Tipo>(elemento, "TipoCorrispondente", false, 5);

            // Validazione campi per interoperabilità
            Utils.Validator.CheckProperty <string>(elemento, "Email", false, 100);
            Utils.Validator.CheckProperty <string>(elemento, "Amministrazione", false, 255);
            Utils.Validator.CheckProperty <string>(elemento, "AOO", false, 255);
            elemento.Urls.ForEach(u => Utils.Validator.CheckUrl(u.Url));
            if (!string.IsNullOrEmpty(elemento.CodiceFiscale))
            {
                if (elemento.CodiceFiscale.Length == 16)
                {
                    Utils.Validator.CheckTaxCode(elemento.CodiceFiscale);
                }
                else
                {
                    Utils.Validator.CheckVatNumber(elemento.CodiceFiscale, Properties.Resources.CodiceFiscaleException);
                }
            }

            if (!string.IsNullOrEmpty(elemento.PartitaIva))
            {
                Utils.Validator.CheckVatNumber(elemento.PartitaIva, Properties.Resources.PartitaIvaException);
            }

            // Validazione indirizzo mail
            //if (!string.IsNullOrEmpty(elemento.Email)) Utils.Validator.CheckMailAddress(elemento.Email);
            elemento.Emails.ForEach(e => Utils.Validator.CheckMailAddress(e.Email));

            // Verifica se il codice non è già presente
            if (Contains(elemento.Codice))
            {
                throw new RubricaException(string.Format(Properties.Resources.ElementoRubricaAlreadyExistException, elemento.Codice));
            }
        }
Beispiel #11
0
        /// <summary>
        /// Rimozione di un oggetto in tabella ElementiRubrica
        /// </summary>
        /// <param name="id"></param>
        private static void InternalDelete(ElementoRubrica elemento)
        {
            Dpa.DataAccess.Database db = RubricaDatabase.CreateDatabase();

            using (Dpa.DataAccess.DBCommandWrapper cw = db.GetStoredProcCommandWrapper(RubricaDatabase.GetSpNameForPackage(SP_DELETE)))
            {
                cw.AddInParameter("pId", DbType.Int32, elemento.Id);
                cw.AddInParameter("pDataUltimaModifica", DbType.DateTime, elemento.DataUltimaModifica);

                Utils.Log.Write(cw.Command);

                db.ExecuteNonQuery(cw);

                if (cw.RowsAffected == 0)
                {
                    throw new RubricaException(Properties.Resources.ConcurrencyException);
                }
            }
        }
Beispiel #12
0
        /// <summary>
        /// Caricamento dati elemento rubrica
        /// </summary>
        /// <param name="elemento"></param>
        protected void FetchDetail(ElementoRubrica elemento)
        {
            EnableInsertMail(elemento);
            this.txtCodice.Text             = elemento.Codice;
            this.txtDescrizione.Text        = elemento.Descrizione;
            this.txtTelefono.Text           = elemento.Telefono;
            this.txtFax.Text                = elemento.Fax;
            this.txtCodiceFiscale.Text      = elemento.CodiceFiscale;
            this.txtPartitaIva.Text         = elemento.PartitaIva;
            this.txtCap.Text                = elemento.Cap;
            this.txtIndirizzo.Text          = elemento.Indirizzo;
            this.txtCitta.Text              = elemento.Citta;
            this.txtNazione.Text            = elemento.Nazione;
            this.txtProvincia.Text          = elemento.Provincia;
            this.txtAmministrazione.Text    = elemento.Amministrazione;
            this.txtAOO.Text                = elemento.AOO;
            this.txtUrl.Text                = elemento.Urls != null && elemento.Urls.Length > 0 ? elemento.Urls[0].Url : String.Empty;
            this.ddlCorrType.SelectedValue  = elemento.TipoCorrispondente.ToString();
            this.txtEmail.Text              = string.Empty;
            this.txtNote.Text               = string.Empty;
            this.txtCodice.Enabled          = Convert.ToBoolean(ViewState["readOnlyMail"]) ? false : true;
            this.txtDescrizione.Enabled     = Convert.ToBoolean(ViewState["readOnlyMail"]) ? false : true;
            this.txtTelefono.Enabled        = Convert.ToBoolean(ViewState["readOnlyMail"]) ? false : true;
            this.txtFax.Enabled             = Convert.ToBoolean(ViewState["readOnlyMail"]) ? false : true;
            this.txtCodiceFiscale.Enabled   = Convert.ToBoolean(ViewState["readOnlyMail"]) ? false : true;
            this.txtPartitaIva.Enabled      = Convert.ToBoolean(ViewState["readOnlyMail"]) ? false : true;
            this.txtCap.Enabled             = Convert.ToBoolean(ViewState["readOnlyMail"]) ? false : true;
            this.txtIndirizzo.Enabled       = Convert.ToBoolean(ViewState["readOnlyMail"]) ? false : true;
            this.txtCitta.Enabled           = Convert.ToBoolean(ViewState["readOnlyMail"]) ? false : true;
            this.txtNazione.Enabled         = Convert.ToBoolean(ViewState["readOnlyMail"]) ? false : true;
            this.txtProvincia.Enabled       = Convert.ToBoolean(ViewState["readOnlyMail"]) ? false : true;
            this.txtAmministrazione.Enabled = Convert.ToBoolean(ViewState["readOnlyMail"]) ? false : true;
            this.txtAOO.Enabled             = Convert.ToBoolean(ViewState["readOnlyMail"]) ? false : true;
            this.txtUrl.Enabled             = Convert.ToBoolean(ViewState["readOnlyMail"]) ? false : true;
            this.ddlCorrType.Enabled        = Convert.ToBoolean(ViewState["readOnlyMail"]) ? false : true;
            txtEmail.Enabled                = Convert.ToBoolean(ViewState["readOnlyMail"]) ? false : true;
            txtNote.Enabled            = Convert.ToBoolean(ViewState["readOnlyMail"]) ? false : true;
            imgAggiungiCasella.Enabled = Convert.ToBoolean(ViewState["readOnlyMail"]) ? false : true;
            this.btnSave.Enabled       = Convert.ToBoolean(ViewState["readOnlyMail"]) ? false : true;

            BindGridViewCaselle(elemento);
        }
Beispiel #13
0
        /// <summary>
        /// Metodo per il caricamento e la visualizzazione delle informazioni di aggiornamento
        /// relative ad un RF
        /// </summary>
        /// <param name="idRf">Id dell'RF</param>
        private void ShowData(String idRf)
        {
            SessionManager sessionMng = new SessionManager();

            ElementoRubrica elemento = DocsPAWA.RubricaComune.RubricaServices.GetElementoRubricaRF(sessionMng.getUserAmmSession(), idRf);

            this.ClearData();

            if (elemento != null)
            {
                const string format = "dd/MM/yyyy HH:mm:ss";

                // L'uo è già presente in rubrica comune come elemento di interesse generale;
                // viene mostrata la data di ultima modifica e la data di creazione
                this.lblCodiceRC.Text             = elemento.Codice;
                this.lblDescrizioneRC.Text        = elemento.Descrizione;
                this.lblDataCreazioneRC.Text      = elemento.DataCreazione.ToString(format);
                this.lblDataUltimaModificaRC.Text = elemento.DataUltimaModifica.ToString(format);
            }
        }
Beispiel #14
0
        /// <summary>
        /// Metodo per l'aggiornamento delle caselle email associate al corrispondente
        /// </summary>
        /// <param name="elemento">Elemento di cui aggiornare le caselle</param>
        /// <param name="multicasella">Flag utilizzato per indicare se bisogna gestire il corrispondente in modalità multicasella</param>
        /// <exception cref="RubricaException">Sollevata in caso di problemi durante la rimozione o il salvataggio delle email</exception>
        private static void UpdateEmails(ElementoRubrica elemento, bool multicasella)
        {
            // Email da salvare
            EMailList emails = null;

            // Aggiornamento delle emails all'utente
            // Nel caso di multicasella, vengono cancellate le email presenti
            // e quindi vengono salvate le nuove mails
            if (multicasella)
            {
                emails = elemento.Emails;

                // Se non ci sono caselle di posta preferite, viene impostata come preferita la prima
                // mail disponibile
                emails.SetFirstMailAsPreferred();
            }
            else
            {
                // Recupero delle caselle associate al corrispondente
                emails = InternalGetEmails(elemento.Id);

                // Nel caso monocasella, se l'attributo mail è valorizzato, vengono caricate le email
                // associate al corrispondente e quindi viene aggiunta la nuova mail impostandola come
                // preferita altrimenti viene cancellata la mail preferita e, se ne sono disponibili altre,
                // viene impostata come preferita la prima disponibile, quindi si procede al salvataggio delle
                // emails
                if (String.IsNullOrEmpty(elemento.Email))
                {
                    emails.RemovePreferred();
                }
                else
                {
                    emails.Add(new EmailInfo(elemento.Email, true));
                }
            }

            // Rimozione delle vecchie mail memorizzate e memorizzazione delle nuove
            InternalRemoveEmails(elemento.Id);

            emails.ForEach(e => InternalInsertEmail(e, elemento.Id));
        }
Beispiel #15
0
        public bool execute(ElementoRubrica er)
        {
            if (!er.interno)
            {
                return(true);
            }

            if (er.tipo == "U")
            {
                return(filtra_smistamento(er.codice));
            }
            else
            if (er.tipo == "R" || er.tipo == "P")
            {
                return(filtra_ruoli_utenti_smistamento(er));
            }
            else
            {
                return(true);
            }
        }
Beispiel #16
0
        protected void btnRubricaRuoloResp_Click(object sender, EventArgs e)
        {
            // Se è stato selezionato un corrispondente, ne vengono visualizzate le informazioni
            if (Session["RuoloResponsabile"] != null && Session["RuoloResponsabile"] is ElementoRubrica[])
            {
                ElementoRubrica el = ((ElementoRubrica[])Session["RuoloResponsabile"])[0];

                // Recupero del dettaglio del corrispondente
                Ruolo corr = UserManager.getCorrispondenteByCodRubricaIE(
                    this.Page,
                    el.codice,
                    DocsPAWA.DocsPaWR.AddressbookTipoUtente.INTERNO) as Ruolo;

                this.txtCodRuoloResp.Text  = corr.codiceRubrica;
                this.txtDescRuoloResp.Text = corr.descrizione;
                this.id_corr_resp.Value    = corr.idGruppo;

                Session.Remove("RuoloResponsabile");

                this.UpdatePanelRoleResp.Update();
            }
        }
Beispiel #17
0
        /// <summary>
        /// Repreimento oggetto DataObject
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        private static ElementoRubrica InternalGet(int id)
        {
            ElementoRubrica elemento = null;

            try
            {
                Dpa.DataAccess.Database db = RubricaDatabase.CreateDatabase();

                using (Dpa.DataAccess.DBCommandWrapper cw = db.GetStoredProcCommandWrapper(RubricaDatabase.GetSpNameForPackage(SP_GET)))
                {
                    cw.AddInParameter("pId", DbType.Int32, id);

                    Utils.Log.Write(cw.Command);

                    using (IDataReader reader = db.ExecuteReader(cw))
                        if (reader.Read())
                        {
                            elemento = CreateElementoRubrica(reader, true);
                        }
                }

                if (elemento == null)
                {
                    throw new ApplicationException(Properties.Resources.DataNotFoundException);
                }
            }
            catch (Exception ex)
            {
                RubricaException exception = new RubricaException(string.Format(Properties.Resources.GetElementoRubricaException, id), ex);

                Utils.Log.Write(exception);

                throw exception;
            }

            return(elemento);
        }
Beispiel #18
0
        /// <summary>
        /// Azione di save dei dati di un elemento
        /// </summary>
        protected virtual void SaveAction()
        {
            ElementoRubrica elemento = null;

            if (this.InsertMode)
            {
                elemento = new ElementoRubrica();
            }
            else
            {
                elemento = this.GetElementoRubricaSelezionato();
            }

            // Aggiornamento attributi oggetto
            if (!this.RefreshElementoRubrica(elemento))
            {
                return;
            }
            if (this.InsertMode)
            {
                // Inserimento
                elemento = this.RubricaServices.Insert(elemento);

                // Impostazione della prima pagina come pagina corrente
                this.grdElementiRubrica.CurrentPageIndex = 0;

                this.InsertMode = false;
            }
            else
            {
                // Modifica
                elemento = this.RubricaServices.Update(elemento);
            }

            // Caricamento dati pagina corrente
            this.FetchList();
        }
Beispiel #19
0
        /// <summary>
        /// Funzione per ricerca e sostituzione di un ruolo con un altro in determinati ruoli
        /// </summary>
        /// <param name="roleToReplace">Ruolo da restituire</param>
        /// <param name="newRole">Ruolo con cui sostituire</param>
        /// <param name="operation">Operazione da compiere</param>
        /// <param name="searchFilters">Filtri di ricerca</param>
        /// <param name="userInfo">Informazioni sull'utente</param>
        /// <param name="isAdmin">True se l'utente richiedente è un amministratore</param>
        /// <param name="models">Collection dei modelli</param>
        /// <param name="copyNotes">True se bisogna copiare le note</param>
        /// <returns>Risultato dell'elaborazione</returns>
        public static FindAndReplaceResponse FindAndReplaceRolesInModelliTrasmissione(ElementoRubrica roleToReplace, ElementoRubrica newRole, FindAndReplaceEnum operation, FiltroRicerca[] searchFilters, InfoUtente userInfo, bool isAdmin, ModelloTrasmissioneSearchResult[] models, bool copyNotes)
        {
            // Costruzione della request
            FindAndReplaceRequest request = new FindAndReplaceRequest()
            {
                NewRole         = newRole,
                Operation       = operation,
                RoleToReplace   = roleToReplace,
                SearchFilters   = searchFilters,
                UserInfo        = userInfo,
                IsAdministrator = isAdmin,
                Models          = models,
                CopyNotes       = copyNotes
            };

            // Esecuzione operazione
            FindAndReplaceResponse response = docsPaWS.FindAndReplaceRoleInModelliTrasmissione(request);

            // Restituzione della response
            return(response);
        }
Beispiel #20
0
        /// <summary>
        /// Creazione oggetto ElementoRubrica
        /// </summary>
        /// <param name="reader"></param>
        /// <param name="datiAggiuntivi"></param>
        /// <returns></returns>
        private static ElementoRubrica CreateElementoRubrica(IDataReader reader, bool datiAggiuntivi)
        {
            object [] array = new object[reader.FieldCount];
            reader.GetValues(array);
            ElementoRubrica elemento = new ElementoRubrica
            {
                Id                 = Convert.ToInt32(Dpa.DataAccess.Helper.DataReaderHelper.GetValue <object>(reader, ID_PROPERTY, false)),
                Codice             = Dpa.DataAccess.Helper.DataReaderHelper.GetValue <string>(reader, CODICE_PROPERTY, false),
                Descrizione        = Dpa.DataAccess.Helper.DataReaderHelper.GetValue <string>(reader, DESCRIZIONE_PROPERTY, false),
                Indirizzo          = Dpa.DataAccess.Helper.DataReaderHelper.GetValue <string>(reader, INDIRIZZO_PROPERTY, true, string.Empty),
                Citta              = Dpa.DataAccess.Helper.DataReaderHelper.GetValue <string>(reader, CITTA_PROPERTY, true, string.Empty),
                Cap                = Dpa.DataAccess.Helper.DataReaderHelper.GetValue <string>(reader, CAP_PROPERTY, true, string.Empty),
                Provincia          = Dpa.DataAccess.Helper.DataReaderHelper.GetValue <string>(reader, PROVINCIA_PROPERTY, true, string.Empty),
                Nazione            = Dpa.DataAccess.Helper.DataReaderHelper.GetValue <string>(reader, NAZIONE_PROPERTY, true, string.Empty),
                Telefono           = Dpa.DataAccess.Helper.DataReaderHelper.GetValue <string>(reader, TELEFONO_PROPERTY, true, string.Empty),
                Fax                = Dpa.DataAccess.Helper.DataReaderHelper.GetValue <string>(reader, FAX_PROPERTY, true, string.Empty),
                Amministrazione    = Dpa.DataAccess.Helper.DataReaderHelper.GetValue <string>(reader, AMMINISTRAZIONE_PROPERTY, true, string.Empty),
                AOO                = Dpa.DataAccess.Helper.DataReaderHelper.GetValue <string>(reader, AOO_PROPERTY, true, string.Empty),
                UtenteCreatore     = Dpa.DataAccess.Helper.DataReaderHelper.GetValue <string>(reader, UTENTECREATORE_PROPERTY, false),
                DataCreazione      = Dpa.DataAccess.Helper.DataReaderHelper.GetValue <DateTime>(reader, DATACREAZIONE_PROPERTY, false),
                DataUltimaModifica = Dpa.DataAccess.Helper.DataReaderHelper.GetValue <DateTime>(reader, DATAULTIMAMODIFICA_PROPERTY, false),
                TipoCorrispondente = (Tipo)Enum.Parse(typeof(Tipo), Dpa.DataAccess.Helper.DataReaderHelper.GetValue <string>(reader, TIPOCORRISPONDENTE_PROPERTY, false)),
                CHA_Pubblicato     = Dpa.DataAccess.Helper.DataReaderHelper.GetValue <string>(reader, PUBBLICATO_PROPERTY, true),
                CodiceFiscale      = Dpa.DataAccess.Helper.DataReaderHelper.GetValue <string>(reader, CODICE_FISCALE_PROPERTY, true, string.Empty),
                PartitaIva         = Dpa.DataAccess.Helper.DataReaderHelper.GetValue <string>(reader, PARTITA_IVA_PROPERTY, true, string.Empty),
            };

            // Attualmente l'url è uno solo
            String url = Dpa.DataAccess.Helper.DataReaderHelper.GetValue <string>(reader, URL_PROPERTY, true);

            if (!String.IsNullOrEmpty(url))
            {
                elemento.Urls.Add(new UrlInfo(url));
            }

            elemento.Emails = InternalGetEmails(elemento.Id);
            EmailInfo prefMail = elemento.Emails.GetPreferredMail();

            if (prefMail != null)
            {
                elemento.Email = prefMail.Email;
            }
            else
            {
                elemento.Email = String.Empty;
            }

            bool amm    = false;
            bool aoo    = false;
            bool emails = false;
            bool urls   = false;


            if (elemento != null && !string.IsNullOrEmpty(elemento.Amministrazione))
            {
                amm = true;
            }

            if (elemento != null && !string.IsNullOrEmpty(elemento.AOO))
            {
                aoo = true;
            }


            if (elemento != null && elemento.Emails != null && elemento.Emails.Count > 0)
            {
                emails = true;
            }

            if (elemento.Urls != null && elemento.Urls.Count > 0)
            {
                urls = true;
            }

            if (amm && aoo && urls)
            {
                elemento.Canale = "INTEROPERABILITA PITRE";
            }
            else
            if (amm && aoo && emails && !urls)
            {
                elemento.Canale = "INTEROPERABILITA";
            }
            else
            if (emails && !urls && !(amm && aoo))
            {
                elemento.Canale = "MAIL";
            }
            else
            if (!emails && !urls && !(amm && aoo))
            {
                elemento.Canale = "LETTERA";
            }


            return(elemento);
        }
Beispiel #21
0
        /// <summary>
        /// Aggiornamento oggetto in tabella ElementiRubrica
        /// </summary>
        /// <param name="elemento"></param>
        /// <param name="multicasella">
        ///     Flag utilizzato per indicare se bisogna gestire il corrispondente come corrispondente multicasella.
        ///     Se un corrispondente è multicasella, la gestione avviene esclusivamente prendendo in considerazione
        ///     la lista delle caselle email altrimenti viene considerata come casella quella passata attraverso
        ///     la valorizzazione della proprietà Email.
        ///     Nel caso monocasella, se l'attributo Mail dell'oggetto ElementoRubrica è valorizzato, viene aggiunta
        ///     (se non esiste) una nuova casella preferita al corrispondente, se viene passato nullo, viene cancellata
        ///     la casella preferita e, se presenti altre email associate al corrispondente, viene impostata
        ///     come preferita la prima casella disponibile.
        /// </param>
        /// <returns></returns>
        private static ElementoRubrica InternalUpdate(ElementoRubrica elemento, bool multicasella)
        {
            Dpa.DataAccess.Database db = RubricaDatabase.CreateDatabase();

            DateTime dataUltimaModifica = DateTime.Now;

            using (IDbConnection connection = db.GetConnection())
            {
                connection.Open();

                using (IDbTransaction transaction = connection.BeginTransaction())
                {
                    using (Dpa.DataAccess.DBCommandWrapper cw = db.GetStoredProcCommandWrapper(RubricaDatabase.GetSpNameForPackage(SP_UPDATE)))
                    {
                        cw.AddInParameter("pId", DbType.Int32, elemento.Id);
                        cw.AddInParameter("pDescrizione", DbType.String, elemento.Descrizione);
                        cw.AddInParameter("pIndirizzo", DbType.String, elemento.Indirizzo);
                        cw.AddInParameter("pCitta", DbType.String, elemento.Citta);
                        cw.AddInParameter("pCap", DbType.String, elemento.Cap);
                        cw.AddInParameter("pProvincia", DbType.String, elemento.Provincia);
                        cw.AddInParameter("pNazione", DbType.String, elemento.Nazione);
                        cw.AddInParameter("pTelefono", DbType.String, elemento.Telefono);
                        cw.AddInParameter("pFax", DbType.String, elemento.Fax);
                        //cw.AddInParameter("pEmail", DbType.String, elemento.Email);
                        cw.AddInParameter("pAOO", DbType.String, elemento.AOO);
                        cw.AddInParameter("pDataUltimaModifica", DbType.DateTime, dataUltimaModifica);
                        cw.AddInParameter("pOldDataUltimaModifica", DbType.DateTime, elemento.DataUltimaModifica);
                        cw.AddInParameter("pTipoCorrispondente", DbType.String, elemento.TipoCorrispondente.ToString());
                        cw.AddInParameter("pAmministrazione", DbType.String, elemento.Amministrazione);

                        if (elemento.Urls.Count > 0)
                        {
                            cw.AddInParameter("pUrl", DbType.String, elemento.Urls[0].Url);
                        }
                        else
                        {
                            cw.AddInParameter("pUrl", DbType.String, String.Empty);
                        }

                        if (string.IsNullOrEmpty(elemento.CHA_Pubblicato))
                        {
                            elemento.CHA_Pubblicato = "0";
                        }
                        cw.AddInParameter("pChaPubblica", DbType.String, elemento.CHA_Pubblicato);

                        //Emanuela: aggiunta campi partita iva e codice fiscale
                        cw.AddInParameter("pCodiceFiscale", DbType.String, elemento.CodiceFiscale);
                        cw.AddInParameter("pPartitaIva", DbType.String, elemento.PartitaIva);


                        Utils.Log.Write(cw.Command);

                        db.ExecuteNonQuery(cw);

                        if (cw.RowsAffected == 0)
                        {
                            throw new RubricaException(Properties.Resources.ConcurrencyException);
                        }
                        else
                        {
                            elemento.DataUltimaModifica = dataUltimaModifica;

                            // Aggiornamento delle emails
                            UpdateEmails(elemento, multicasella);

                            transaction.Commit();
                        }
                    }
                }
            }

            return(elemento);
        }
Beispiel #22
0
        /// <summary>
        /// Funzione per la ricerca di un corrispondente a partire dal suo codice.
        /// </summary>
        /// <param name="callType">Il calltype</param>
        /// <param name="corrCode">Il codice del corrispondente da ricercare</param>
        /// <param name="role">Il ruolo con cui è stata lanciata la procedura</param>
        /// <param name="userInfo">Le informazioni sull'utente che ha lanciato la procedura</param>
        /// <param name="registrySyd">L'id del registro</param>
        /// <param name="rfSyd">L'id dell'RF</param>
        /// <param name="isEnabledSmistamento">True se è abilitato lo smistamento</param>
        /// <param name="userTypeForProject">La tipologia di utente da ricercare (Interna/Esterna/Globale). Questo parametro viene preso in considerazione solo nel caso di campi custom di tipo Corrispondente.</param>
        /// <returns>Il corrispondente individuato</returns>
        public static Corrispondente GetCorrispondenteByCode(
            ParametriRicercaRubrica.CallType callType,
            string corrCode,
            Ruolo role,
            InfoUtente userInfo,
            string registrySyd,
            string rfSyd,
            bool isEnabledSmistamento,
            TipoUtente userTypeForProject)
        {
            #region Dichiarazione Variabili

            // L'oggetto utilizzato per memorizzare i parametri di ricerca
            ParametriRicercaRubrica searchParameters;

            // L'oggetto per memorizzare le impostazioni sullo smistamento
            SmistamentoRubrica smistamentoRubrica;

            // L'oggetto per l'effettuazione delle ricerche nella rubrica
            DPA3_RubricaSearchAgent corrSearcher;

            // La lista degli elementi resttiuiti dalla ricerca
            ArrayList corrList;

            // Il corrispondente da restituire
            Corrispondente toReturn = null;

            #endregion

            #region Impostazione parametri di ricerca

            // Creazione oggetto per la memorizzazione dei parametri di ricerca
            searchParameters = new ParametriRicercaRubrica();

            // Impostazione del call type
            searchParameters.calltype = callType;

            // Impostazione del codice da ricercare
            searchParameters.codice = corrCode;

            // Impostazione del flag per la ricerca del codice esatta
            searchParameters.queryCodiceEsatta = true;

            // Creazione del caller
            searchParameters.caller = new ParametriRicercaRubrica.CallerIdentity();

            // Impostazione del calltype
            searchParameters.caller.IdRuolo = role.systemId;

            // Impostazione dell'id utente
            searchParameters.caller.IdUtente = userInfo.idPeople;

            // Impostazione dell'id registro
            searchParameters.caller.IdRegistro = registrySyd;

            // Impostazione del filtro registro per la ricerca
            searchParameters.caller.filtroRegistroPerRicerca = registrySyd;

            // La ricerca va effettuata su Uffici, Utenti, Ruoli, RF
            searchParameters.doUo     = true;
            searchParameters.doUtenti = true;
            searchParameters.doRuoli  = true;
            searchParameters.doRF     = true;
            bool abilitazioneRubricaComune = BusinessLogic.RubricaComune.Configurazioni.GetConfigurazioni(userInfo).GestioneAbilitata;
            searchParameters.doRubricaComune = abilitazioneRubricaComune;
            #endregion

            #region Impostazione parametri per smistamento

            // Creazione oggetto per parametri smistamento
            smistamentoRubrica = new SmistamentoRubrica();

            // Abilitazione smistamento
            smistamentoRubrica.smistamento = isEnabledSmistamento ? "1" : "0";

            // Impostazione calltype
            smistamentoRubrica.calltype = callType;

            // Impostazione informazioni sull'utente
            smistamentoRubrica.infoUt = userInfo;

            // Impostazione ruolo
            smistamentoRubrica.ruoloProt = role;

            // Impostazione dell'id del registro
            smistamentoRubrica.idRegistro = registrySyd;

            #endregion

            #region Impostazione parametri dipendenti dal contesto

            // Impostazione parametri dipendenti dal contesto
            switch (callType)
            {
            case ParametriRicercaRubrica.CallType.CALLTYPE_PROTO_IN:
                if (!String.IsNullOrEmpty(rfSyd))
                {
                    searchParameters.caller.filtroRegistroPerRicerca += ", " + rfSyd;
                }
                searchParameters.doRubricaComune         = abilitazioneRubricaComune;
                searchParameters.doRubricaComune         = true;
                smistamentoRubrica.daFiltrareSmistamento = "0";
                searchParameters.tipoIE = TipoUtente.GLOBALE;

                break;

            case ParametriRicercaRubrica.CallType.CALLTYPE_PROTO_OUT_MITT:
                smistamentoRubrica.daFiltrareSmistamento = "0";
                searchParameters.tipoIE = TipoUtente.INTERNO;

                break;

            case ParametriRicercaRubrica.CallType.CALLTYPE_PROTO_OUT:
                searchParameters.doListe         = true;
                searchParameters.doRubricaComune = abilitazioneRubricaComune;
                if (!String.IsNullOrEmpty(rfSyd))
                {
                    searchParameters.caller.filtroRegistroPerRicerca += ", " + rfSyd;
                }

                smistamentoRubrica.daFiltrareSmistamento = "1";
                searchParameters.tipoIE = TipoUtente.GLOBALE;

                break;

            case ParametriRicercaRubrica.CallType.CALLTYPE_PROTO_INT_MITT:
                smistamentoRubrica.daFiltrareSmistamento = "0";
                searchParameters.tipoIE = TipoUtente.INTERNO;

                break;

            case ParametriRicercaRubrica.CallType.CALLTYPE_PROTO_INT_DEST:
                searchParameters.doListe = true;
                smistamentoRubrica.daFiltrareSmistamento = "1";
                searchParameters.tipoIE = TipoUtente.INTERNO;

                break;

            case ParametriRicercaRubrica.CallType.CALLTYPE_CORR_EST:
                if (!String.IsNullOrEmpty(rfSyd))
                {
                    searchParameters.caller.filtroRegistroPerRicerca += ", " + rfSyd;
                }
                searchParameters.doRubricaComune         = true;
                searchParameters.tipoIE                  = userTypeForProject;
                smistamentoRubrica.daFiltrareSmistamento = "0";

                break;
            }

            #endregion

            #region Esecuzione Ricerca

            // Creazione oggetto per la ricerca
            corrSearcher = new DPA3_RubricaSearchAgent(userInfo);

            // Esecuzione della ricerca
            corrList = corrSearcher.Search(searchParameters, smistamentoRubrica);

            #endregion

            #region Gestione risultato

            // Se non sono stati restituiti corrispondenti eccezione
            if (corrList == null || corrList.Count == 0)
            {
                throw new Exception(String.Format(
                                        "Nessun corrispondente rilevato con il codice {0}",
                                        corrCode));
            }

            // Se sono stati restituiti più corrispondenti, ambiguità
            if (corrList.Count > 1)
            {
                throw new Exception(String.Format(
                                        "La ricerca del corrispondente con codice {0} ha restituito {1} risultati. Provare a restringere il campo di ricerca specificando un RF.",
                                        corrCode, corrList.Count));
            }

            #endregion

            // Reperimento dei dati sul corrispondente
            try
            {
                ElementoRubrica temp = (ElementoRubrica)corrList[0];
                if (temp.isRubricaComune)
                {
                    Corrispondente tempCorr = BusinessLogic.RubricaComune.RubricaServices.UpdateCorrispondente(userInfo, temp.codice);
                    toReturn = tempCorr;
                }
                else
                {
                    toReturn = UserManager.getCorrispondenteBySystemID(temp.systemId);
                }
            }
            catch (Exception e)
            {
                throw new ImportException(
                          String.Format(
                              "Errore durante il reperimento dei dati sul corrispondente con codice '{0}'",
                              corrCode));
            }

            // Restituzione del corrispondente
            return(toReturn);
        }
        protected void TxtCodeCorrespondentCustom_OnTextChanged(object sender, EventArgs e)
        {
            try {
                if (!string.IsNullOrEmpty(this.PageCaller) && this.PageCaller.Equals("Popup"))
                {
                    ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "function", "reallowOp();", true);
                }

                ElementoRubrica[] listaCorr = null;
                Corrispondente    corr      = null;

                if (!string.IsNullOrEmpty(this.TxtCodeCorrespondentCustomValue.Text))
                {
                    switch (typeChooseCorrespondent)
                    {
                    case "INTERNI":
                        if (SearchCorrespondentIntExtWithDisabled && this.ChkStoryCustomCorrespondent.Checked)
                        {
                            this.CalltypeCorrespondentCustom = RubricaCallType.CALLTYPE_CORR_INT_CON_DISABILITATI;
                        }
                        else
                        {
                            this.CalltypeCorrespondentCustom = RubricaCallType.CALLTYPE_CORR_INT;
                        }
                        break;

                    case "ESTERNI":
                        this.CalltypeCorrespondentCustom = RubricaCallType.CALLTYPE_CORR_EST;
                        break;

                    case "INTERNI/ESTERNI":
                        if (SearchCorrespondentIntExtWithDisabled && this.ChkStoryCustomCorrespondent.Checked)
                        {
                            this.CalltypeCorrespondentCustom = RubricaCallType.CALLTYPE_CORR_INT_EST_CON_DISABILITATI;
                        }
                        else
                        {
                            this.CalltypeCorrespondentCustom = RubricaCallType.CALLTYPE_CORR_INT_EST;
                        }
                        break;

                    case "0":
                        if (SearchCorrespondentIntExtWithDisabled && this.ChkStoryCustomCorrespondent.Checked)
                        {
                            this.CalltypeCorrespondentCustom = RubricaCallType.CALLTYPE_CORR_INT_EST_CON_DISABILITATI;
                        }
                        else
                        {
                            this.CalltypeCorrespondentCustom = RubricaCallType.CALLTYPE_CORR_INT_EST;
                        }
                        break;

                    case "MISSING_ROLES":
                        this.CalltypeCorrespondentCustom = RubricaCallType.CALLTYPE_CORR_INT_NO_UO;
                        break;
                    }

                    if (this.ChooseMultipleCorrespondent == null)
                    {
                        listaCorr = UIManager.AddressBookManager.getElementiRubricaMultipli(this.TxtCodeCorrespondentCustomValue.Text, this.CalltypeCorrespondentCustom, true);

                        if (listaCorr == null || (listaCorr != null && listaCorr.Length == 0))
                        {
                            corr = null;
                            this.IdCorrespondentCustomHidden.Value           = string.Empty;
                            this.TxtCodeCorrespondentCustomValue.Text        = string.Empty;
                            this.TxtDescriptionCorrespondentCustomValue.Text = string.Empty;
                            string msgDesc = "WarningDocumentCorrNotFound";
                            //this.UpPnlCorrespondentCustom.Update();

                            ScriptManager.RegisterStartupScript(this, this.GetType(), "ajaxDialogModal", "if (parent.fra_main) {parent.fra_main.ajaxDialogModal('" + msgDesc.Replace("'", @"\'") + "', 'warning', '');} else {parent.ajaxDialogModal('" + msgDesc.Replace("'", @"\'") + "', 'warning', '');}", true);
                        }
                        else
                        {
                            if (listaCorr != null && listaCorr.Length > 1)
                            {
                                if (!string.IsNullOrEmpty(SelectedCustomCorrespondentIndex))
                                {
                                    int             index = Convert.ToInt32(SelectedCustomCorrespondentIndex);
                                    ElementoRubrica el    = listaCorr[index];
                                    if (!string.IsNullOrEmpty(el.systemId))
                                    {
                                        corr = UIManager.AddressBookManager.GetCorrespondentBySystemId(el.systemId);
                                    }
                                    else
                                    {
                                        corr = UIManager.AddressBookManager.getCorrispondenteByCodRubricaRubricaComune(el.codice);
                                    }
                                    if (corr != null)
                                    {
                                        this.IdCorrespondentCustomHidden.Value           = corr.systemId;
                                        this.TxtCodeCorrespondentCustomValue.Text        = corr.codiceRubrica;
                                        this.TxtDescriptionCorrespondentCustomValue.Text = corr.descrizione;
                                    }
                                    else
                                    {
                                        corr = null;
                                        this.IdCorrespondentCustomHidden.Value           = string.Empty;
                                        this.TxtCodeCorrespondentCustomValue.Text        = string.Empty;
                                        this.TxtDescriptionCorrespondentCustomValue.Text = string.Empty;
                                    }

                                    this.SelectedCustomCorrespondentIndex = string.Empty;
                                }
                                else
                                {
                                    corr           = null;
                                    this.FoundCorr = listaCorr;
                                    this.TypeChooseCorrespondent = this.TypeCorrespondentCustom.ToString();
                                    this.TypeRecord = "custom";
                                    this.IdCustomObjectCustomCorrespondent = this.ID;
                                    ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "chooseCorrespondent", "ajaxModalPopupChooseCorrespondent();", true);
                                    return;
                                }
                            }
                            else
                            {
                                if (listaCorr != null && listaCorr.Length == 1) // && !this.cbx_storicizzato.Checked)
                                {
                                    DocsPaWR.ElementoRubrica er = listaCorr[0];

                                    if (!string.IsNullOrEmpty(er.systemId))
                                    {
                                        corr = UIManager.AddressBookManager.GetCorrespondentBySystemId(er.systemId);
                                    }
                                    else
                                    {
                                        corr = UIManager.AddressBookManager.getCorrispondenteByCodRubricaRubricaComune(er.codice);
                                    }

                                    if (corr != null)
                                    {
                                        this.IdCorrespondentCustomHidden.Value           = corr.systemId;
                                        this.TxtCodeCorrespondentCustomValue.Text        = corr.codiceRubrica;
                                        this.TxtDescriptionCorrespondentCustomValue.Text = corr.descrizione;
                                    }
                                    else
                                    {
                                        corr = null;
                                        this.IdCorrespondentCustomHidden.Value           = string.Empty;
                                        this.TxtCodeCorrespondentCustomValue.Text        = string.Empty;
                                        this.TxtDescriptionCorrespondentCustomValue.Text = string.Empty;
                                    }
                                }
                            }
                        }
                    }
                    else
                    {
                        if (this.IdCustomObjectCustomCorrespondent == this.ID)
                        {
                            this.IdCorrespondentCustomHidden.Value           = this.ChooseMultipleCorrespondent.systemId;
                            this.TxtCodeCorrespondentCustomValue.Text        = this.ChooseMultipleCorrespondent.codiceRubrica;
                            this.TxtDescriptionCorrespondentCustomValue.Text = this.ChooseMultipleCorrespondent.descrizione;
                            this.ChooseMultipleCorrespondent = null;
                        }
                    }
                }
                else
                {
                    this.IdCorrespondentCustomHidden.Value           = string.Empty;
                    this.TxtCodeCorrespondentCustomValue.Text        = string.Empty;
                    this.TxtDescriptionCorrespondentCustomValue.Text = string.Empty;
                }
            }
            catch (System.Exception ex)
            {
                UIManager.AdministrationManager.DiagnosticError(ex);
                return;
            }
        }
Beispiel #24
0
        /// <summary>
        /// Inserimento nuovo oggetto in tabella ElementiRubrica
        /// </summary>
        /// <param name="elemento"></param>
        /// <returns></returns>
        private static ElementoRubrica InternalInsert(ElementoRubrica elemento)
        {
            Dpa.DataAccess.Database db = RubricaDatabase.CreateDatabase();

            using (IDbConnection connection = db.GetConnection())
            {
                connection.Open();

                using (IDbTransaction transaction = connection.BeginTransaction())
                {
                    using (Dpa.DataAccess.DBCommandWrapper cw = db.GetStoredProcCommandWrapper(RubricaDatabase.GetSpNameForPackage(SP_INSERT)))
                    {
                        elemento.DataCreazione      = DateTime.Now;
                        elemento.DataUltimaModifica = DateTime.Now;

                        cw.AddInParameter("pCodice", DbType.String, elemento.Codice);
                        cw.AddInParameter("pDescrizione", DbType.String, elemento.Descrizione);
                        cw.AddInParameter("pIndirizzo", DbType.String, elemento.Indirizzo);
                        cw.AddInParameter("pCitta", DbType.String, elemento.Citta);
                        cw.AddInParameter("pCap", DbType.String, elemento.Cap);
                        cw.AddInParameter("pProvincia", DbType.String, elemento.Provincia);
                        cw.AddInParameter("pNazione", DbType.String, elemento.Nazione);
                        cw.AddInParameter("pTelefono", DbType.String, elemento.Telefono);
                        cw.AddInParameter("pFax", DbType.String, elemento.Fax);
                        //cw.AddInParameter("pEmail", DbType.String, elemento.Email);
                        cw.AddInParameter("pAOO", DbType.String, elemento.AOO);
                        cw.AddInParameter("pDataCreazione", DbType.DateTime, elemento.DataCreazione);
                        cw.AddInParameter("pDataUltimaModifica", DbType.DateTime, elemento.DataUltimaModifica);
                        cw.AddInParameter("pUtenteCreatore", DbType.String, Security.RubricaPrincipal.Current.Identity.Name);
                        cw.AddInParameter("pTipoCorrispondente", DbType.String, elemento.TipoCorrispondente.ToString());
                        cw.AddInParameter("pAmministrazione", DbType.String, elemento.Amministrazione);
                        if (elemento.Urls.Count > 0)
                        {
                            cw.AddInParameter("pUrl", DbType.String, elemento.Urls[0].Url);
                        }
                        else
                        {
                            cw.AddInParameter("pUrl", DbType.String, String.Empty);
                        }
                        if (string.IsNullOrEmpty(elemento.CHA_Pubblicato))
                        {
                            elemento.CHA_Pubblicato = "0";
                        }
                        cw.AddInParameter("pChaPubblica", DbType.String, elemento.CHA_Pubblicato);
                        cw.AddOutParameter("pId", DbType.Int32, 0);

                        //Emanuela: aggiunta campi partita iva e codice fiscale
                        cw.AddInParameter("pCodiceFiscale", DbType.String, elemento.CodiceFiscale);
                        cw.AddInParameter("pPartitaIva", DbType.String, elemento.PartitaIva);

                        Utils.Log.Write(cw.Command);

                        db.ExecuteNonQuery(cw);

                        if (cw.RowsAffected > 0)
                        {
                            elemento.Id = Convert.ToInt32(cw.GetParameterValue("pId"));

                            // Rimozione delle email e associazione delle nuove
                            if (!String.IsNullOrEmpty(elemento.Email) && elemento.Emails.Count(m => m.Email == elemento.Email) == 0)
                            {
                                elemento.Emails.Add(new EmailInfo(elemento.Email, true));
                            }

                            elemento.Emails.ForEach(d => InternalInsertEmail(d, elemento.Id));

                            // Commit transazione
                            transaction.Commit();
                        }
                    }
                }
            }

            return(elemento);
        }
Beispiel #25
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="data"></param>
 /// <returns></returns>
 public ElementoRubrica Insert(ElementoRubrica data)
 {
     return(GetService().Insert(new InsertRequest(GetCredentials(), data)).InsertResult);
 }
Beispiel #26
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="data"></param>
 /// <returns></returns>
 public ElementoRubrica Update(ElementoRubrica data)
 {
     return(GetService().Update(new UpdateRequest(this.GetCredentials(), data)).UpdateResult);
 }