/// <summary> /// Funzione per la restituzione di un valore di esempio per un campo /// </summary> /// <param name="customObject">Oggetto custom per cui generare un valore di esempio</param> /// <returns>Valore di esempio</returns> private static String GetSampleValueForField(OggettoCustom customObject) { String sampleValue = String.Empty; switch (customObject.TIPO.DESCRIZIONE_TIPO.ToUpper()) { case "CASELLADISELEZIONE": sampleValue = "Item1; Item2"; break; case "CORRISPONDENTE": sampleValue = "Name Surname"; break; case "LINK": sampleValue = "http://fakesite.com"; break; default: sampleValue = "Test Value"; break; } return(sampleValue); }
public static UserControls.Calendar.VisibleTimeModeEnum getVisibleTimeMode(OggettoCustom oggettoCustom) { switch (oggettoCustom.FORMATO_ORA.ToUpper()) { case "HH": return(UserControls.Calendar.VisibleTimeModeEnum.Hours); break; case "HH:MM": return(UserControls.Calendar.VisibleTimeModeEnum.Minutes); break; case "HH:MM:SS": return(UserControls.Calendar.VisibleTimeModeEnum.Seconds); break; default: return(UserControls.Calendar.VisibleTimeModeEnum.Nothing); break; } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { string oggettoId = Request["oggettoId"]; string context = Request["context"]; OggettoCustom oggCust = null; if ("D".Equals(context)) { oggCust = ProfilazioneDocManager.getOggettoById(oggettoId, this); } else { oggCust = ProfilazioneFascManager.getOggettoById(oggettoId, this); } ConfigurationInfo conf = new ConfigurationInfo(); conf.Value = oggCust.CONFIG_OBJ_EST; ConfInfo = conf; } this.lbl_descr.Text = IntegrationAdapter.DescriptionLabel; this.lbl_codice.Text = IntegrationAdapter.IdLabel; this.dg_OggEst.Columns[1].HeaderText = IntegrationAdapter.IdLabel; this.dg_OggEst.Columns[2].HeaderText = IntegrationAdapter.DescriptionLabel; }
public virtual void RefreshDataDocument() { SchedaDocumento doc = UIManager.DocumentManager.getSelectedRecord(); if (doc != null && !string.IsNullOrEmpty(doc.systemId)) { this.DocumentImgInfoProcessiAvviati.Enabled = true; this.DocumentLblDocumentId.Visible = true; this.LblIdDocument.Visible = true; this.LblIdDocument.Text = doc.systemId; if (doc.protocollo != null && !string.IsNullOrEmpty(doc.protocollo.segnatura)) { this.DocumentLblReferenceCodeLabel.Visible = true; this.LblReferenceCode.Visible = true; this.LblReferenceCode.Text = doc.protocollo.segnatura; this.LblReferenceCode.ToolTip = doc.protocollo.segnatura; } if (doc.template != null) { this.DocumentLitTypeDocumentHead.Visible = true; this.DocumentLitTypeDocumentValue.Visible = true; this.DocumentLitTypeDocumentValue.Text = doc.template.DESCRIZIONE; string repertory = DocumentManager.getSegnaturaRepertorioNoHTML(doc.systemId, AdministrationManager.AmmGetInfoAmmCorrente(UserManager.GetInfoUser().idAmministrazione).Codice); if (!string.IsNullOrEmpty(repertory)) { OggettoCustom oggettoCustom = (from el in doc.template.ELENCO_OGGETTI where el.TIPO.DESCRIZIONE_TIPO.Equals("Contatore") && !string.IsNullOrEmpty(el.DATA_ANNULLAMENTO) select el).FirstOrDefault(); if (oggettoCustom != null) { DocumentLitRepertoryValue.Attributes.Add("class", "redStrike"); } this.DocumentLitRepertoryValue.Visible = true; this.DocumentLitRepertory.Visible = true; this.DocumentLitRepertoryValue.Text = repertory; } } this.UpcontainerDocumentTopDx.Update(); this.UpcontainerDocumentTopCx.Update(); this.EnableDocumentButtons(); } else { this.DocumentLitTypeDocumentHead.Visible = false; this.DocumentLitTypeDocumentValue.Visible = false; this.DocumentLitRepertoryValue.Visible = false; this.DocumentLitRepertory.Visible = false; } }
public static bool CheckAzioneAttesaPassoFirma(SchedaDocumento schedaDoc) { InfoUtente infoUtente = UserManager.GetInfoUser(); bool result = true; try { //Attualmente le operazioni che vanno controllate sono passi attesi dal passo in esecuzione di un processo di firma sono REPERTORIAZIONE, FASCICOLAZIONE, SPEDIZIONE, PROTOCOLLAZIONE //FASCICOLAZIONE E PROTOCOLLAZIONE vengono gestite nel BE IstanzaPassoDiFirma istanza = docsPaWS.GetIstanzaPassoFirmaInAttesaByDocnumber(schedaDoc.docNumber); //Controllo l'azione del passo di firma #region REPERTORIO bool daRepertoriare = false; Templates template = schedaDoc.template; if (template != null && !string.IsNullOrEmpty(template.ID_TIPO_ATTO) && template.ELENCO_OGGETTI != null && template.ELENCO_OGGETTI.Count() > 0) { OggettoCustom ogg = (from o in template.ELENCO_OGGETTI.Cast <OggettoCustom>() where o.TIPO.DESCRIZIONE_TIPO.Equals("Contatore") && o.REPERTORIO.Equals("1") && o.CONTATORE_DA_FAR_SCATTARE && string.IsNullOrEmpty(o.VALORE_DATABASE) select o).FirstOrDefault(); if (ogg != null) { daRepertoriare = true; } } if (daRepertoriare) { if (!infoUtente.idGruppo.Equals(istanza.RuoloCoinvolto.idGruppo)) { return(false); } if (!string.IsNullOrEmpty(istanza.UtenteCoinvolto.idPeople) && !infoUtente.idPeople.Equals(istanza.UtenteCoinvolto.idPeople)) { return(false); } if (!string.IsNullOrEmpty(istanza.UtenteLocker) && !infoUtente.idPeople.Equals(istanza.UtenteCoinvolto.idPeople)) { return(false); } if (!istanza.TipoFirma.Equals(Azione.DOCUMENTO_REPERTORIATO.ToString())) { return(false); } } #endregion } catch (Exception ex) { UIManager.AdministrationManager.DiagnosticError(ex); return(false); } return(result); }
public static Templates aggiungiOggettoCustomTemplateFasc(OggettoCustom oggettoCustom, Templates template, Page page) { try { return(docsPaWS.aggiungiOggettoCustomTemplateFasc(oggettoCustom, template)); } catch (Exception ex) { ErrorManager.redirect(page, ex); return(null); } }
public OggettoCustom salvaValoreOggetto(OggettoCustom _oggettoCustom, string _valore) { switch (_oggettoCustom.TIPO.DESCRIZIONE_TIPO) { case "CampoDiTesto": _oggettoCustom.VALORE_DATABASE = _valore; break; case "Data": _oggettoCustom.VALORE_DATABASE = _valore; break; default: _oggettoCustom.VALORE_DATABASE = _valore; break; } return(_oggettoCustom); }
public static void addNoRightsCustomObject(ArrayList assDocFascRuoli, OggettoCustom oggettoCustom) { DocsPaWR.AssDocFascRuoli[] assDocFascRuoliArray = (DocsPaWR.AssDocFascRuoli[])assDocFascRuoli.ToArray(typeof(AssDocFascRuoli)); DocsPaWR.AssDocFascRuoli assDocFascRuolo = assDocFascRuoliArray.Where(asRuolo => asRuolo.ID_OGGETTO_CUSTOM.Equals(oggettoCustom.SYSTEM_ID.ToString())).FirstOrDefault(); if (assDocFascRuolo == null) { DocsPaWR.AssDocFascRuoli newAssDocFascRuoli = new AssDocFascRuoli(); newAssDocFascRuoli.ID_OGGETTO_CUSTOM = oggettoCustom.SYSTEM_ID.ToString(); newAssDocFascRuoli.INS_MOD_OGG_CUSTOM = "0"; newAssDocFascRuoli.VIS_OGG_CUSTOM = "0"; assDocFascRuoli.Add(newAssDocFascRuoli); } }
public InteropSchedaDocHandler(InteropCreazioneDocRequest request) { try { _template = ProfilazioneDocumenti.getTemplateById(request.StatusTemplate.IdTemplate); logger.Debug("template " + _template.DESCRIZIONE + " trovato"); OggettoCustom oc = _template.ELENCO_OGGETTI.Cast <OggettoCustom>().Single(e => request.StatusTemplate.StatusTemplateFieldName.Equals(e.DESCRIZIONE)); logger.Debug("Oggetto custom trovato " + oc.DESCRIZIONE); oc.VALORE_DATABASE = request.StatusTemplate.StatusNotProcessedValue; _processor = new MailProcessor(request.FiltriMail); } catch (Exception e) { logger.Debug("Errore nella costruzione del template: " + e.Message); } }
public static void addNoRightsCustomObject(ArrayList assDocFascRuoli, OggettoCustom oggettoCustom) { try { DocsPaWR.AssDocFascRuoli[] assDocFascRuoliArray = (DocsPaWR.AssDocFascRuoli[])assDocFascRuoli.ToArray(typeof(AssDocFascRuoli)); DocsPaWR.AssDocFascRuoli assDocFascRuolo = assDocFascRuoliArray.Where(asRuolo => asRuolo.ID_OGGETTO_CUSTOM.Equals(oggettoCustom.SYSTEM_ID.ToString())).FirstOrDefault(); if (assDocFascRuolo == null) { DocsPaWR.AssDocFascRuoli newAssDocFascRuoli = new AssDocFascRuoli(); newAssDocFascRuoli.ID_OGGETTO_CUSTOM = oggettoCustom.SYSTEM_ID.ToString(); newAssDocFascRuoli.INS_MOD_OGG_CUSTOM = "0"; newAssDocFascRuoli.VIS_OGG_CUSTOM = "0"; assDocFascRuoli.Add(newAssDocFascRuoli); } } catch (System.Exception ex) { UIManager.AdministrationManager.DiagnosticError(ex); } }
private IIntegrationAdapter GetIntegrationAdapter(string oggettoId, string type, string adapterId, string adapterVersion, string position) { if (!string.IsNullOrEmpty(position)) { Templates template = (Templates)Session["template"]; int pos = Int32.Parse(position); OggettoCustom temp = template.ELENCO_OGGETTI[pos]; if (temp != null && !string.IsNullOrEmpty(temp.CONFIG_OBJ_EST)) { ConfigurationInfo conf = new ConfigurationInfo(); conf.Value = temp.CONFIG_OBJ_EST; return(IntegrationAdapterFactory.Instance.GetAdapterConfigured(conf)); } } if (!string.IsNullOrEmpty(oggettoId)) { OggettoCustom oggCust = null; if ("D".Equals(type)) { oggCust = ProfilazioneDocManager.getOggettoById(oggettoId, this); } else { oggCust = ProfilazioneFascManager.getOggettoById(oggettoId, this); } ConfigurationInfo conf = new ConfigurationInfo(); conf.Value = oggCust.CONFIG_OBJ_EST; return(IntegrationAdapterFactory.Instance.GetAdapterConfigured(conf)); } else { if (!string.IsNullOrEmpty(adapterVersion)) { return(IntegrationAdapterFactory.Instance.GetAdapter(adapterId, new Version(adapterVersion))); } else { return(IntegrationAdapterFactory.Instance.GetAdapter(adapterId)); } } }
protected void Page_Load(object sender, EventArgs e) { if (Request.QueryString["IdOggCustom"] != null && Request.QueryString["IdTemplate"] != null) { idOggetto = Request.QueryString["IdOggCustom"]; idTemplate = Request.QueryString["IdTemplate"]; if (!string.IsNullOrEmpty(idOggetto) && !string.IsNullOrEmpty(idTemplate)) { oggettoCustom = ProfilazioneDocManager.getOggettoById(idOggetto, this); lbl_titolo.Text = oggettoCustom.DESCRIZIONE; contatori = ProfilazioneDocManager.GetValuesContatoriDoc(this, oggettoCustom); msg_Elimina.GetMessageBoxResponse += new Utilities.MessageBox.Message(this.msg_Elimina_GetMessageBoxResponse); } } if (!IsPostBack) { caricaDgContatori(); impostaVisualizzazione(); } }
public bool ManageAttachXML(DocsPaVO.documento.SchedaDocumento schedaDocOriginale, DocsPaVO.documento.SchedaDocumento schedaDocCopiato, string IdRuoloMittenteFisico, DocsPaVO.utente.InfoUtente infoUtenteInterop) { //****************************************************************************************************************// // Modifica Evolutiva di Giordano Iacozzilli Data: 27/04/2012 // // La presidenza del Consiflio dei Ministri richiede la possibilità di inviare via Interoperabilità interna, // al Registro dell'Ufficio UBRRAC un file Xml contenente un insieme di dati integrativi associati ad alcune tipologie // di documenti prodotti dai centri di spesa per una successiva elaboraizone dal sistema OpenDGov. // //Workflow: // 1) Controllo presenza su db del codice FE_ATTACH_XML nella Config Globali // 2) Se il controllo è ok, verifico che il tipo doc sia compreso nella lista dei tipi ammessi(GET DEI TIPI DOC COL PIPE DAL DB). // 3) Verifico che il mio Ruolo abbia la visibilità su tutti i campi, altrimenti nada. // 4) Creo L'xml e lo allego alla scheda Doc // //****************************************************************************************************************// //Doppio controllo, interop Semplificata e Xml Attach. if (System.Configuration.ConfigurationManager.AppSettings["INTEROP_INT_NO_MAIL"] != null && System.Configuration.ConfigurationManager.AppSettings["INTEROP_INT_NO_MAIL"].ToString() != "0") { //1) Controllo presenza su db del codice FE_ATTACH_XML nella Config Globali if (GET_XML_ATTACH()) { //Get Template. DocsPaVO.ProfilazioneDinamica.Templates template = (schedaDocOriginale.template); string err = string.Empty; //verifico che il tipo doc sia compreso nella lista dei tipi ammessi if (template != null && GET_TIPI_ATTI_CUSTOM().Contains(ClearString(GetDescrTipoAtto(template.ID_TIPO_ATTO, infoUtenteInterop.idAmministrazione)))) { DocsPaVO.ProfilazioneDinamica.AssDocFascRuoli _ass = new AssDocFascRuoli(); //Verifico che il mio Ruolo abbia la visibilità su tutti i campi, altrimenti nada. int _totCampi = template.ELENCO_OGGETTI.Count; int _ContCampi = 0; for (int i = 0; i < template.ELENCO_OGGETTI.Count; i++) { OggettoCustom oggettoCustom = (OggettoCustom)template.ELENCO_OGGETTI[i]; // visibilità. _ass = ProfilazioneDinamica.ProfilazioneDocumenti.getDirittiCampoTipologiaDoc(IdRuoloMittenteFisico, template.SYSTEM_ID.ToString(), oggettoCustom.SYSTEM_ID.ToString()); if (_ass.VIS_OGG_CUSTOM == "1") { _ContCampi = _ContCampi + 1; } } //Verifico che il mio Ruolo abbia la visibilità su tutti i campi if (_ContCampi == _totCampi) { if (schedaDocCopiato.documenti != null && schedaDocCopiato.documenti[0] != null) { try { Dictionary <string, string> _dict = new Dictionary <string, string>(); foreach (OggettoCustom oggettoCustom in template.ELENCO_OGGETTI) { _dict.Add(oggettoCustom.DESCRIZIONE, oggettoCustom.VALORE_DATABASE); } //Creo L'xml e lo allego alla scheda Doc XmlDocument xDocDaAllegare = new XmlDocument(); xDocDaAllegare = CreateXmlToAttach(_dict, schedaDocCopiato, GetDescrTipoAtto(template.ID_TIPO_ATTO, infoUtenteInterop.idAmministrazione)); DocsPaVO.documento.Allegato allegato = null; //Add Allegato: allegato = new DocsPaVO.documento.Allegato(); allegato.descrizione = GetDescrTipoAtto(template.ID_TIPO_ATTO, infoUtenteInterop.idAmministrazione) + "_XML"; allegato.numeroPagine = 1; allegato.docNumber = schedaDocCopiato.docNumber; allegato.version = "0"; allegato.position = (schedaDocOriginale.allegati.Count + 1); allegato = BusinessLogic.Documenti.AllegatiManager.aggiungiAllegato(infoUtenteInterop, allegato); //Add del File xml come filedocumento: DocsPaVO.documento.FileDocumento fdAllNew = new DocsPaVO.documento.FileDocumento(); fdAllNew.content = Encoding.UTF8.GetBytes(xDocDaAllegare.OuterXml); fdAllNew.length = Encoding.UTF8.GetBytes(xDocDaAllegare.OuterXml).Length; fdAllNew.name = GetDescrTipoAtto(template.ID_TIPO_ATTO, infoUtenteInterop.idAmministrazione) + "_XML" + ".xml"; fdAllNew.fullName = fdAllNew.name; fdAllNew.contentType = "text/xml"; DocsPaVO.documento.FileRequest fr = (DocsPaVO.documento.FileRequest)allegato; if (!BusinessLogic.Documenti.FileManager.putFile(ref fr, fdAllNew, infoUtenteInterop, out err)) { throw new Exception(err); } } catch (Exception ex) { err = ex.Message; throw ex; } } else { return(false); } } else { return(false); } } else { return(false); } } else { return(false); } return(true); } else { return(false); } }
public void inserisciContatore(OggettoCustom oggettoCustom) { if (oggettoCustom.DESCRIZIONE.Equals("")) { return; } Label etichettaContatore = new Label(); etichettaContatore.Text = oggettoCustom.DESCRIZIONE; etichettaContatore.Font.Size = FontUnit.Point(8); etichettaContatore.Font.Bold = true; etichettaContatore.Font.Name = "Verdana"; TableRow row = new TableRow(); TableCell cell_1 = new TableCell(); cell_1.Controls.Add(etichettaContatore); row.Cells.Add(cell_1); TableCell cell_2 = new TableCell(); if (oggettoCustom.CONTA_DOPO == "1") { //Label etichettaContaDopo = new Label(); //etichettaContaDopo.Text = " Calcola"; //etichettaContaDopo.Font.Size = FontUnit.Point(8); //etichettaContaDopo.Font.Bold = true; //etichettaContaDopo.Font.Name = "Verdana"; //cell_2.Controls.Add(etichettaContaDopo); CheckBox cbContaDopo = new CheckBox(); cbContaDopo.ToolTip = "Attiva / Disattiva incremento del contatore al salvataggio dei dati."; cbContaDopo.CssClass = "comp_profilazione_anteprima"; cell_2.Controls.Add(cbContaDopo); } TextBox contatore = new TextBox(); contatore.ID = oggettoCustom.POSIZIONE; contatore.Width = Unit.Percentage(100); contatore.Enabled = false; contatore.BackColor = System.Drawing.Color.WhiteSmoke; contatore.CssClass = "comp_profilazione_anteprima"; cell_2.Controls.Add(contatore); switch (oggettoCustom.TIPO_CONTATORE) { case "T": break; case "A": Label etichettaAoo = new Label(); etichettaAoo.Text = " AOO"; etichettaAoo.Font.Size = FontUnit.Point(8); etichettaAoo.Font.Bold = true; etichettaAoo.Font.Name = "Verdana"; etichettaAoo.Width = 30; cell_2.Controls.Add(etichettaAoo); DropDownList ddlAoo = new DropDownList(); ddlAoo.CssClass = "comp_profilazione_anteprima"; ddlAoo.Items.Add("AOO"); ddlAoo.Width = 100; cell_2.Controls.Add(ddlAoo); break; case "R": Label etichettaRf = new Label(); etichettaRf.Text = " RF"; etichettaRf.Font.Size = FontUnit.Point(8); etichettaRf.Font.Bold = true; etichettaRf.Font.Name = "Verdana"; etichettaRf.Width = 30; cell_2.Controls.Add(etichettaRf); DropDownList ddlRf = new DropDownList(); ddlRf.CssClass = "comp_profilazione_anteprima"; ddlRf.Items.Add("RF"); ddlRf.Width = 100; cell_2.Controls.Add(ddlRf); break; } row.Cells.Add(cell_2); table.Rows.Add(row); }
public static ImportAttestatiResponse ImportAttestati(ImportAttestatiRequest request) { ImportAttestatiResponse resp = new ImportAttestatiResponse(); InfoUtente iu = null; Ruolo role = null; List <SchedaDocumento> docsTrasmissione = new List <SchedaDocumento>(); using (DocsPaDB.TransactionContext transactionContext = new DocsPaDB.TransactionContext()) { try { iu = request.InfoUtente.InfoUtente; role = UserManager.getRuolo(request.Ruolo.Id); iu.idGruppo = role.idGruppo; iu.idCorrGlobali = role.systemId; AttestatiListVO attestati = request.Attestati; //lock del documento principale logger.Debug("lock del documento principale, doc number : " + attestati.DocNumber); //creazione schede foreach (AttestatoVO att in attestati.Attestati) { SchedaDocumento sd = CreateSchedaDocumentoFromAttestato(att, iu, role, request.IdRegistro); AcquireFileAndAllegato(att, sd, iu); docsTrasmissione.Add(sd); } //set dello stato del doc principale SchedaDocumento attList = DocManager.getDettaglio(iu, null, request.Attestati.DocNumber); OggettoCustom oc = attList.template.ELENCO_OGGETTI.Cast <OggettoCustom>().Single(e => request.Attestati.StatusTemplate.StatusTemplateFieldName.Equals(e.DESCRIZIONE)); oc.VALORE_DATABASE = request.Attestati.StatusTemplate.StatusProcessedValue; bool daAggiornareUffRef; DocSave.save(iu, attList, false, out daAggiornareUffRef, role); //unlock del documento principale transactionContext.Complete(); } catch (Exception e) { resp.Code = ImportAttestatiResponseCode.KO; resp.ErrorMessage = e.Message; return(resp); } } if (request.Trasmissione == null) { logger.Debug("Nessuna trasmissione da eseguire"); resp.Code = ImportAttestatiResponseCode.OK; return(resp); } else { try { logger.Debug("Esegui trasmissioni"); EseguiTrasmissioni(request.Trasmissione, docsTrasmissione, iu, role); resp.Code = ImportAttestatiResponseCode.OK; return(resp); } catch (Exception e) { resp.ErrorMessage = e.Message; resp.Code = ImportAttestatiResponseCode.WARNING; return(resp); } } }
public static List <String> CompileProfilationField(OggettoCustom customObject, AssDocFascRuoli rights, String[] fieldValues, Ruolo role, InfoUtente userInfo, string RFCode, string administrationId, string registryCode, bool isEnabledSmistamento) { #region Dichiarazione variabili // Il registro Registro registry; // Il system id dell'RF string rfSyd = String.Empty; // Il system id del registro string registrySyd = String.Empty; // Tipologia di utente da ricercare TipoUtente userType; // La lista dei problemi emersi durante la compilazione del campo List <String> toReturn; // Oggetto in cui depositare le informazioni sul campo da selezionare ValoreOggetto objectValue; #endregion // Creazione della lista da restituire toReturn = new List <string>(); // ...a seconda del tipo di oggetto bisogna intraprendere // operazioni diverse per quanto riguarda l'assegnazione dei valori switch (customObject.TIPO.DESCRIZIONE_TIPO.ToUpper()) { case "CASELLADISELEZIONE": // Nel caso della casella di selezione è possibile che sia selezionato // più di un valore // Se il ruolo può modificare il campo... if (rights.INS_MOD_OGG_CUSTOM == "1") { // ...vengono impostati i valori // Per ogni stringa contenuta all'interno dei valori selezionati, // bisogna ricercare l'oggetto con le informazioni sull'opzione da selezionare // ricavandone la posizione ed inserendo tale descrizione nella stessa posizione // ma nell'array VALORI_SELEZIONATI foreach (string selectedValue in fieldValues) { objectValue = ((ValoreOggetto[])customObject.ELENCO_VALORI.ToArray(typeof(ValoreOggetto))).Where( e => e.VALORE.ToUpper().Equals(selectedValue.ToUpper())).FirstOrDefault(); // Se il valore non è stato reperito correttamente, viene lanciata una eccezione if (objectValue == null) { throw new Exception(String.Format("Valore '{0}' non valido", selectedValue)); } customObject.VALORI_SELEZIONATI[customObject.ELENCO_VALORI.IndexOf(objectValue)] = selectedValue; } } else { // ...altrimenti non si può impostare il valore. Si procede quindi // all'aggiunta di un messaggio di avviso alla lista dei "warnings" toReturn.Add(String.Format("Non è possible valorizzare il campo '{0}' in quanto il ruolo non possiede diritto di modifica su tale campo", customObject.DESCRIZIONE)); } break; case "CORRISPONDENTE": // Se il ruolo possiede i diritti di modifica sul campo... if (rights.INS_MOD_OGG_CUSTOM == "1") { Corrispondente corr = FindCorrispondente(fieldValues[0], customObject, userInfo, role, RFCode, registryCode, administrationId, isEnabledSmistamento); customObject.VALORE_DATABASE = corr.systemId; } else { // Altrimenti si aggiunge un messaggio alla lista dei warnings toReturn.Add(String.Format("Non è possible valorizzare il campo '{0}' in quanto il ruolo non possiede diritto di modifica su tale campo", customObject.DESCRIZIONE)); } break; case "CONTATORE": case "CONTATORESOTTOCONTATORE": try { // Reperimento dei dati sul registro registry = RegistriManager.getRegistroByCodAOO( fieldValues[0].ToUpper(), administrationId); } catch (Exception e) { throw new Exception( String.Format("Errore durante il reperimento delle informazioni sul Registro/RF {0}", fieldValues[0])); } switch (customObject.TIPO_CONTATORE.ToUpper()) { case "A": // Contatore di AOO customObject.ID_AOO_RF = registry.systemId; break; case "R": // Contatore di RF // Se il registro non è un registro di RF, eccezione if (!(registry.chaRF == "1")) { throw new Exception(String.Format( "Il registro {0} non è un RF", fieldValues[0])); } // Impostazione dell'id registro customObject.ID_AOO_RF = registry.systemId; break; } // Se il contatore è abilitato allo scatto differito... if (customObject.CONTA_DOPO == "0") { // Se il ruolo ha diritti di modifica sul contatore... if (rights.INS_MOD_OGG_CUSTOM == "1") { // Il contatore deve scattare customObject.CONTATORE_DA_FAR_SCATTARE = true; } } break; case "LINK": if (fieldValues.Length < 2) { throw new Exception("Per costruire un oggetto link sono necessari due valori"); } if ("INTERNO".Equals(customObject.TIPO_LINK)) { if ("DOCUMENTO".Equals(customObject.TIPO_OBJ_LINK)) { InfoDocumento infoDoc = null; try { infoDoc = DocManager.GetInfoDocumento(userInfo, fieldValues[1], null, true); } catch (Exception e) { throw new Exception(String.Format("Errore nel reperimento del documento con id {0}", fieldValues[1])); } if (infoDoc == null) { throw new Exception(String.Format("Il documento con id {0} non è presente", fieldValues[1])); } string errorMessage = ""; int result = DocManager.VerificaACL("D", infoDoc.idProfile, userInfo, out errorMessage); if (result != 2) { throw new Exception(String.Format("Non si possiedono i diritti per reperire il documento con id {0}", fieldValues[1])); } } else { Fascicolo fasc = null; try { // fasc = FascicoloManager.getFascicoloById(fieldValues[1], userInfo); fasc = FascicoloManager.getFascicoloDaCodice(userInfo, fieldValues[1], null, false, true); } catch (Exception e) { throw new Exception(String.Format("Errore nel reperimento del fascicolo con id {0}", fieldValues[1])); } if (fasc == null) { throw new Exception(String.Format("Il fascicolo con id {0} non è presente", fieldValues[1])); } string errorMessage = ""; int result = DocManager.VerificaACL("F", fasc.systemID, userInfo, out errorMessage); if (result != 2) { throw new Exception(String.Format("Non si possiedono i diritti per reperire il fascicolo con id {0}", fieldValues[1])); } } } customObject.VALORE_DATABASE = fieldValues[0] + "||||" + fieldValues[1]; break; case "OGGETTOESTERNO": if (fieldValues.Length < 2) { throw new Exception("Per costruire un oggetto esterno sono necessari due valori"); } customObject.MANUAL_INSERT = true; customObject.CODICE_DB = fieldValues[0]; customObject.VALORE_DATABASE = fieldValues[1]; break; default: // In tutti gli altri casi il valore è uno solo // Se il ruolo ha diritti di modofica, viene impostato // il valore altrimenti viene inserito un messaggio nella // lista dei warning if (rights.INS_MOD_OGG_CUSTOM == "1") { customObject.VALORE_DATABASE = fieldValues[0]; } else { // ...altrimenti non si può impostare il valore. Si procede quindi // all'aggiunta di un messaggio di avviso alla lista dei "warnings" toReturn.Add(String.Format("Non è possible valorizzare il campo '{0}' in quanto il ruolo non possiede diritto di modifica su tale campo", customObject.DESCRIZIONE)); } break; } // Restituzione della lista delle eventuali segnalazioni return(toReturn); }
private void ControlloTipologiaDocControlloPreventivo(ref DocsPaVO.documento.SchedaDocumento schedaDocumentoDaVerificare, ref string message, DocsPaVO.utente.InfoUtente infoUtente) { //************************************************************************************************************************************** //MODIFICA EVOLUTIVA: GIORDANO IACOZZILLI: 16/05/2012 //Bisogna aggiungere 2 controlli al tipo documento UBR: //1) Ragione Proveddimento non è obbligatorio nei casi in cui // tipo provvedimento = // Rendiconto // Altro Tipo //2) Numero impegno è obbligatorio solo se: // tipo provvedimento = // Impegno // O/P su impegno //************************************************************************************************************************************** OggettoCustom[] elencoOggetti = (OggettoCustom[])schedaDocumentoDaVerificare.template.ELENCO_OGGETTI.ToArray(typeof(OggettoCustom)); OggettoCustom _tipoprovvedimento = elencoOggetti.Where(oggetto => oggetto.DESCRIZIONE.ToUpper().Replace(" ", "").Equals("TIPODIPROVVEDIMENTO")).FirstOrDefault(); OggettoCustom _OggettoProvvedimento = elencoOggetti.Where(oggetto => oggetto.DESCRIZIONE.ToUpper().Replace(" ", "").Equals("OGGETTO")).FirstOrDefault(); OggettoCustom _Descrizioneprovvedimento = elencoOggetti.Where(oggetto => oggetto.DESCRIZIONE.ToUpper().Replace(" ", "").Equals("DESCRIZIONEPROVVEDIMENTO")).FirstOrDefault(); OggettoCustom _UlterioreDescrizioneprovvedimento = elencoOggetti.Where(oggetto => oggetto.DESCRIZIONE.ToUpper().Replace(" ", "").Equals("ULTDESCRIZIONEPROVVEDIMENTO")).FirstOrDefault(); //1) Numero impegno è obbligatorio solo se: // tipo provvedimento = // Impegno // O/P su impegno if ((_tipoprovvedimento.VALORE_DATABASE.ToUpper().Replace(" ", "") == "IMPEGNO") || (_tipoprovvedimento.VALORE_DATABASE.ToUpper().Replace(" ", "") == "O/PSUIMPEGNO")) { OggettoCustom _numeroimpegno = elencoOggetti.Where(oggetto => oggetto.DESCRIZIONE.ToUpper().Replace(" ", "").Equals("NUMEROIMPEGNO")).FirstOrDefault(); if (string.IsNullOrEmpty(_numeroimpegno.VALORE_DATABASE)) { message += "\\n\\nIl campo [Numero Impegno] è obbligatorio nei casi in cui il [tipo provvedimento] sia uguale a [Impegno] e [o/p su Impegno] "; } } //2) Il campo importo deve essere un decimal. OggettoCustom _importo = elencoOggetti.Where(oggetto => oggetto.DESCRIZIONE.ToUpper().Replace(" ", "").Equals("IMPORTO")).FirstOrDefault(); if (!string.IsNullOrEmpty(_importo.VALORE_DATABASE)) { try { decimal _dec = Convert.ToDecimal(_importo.VALORE_DATABASE.Replace(".", ",").ToString()); } catch { message += "\\n\\nIl campo [Importo] deve essere di tipo Decimal"; } } //3) Modifica di congruità dei valori inseriti nelle 4 combobox: //1) Tipo Provvedimento //2) Oggetto //3) Descrizione //4) ulteriore descrizione //Get XML Dictionary: XDocument myxml = XDocument.Load(AppDomain.CurrentDomain.BaseDirectory + @"Xml\PCM_TIPO_PROVVEDIMENTI.xml"); TIPO_PROVVEDIMENTO _typeprov = new TIPO_PROVVEDIMENTO(); List <TIPO_PROVVEDIMENTO> _lsttipo = new List <TIPO_PROVVEDIMENTO>(); //Inserisco l'xml nella mia lista per filtrarlo con linq: foreach (var tipiprovvedimenti in myxml.Descendants("Records")) { string tipo = tipiprovvedimenti.Element("TIPO") == null ? string.Empty : tipiprovvedimenti.Element("TIPO").Value; string oggetto = tipiprovvedimenti.Element("OGGETTO") == null ? string.Empty : tipiprovvedimenti.Element("OGGETTO").Value; string descrizione = tipiprovvedimenti.Element("DESCRIZIONE") == null ? string.Empty : tipiprovvedimenti.Element("DESCRIZIONE").Value; string ultdescrizione = tipiprovvedimenti.Element("ULTDESCRIZIONE") == null ? string.Empty : tipiprovvedimenti.Element("ULTDESCRIZIONE").Value; _lsttipo.Add(new TIPO_PROVVEDIMENTO { Tipo = tipo, Oggetto = oggetto, Descrizione = descrizione, UltDescrizione = ultdescrizione }); } //Chiamo la funzione di filtro passandogli il messaggio per gli errori di ritorno. message += VerifyComboProvvedimenti(_lsttipo, _tipoprovvedimento, _OggettoProvvedimento, _Descrizioneprovvedimento, _UlterioreDescrizioneprovvedimento); //Se i controlli sono andati tutti a buon fine aggiorno i campi if (string.IsNullOrEmpty(message)) { schedaDocumentoDaVerificare.template.ELENCO_OGGETTI = new System.Collections.ArrayList(elencoOggetti); } }
private string VerifyComboProvvedimenti(List <TIPO_PROVVEDIMENTO> _lsttipo, OggettoCustom _tipoprovvedimento, OggettoCustom _ragioneProvvedimento, OggettoCustom _Descrizioneprovvedimento, OggettoCustom _UlterioreDescrizioneprovvedimento) { try { //Filtro con Linq! //Il primo filtro massivo è sul valore di tipo provvedimento: var queryTipoProvvedimento = from mylistQ in _lsttipo where mylistQ.Tipo == _tipoprovvedimento.VALORE_DATABASE.ToString() select mylistQ; //Se filtro provvedimento è valorizzato, vado a verificare il secondo //livello, cioè l'oggetto if (queryTipoProvvedimento.Count() > 0) { //Vado a filtrare per l'oggetto: var queryOggetto = (from mylistOgg in queryTipoProvvedimento where mylistOgg.Oggetto == _ragioneProvvedimento.VALORE_DATABASE.ToString() select mylistOgg).Distinct(); if (queryOggetto.Count() > 0) { //Vado a filtrare per la descrizione: var queryDescrizione = (from mylistDescr in queryOggetto where mylistDescr.Descrizione == _Descrizioneprovvedimento.VALORE_DATABASE.ToString() select mylistDescr).Distinct(); if (queryDescrizione.Count() > 0) { //Vado a filtrare per la Ulteriore descrizione: var queryULTDescrizione = (from mylistUltDescr in queryDescrizione where mylistUltDescr.UltDescrizione == _UlterioreDescrizioneprovvedimento.VALORE_DATABASE.ToString() select mylistUltDescr).Distinct(); if (queryULTDescrizione.Count() > 0) { return(""); } else { string returnMessage = string.Empty; foreach (var _TP in queryDescrizione) { if (string.IsNullOrEmpty(_TP.UltDescrizione)) { //Se non ho nessun valore, vuol dire che tutte le combo non devono essere valorizzate! return("\\n\\nCon il valore del campo [Descrizione provvedimento] inserito, il valore del campo [ult Descrizione provvedimento] non deve essere valorizzato"); } else if (!returnMessage.Contains(_TP.UltDescrizione)) { returnMessage += "\\n" + _TP.UltDescrizione; } } return("\\n\\nIl valore del campo [Ult descrizione provvedimento] selezionato, non è compatibile con il valore del campo [descrizione] inserito." + "\\n\\nElenco valori ammessi per la descrizione provvedimento selezionata:" + returnMessage); } } else { string returnMessage = string.Empty; foreach (var _TP in queryOggetto) { if (string.IsNullOrEmpty(_TP.Descrizione)) { //Se non ho nessun valore, vuol dire che tutte le combo non devono essere valorizzate! return("\\n\\nCon il valore del campo [Oggetto] inserito i valori [descrizione provvedimento], [ult Descrizione provvedimento] non devono essere valorizzati"); } else if (!returnMessage.Contains(_TP.Descrizione)) { returnMessage += "\\n" + _TP.Descrizione; } } return("\\n\\nIl valore del campo [descrizione provvedimento] selezionato, non è compatibile con il valore del campo [oggetto] inserito." + "\\n\\nElenco valori ammessi per il campo oggetto selezionato:" + returnMessage); } } else { string returnMessage = string.Empty; foreach (var _TP in queryTipoProvvedimento) { if (string.IsNullOrEmpty(_TP.Oggetto)) { //Se non ho nessun valore, vuol dire che tutte le combo non devono essere valorizzate! return("\\nCon il valore del campo [Tipo di Provvedimento] inserito i valori [oggetto], [descrizione provvedimento], [ult Descrizione provvedimento] non devono essere valorizzati"); } else if (!returnMessage.Contains(_TP.Oggetto)) { returnMessage += "\\n" + _TP.Oggetto; } } return("\\n\\nIl valore del campo [oggetto] selezionato, non è compatibile con il valore del campo [Tipo di Provvedimento] inserito." + "\\n\\nElenco valori ammessi per il tipo provvedimento selezionato:" + returnMessage); } } } catch (Exception ex) { return(ex.Message); } return(""); }
public static Corrispondente FindCorrispondente(string codice, OggettoCustom customObject, InfoUtente userInfo, Ruolo role, string RFCode, string registryCode, string administrationId, bool isEnabledSmistamento) { Registro registry; string rfSyd = string.Empty; string registrySyd = string.Empty; TipoUtente userType; if (!String.IsNullOrEmpty(RFCode)) { try { // Reperimento dei dati sull'RF registry = RegistriManager.getRegistroByCodAOO( RFCode.ToUpper(), administrationId); } catch (Exception e) { throw new ImportException( String.Format("Errore durante il reperimento delle informazioni sul Registro/RF {0}", RFCode)); } // Se il registro non è stato recuperato con successo, viene lanciata // un'eccezione if (registry == null) { throw new ImportException(String.Format("Registro con codice {0} non trovato.", RFCode)); } // Se il registro trovato non è un RF -> errore, altrimenti // si aggiunge l'id del registro al filstro registri if (registry.chaRF.Trim() != "1") { throw new ImportException(String.Format("Il registro {0} specificato, non è un RF.", RFCode)); } rfSyd = registry.systemId; } #endregion #region Registro try { // Reperimento dei dati sul registro registry = RegistriManager.getRegistroByCodAOO( registryCode.ToUpper(), administrationId); } catch (Exception e) { throw new ImportException( String.Format("Errore durante il reperimento delle informazioni sul Registro/RF {0}", registryCode)); } // Se il registro non è stato recuperato con successo -> eccezione, // altrimenti viene aggiunto l'id del registro al filtro registri if (registry == null) { throw new ImportException(String.Format("Registro {0} specificato non trovato.", registryCode)); } registrySyd = registry.systemId; #endregion // Impostazione del codice corrispondente // Se il codice non è impostato, eccezione, altrimenti impostazione // del codice if (String.IsNullOrEmpty(codice)) { throw new ImportException(String.Format("Codice corrispondente non valido.")); } // Individuazione del tipo di utente da ricercare switch (customObject.TIPO_RICERCA_CORR.ToUpper()) { case "INTERNI": userType = TipoUtente.INTERNO; break; case "ESTERNI": userType = TipoUtente.ESTERNO; break; default: userType = TipoUtente.GLOBALE; break; } // Impostazione del corrispondente return(GetCorrispondenteByCode( ParametriRicercaRubrica.CallType.CALLTYPE_CORR_EST, codice, role, userInfo, registrySyd, rfSyd, isEnabledSmistamento, userType)); }