Example #1
0
        private void btnSaveConfig_Click(object sender, EventArgs e)
        {
            //if (txtViewName.Text.Length < 1)
            //{
            //    MessageBox.Show("Please enter a view name.", "Bright Manager", MessageBoxButtons.OK, MessageBoxIcon.Warning);
            //    return;
            //}

            //if (!dxValidationProvider1.Validate())
            //    return;

            if (!ValidateColumnsInView())
                return;

            if (!m_LoadedConfig) {
                CreateBlankView _control = new CreateBlankView(true);
                _control.AfterSave += new CreateBlankView.AfterSaveEventHandler(_control_AfterSave);
                PopupDialog _dlg = new PopupDialog() {
                    FormBorderStyle = FormBorderStyle.FixedSingle,
                    MinimizeBox = false,
                    MaximizeBox = false,
                    StartPosition = FormStartPosition.CenterScreen,
                    Text = "New View"
                };
                _dlg.Controls.Add(_control);
                _dlg.ClientSize = new Size(_control.Width + 2, _control.Height + 2);
                _dlg.ShowDialog(this.ParentForm);
            }
            else {
                WaitDialog.Show("Saving Configuration ...");
                this.SaveConfiguration(false);
                WaitDialog.Close();
            }

            //m_ConfigGrid.Complete = true;
            //tbpgeGridConfig.Image = ManagerApplication.Properties.Resources.save_ok;

            #region Saving Logic
            //WaitDialog.Show("Saving configuration...");
            //System.IO.StringWriter writer = new System.IO.StringWriter();
            //DataSet dsResult = null;
            //if (dtColumnsInView.DataSet == null) {
            //    dsResult = new DataSet("view");
            //    dsResult.Tables.Add(dtColumnsInView);
            //} else {
            //    dsResult = dtColumnsInView.DataSet;
            //}
            //dsResult.WriteXml(writer, XmlWriteMode.IgnoreSchema);
            //var xmlConfig = writer.ToString();

            //if (viewConfig == null) {
            //    viewConfig = new view_configuration() {
            //        date_created = DateTime.Now,
            //        created_by = UserSession.CurrentUser.UserId
            //    };
            //} else {
            //    viewConfig.modified_by = UserSession.CurrentUser.UserId;
            //    viewConfig.date_modified = DateTime.Now;
            //}
            //viewConfig.xml_config = xmlConfig;
            //viewConfig.name = m_ViewName;
            //viewConfig.subcampaign_id = m_iSubcampaignID;

            //try {
            //    if (IsNewConfig)
            //        BPContext.view_configuration.AddObject(viewConfig);
            //    BPContext.SaveChanges();

            //    int configID = viewConfig.id;
            //    BindViewList();
            //    lookUpEditViewList.EditValue = configID;
            //    btnDeleteView.Enabled = true;
            //    btnShowXmlViewConfig.Enabled = true;
            //    MessageBox.Show("View configuration has been saved.", "Success", MessageBoxButtons.OK, MessageBoxIcon.Information);
            //    IsNewConfig = false;
            //    IsSaved = true;

            //    /**
            //     * changing tab color code.
            //     */
            //    //tcViewConfig.LookAndFeel.Style = DevExpress.LookAndFeel.LookAndFeelStyle.Flat;
            //    //tcViewConfig.LookAndFeel.UseDefaultLookAndFeel = false;
            //    //tbpgeGridReport.Appearance.Header.BackColor = Color.PaleGreen;
            //    //tbpgeGridReport.Appearance.Header.Options.UseBackColor = true;

            //} catch {
            //}
            //WaitDialog.Close();
            #endregion
        }
Example #2
0
        private void _control_AfterSave(CreateBlankView.AfterSaveArgs e)
        {
            m_ViewName = e.ViewName;
            m_IsNew = e.IsNew;

            if (m_IsNew) {
                WaitDialog.Show("Saving configuration...");
                if (this.SaveConfiguration(true))
                    m_LoadedConfig = true; // so that the next save, the popup will not show again.

                #region Commented Code
                //m_ConfigGrid.Complete = true;
                //tbpgeGridConfig.Image = ManagerApplication.Properties.Resources.save_ok;

                //WaitDialog.Show(ParentForm, "Loading Data Views...");
                //lookUpEditViewList.EditValue = null;
                //lookUpEditViewList.Properties.ReadOnly = true;
                //lookUpEditSubcampaign.Properties.ReadOnly = true;

                ////lcgHeaderControls.Enabled = true;
                //lcgLeft.Enabled = true;
                //lcgRight.Enabled = true;
                //txtViewName.Text = "";

                //BindGridAvailableColumns();
                //BindGridColumnsInView();
                ////var objSen = sender as SimpleButton;
                ////if (objSen != null) objSen.Enabled = false;
                //btnCreateBlankView.Enabled = false;
                //btnLoadView.Enabled = false;
                //btnDeleteView.Enabled = false;
                ////btnDuplicateView.Enabled = false;
                //btnShowXmlViewConfig.Enabled = true;
                //IsNewConfig = true;
                //viewConfig = null;
                #endregion
            }
            else {
                WaitDialog.Show("Renaming View ...");
                m_efoViewConfig.name = m_ViewName;
                m_efoViewConfig.modified_by = UserSession.CurrentUser.UserId;
                m_efoViewConfig.date_modified = DateTime.Now;
                try {
                    m_efDbContext.SaveChanges();
                    int configID = m_efoViewConfig.id;
                    this.BindViewList();
                    lookUpEditViewList.EditValue = configID;
                    //btnDeleteView.Enabled = true;
                    //btnShowXmlViewConfig.Enabled = true;
                    m_ConfigGrid.Complete = true;
                    tbpgeGridConfig.Image = ManagerApplication.Properties.Resources.save_ok;
                    IsNewConfig = false;
                    IsSaved = true;

                    /**
                     * reload view list combo box
                     */
                    this.lookUpEditViewList.EditValueChanged -= new System.EventHandler(this.lookUpEditViewList_EditValueChanged);
                    int _EditValue = lookUpEditViewList.EditValue == null ? 0 : (int)lookUpEditViewList.EditValue;
                    this.BindViewList(_EditValue);
                    this.lookUpEditViewList.EditValueChanged += new System.EventHandler(this.lookUpEditViewList_EditValueChanged);

                    btnLoadView.Enabled = true;
                    btnDeleteView.Enabled = true;
                    btnRenameView.Enabled = true;
                    btnShowXmlViewConfig.Enabled = true;
                }
                catch {
                }
            }
            WaitDialog.Close();
        }
Example #3
0
        private void btnRenameView_Click(object sender, EventArgs e)
        {
            if (!IsSaved) {
                if (MessageBox.Show("Do you want to save changes to the current view?", "Confirm", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
                    btnSaveConfig_Click(null, null);
                else
                    IsSaved = true;
            }

            if (gvAvailableColumns.RowCount < 1) {
                MessageBox.Show("Please load the config file first.", "Bright Manager", MessageBoxButtons.OK, MessageBoxIcon.Information);
                return;
            }

            CreateBlankView _control = new CreateBlankView(false, m_efoViewConfig.name);
            _control.AfterSave += new CreateBlankView.AfterSaveEventHandler(_control_AfterSave);

            PopupDialog _dlg = new PopupDialog() {
                FormBorderStyle = FormBorderStyle.FixedSingle,
                MinimizeBox = false,
                MaximizeBox = false,
                StartPosition = FormStartPosition.CenterScreen,
                Text = "Rename View"
            };
            _dlg.Controls.Add(_control);
            _dlg.ClientSize = new Size(_control.Width + 2, _control.Height + 2);
            _dlg.ShowDialog(this.ParentForm);
        }