public bool ValidateMDControl(MDControl md) { if (md.MD_ContactListBox.Items.Count == 0) { MessageBox.Show(GlobalStrings.MsgNoPointOfContact); md.MD_tabControl.SelectedTab = md.MetadataTab; md.MD_ContactListBox.Focus(); return false; } if (md.MD_LanguageComboBox.SelectedIndex == -1) { MessageBox.Show(GlobalStrings.MsgMetaLangNotFound); return false; } if (md.ID_ResourseTitleTextBox.Text == "") { MessageBox.Show(GlobalStrings.MsgResourceTitleMetaNotFound); return false; } if (md.ID_ResourceAbstractTextBox.Text == "") { MessageBox.Show(GlobalStrings.MsgResourceMetaNotFound); return false; } if (md.ID_ResourceTypeComboBox.SelectedIndex == -1) { MessageBox.Show(GlobalStrings.MsgResourceTypeNotSelected); return false; } if (md.ID_ResourceLanguageListBox.Items.Count == 0) { MessageBox.Show(GlobalStrings.MsgResourceLangMetaNotFound); return false; } if (md.ID_UIDListBox.Items.Count == 0) { MessageBox.Show(GlobalStrings.MsgUniqueResourceIdNotFound); return false; } if (md.CL_TopicCategoryListBox.Items.Count == 0) { MessageBox.Show(GlobalStrings.MsgTopicCategNotFound); return false; } if (md.KW_KeywordListBox.Items.Count == 0) { MessageBox.Show(GlobalStrings.MsgKeywordsNotFound); return false; } if (md.GEO_ExtendListBox.Items.Count == 0) { MessageBox.Show(GlobalStrings.MsgGeogrExtendNotFound); return false; } if (md.TMP_TemporalExtendListBox.Items.Count == 0 && md.TMP_PublicDateListBox.Items.Count == 0 && md.TMP_RevisionDateListBox.Items.Count == 0 && md.TMP_CreationDateListBox.Items.Count == 0) { MessageBox.Show(GlobalStrings.MsgTempRefMustBeCompleted); return false; } if (md.LIN_FreeTextBox.Text == "") { MessageBox.Show(GlobalStrings.MsgLineageFreeTextNotFound); return false; } if (md.CSTR_ConditionsUseGeneralListBox.Items.Count == 0) { MessageBox.Show(GlobalStrings.MsgCondAccessAndUseNotFound); return false; } if (md.CSTR_LimitationsPublicListBox.Items.Count == 0) { MessageBox.Show(GlobalStrings.MsgLimitPublicAccessNotFound); return false; } if (md.ORG_IndividualListBox.Items.Count == 0) { MessageBox.Show(GlobalStrings.MsgRespPartMetaNotFound); return false; } return true; }
public void FillMDControl(MDObject obj, MDControl md) { md.mdguid = obj.FileIdentifier; md.MD_ContactListBox.Items.Clear(); foreach (object o in obj.MD_PointOfContact) { md.MD_ContactListBox.Items.Add((string)o); } DateTime dt = Convert.ToDateTime(obj.MD_Date); md.MD_DateTimePicker.Value = dt; md.MD_LanguageComboBox.SelectedItem = obj.MD_Language; md.ID_ResourseTitleTextBox.Text = obj.ID_ResourseTitle; md.ID_ResourceAbstractTextBox.Text = obj.ID_ResourceAbstract; md.ID_ResourceTypeComboBox.SelectedItem = obj.ID_ResourceType; md.ID_ResourceLocatorListBox.Items.Clear(); if (obj.ID_ResourceLocator.Count > 0) { foreach (object o in obj.ID_ResourceLocator) { md.ID_ResourceLocatorListBox.Items.Add((string)o); } } md.ID_UIDListBox.Items.Clear(); foreach (object o in obj.ID_UniqueResourceIdentifier) { md.ID_UIDListBox.Items.Add((string)o); } md.ID_ResourceLanguageListBox.Items.Clear(); foreach (object o in obj.ID_ResourceLanguage) { md.ID_ResourceLanguageListBox.Items.Add((string)o); } md.CL_TopicCategoryListBox.Items.Clear(); foreach (object o in obj.CL_TopicCategory) { md.CL_TopicCategoryListBox.Items.Add((string)o); } md.KW_KeywordListBox.Items.Clear(); foreach (object o in obj.KW_Keyword) { md.KW_KeywordListBox.Items.Add((string)o); } md.GEO_ExtendListBox.Items.Clear(); foreach (object o in obj.GEO_GeographicExtend) { md.GEO_ExtendListBox.Items.Add((string)o); } md.TMP_TemporalExtendListBox.Items.Clear(); foreach (object o in obj.TMP_TemporalExtend) { md.TMP_TemporalExtendListBox.Items.Add((string)o); } md.TMP_CreationDateListBox.Items.Clear(); md.TMP_AddCreationDateButton.Enabled = true; if (obj.TMP_DateCreation != "") { md.TMP_CreationDateListBox.Items.Add(obj.TMP_DateCreation); md.TMP_AddCreationDateButton.Enabled = false; } md.TMP_RevisionDateListBox.Items.Clear(); md.TMP_AddRevisionDateButton.Enabled = true; if (obj.TMP_DateRevision != "") { md.TMP_RevisionDateListBox.Items.Add(obj.TMP_DateRevision); md.TMP_AddRevisionDateButton.Enabled = false; } md.TMP_PublicDateListBox.Items.Clear(); if (obj.TMP_DatePublication.Count > 0) { foreach (object o in obj.TMP_DatePublication) { md.TMP_PublicDateListBox.Items.Add((string)o); } } md.LIN_FreeTextBox.Text = obj.QLT_Lineage; md.QLT_ListBox.Items.Clear(); if (obj.QLT_Scale.Count > 0) { foreach (object o in obj.QLT_Scale) { md.QLT_ListBox.Items.Add("Κλίμακα: " + (string)o); } } if (obj.QLT_Distance.Count > 0) { foreach (object o in obj.QLT_Distance) { md.QLT_ListBox.Items.Add("Απόσταση: " + (string)o); } } md.CFRM_ListBox.Items.Clear(); if (obj.CFRM_Title.Count > 0) { int cnt = obj.CFRM_Title.Count; for (int i = 0; i < cnt; i++) { string tmp = ((string)obj.CFRM_Degree[i]) + "|" + ((string)obj.CFRM_Title[i]) + "|" + ((string)obj.CFRM_DateType[i]) + "|" + ((string)obj.CFRM_Date[i]); md.CFRM_ListBox.Items.Add(tmp); } } md.CSTR_ConditionsUseGeneralListBox.Items.Clear(); foreach (object t in obj.CSTR_ConditionsUseGeneral) { md.CSTR_ConditionsUseGeneralListBox.Items.Add((string)t); } md.CSTR_AddConditionsUseGeneralButton1.Enabled = false; md.CSTR_AddConditionsUseGeneralButton2.Enabled = false; md.CSTR_LimitationsPublicListBox.Items.Clear(); foreach (object t in obj.CSTR_LimitationsPublic) { md.CSTR_LimitationsPublicListBox.Items.Add((string)t); } md.CSTR_AddLimitationsPublicButton1.Enabled = false; md.CSTR_AddLimitationsPublicButton2.Enabled = false; md.ORG_IndividualListBox.Items.Clear(); foreach (object o in obj.ORG_ResponsibleParty) { md.ORG_IndividualListBox.Items.Add((string)o); } }
public void FillMDObject(MDObject obj, MDControl md) { obj.FileIdentifier = md.mdguid; foreach (object contact in md.MD_ContactListBox.Items) { string tmp = (string) contact; obj.MD_PointOfContact.Add(tmp); } obj.MD_Date = md.MD_DateTimePicker.Value.ToString("yyyy-MM-dd"); obj.MD_Language = (string)md.MD_LanguageComboBox.SelectedItem; obj.ID_ResourseTitle = md.ID_ResourseTitleTextBox.Text; obj.ID_ResourceAbstract = md.ID_ResourceAbstractTextBox.Text; obj.ID_ResourceType = (string)md.ID_ResourceTypeComboBox.SelectedItem; if (md.ID_ResourceLocatorListBox.Items.Count != 0) { foreach (object locator in md.ID_ResourceLocatorListBox.Items) { string tmp = (string)locator; obj.ID_ResourceLocator.Add(tmp); } } foreach (object uid in md.ID_UIDListBox.Items) { obj.ID_UniqueResourceIdentifier.Add((string)uid); } foreach (object lang in md.ID_ResourceLanguageListBox.Items) { obj.ID_ResourceLanguage.Add((string)lang); } foreach (object t in md.CL_TopicCategoryListBox.Items) { obj.CL_TopicCategory.Add((string)t); } foreach (object t in md.KW_KeywordListBox.Items) { obj.KW_Keyword.Add((string)t); } foreach (object t in md.GEO_ExtendListBox.Items) { obj.GEO_GeographicExtend.Add((string)t); } foreach (object t in md.TMP_TemporalExtendListBox.Items) { obj.TMP_TemporalExtend.Add((string)t); } if (md.TMP_CreationDateListBox.Items.Count != 0) { foreach (object t in md.TMP_CreationDateListBox.Items) { obj.TMP_DateCreation = (string)t; } } if (md.TMP_PublicDateListBox.Items.Count != 0) { foreach (object t in md.TMP_PublicDateListBox.Items) { obj.TMP_DatePublication.Add((string)t); } } if (md.TMP_RevisionDateListBox.Items.Count != 0) { foreach (object t in md.TMP_RevisionDateListBox.Items) { obj.TMP_DateRevision = (string)t; } } obj.QLT_Lineage = md.LIN_FreeTextBox.Text; if (md.QLT_ListBox.Items.Count != 0) { foreach (object t in md.QLT_ListBox.Items) { string tmp = (string)t; string[] sub = tmp.Split(' '); if (sub[0] == "Κλίμακα:") { obj.QLT_Scale.Add(sub[1]); } else if (sub[0] == "Απόσταση:") { string sum = sub[1] + " " + sub[2]; obj.QLT_Distance.Add(sum); } } } if (md.CFRM_ListBox.Items.Count != 0) { foreach (object t in md.CFRM_ListBox.Items) { string tmp = (string)t; string[] sub = tmp.Split('|'); obj.CFRM_Degree.Add(sub[0]); obj.CFRM_Title.Add(sub[1]); obj.CFRM_DateType.Add(sub[2]); obj.CFRM_Date.Add(sub[3]); } } foreach (object t in md.CSTR_ConditionsUseGeneralListBox.Items) { obj.CSTR_ConditionsUseGeneral.Add((string)t); } foreach (object t in md.CSTR_LimitationsPublicListBox.Items) { obj.CSTR_LimitationsPublic.Add((string)t); } foreach (object t in md.ORG_IndividualListBox.Items) { obj.ORG_ResponsibleParty.Add((string)t); } return; }