private void btnOK_Click(object sender, EventArgs e) { if (!NamingGuidance.CheckNameFocus(tbName, "Datasource Name", true)) { return; } // Fetch all datasourcenames in a list IList <string> dataSourceNames = (from ds in View.DataSources where ds.Id != DataSource.Id select ds.Name).ToList(); // Check name of Datasource if (!NamingGuidance.CheckNameNotInList(tbName.Text.Trim(), "Datasource Name", "Datasource List", dataSourceNames, false, true)) { return; } DataSource.Name = tbName.Text.Trim(); // Save the datasource modelService.SaveDomainObject(DataSource); DialogResult = DialogResult.OK; }
private void okBtn_Click(object sender, EventArgs e) { if (!NamingGuidance.CheckMappedPropertyName(tbNewName.Text.Trim(), true)) { tbNewName.SelectAll(); tbNewName.Focus(); return; } if (MaxPropertyLength > 0 && tbNewName.Text.Trim().Length > MaxPropertyLength) { MessageBox.Show("The new name is too long! Maximum " + MaxPropertyLength.ToString() + " characters.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } if (!string.IsNullOrEmpty(NameSuffix) && !tbNewName.Text.Trim().EndsWith(NameSuffix, false, null)) { MessageBox.Show(string.Format("The new name is missing the suffix (\"{0}\")!", NameSuffix), "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } NewName = tbNewName.Text.Trim(); DialogResult = DialogResult.OK; }
private void btnOK_Click(object sender, EventArgs e) { if (!NamingGuidance.CheckNameFocus(tbName, "Custom Dialog Name", true)) { return; } if (!NamingGuidance.CheckCaptionFocus(tbTopic, "Topic", true)) { return; } if (!NamingGuidance.CheckDLLName(tbDLLName.Text.Trim(), "DLL Name", true)) { tbDLLName.Focus(); return; } CustomDialog.Name = tbName.Text.Trim(); CustomDialog.Topic = tbTopic.Text.Trim(); CustomDialog.DLLName = tbDLLName.Text.Trim(); // Save the Custom Dialog to database modelService.SaveDomainObject(CustomDialog); // if this is a new dialog leave the dialog as checked out if (newDialog == true) { CheckOutInObject(CustomDialog, true); ContaindDomainObjectIdAndType = new KeyValuePair <Guid, Type>(CustomDialog.Id, typeof(CustomDialog)); } DialogResult = DialogResult.OK; }
private void btnOK_Click(object sender, EventArgs e) { if (!NamingGuidance.CheckCaptionFocus(tbLabelText, "Label Caption", true)) { return; } DialogResult = DialogResult.OK; }
private void OkButton_Click(object sender, EventArgs e) { bool isNew = false; if (IsEditable) { Cursor.Current = Cursors.WaitCursor; isNew = businessEntity.Id == Guid.Empty; if (!NamingGuidance.CheckNameEmptyFocus(NameTextBox, "Module Name", true)) { return; } if (string.IsNullOrEmpty(businessEntity.Name) || businessEntity.Name.ToUpper() != NameTextBox.Text.Trim().ToUpper()) { IEnumerable <string> businessEntityNames = modelService.GetAllDomainObjectsByApplicationId <BusinessEntity>(FrontendApplication.Id).Select <BusinessEntity, string>(s => s.Name); if (!NamingGuidance.CheckNameNotInList(NameTextBox.Text.Trim(), "BusinessEntity Name", "List of BusinessEntity", businessEntityNames, false, true)) { return; } } if (!isNew) { businessEntity = modelService.GetInitializedDomainObject <BusinessEntity>(businessEntity.Id); } businessEntity.Name = NameTextBox.Text; businessEntity = (BusinessEntity)modelService.SaveDomainObject(businessEntity); if (isNew) { try { configurationManagementService.CheckOutDomainObject(businessEntity.Id, typeof(BusinessEntity)); } catch (Exception ex) { Cursor.Current = Cursors.Default; MessageBox.Show(ex.Message); return; } } ContaindDomainObjectIdAndType = new KeyValuePair <Guid, Type>(businessEntity.Id, typeof(BusinessEntity)); Cursor.Current = Cursors.Default; this.DialogResult = System.Windows.Forms.DialogResult.OK; this.Close(); } }
private void btnOK_Click(object sender, EventArgs e) { if (!NamingGuidance.CheckNameFocus(tbName, "Query Name", true)) { return; } // Check length of queryname if (MaxQueryNameLength > 0 && tbName.Text.Trim().Length > MaxQueryNameLength) { MessageBox.Show("The Query Name is too long, it can be maximum " + MaxQueryNameLength.ToString() + " characters.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } // Find the parameters that is nonunique if (outParameterNames.Count > 0) { IList <string> list = outParameterNames.Values.GroupBy(s => s).Where(g => g.Count() > 1).Select(g => g.Key).ToList(); if (list.Count > 0) { // Make a nice comma separated list! string listNames = list.Aggregate((current, next) => current + ", " + next); if (list.Count > 1) { MessageBox.Show("The parameters with the names " + listNames + " must be renamed.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } else { MessageBox.Show("The parameters with the name " + listNames + " must be renamed.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } return; } } ReportQuery parentReportQuery; string errorText; if (!ReportHelper.CheckReportParameterCombinations(ExistingSources, rtSQL.Text, out errorText, out parentReportQuery)) { MessageBox.Show(errorText, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } ParentReportQuery = parentReportQuery; CurrentQuery.Name = tbName.Text.Trim(); DialogResult = DialogResult.OK; }
private bool AddQueryInfo() { bool propertiesAdded = true; queryControl.CompileQuery(); if (queryControl.IsQueryCompiled) { if (!NamingGuidance.CheckQueryName(queryControl.QueryName, true)) { return(false); } if (Action.Query.Id != Guid.Empty) { using (new SessionScope(MetaManagerServices.GetSessionFactory(), MetaManagerServices.GetDomainInterceptor(), true, FlushMode.Never, true)) { // Get a fresh copy from database (original) Query dbQuery = modelService.GetInitializedDomainObject <Query>(Action.Query.Id); // Syncronize the new one with the one in the database //if (!MetaManagerServices.Helpers.QueryHelper.SyncProperties(Action.Query, dbQuery, HandleDeletedQueryProperties, out propertiesAdded)) if (!MetaManagerServices.Helpers.QueryHelper.SyncProperties(queryControl.Query, dbQuery, HandleDeletedQueryProperties, out propertiesAdded)) { return(false); } foreach (QueryProperty qp in queryPropertyToDelete) { dbQuery.Properties.Remove(qp); } Action.Query = dbQuery; } } Action.Query.Name = queryControl.QueryName.Trim(); Action.Query.Schema = schema; return(true); } else { MessageBox.Show("You must compile the query first."); return(false); } }
private void saveBtn_Click(object sender, EventArgs e) { foreach (DataGridViewRow row in dgvDialogs.Rows) { // Check Name if (!NamingGuidance.CheckDialogName((string)row.Cells[1].Value, true)) { // Start editing the faulty name cell dgvDialogs.CurrentCell = row.Cells[1]; dgvDialogs.BeginEdit(false); return; } // Check title if (!NamingGuidance.CheckCaption((string)row.Cells[2].Value, "Dialog Title", true)) { // Start editing the faulty name cell dgvDialogs.CurrentCell = row.Cells[2]; dgvDialogs.BeginEdit(false); return; } } SelectedDialogs.Clear(); foreach (LocalDialog d in localDialogs) { if (d.Selected) { // Now set the new Name and Title from the grid. d.Dialog.Name = d.Name; d.Dialog.Title = d.Title; // Add the dialog to the selected ones. SelectedDialogs.Add(d.Dialog); } } if (SelectedDialogs.Count > 0) { DialogResult = DialogResult.OK; } else { cancelBtn_Click(sender, e); } }
private void propertyGrid_PropertyValueChanged(object s, PropertyValueChangedEventArgs e) { if (propertyGrid.SelectedObject != null && propertyGrid.SelectedObject is UXComponent) { UXComponent comp = propertyGrid.SelectedObject as UXComponent; if (e.ChangedItem.Label == "Name") { if (!NamingGuidance.CheckNameNotInList(comp.Name, "Component Name", "Dialog Component Namelist", ComponentNames, false, true) || !NamingGuidance.CheckName(comp.Name, "Component Name", true)) { comp.Name = (string)e.OldValue; } } } }
private void dgvDialogs_CellValidating(object sender, DataGridViewCellValidatingEventArgs e) { // Check if edited cell is Name or Title if (e.ColumnIndex == 1) // Name { if (!NamingGuidance.CheckDialogName(e.FormattedValue.ToString(), true)) { e.Cancel = true; } } else if (e.ColumnIndex == 2) // Title { if (!NamingGuidance.CheckCaption(e.FormattedValue.ToString(), "Dialog Title", true)) { e.Cancel = true; } } }
private bool AddActionInfo() { if (targetProcedureBtn.Checked) { if (!NamingGuidance.CheckActionNameStoredProcedure(actionNameTb.Text.Trim(), true)) { return(false); } } else { if (!NamingGuidance.CheckActionNameQuery(actionNameTb.Text.Trim(), true)) { return(false); } ; } if (Action.Name != actionNameTb.Text.Trim() || newAction) { // Get all names for the actions in this businessentity BusinessEntity selectedBE = entityCbx.SelectedItem as BusinessEntity; IList <DataAccess.Domain.Action> foundActions = modelService.GetVersionControlledDomainObjectsForParent(typeof(DataAccess.Domain.Action), selectedBE.Id).Cast <DataAccess.Domain.Action>().ToList(); IEnumerable <string> actionNames = null; if (foundActions != null && foundActions.Count > 0) { // Make list to a list of strings. actionNames = foundActions.Select <Cdc.MetaManager.DataAccess.Domain.Action, string>(action => action.Name); } // Check if name already exist if (!NamingGuidance.CheckNameNotInList(actionNameTb.Text.Trim(), "Action Name", "list of Action Names for BusinessEntities", actionNames, false, true)) { return(false); } // Update Action name Action.Name = actionNameTb.Text.Trim(); Action.BusinessEntity = selectedBE; } return(true); }
private void btnOK_Click(object sender, EventArgs e) { if (!NamingGuidance.CheckMappedPropertyName(tbName.Text, true)) { return; } Property = new Property(); Property.Name = tbName.Text.Trim(); Property.BusinessEntity = _businessEntity; if (rbString.Checked) { Property.Type = typeof(string); } else if (rbInt.Checked) { Property.Type = typeof(int); } else if (rbInt64.Checked) { Property.Type = typeof(long); } else if (rbDouble.Checked) { Property.Type = typeof(double); } else if (rbDecimal.Checked) { Property.Type = typeof(decimal); } else if (rbBoolean.Checked) { Property.Type = typeof(bool); } else if (rbDateTime.Checked) { Property.Type = typeof(DateTime); } DialogResult = DialogResult.OK; }
private void btnOK_Click(object sender, EventArgs e) { // Check name. if (!NamingGuidance.CheckCustomViewName(tbName.Text.Trim(), true)) { tbName.Focus(); return; } // Check Title if (!NamingGuidance.CheckCaptionFocus(tbTitle, "Custom View Title", true)) { return; } // Check DLL Name if (!NamingGuidance.CheckDLLName(cbDLLName.Text.Trim(), "Custom View DLL Name", true)) { cbDLLName.Focus(); return; } // Check CustomClassName if (!NamingGuidance.CheckClassName(tbClassName.Text, "Custom View Class Name", true)) { tbClassName.Focus(); return; } // Create the view EditView.BusinessEntity = (BusinessEntity)cbBusinessEntity.SelectedItem; EditView.CustomClassName = tbClassName.Text.Trim(); EditView.CustomDLLName = cbDLLName.Text.Trim(); EditView.Name = tbName.Text.Trim(); EditView.Title = tbTitle.Text.Trim(); // Persist the view EditView = (DataAccess.Domain.View)modelService.SaveDomainObject(EditView); DialogResult = DialogResult.OK; }
private void CheckMappedProperties(PropertyMap propertyMap) { List <string> propNames = new List <string>(); foreach (MappedProperty prop in propertyMap.MappedProperties) { if (prop.Target == null) { throw new ArgumentException("Property is not mapped.", prop.Source.Name); } string name = prop.Name; if (string.IsNullOrEmpty(name)) { name = prop.Target.Name; } if (prop.TargetProperty != null) { if (prop.TargetProperty.BusinessEntity == null) { throw new ArgumentException("Property has no BusinessEntity.", prop.Name); } } // Check the names NamingGuidance.CheckMappedPropertyName(name, false); if (propNames.Contains(name)) { throw new ArgumentException("Duplicate property name.", name); } else { propNames.Add(name); } } }
private void btnOK_Click(object sender, EventArgs e) { if (!NamingGuidance.CheckCaptionFocus(tbCaption, "MenuItem Caption", true)) { return; } if (!IsRootMenuItem && !NamingGuidance.CheckNameFocus(tbName, "MenuItem Name", true)) { return; } if (!IsRootMenuItem && !NamingGuidance.CheckGUIDFocus(tbAuthorizationId, "MenuItem Authorization Id", true)) { return; } CurrentMenuItem.Caption = tbCaption.Text.Trim(); CurrentMenuItem.Name = tbName.Text.Trim(); DialogResult = DialogResult.OK; }
private bool CheckIfCanSave() { // Check name if (!NamingGuidance.CheckNameFocus(tbName, "Service Name", true)) { return(false); } // Check if the service already exist if (!Editing || (Editing && Service.Name.ToUpper() != tbName.Text.Trim().ToUpper())) { IEnumerable <string> serviceExistList = modelService.GetAllDomainObjectsByApplicationId <Service>(BackendApplication.Id).Select(s => s.Name); if (!NamingGuidance.CheckNameNotInList(tbName.Text.Trim(), "Service Name", "List of Services", serviceExistList, false, true)) { return(false); } } return(true); }
private void btnOK_Click(object sender, EventArgs e) { // Check name if (!NamingGuidance.CheckViewName(tbName.Text.Trim(), true)) { return; } // Check title if (!NamingGuidance.CheckCaptionFocus(tbTitle, "View Title", true)) { return; } // Check unique name IList <Cdc.MetaManager.DataAccess.Domain.View> viewList = dialogService.GetViewsByNameAndApplicationId(tbName.Text, FrontendApplication.Id); if (viewList.Count > 1) { MessageBox.Show("The name of the view is not unique, please change the value for the view name!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); tbName.SelectAll(); tbName.Focus(); return; } View.Name = tbName.Text.Trim(); View.Title = tbTitle.Text.Trim(); View.LayoutManualyAdapted = LayoutManualyAdaptedcheckBox.Checked; // Save View modelService.SaveDomainObject(View); DialogResult = DialogResult.OK; }
private void sourceGrid_PropertyValueChanged(object s, PropertyValueChangedEventArgs e) { MappedProperty property = sourceGrid.SelectedObject as MappedProperty; if (e.ChangedItem.PropertyDescriptor.Name == "DefaultValue") { if (!string.IsNullOrEmpty(property.DefaultValue)) { property.IsEnabled = true; } } if (e.ChangedItem.PropertyDescriptor.Name == "Name") { if (e.ChangedItem.Value != null) { if (!NamingGuidance.CheckMappedPropertyName(e.ChangedItem.Value.ToString(), true)) { property.Name = (e.OldValue == null ? null : e.OldValue.ToString()); } } } if (!MultiSelMode) { foreach (ListViewItem item in propertyListView.Items) { UpdateListItem(item); } } else { // Save all changes so we can save all later ChangedMultiSelProperties[e.ChangedItem.PropertyDescriptor.Name] = e.ChangedItem.Value; } }
private void btnOK_Click(object sender, EventArgs e) { // Check name. if (!NamingGuidance.CheckDialogName(tbName.Text.Trim(), true)) { return; } // Check Title if (!NamingGuidance.CheckCaptionFocus(tbTitle, "Dialog title", true)) { return; } foreach (Module item in moduleCbx.Items.Cast <Module>()) { if (item.Name == moduleCbx.Text) { moduleCbx.SelectedItem = item; } } // The name must be unique within the same module IList <Cdc.MetaManager.DataAccess.Domain.Dialog> dialogList = dialogService.FindDialogsByNameAndModule(FrontendApplication.Id, moduleCbx.Text, tbName.Text); if (dialogList.Count > 0) { MessageBox.Show("The name of the dialog must be unique within the same module, please change the value for the dialog name!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); tbName.SelectAll(); tbName.Focus(); return; } Module module = moduleCbx.SelectedItem as Module; try { if (module == null) { if (string.IsNullOrEmpty(moduleCbx.Text)) { MessageBox.Show("You must select or enter a module."); return; } else { module = new Module(); module.Application = FrontendApplication; module.Name = moduleCbx.Text; module = (Module)modelService.SaveDomainObject(module); PopulateModuleCombobox(); foreach (Module item in moduleCbx.Items.Cast <Module>()) { if (item.Id == module.Id) { moduleCbx.SelectedItem = item; } } } } Dialog = new Dialog(); Dialog.Name = tbName.Text.Trim(); Dialog.Title = tbTitle.Text.Trim(); Dialog.CreatorName = tbCreatorName.Text.Trim(); Dialog.Type = (DialogType)Enum.Parse(typeof(DialogType), typeCbx.SelectedItem.ToString()); //Check that Views that are used in create or modify dialogs not is used in other dialogs if (Dialog.Type == DialogType.Create || Dialog.Type == DialogType.Modify) { long noOfViews = dialogService.CountViewNodes(SelectedView); if (noOfViews > 0) { //We will not allow to use the same view in several dialogs. MessageBox.Show("The view is already used by another dialog. Please, select another view for this dialog!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); tbViewName.SelectAll(); tbViewName.Focus(); return; } } // Create Rote ViewNode ViewNode rootNode = new Cdc.MetaManager.DataAccess.Domain.ViewNode(); rootNode.View = SelectedView; if (Dialog.Type == DialogType.Overview || Dialog.Type == DialogType.Drilldown) { rootNode.Title = "Overview"; } else if (Dialog.Type == DialogType.Create || Dialog.Type == DialogType.Modify || Dialog.Type == DialogType.Find) { rootNode.Title = Dialog.Title; } rootNode.Sequence = 1; rootNode.Dialog = Dialog; Dialog.ViewNodes.Add(rootNode); Dialog.RootViewNode = rootNode; Dialog.InterfaceView = SelectedView; Dialog.Module = moduleCbx.SelectedItem as Module; // Save Dialog modelService.MergeSaveDomainObject(Dialog); // Check out the dialog CheckOutInObject(Dialog, true); ContaindDomainObjectIdAndType = new KeyValuePair <Guid, Type>(Dialog.Id, typeof(Dialog)); DialogResult = DialogResult.OK; } catch (Exception ex) { MessageBox.Show(ex.ToString()); } }
private void btnOK_Click(object sender, EventArgs e) { if (EditMappedProperty != null) { string defaultValue = tbDefaultValue.Text.Trim(); if (rbDefaultText.Checked) { // Check default value if (!string.IsNullOrEmpty(defaultValue)) { if (!CheckDefaultValue(defaultValue, DefaultValueType)) { return; } } } if (EditMappedProperty.IsCustom) { // Check name if (!NamingGuidance.CheckNameFocus(tbName, "Property Name", true)) { return; } EditMappedProperty.Name = tbName.Text.Trim(); } if (rbDefaultText.Checked) { EditMappedProperty.DefaultValue = defaultValue; EditMappedProperty.DefaultSessionProperty = null; } else if (rbDefaultSession.Checked) { EditMappedProperty.DefaultValue = null; EditMappedProperty.DefaultSessionProperty = (UXSessionProperty)cbDefaultSession.SelectedItem; } else { EditMappedProperty.DefaultValue = null; EditMappedProperty.DefaultSessionProperty = null; } if (EditMappedProperty.IsSearchable != cbSearchable.Checked) { SearchableParameterUpdated = true; } EditMappedProperty.IsSearchable = cbSearchable.Checked; EditMappedProperty.DisplayFormat = tbDisplayFormat.Text.Trim(); } else { // Save for multiselect if (!DisableDefaultValueEditing) { string defaultValue = tbDefaultValue.Text.Trim(); // Check default value if (rbDefaultText.Checked && !string.IsNullOrEmpty(defaultValue)) { if (!CheckDefaultValue(defaultValue, DefaultValueType)) { return; } } // Update defaults foreach (MappedProperty prop in EditMappedProperties) { if (rbDefaultText.Checked) { prop.DefaultValue = defaultValue; prop.DefaultSessionProperty = null; } else if (rbDefaultSession.Checked) { prop.DefaultValue = null; prop.DefaultSessionProperty = (UXSessionProperty)cbDefaultSession.SelectedItem; } else { prop.DefaultValue = null; prop.DefaultSessionProperty = null; } } } // Update searchable and displayformat depending on if requestprop or not foreach (MappedProperty prop in EditMappedProperties) { if (prop.IsSearchable != cbSearchable.Checked) { SearchableParameterUpdated = true; } if (IsRequestProperty) { prop.IsSearchable = cbSearchable.Checked; } else { prop.DisplayFormat = tbDisplayFormat.Text.Trim(); } } } DialogResult = DialogResult.OK; }
private void OkButton_Click(object sender, EventArgs e) { if (IsEditable) { Cursor.Current = Cursors.WaitCursor; if (application.IsFrontend == false) { if (ConnectionStringTextBox.Text != schema.ConnectionString) { if (MessageBox.Show("You have changed the connection string. This change cannot be cancelled. Are you sure that you want to save the change?", "Question", MessageBoxButtons.OKCancel, MessageBoxIcon.Question) == DialogResult.Cancel) { return; } else { //check out schema try { MetaManagerServices.GetConfigurationManagementService().CheckOutDomainObject(schema.Id, modelService.GetDomainObjectType(schema)); } catch (ConfigurationManagementException ex) { Cursor.Current = Cursors.Default; MessageBox.Show(ex.Message); return; } schema = schema = modelService.GetAllDomainObjectsByApplicationId <Schema>(BackendApplication.Id)[0]; schema.ConnectionString = ConnectionStringTextBox.Text; // Save schema schema = (Cdc.MetaManager.DataAccess.Domain.Schema)modelService.SaveDomainObject(schema); // checkin try { MetaManagerServices.GetConfigurationManagementService().CheckInDomainObject(schema.Id, modelService.GetDomainObjectType(schema), BackendApplication); } catch (ConfigurationManagementException ex) { Cursor.Current = Cursors.Default; MessageBox.Show(ex.Message); } } } } if (!NamingGuidance.CheckName(NameTextBox.Text, "Application Name", true)) { return; } application.Name = NameTextBox.Text; application.Namespace = NamespaceTextBox.Text; application.Version = VersionTextBox.Text; application = (Cdc.MetaManager.DataAccess.Domain.Application)modelService.SaveDomainObject(application); ContaindDomainObjectIdAndType = new KeyValuePair <Guid, Type>(application.Id, typeof(Cdc.MetaManager.DataAccess.Domain.Application)); Cursor.Current = Cursors.Default; this.DialogResult = System.Windows.Forms.DialogResult.OK; this.Close(); } }
private void btnOk_Click(object sender, EventArgs e) { bool isNew = false; if (IsEditable) { Cursor.Current = Cursors.WaitCursor; isNew = serviceMethod.Id == Guid.Empty; if (!NamingGuidance.CheckNameEmptyFocus(tbServiceMethodName, "ServiceMethod Name", true)) { return; } if (string.IsNullOrEmpty(serviceMethod.Name) || serviceMethod.Name.ToUpper() != tbServiceMethodName.Text.Trim().ToUpper()) { IEnumerable <string> serviceMethodNames = modelService.GetAllDomainObjectsByApplicationId <ServiceMethod>(BackendApplication.Id).Where(s => s.Service.Id == Service.Id).Select <ServiceMethod, string>(s => s.Name); if (!NamingGuidance.CheckNameNotInList(tbServiceMethodName.Text.Trim(), "ServiceMethod Name", "List of ServiceMethods", serviceMethodNames, false, true)) { return; } } serviceMethod.Name = tbServiceMethodName.Text; if (!typeof(DataAccess.Domain.Action).IsAssignableFrom(cbAction.SelectedItem.GetType())) { if (!NHibernate.NHibernateUtil.IsInitialized(Service)) { Service = modelService.GetInitializedDomainObject <Service>(Service.Id); } CreateEditActionWizard form = new CreateEditActionWizard(); form.FrontendApplication = FrontendApplication; form.BackendApplication = BackendApplication; form.ServiceMethodOwner = serviceMethod; Dictionary <string, object> criteria = new Dictionary <string, object>(); criteria.Add("Name", Service.Name); IList <BusinessEntity> entityList = modelService.GetAllDomainObjectsByPropertyValues <BusinessEntity>(criteria); if (entityList.Count > 0) { form.BusinessEntity = entityList[0]; } form.ShowDialog(); if (form.ContaindDomainObjectIdAndType.Key == Guid.Empty) { return; } serviceMethod.MappedToAction = form.Action; } else { serviceMethod.MappedToAction = (DataAccess.Domain.Action)cbAction.SelectedItem; } serviceMethod = MetaManagerServices.Helpers.ServiceMethodHelper.SaveAndSynchronize(serviceMethod); if (isNew) { try { configurationManagementService.CheckOutDomainObject(serviceMethod.Id, typeof(ServiceMethod)); } catch (Exception ex) { Cursor.Current = Cursors.Default; MessageBox.Show(ex.Message); return; } } ContaindDomainObjectIdAndType = new KeyValuePair <Guid, Type>(serviceMethod.Id, typeof(ServiceMethod)); Cursor.Current = Cursors.Default; this.DialogResult = DialogResult.OK; } }
private void btnOK_Click(object sender, EventArgs e) { // Check Action Name if (UXAction.MappedToObject != null) { // Check if mapped to Dialog if (UXAction.MappedToObject.ActionType == UXActionType.Dialog) { if (!NamingGuidance.CheckUXActionDialogName(UXAction.Name, true)) { return; } if (!string.IsNullOrEmpty(UXAction.AlarmId) && (UXAction.Dialog.InterfaceView.ServiceMethod != null)) { MessageBox.Show("AlarmId can only be used if the target Dialog has a Service Method defined.", "Action", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } } // Check if mapped to Service else if (UXAction.MappedToObject.ActionType == UXActionType.ServiceMethod) { if (!NamingGuidance.CheckUXActionServiceName(UXAction.Name, true)) { return; } } } else { // Check if not mapped if (!NamingGuidance.CheckName(UXAction.Name, "UXAction Name", true)) { return; } if (!string.IsNullOrEmpty(UXAction.AlarmId)) { MessageBox.Show("AlarmId can only be used when the Action points to a Dialog or Service Method.", "Action", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } } if (!NamingGuidance.CheckCaption(UXAction.Caption, "UXAction Caption", true)) { return; } if (UXAction.MappedToObject == null) { if (MessageBox.Show("You haven't mapped the Action to any object. Do you want to save the Action anyway?", "Warning", MessageBoxButtons.YesNo, MessageBoxIcon.Exclamation, MessageBoxDefaultButton.Button1) == DialogResult.No) { return; } } if (UXAction.OriginalDialog == null) { UXAction.OriginalDialog = string.Empty; } Cursor = Cursors.WaitCursor; // Save try { if (addedMappedPropertiesInRequestMap.Count > 0 || deletedMappedPropertiesInRequestMap.Count > 0) { modelService.StartSynchronizePropertyMapsInObjects(UXAction, new List <IDomainObject>(), deletedMappedPropertiesInRequestMap.Cast <IDomainObject>().ToList()); } UXAction = (UXAction)modelService.SaveDomainObject(UXAction); ContaindDomainObjectIdAndType = new KeyValuePair <Guid, Type>(UXAction.Id, typeof(UXAction)); DialogResult = DialogResult.OK; } catch (Exception ex) { MessageBox.Show(ex.ToString()); } Cursor = Cursors.Default; }
private void btnOK_Click(object sender, EventArgs e) { string newViewName = tbName.Text.Trim(); // Check name. if (!NamingGuidance.CheckViewName(newViewName, true)) { return; } // Check Title if (!NamingGuidance.CheckCaptionFocus(tbTitle, "View Title", true)) { return; } // Check unique name IList <Cdc.MetaManager.DataAccess.Domain.View> viewList = dialogService.GetViewsByNameAndApplicationId(tbName.Text, FrontendApplication.Id); if (viewList.Count > 0) { MessageBox.Show("The name of the view is not unique, please change the value for the view name!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); tbName.SelectAll(); tbName.Focus(); return; } Cursor.Current = Cursors.WaitCursor; // Create the view NewView.BusinessEntity = (BusinessEntity)cbBusinessEntity.SelectedItem; NewView.Name = newViewName; NewView.Title = tbTitle.Text.Trim(); // Create VisualTree if (rbtnGroupbox.Checked) { NewView.VisualTree = new UXWrapPanel(); UXGroupBox groupBox = new UXGroupBox(); groupBox.Caption = "Change Me"; NewView.VisualTree.Children.Add(groupBox); } else if (rbtnGrid.Checked) { NewView.VisualTree = new UXDockPanel(); UXDataGrid dataGrid = new UXDataGrid(); dataGrid.Name = "NoName"; NewView.VisualTree.Children.Add(dataGrid); } else if (rbtnTwoWayListBox.Checked) { NewView.VisualTree = new UXWrapPanel(); UXTwoWayListBox twoWayListBox = new UXTwoWayListBox(); twoWayListBox.Name = "TwoWayListBox"; NewView.VisualTree.Children.Add(twoWayListBox); } if (NewView.ServiceMethod != null) { dialogService.CreateViewServiceMethodMap(NewView, NewView.ServiceMethod.Id); } else { NewView.RequestMap = new PropertyMap(); NewView.ResponseMap = new PropertyMap(); } FrontendApplication = modelService.GetInitializedDomainObject <DataAccess.Domain.Application>(FrontendApplication.Id); NewView.Application = FrontendApplication; // Persist the view NewView = (DataAccess.Domain.View)modelService.SaveDomainObject(NewView); ContaindDomainObjectIdAndType = new KeyValuePair <Guid, Type>(NewView.Id, typeof(DataAccess.Domain.View)); //CheckOut view CheckOutInObject(NewView, true); DialogResult = DialogResult.OK; Cursor.Current = Cursors.Default; }
private void btnOK_Click(object sender, EventArgs e) { SelectedAction = null; if (rbSelectAction.Checked) { // An existing action is selected if (ListViewSelectedAction != null) { SelectedAction = ListViewSelectedAction; } DialogResult = DialogResult.OK; } else if (rbCreateAction.Checked) { // Check if name is ok if (MappableUXObject is Dialog || MappableUXObject is CustomDialog) { if (!NamingGuidance.CheckUXActionDialogName(tbName.Text.Trim(), true)) { tbName.Focus(); return; } } else if (MappableUXObject is ServiceMethod) { if (!NamingGuidance.CheckUXActionServiceName(tbName.Text.Trim(), true)) { tbName.Focus(); return; } } // Check if name exists if (!NamingGuidance.CheckNameNotInList(tbName.Text.Trim(), "UXAction Name", "Action Names for the current Application", AllActionNames, false, true)) { return; } // Check if Caption is ok if (!NamingGuidance.CheckCaptionFocus(tbCaption, "Caption", true)) { return; } FrontendApplication = modelService.GetInitializedDomainObject <DataAccess.Domain.Application>(FrontendApplication.Id); // Create the new action SelectedAction = MetaManagerServices.Helpers.UXActionHelper.CreateUXActionForMappableObject(MappableUXObject, FrontendApplication, tbName.Text.Trim(), tbCaption.Text.Trim()); // Leave the action as checked out CheckOutInObject(SelectedAction, true); DialogResult = DialogResult.OK; } if (SelectedAction == null) { MessageBox.Show("No action selected/created!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } }