Exemplo n.º 1
0
        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;
        }
Exemplo n.º 2
0
        private void btnOK_Click(object sender, EventArgs e)
        {
            if (!NamingGuidance.CheckCaptionFocus(tbLabelText, "Label Caption", true))
            {
                return;
            }

            DialogResult = DialogResult.OK;
        }
Exemplo n.º 3
0
        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;
        }
Exemplo n.º 4
0
        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;
        }
Exemplo n.º 5
0
        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;
        }
Exemplo n.º 6
0
        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;
        }
Exemplo n.º 7
0
        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());
            }
        }
Exemplo n.º 8
0
        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;
            }
        }