public static DocumentoParolaChiave[] addToArrayParoleChiave(DocumentoParolaChiave[] array, DocumentoParolaChiave nuovoElemento) { try { DocumentoParolaChiave[] nuovaLista; if (array != null) { int len = array.Length; nuovaLista = new DocumentoParolaChiave[len + 1]; array.CopyTo(nuovaLista, 0); nuovaLista[len] = nuovoElemento; return(nuovaLista); } else { nuovaLista = new DocumentoParolaChiave[1]; nuovaLista[0] = nuovoElemento; return(nuovaLista); } } catch (System.Exception ex) { UIManager.AdministrationManager.DiagnosticError(ex); return(null); } }
/// <summary> /// Reperimento delle possibili parole chiavi da associare ad un documento /// </summary> /// <param name="idAmministrazione"></param> /// <returns></returns> public DocumentoParolaChiave[] GetParoleChiavi(string idAmministrazione) { DocsPaWebService ws = new DocsPaWebService(); DocumentoParolaChiave[] retValue = ws.DocumentoGetParoleChiave(idAmministrazione); if (retValue == null) { retValue = new DocumentoParolaChiave[0]; } return(retValue); }
/// <summary> /// Creazione elemento parola chiave /// </summary> /// <param name="parolaChiave"></param> /// <returns></returns> private ListItem GetListItemParolaChiave(DocumentoParolaChiave parolaChiave) { ListItem retValue = null; if (parolaChiave == null) { retValue = new ListItem(string.Empty, string.Empty); } else { retValue = new ListItem(parolaChiave.descrizione, parolaChiave.systemId); } return(retValue); }
// /// <summary> // /// Abilitazione / disabilitazione modalità inserimento parola chiave // /// </summary> // public bool AllowInsertMode // { // get // { // return false; // } // set // { // // } // } /// <summary> /// Reperimento delle parole chiavi selezionate /// </summary> /// <returns></returns> public DocumentoParolaChiave[] GetSelectedParoleChiavi() { ArrayList retValue = new ArrayList(); foreach (ListItem item in this.listParoleChiavi.Items) { if (item.Selected) { ParolaChiave parolaChiave = this.GetParolaChiaveViewState(item.Value); DocumentoParolaChiave docParolaChiave = new DocumentoParolaChiave(); docParolaChiave.idAmministrazione = parolaChiave.IDAmministrazione; docParolaChiave.systemId = parolaChiave.ID; docParolaChiave.descrizione = parolaChiave.Descrizione; retValue.Add(docParolaChiave); } } return((DocumentoParolaChiave[])retValue.ToArray(typeof(DocumentoParolaChiave))); }
/// <summary> /// Rimozione di una parola chiave /// </summary> /// <param name="id"></param> private void RemoveParolaChiave(string id) { ArrayList list = new ArrayList(this.SearchProperties.Documento.ParoleChiavi); DocumentoParolaChiave itemToRemove = null; foreach (DocumentoParolaChiave item in list) { if (item.systemId.Equals(id)) { itemToRemove = item; break; } } if (itemToRemove != null) { list.Remove(itemToRemove); this.SearchProperties.Documento.ParoleChiavi = (DocumentoParolaChiave[])list.ToArray(typeof(DocumentoParolaChiave)); this.FetchParoleChiavi(); } }