public override void UpdateTermValue(string termGroupContainerName) { if (_externalTerm.SelectedItems == null) _externalTerm.InitializeSelectedItems(); //Do NOT call GetHiddenFieldName here; this.ClientID does not containg the containing ManagedItemProfilePanel //because this control is not nested in the parent panel yet. string prefix = (string.IsNullOrEmpty(termGroupContainerName) ? "" : termGroupContainerName + "_"); string hiddenFieldName = prefix + this.ID + "__NewValues"; string hiddenFieldValue = Request.Form[hiddenFieldName]; if (!string.IsNullOrEmpty(hiddenFieldValue)) { string[] rows = hiddenFieldValue.Split(new char[] { '~' }, StringSplitOptions.RemoveEmptyEntries); foreach (string row in rows) { Business.ExternalInterfaceListItem listItem = new Business.ExternalInterfaceListItem(_externalTerm.InterfaceConfig); string[] values = row.Split(new char[] { '|' }, StringSplitOptions.None); listItem.Key = values[0]; //check to see if listItem.Key is already in SelectedItems; if so, don't add the new item bool listItemAlreadyExists = false; foreach (Business.ExternalInterfaceListItem selectedItem in _externalTerm.SelectedItems) if (selectedItem.Key == listItem.Key) { listItemAlreadyExists = true; break; } if (!listItemAlreadyExists) { for (int i = 1; i < values.Length; i++) { string[] keyValuePair = values[i].Split(new char[] { '=' }); string fieldName = HttpUtility.HtmlDecode(keyValuePair[0]); string fieldValue = HttpUtility.HtmlDecode(keyValuePair[1]); listItem.FieldValues.Add(fieldName, fieldValue); } _externalTerm.SelectedItems.Add(listItem); } } SetPageDirty(true); } }
private void SetControlPreSelects() { if (_report == null) return; if (_report.SearchCriteria == null) return; if (_report.SearchCriteria.ManagedItemNumber != null) txtManagedItemNumber.Text = _report.SearchCriteria.ManagedItemNumber; if (_report.SearchCriteria.TemplateId.HasValue) ddlTemplate.SelectedValue = _report.SearchCriteria.TemplateId.ToString(); if (_report.SearchCriteria.Statuses != null) if (_report.SearchCriteria.Statuses.Count == 1) if (ddlStatus.Items.Count > 0) ddlStatus.SelectedValue = _report.SearchCriteria.Statuses[0]; if (_report.SearchCriteria.KeyWords != null) txtKeywords.Text = _report.SearchCriteria.KeyWords; string field1 = null; string field2 = null; foreach (Business.Term term in _itatSystem.Terms) { if (term.Runtime.Visible) { switch (term.TermType) { case Business.TermType.Text: case Business.TermType.MSO: GetSearchDBInfo(term.DBFieldName, ref field1, ref field2); SetTextBoxText(_systemTermControls[term.Name], field1); break; case Business.TermType.Date: case Business.TermType.Renewal: GetSearchDBInfo(term.DBFieldName, ref field1, ref field2); SetDateRangeText(_systemTermControls[term.Name], field1, field2); break; case Business.TermType.Facility: if (_report.SearchCriteria.FacilityIds != null) if (_report.SearchCriteria.FacilityIds.Count == 1) SetDropDownList(_systemTermControls[term.Name], _report.SearchCriteria.FacilityIds[0].ToString()); break; case Business.TermType.PickList: GetSearchDBInfo(term.DBFieldName, ref field1, ref field2); SetDropDownList(_systemTermControls[term.Name], field1); break; } } } if (_report.SearchCriteria.ExternalTermsCriteria != null) { foreach (string interfaceName in _report.SearchCriteria.ExternalTermsCriteria.Keys) { Business.ExternalInterfaceSearchCriteria eisc = _report.SearchCriteria.ExternalTermsCriteria[interfaceName]; Business.ExternalInterfaceConfig eic = _itatSystem.FindExternalInterfaceConfig(interfaceName); Business.ExternalTerm extTerm = _externalTerms[interfaceName]; extTerm.InitializeSelectedItems(); foreach (Business.ExternalInterfaceSearchCriteriaValue eiscv in eisc.Values) { Business.ExternalInterfaceListItem eili = new Business.ExternalInterfaceListItem(eic); eili.Key = eiscv.KeyValue; eili.FieldValues = new Dictionary<string, string>(); foreach (Business.ExternalInterfaceSearchCriteriaDetail detail in eiscv.Details) eili.FieldValues.Add(detail.FieldName, detail.FieldValue); extTerm.SelectedItems.Add(eili); } } } }
public void LoadValues() { if (_managedItem == null) return; _selectedItems = new List<ExternalInterfaceListItem>(); DataTable dt = Data.ExternalTerm.GetValues(_managedItem.ManagedItemID, _interfaceConfig.Name); string previousKeyValue = string.Empty; Business.ExternalInterfaceListItem listItem = null; foreach (DataRow row in dt.Rows) { string keyValue = (string)row[Data.DataNames._C_KeyValue]; if (keyValue != previousKeyValue) { previousKeyValue = keyValue; if (listItem != null) _selectedItems.Add(listItem); listItem = new Business.ExternalInterfaceListItem(_interfaceConfig); listItem.Key = keyValue; } listItem.FieldValues.Add((string)row[1], (string)row[2]); } if (listItem != null) _selectedItems.Add(listItem); _valuesLoaded = true; }