Example #1
0
        private void EditApplicationInfo_Load(object sender, EventArgs e)
        {
            application = modelService.GetInitializedDomainObject <Cdc.MetaManager.DataAccess.Domain.Application>(ContaindDomainObjectIdAndType.Key);
            if (application.IsFrontend == false)
            {
                schema = modelService.GetAllDomainObjectsByApplicationId <Schema>(BackendApplication.Id)[0];
                ConnectionStringTextBox.Visible = true;
                connectionStringLabel.Visible   = true;
                ConnectionStringTextBox.Text    = schema.ConnectionString;
            }
            else
            {
                ConnectionStringTextBox.Visible = false;
                connectionStringLabel.Visible   = false;
            }

            IsEditable = application.IsLocked && application.LockedBy == Environment.UserName;

            NameTextBox.Text      = application.Name;
            NamespaceTextBox.Text = application.Namespace;
            VersionTextBox.Text   = application.Version;


            if (!IsEditable)
            {
                NameTextBox.ReadOnly             = true;
                NamespaceTextBox.ReadOnly        = true;
                VersionTextBox.ReadOnly          = true;
                ConnectionStringTextBox.ReadOnly = true;
                OkButton.Visible = false;
            }
            else
            {
                EnableDisableButtons();
            }

            Cursor.Current = Cursors.Default;
            NamespaceTextBox.Focus();
        }
Example #2
0
        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();
            }
        }