private IConceptSchemeMutableObject GetConceptschemeForm() { bool isInError = false; // Indicatore di errore string messagesGroup = string.Empty; // Stringa di raggruppamento errori int errorCounter = 1; // Contatore errori #region CONCEPTSCHEME ID if (!ValidationUtils.CheckIdFormat(txtDSDID.Text)) { messagesGroup += Convert.ToString(errorCounter) + ")" + Resources.Messages.err_id_format + "<br /><br />"; errorCounter++; isInError = true; } #endregion #region CONCEPTSCHEME AGENCY if (cmbAgencies.Text.Trim().Equals(string.Empty)) { messagesGroup += Convert.ToString(errorCounter) + ") " + Resources.Messages.err_agency_missing + "<br /><br />"; errorCounter++; isInError = true; } #endregion #region CONCEPTSCHEME VERSION if (!ValidationUtils.CheckVersionFormat(txtVersion.Text)) { messagesGroup += Convert.ToString(errorCounter) + ")" + Resources.Messages.err_version_format + "<br /><br />"; errorCounter++; isInError = true; } #endregion /* URI NOT REQUIRED */ #region CONCEPTSCHEME URI if ((txtDSDURI.Text != string.Empty) && !ValidationUtils.CheckUriFormat(txtDSDURI.Text)) { messagesGroup += Convert.ToString(errorCounter) + ")" + Resources.Messages.err_uri_format + "<br /><br />"; errorCounter++; isInError = true; } #endregion #region CONCEPTSCHEME NAMES if (AddTextName.TextObjectList == null || AddTextName.TextObjectList.Count == 0) { messagesGroup += Convert.ToString(errorCounter) + ")" + Resources.Messages.err_list_name_format + "<br /><br />"; errorCounter++; isInError = true; } #endregion #region CONCEPTSCHEME START END DATE bool checkForDatesCombination = true; if (!txtValidFrom.Text.Trim().Equals(string.Empty) && !ValidationUtils.CheckDateFormat(txtValidFrom.Text)) { messagesGroup += Convert.ToString(errorCounter) + ")" + Resources.Messages.err_date_from_format + "<br /><br />"; errorCounter++; checkForDatesCombination = false; isInError = true; } if (!txtValidTo.Text.Trim().Equals(string.Empty) && !ValidationUtils.CheckDateFormat(txtValidTo.Text)) { messagesGroup += Convert.ToString(errorCounter) + ")" + Resources.Messages.err_date_to_format + "<br /><br />"; errorCounter++; checkForDatesCombination = false; isInError = true; } if (!txtValidFrom.Text.Trim().Equals(string.Empty) && !txtValidTo.Text.Trim().Equals(string.Empty)) { // Controllo congruenza date if (checkForDatesCombination) { if (!ValidationUtils.CheckDates(txtValidFrom.Text, txtValidTo.Text)) { messagesGroup += Convert.ToString(errorCounter) + ")" + Resources.Messages.err_date_diff + "<br /><br />"; errorCounter++; isInError = true; } } } #endregion if (isInError) { Utils.ShowDialog(messagesGroup, 300); return null; } IConceptSchemeMutableObject tmpConceptscheme = new ConceptSchemeMutableCore(); #region CREATE CONCEPTSCHEME FROM FORM tmpConceptscheme.AgencyId = GetAgencyValue(); tmpConceptscheme.Id = txtDSDID.Text; tmpConceptscheme.Version = txtVersion.Text; tmpConceptscheme.FinalStructure = TertiaryBool.ParseBoolean(chkIsFinal.Checked); tmpConceptscheme.Uri = (!txtDSDURI.Text.Trim().Equals(string.Empty) && ValidationUtils.CheckUriFormat(txtDSDURI.Text)) ? new Uri(txtDSDURI.Text) : null; if (!txtValidFrom.Text.Trim().Equals(string.Empty)) { tmpConceptscheme.StartDate = DateTime.ParseExact(txtValidFrom.Text, "dd/MM/yyyy", CultureInfo.InvariantCulture); } if (!txtValidTo.Text.Trim().Equals(string.Empty)) { tmpConceptscheme.EndDate = DateTime.ParseExact(txtValidTo.Text, "dd/MM/yyyy", CultureInfo.InvariantCulture); } foreach (var tmpName in AddTextName.TextObjectList) { tmpConceptscheme.AddName(tmpName.Locale, tmpName.Value); } if (AddTextDescription.TextObjectList != null) foreach (var tmpDescription in AddTextDescription.TextObjectList) { tmpConceptscheme.AddDescription(tmpDescription.Locale, tmpDescription.Value); } if (AnnotationGeneralControl.AnnotationObjectList != null) foreach (var annotation in AnnotationGeneralControl.AnnotationObjectList) { tmpConceptscheme.AddAnnotation(annotation); } #endregion return tmpConceptscheme; }