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 Savebutton_Click(object sender, EventArgs e) { if (deltaList != null) { try { Cursor = Cursors.WaitCursor; foreach (DeltaListEntry delta in deltaList) { if (delta.PreviewMode) { delta.SwitchCurrentOjects(); } } //Try to check out foreach (DeltaListEntry delta in deltaList) { if (delta.CurrentObject_CurrentVersion != null && typeof(IVersionControlled).IsAssignableFrom(delta.CurrentObject_CurrentVersion.GetType())) { configurationManagementService.CheckOutDomainObject(((IVersionControlled)delta.CurrentObject_CurrentVersion).Id, delta.CurrentObject_CurrentVersion.GetType()); } } importChangeHelper.ApplyChange(deltaList, true); Cursor = Cursors.Default; } catch (Exception ex) { Cursor = Cursors.Default; System.Windows.MessageBox.Show(ex.Message); } } }
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; } }