Exemplo n.º 1
0
        /// <summary>
        /// Add new Entity Click
        /// </summary>
        public void AddEntity_Click(object sender, EventArgs e)
        {
            // Return if Add Entity is Allready shwowen
            if (tabPageAdd.Text != Glossary.Add)
            {
                return;
            }

            // Show TabAdd Page
            tabPageAdd.Text = this.BLO_Instance.ConfigEntity.AddButton?.Title;
            tabControl_MainManager.CausesValidation = false;
            tabControl_MainManager.SelectedTab      = tabPageAdd;
            // Fix MetroFrameWork Scrol TabPage Bug
            this.tabControl_MainManager.TabPages["tabPageAdd"].CreateControl();


            // Create EntryForm Instance
            BaseEntity    Entity = (BaseEntity)this.BLO_Instance.CreateEntityInstance();
            BaseEntryForm form   = EntryForm_Instance.CreateInstance(BLO_Instance, Entity, this.Filter_Instance.GetFilterValues());

            form.Name = "Form";
            form.Dock = DockStyle.Fill;
            form.ShowEntity(this.Filter_Instance.GetFilterValues(), BaseEntryForm.EntityActions.Add);
            tabPageAdd.Controls.Add(form);
            form.EnregistrerClick += EntryFormSave_Click;
            form.AnnulerClick     += CancelEntryForm_Click;
        }
Exemplo n.º 2
0
        /// <summary>
        /// DataGridControl_EditClick event
        /// </summary>
        private void DataGridControl_EditClick(object sender, EventArgs e)
        {
            BaseEntity entity        = (BaseEntity)this.DataGridControl_Instance.SelectedEntity;
            string     tabEditerName = "TabEditer-" + entity.Id;

            if (tabControl_MainManager.TabPages.IndexOfKey(tabEditerName) == -1)
            {
                // Creation of Edit Tab page
                TabPage tabEditer = new TabPage();
                tabEditer.Text = Glossary.Update + " : " + entity.ToString();
                tabEditer.Name = tabEditerName;
                tabEditer.Font = this.tabControl_MainManager.TabPages["TabGrid"].Font;
                tabControl_MainManager.TabPages.Add(tabEditer);
                tabControl_MainManager.CausesValidation = false;
                // Creation of EntryForm
                BaseEntryForm form = EntryForm_Instance.CreateInstance(this.BLO_Instance, entity, null);
                form.Name = "EntityForm";
                form.Dock = DockStyle.Fill;

                this.tabControl_MainManager.TabPages[tabEditerName].Controls.Add(form);
                tabControl_MainManager.SelectedTab = tabEditer;
                form.ShowEntity(this.Filter_Instance.GetFilterValues(), BaseEntryForm.EntityActions.Update);
                // Entry Form Events
                form.EnregistrerClick += Form_EditerClick;
                form.AnnulerClick     += Form_AnnulerEditerClick;
            }
            else
            {
                TabPage tabEditer = this.tabControl_MainManager.TabPages[tabEditerName];
                tabControl_MainManager.SelectedTab = tabEditer;
            }
        }