private IDataConsumerSchemeMutableObject GetDataConsumerschemeForm(IDataConsumerSchemeMutableObject dataConsumerScheme) { if (dataConsumerScheme == null) return GetDataConsumerschemeForm(); bool isInError = false; // Indicatore di errore string messagesGroup = string.Empty; // Stringa di raggruppamento errori int errorCounter = 1; // Contatore errori #region DATACONSUMERSCHEME ID if (!ValidationUtils.CheckIdFormat(txtDSDID.Text)) { messagesGroup += Convert.ToString(errorCounter) + ")" + Resources.Messages.err_id_format + "<br /><br />"; errorCounter++; isInError = true; } #endregion #region DATACONSUMERSCHEME AGENCY if ( cmbAgencies.Text.Trim().Equals( string.Empty ) ) { messagesGroup += Convert.ToString(errorCounter) + ") " + Resources.Messages.err_agency_missing + "<br /><br />"; errorCounter++; isInError = true; } #endregion #region DATACONSUMERSCHEME 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 DATACONSUMERSCHEME 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 DATACONSUMERSCHEME 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 DATACONSUMERSCHEME 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; } #region CREATE DATACONSUMERSCHEME FROM FORM dataConsumerScheme.AgencyId = GetAgencyValue(); dataConsumerScheme.Id = txtDSDID.Text; dataConsumerScheme.Version = txtVersion.Text; dataConsumerScheme.FinalStructure = TertiaryBool.ParseBoolean(chkIsFinal.Checked); dataConsumerScheme.Uri = (!txtDSDURI.Text.Trim().Equals( string.Empty ) && ValidationUtils.CheckUriFormat(txtDSDURI.Text)) ? new Uri(txtDSDURI.Text) : null; if (!txtValidFrom.Text.Trim().Equals(string.Empty)) { dataConsumerScheme.StartDate = DateTime.ParseExact(txtValidFrom.Text, "dd/MM/yyyy", CultureInfo.InvariantCulture); } if (!txtValidTo.Text.Trim().Equals(string.Empty)) { dataConsumerScheme.EndDate = DateTime.ParseExact(txtValidTo.Text, "dd/MM/yyyy", CultureInfo.InvariantCulture); } if (dataConsumerScheme.Names.Count != 0) { dataConsumerScheme.Names.Clear(); } if (dataConsumerScheme.Descriptions.Count != 0) { dataConsumerScheme.Descriptions.Clear(); } foreach (var tmpName in AddTextName.TextObjectList) { dataConsumerScheme.AddName(tmpName.Locale, tmpName.Value); } if (AddTextDescription.TextObjectList != null) foreach (var tmpDescription in AddTextDescription.TextObjectList) { dataConsumerScheme.AddDescription(tmpDescription.Locale, tmpDescription.Value); } if (dataConsumerScheme.Annotations.Count != 0) { dataConsumerScheme.Annotations.Clear(); } if (AnnotationGeneralControl.AnnotationObjectList != null) foreach (var annotation in AnnotationGeneralControl.AnnotationObjectList) { dataConsumerScheme.AddAnnotation(annotation); } #endregion return dataConsumerScheme; }
private bool SaveInMemory(IDataConsumerSchemeMutableObject dataConsumerScheme) { if (dataConsumerScheme == null) return false; Session[KEY_PAGE_SESSION] = dataConsumerScheme; return true; }
private bool SendQuerySubmit(IDataConsumerSchemeMutableObject dataConsumerScheme) { try { ISdmxObjects sdmxObjects = new SdmxObjectsImpl(); sdmxObjects.AddDataConsumerScheme(dataConsumerScheme.ImmutableInstance); WSModel modelDataConsumerScheme = new WSModel(); XmlDocument result = modelDataConsumerScheme.SubmitStructure(sdmxObjects); Utils.GetXMLResponseError(result); return true; } catch (Exception ex) { return false; } }
private IDataConsumerSchemeMutableObject InsertDataConsumerInDataConsumerscheme(IDataConsumerSchemeMutableObject dataConsumerScheme) { if (dataConsumerScheme == null) return null; IDataConsumerMutableObject dataConsumer = new DataConsumerMutableCore(); string data_consumer_id = txt_id_new.Text.Trim(); IList<ITextTypeWrapperMutableObject> data_consumer_names = AddTextName_new.TextObjectList; IList<ITextTypeWrapperMutableObject> data_consumer_descs = AddTextDescription_new.TextObjectList; // string code_order_str = txtOrderNewCode.Text.Trim(); ----- ORDINE #region DATACONSUMER ID if (ValidationUtils.CheckIdFormat(data_consumer_id)) { dataConsumer.Id = data_consumer_id; } else { lblErrorOnNewInsert.Text = Resources.Messages.err_id_format; Utils.AppendScript( "openPopUp('df-Dimension', 600);" ); Utils.AppendScript("location.href= '#dataconsumers';"); return null; } IEnumerable<IDataConsumerMutableObject> dataConsumers = (from c in dataConsumerScheme.Items where c.Id == data_consumer_id select c).OfType<IDataConsumerMutableObject>(); if (dataConsumers.Count() > 0) { lblErrorOnNewInsert.Text = Resources.Messages.err_id_exist; Utils.AppendScript( "openPopUp('df-Dimension', 600);" ); Utils.AppendScript("location.href= '#dataconsumers';"); return null; } #endregion #region DATACONSUMER NAMES if (data_consumer_names != null) { foreach (var tmpName in data_consumer_names) { dataConsumer.AddName(tmpName.Locale, tmpName.Value); } } else { lblErrorOnNewInsert.Text = Resources.Messages.err_list_name_format; Utils.AppendScript( "openPopUp('df-Dimension', 600);" ); Utils.AppendScript("location.href= '#dataconsumers';"); return null; } #endregion #region DATACONSUMER DESCRIPTIONS if (data_consumer_descs != null) { foreach (var tmpDescription in data_consumer_descs) { dataConsumer.AddDescription(tmpDescription.Locale, tmpDescription.Value); } } #endregion dataConsumerScheme.Items.Add(dataConsumer); try { // Ultimo controllo se ottengo Immutable istanze validazione completa var canRead = dataConsumerScheme.ImmutableInstance; } catch (Exception ex) { dataConsumerScheme.Items.Remove(dataConsumer); return null; } return dataConsumerScheme; }