public bool IsEnable(object Sender, object Element) { bool retval = false; // O.R. [2009-07-28]: Check license and NET Framework version // O.R. [2009-10-28]: Check SchemaManager count SchemaMaster[] list = SchemaManager.GetAvailableShemaMasters(); if (Configuration.WorkflowModule && WorkflowActivityWrapper.IsFramework35Installed() && list != null && list.Length > 0) { retval = true; } return(retval); }
private void BindData() { RebuildTemplateGroupList(); if (instance != null) // create from instance { NameText.Text = instance.Name; if (instance.Description != null) { DescriptionText.Text = instance.Description; } SchemaMaster currentShemaMaster = SchemaManager.GetShemaMaster(instance.SchemaId); string title = currentShemaMaster.Description.Comment; if (string.IsNullOrEmpty(title)) { title = currentShemaMaster.Description.Name; } SchemaMasterList.Items.Add(new ListItem(CHelper.GetResFileString(title), currentShemaMaster.Description.Id.ToString())); SchemaMasterList.Enabled = false; ControlName = currentShemaMaster.Description.UI.EditControl; // Object types DisableUnsupportedObjectTypes(currentShemaMaster); // Lock Library LockLibraryCheckBox.Checked = WorkflowParameters.GetOwnerReadOnly(instance); // Overdue Action CHelper.SafeSelect(AssignmentOverdueActionList, ((int)WorkflowParameters.GetAssignmentOverdueAction(instance)).ToString()); } else if (template != null) // edit { NameText.Text = template.Name; if (template.Description != null) { DescriptionText.Text = template.Description; } SchemaMaster currentShemaMaster = SchemaManager.GetShemaMaster(template.SchemaId); string title = currentShemaMaster.Description.Comment; if (string.IsNullOrEmpty(title)) { title = currentShemaMaster.Description.Name; } SchemaMasterList.Items.Add(new ListItem(CHelper.GetResFileString(title), currentShemaMaster.Description.Id.ToString())); SchemaMasterList.Enabled = false; ControlName = currentShemaMaster.Description.UI.EditControl; if (template.ProjectId.HasValue) { ProjectControl.ObjectId = (int)template.ProjectId.Value; } // Object types DisableUnsupportedObjectTypes(currentShemaMaster); List <int> selectedObjectTypes = new List <int>(template.SupportedIbnObjectTypes); DocumentCheckBox.Checked = selectedObjectTypes.Contains((int)ObjectTypes.Document); IncidentCheckBox.Checked = selectedObjectTypes.Contains((int)ObjectTypes.Issue); TaskCheckBox.Checked = selectedObjectTypes.Contains((int)ObjectTypes.Task); TodoCheckBox.Checked = selectedObjectTypes.Contains((int)ObjectTypes.ToDo); // Lock Library LockLibraryCheckBox.Checked = WorkflowParameters.GetOwnerReadOnly(template); // Overdue Action CHelper.SafeSelect(AssignmentOverdueActionList, ((int)WorkflowParameters.GetAssignmentOverdueAction(template)).ToString()); // Template Group TemplateGroupValue = template.TemplateGroup; } else // new { SchemaMaster[] list = SchemaManager.GetAvailableShemaMasters(); if (list != null && list.Length > 0) { List <ListItem> listItems = new List <ListItem>(); foreach (SchemaMaster item in list) { string title = item.Description.Comment; if (string.IsNullOrEmpty(title)) { title = item.Description.Name; } listItems.Add(new ListItem(CHelper.GetResFileString(title), item.Description.Id.ToString())); } listItems.Sort(delegate(ListItem x, ListItem y) { return(x.Text.CompareTo(y.Text)); }); SchemaMasterList.Items.AddRange(listItems.ToArray()); SchemaMasterList.SelectedIndex = 0; SchemaMaster currentShemaMaster = null;; string selectedItem = SchemaMasterList.SelectedValue; foreach (SchemaMaster item in list) { if (item.Description.Id.ToString() == selectedItem) { currentShemaMaster = item; break; } } ControlName = currentShemaMaster.Description.UI.CreateControl; DisableUnsupportedObjectTypes(currentShemaMaster); } } string url = String.Format(CultureInfo.InvariantCulture, "{0}?type=TemplateGroups&btn={1}", ResolveClientUrl("~/Apps/MetaDataBase/Pages/Public/EnumView.aspx"), Page.ClientScript.GetPostBackEventReference(RefreshButton, "")); EditItemsButton.Attributes.Add("onclick", String.Format(CultureInfo.InvariantCulture, "enumEdit_OpenWindow(\"{0}\", 750, 500, 1)", url)); }
private void BindData() { if (instance == null) // new { SchemaMaster[] list = SchemaManager.GetAvailableShemaMasters(); if (list != null && list.Length > 0) { List <ListItem> listItems = new List <ListItem>(); foreach (SchemaMaster item in list) { string title = item.Description.Comment; if (string.IsNullOrEmpty(title)) { title = item.Description.Name; } listItems.Add(new ListItem(CHelper.GetResFileString(title), item.Description.Id.ToString())); } listItems.Sort(delegate(ListItem x, ListItem y) { return(x.Text.CompareTo(y.Text)); }); SchemaMasterList.Items.AddRange(listItems.ToArray()); SchemaMasterList.SelectedIndex = 0; SchemaMaster currentShemaMaster = null;; string selectedItem = SchemaMasterList.SelectedValue; foreach (SchemaMaster item in list) { if (item.Description.Id.ToString() == selectedItem) { currentShemaMaster = item; break; } } ControlName = currentShemaMaster.Description.UI.CreateControl; } } else // edit { NameText.Text = instance.Name; if (instance.Description != null) { DescriptionText.Text = instance.Description; } SchemaMaster currentShemaMaster = SchemaManager.GetShemaMaster(instance.SchemaId); string title = currentShemaMaster.Description.Comment; if (string.IsNullOrEmpty(title)) { title = currentShemaMaster.Description.Name; } SchemaMasterList.Items.Add(new ListItem(CHelper.GetResFileString(title), currentShemaMaster.Description.Id.ToString())); SchemaMasterList.Enabled = false; // Lock Library LockLibraryCheckBox.Checked = WorkflowParameters.GetOwnerReadOnly(instance); // Overdue Action CHelper.SafeSelect(AssignmentOverdueActionList, ((int)WorkflowParameters.GetAssignmentOverdueAction(instance)).ToString()); ControlName = currentShemaMaster.Description.UI.EditControl; } }