private void btnOK_Click(object sender, EventArgs e)
 {
     if (VariableFacade.AddContentsTime(MainTable))
     {
         DialogResult = System.Windows.Forms.DialogResult.OK;
     }
 }
        public CreateMainTable()
        {
            InitializeComponent();

            pressCategoryComboBox.DataSource    = Option.GetOptions("PresCategory");
            specCharExistsComboBox.DataSource   = Option.GetOptions("SpecCharExists");
            englishStatusComboBox.DataSource    = Option.GetOptions("StatusEn");
            englishPublishedComboBox.DataSource = Option.GetOptions("YesNo");
            statAuthorityComboBox.DataSource    = Option.GetOptions("StatAuthority");
            producerComboBox.DataSource         = Option.GetOptions("StatAuthority");
            presCellsZeroComboBox.DataSource    = Option.GetOptions("YesNo");
            aggregPossibleComboBox.DataSource   = Option.GetOptions("YesNo");
            stockFAComboBox.DataSource          = Option.GetOptions("StockFA");
            cFPricesComboBox.DataSource         = Option.GetOptions("CFPrices");
            dayAdjComboBox.DataSource           = Option.GetOptions("YesNo");
            seasAdjComboBox.DataSource          = Option.GetOptions("YesNo");
            storeFormatComboBox.DataSource      = Option.GetOptions("StoreFormat");
            variableTypeComboBox.DataSource     = Option.GetOptions("VariableType");
            copyrightComboBox.DataSource        = Option.GetOptions("Copyright");
            themeComboBox.DataSource            = Option.GetThemeOptions();
            timeScaleIdComboBox.DataSource      = Option.GetTimeScaleOptions();
            presMissingLineComboBox.DataSource  = Option.GetPresMissingLineOptions();
            FootnoteNo = VariableFacade.GetFootnoteNextId();

            NewMainTable = new PxMainTable();
            //lbContents.DataSource = _table.Contents;
            //lbVariables.DataSource = _table.Variables;
        }
 private void lvVariables_SelectedIndexChanged(object sender, EventArgs e)
 {
     if (lvVariables.SelectedIndices.Count == 1)
     {
         SelectedVariable = VariableFacade.GetVarible(lvVariables.SelectedItems[0].Text);
         pxVariableBindingSource.DataSource = SelectedVariable;
     }
 }
Esempio n. 4
0
        private void btnAddTimePeriods_Click(object sender, EventArgs e)
        {
            CreateMainTable frmCreateMainTable = new CreateMainTable();

            frmCreateMainTable.NewMainTable = VariableFacade.GetMainTableById(menuTextBox.Text);
            frmCreateMainTable.SetEditMode();
            frmCreateMainTable.ShowDialog();
        }
        private void ChooseVariable_Load(object sender, EventArgs e)
        {
            List <Option> variables = VariableFacade.GetVariableList();

            foreach (var v in variables)
            {
                lvVariables.Items.Add(v.Code).SubItems.Add(v.Text);
            }
        }
Esempio n. 6
0
        private void btnNewValuepool_Click(object sender, EventArgs e)
        {
            CreateValuePoolDialog dlg = new CreateValuePoolDialog();

            if (dlg.ShowDialog() == System.Windows.Forms.DialogResult.OK)
            {
                lbValuePools.DataSource    = VariableFacade.GetValuePools();
                lbValuePools.SelectedValue = dlg.SelectedValuePool.ValuePool;
            }
        }
Esempio n. 7
0
        private void btnAddTable_Click(object sender, EventArgs e)
        {
            PxMenuSelection selectedMenu = (PxMenuSelection)tvMenuSelection.SelectedNode.Tag;
            int             levelNo;

            int.TryParse(selectedMenu.LevelNo, out levelNo);
            if (levelNo < 5)
            {
                CreateMainTable frmCreateDialog = new CreateMainTable();

                frmCreateDialog.NewMainTable.Theme = selectedMenu.GetTheme(selectedMenu);
                if (selectedMenu.GetTheme(selectedMenu) == null)
                {
                    MessageBox.Show("Can not insert a table in this node", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    return;
                }
                frmCreateDialog.SetTheme(frmCreateDialog.NewMainTable.Theme);

                if (frmCreateDialog.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                {
                    PxMenuSelection newMenuSelection = new PxMenuSelection();
                    newMenuSelection.Parent              = selectedMenu;
                    newMenuSelection.LevelNo             = "5";
                    newMenuSelection.PresText            = frmCreateDialog.NewMainTable.PresText;
                    newMenuSelection.PresTextEnglish     = frmCreateDialog.NewMainTable.TableTitleEnglish;
                    newMenuSelection.Menu                = frmCreateDialog.NewMainTable.TableId;
                    newMenuSelection.Presentation        = "A";
                    newMenuSelection.PresentationEnglish = "A";

                    string message = "";

                    if (!newMenuSelection.Validate(ref message))
                    {
                        MessageBox.Show(message, "Create Menu Selection", MessageBoxButtons.OKCancel, MessageBoxIcon.Information);
                        return;
                    }

                    if (!VariableFacade.Save(newMenuSelection, ref message))
                    {
                        MessageBox.Show(message, "Create Menu Selection", MessageBoxButtons.OKCancel, MessageBoxIcon.Information);
                        return;
                    }

                    selectedMenu.Childrens.Add(newMenuSelection);
                    TreeNode newTheme = new TreeNode();
                    newTheme.Name = newMenuSelection.Menu;
                    newTheme.Text = newMenuSelection.PresText;
                    newTheme.Tag  = newMenuSelection;

                    tvMenuSelection.SelectedNode.Nodes.Add(newTheme);
                    tvMenuSelection.SelectedNode = newTheme;
                }
            }
        }
Esempio n. 8
0
 private void btnSave_Click(object sender, EventArgs e)
 {
     if (VariableFacade.UpdateMenuSelection((PxMenuSelection)pxMenuSelectionBindingSource.DataSource))
     {
         MessageBox.Show("Menu selection saved succesfuly", "Information", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
     else
     {
         MessageBox.Show("Can not save Menu Selection", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }
        private void ImportFromExcel(string excelPath)
        {
            List <string> periods = VariableFacade.GetTimeValuesFormExcel(excelPath);

            foreach (var period in periods)
            {
                if (!AddPeriod(period))
                {
                    MessageBox.Show("Could not add period " + period);
                }
            }
        }
Esempio n. 10
0
 private void lbValuePools_SelectedIndexChanged(object sender, EventArgs e)
 {
     lbValuesets.DataSource = VariableFacade.GetValuesetsByValuePoolPxValueset(lbValuePools.SelectedValue.ToString());
     if (lbValuesets.SelectedValue != null)
     {
         btnOk.Enabled = true;
     }
     else
     {
         btnOk.Enabled = false;
     }
 }
        private void InsertData(string fileName)
        {
            string msg = "";

            if (!VariableFacade.DataInsertInDb(_table, fileName, rbtDeleteAllRowsFirst.Checked, ref msg))
            {
                MessageBox.Show(msg);
            }
            else
            {
                btnActivateTable.Enabled = true;
            }
        }
        private void btnCreateDataTable_Click(object sender, EventArgs e)
        {
            string msg = "";

            if (VariableFacade.CreateDataTable(_table, ref msg))
            {
                BindMainTableForm();
            }
            else
            {
                MessageBox.Show(msg, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
        private void btnActivateTable_Click(object sender, EventArgs e)
        {
            string msg = "";

            _table.TableStatus = "A";
            if (!VariableFacade.Save(_table, ref msg))
            {
                MessageBox.Show(msg);
            }
            else
            {
                MessageBox.Show("The table was activated");
            }
        }
Esempio n. 14
0
        private void ChooseValuset_Load(object sender, EventArgs e)
        {
            lbValuePools.DataSource = VariableFacade.GetValuePools();
            if (!String.IsNullOrEmpty(selectedValuePool))
            {
                lbValuePools.SelectedValue = selectedValuePool;
            }
            if (!String.IsNullOrEmpty(selectedValueset))
            {
                lbValuesets.SelectedValue = selectedValueset;
            }
            valuePresComboBox.DataSource = Option.GetOptions("ValuePres");

            SelectedValue = (PxValue)dgwValues.SelectedRows[0].DataBoundItem;
        }
Esempio n. 15
0
 private void SaveValueFootnotes()
 {
     foreach (var vs in (List <PxValueSet>)lbValuesets.DataSource)
     {
         if (vs.IsDirty)
         {
             vs.ValuePool = lbValuePools.SelectedValue.ToString();
             foreach (var v in ((List <PxValue>)dgwValues.DataSource))
             {
                 vs.Values.Add(v);
             }
             string msg = "";
             VariableFacade.Save(vs, ref msg);
         }
     }
 }
Esempio n. 16
0
        private void MainForm_Load(object sender, EventArgs e)
        {
            //MessageBox.Show(ConfigurationManager.ConnectionStrings["PcAxisDatabase"].ConnectionString);
            //PxMetaModel.PcAxisMetabaseEntities db = new PxMetaModel.PcAxisMetabaseEntities();
            //loading the treeview items
            var      menuStart = VariableFacade.GetMenuStart();
            TreeNode start     = tvMenuSelection.Nodes.Add(menuStart.PresText);

            start.Name = menuStart.Menu;
            start.Tag  = menuStart;
            PopulateTree(start);
            TreeViewFormat(start);

            presentationComboBox.DataSource        = Option.GetOptions("Presentation");
            presentationEnglishComboBox.DataSource = Option.GetOptions("Presentation");
        }
Esempio n. 17
0
        private void btnOk_Click(object sender, EventArgs e)
        {
            string message = "";

            if (!_valueSet.Validate(ref message))
            {
                MessageBox.Show(message, "Create valueset", MessageBoxButtons.OKCancel, MessageBoxIcon.Information);
                return;
            }

            if (!VariableFacade.Save(_valueSet, ref message))
            {
                MessageBox.Show(message, "Create value pool", MessageBoxButtons.OKCancel, MessageBoxIcon.Information);
                return;
            }
            this.DialogResult = System.Windows.Forms.DialogResult.OK;
        }
Esempio n. 18
0
        private void btnOK_Click(object sender, EventArgs e)
        {
            string message = "";

            if (!NewMenuSelection.Validate(ref message))
            {
                MessageBox.Show(message, "Create Menu Selection", MessageBoxButtons.OKCancel, MessageBoxIcon.Information);
                return;
            }

            if (!VariableFacade.Save(NewMenuSelection, ref message))
            {
                MessageBox.Show(message, "Create Menu Selection", MessageBoxButtons.OKCancel, MessageBoxIcon.Information);
                return;
            }
            DialogResult = System.Windows.Forms.DialogResult.OK;
        }
        private void variableTextBox_Validating(object sender, CancelEventArgs e)
        {
            if (pxVariableBindingSource.DataSource == null)
            {
                return;
            }
            PxVariable var = ((PxVariable)pxVariableBindingSource.DataSource);

            if (var.IsNew)
            {
                if (VariableFacade.VariableExisit(var.Variable))
                {
                    MessageBox.Show("Variable already exists!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    e.Cancel = true;
                }
            }
        }
        private bool SaveMainTable()
        {
            string message = "";

            if (!_table.Validate(ref message))
            {
                MessageBox.Show(message, "Create Table", MessageBoxButtons.OKCancel, MessageBoxIcon.Information);
                return(false);
            }

            if (!VariableFacade.Save(_table, ref message))
            {
                MessageBox.Show(message, "Create Table", MessageBoxButtons.OKCancel, MessageBoxIcon.Information);
                return(false);
            }
            return(true);
        }
        private void btnChooseValueset_Click(object sender, EventArgs e)
        {
            ChooseValuset frmValueset = new ChooseValuset();

            frmValueset.SelectedMainTable = _table;
            frmValueset.SelectedContent   = (PxContent)lbContents.SelectedItem;
            frmValueset.SelectedVariable  = (PxVariable)lbVariables.SelectedItem;
            frmValueset.selectedValueset  = valueSetLabel1.Text;
            frmValueset.selectedValuePool = VariableFacade.GetValuepoolByValueSet(valueSetLabel1.Text);
            frmValueset.FootnoteNo        = FootnoteNo;
            if (frmValueset.ShowDialog() == System.Windows.Forms.DialogResult.OK)
            {
                FootnoteNo = frmValueset.FootnoteNo;
                ((PxVariable)pxVariableBindingSource.DataSource).ValueSet = frmValueset.selectedValueset;
                ((PxVariable)pxVariableBindingSource.DataSource).MarkAsDirty();
                _table.MarkAsDirty();
            }
        }
Esempio n. 22
0
        private void lbValuesets_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (lbValuesets.SelectedValue != null)
            {
                btnOk.Enabled = true;
                List <Option> eliminationSource = Option.GetOptions("Elimination");

                eliminationSource.AddRange(VariableFacade.GetValuesListByValueset(lbValuesets.SelectedValue.ToString()));
                eliminationComboBox.DataSource = eliminationSource;

                List <Model.PxValue> valuesOfSelectedValueset = VariableFacade.GetValuesByValueset(lbValuesets.SelectedValue.ToString());

                pxValueSetBindingSource.DataSource = VariableFacade.GetValueSet(lbValuesets.SelectedValue.ToString());
                dgwValues.DataSource = valuesOfSelectedValueset;
            }
            else
            {
                btnOk.Enabled = false;
            }
        }
Esempio n. 23
0
        private void PopulateTree(TreeNode node)
        {
            PxMenuSelection sel = (PxMenuSelection)node.Tag;

            VariableFacade.LoadChildren(sel);

            foreach (var theme in sel.Childrens)
            {
                TreeNode newTheme = new TreeNode();
                newTheme.Name = theme.Menu;
                newTheme.Text = theme.PresText;
                newTheme.Tag  = theme;

                if (theme.LevelNo != "5")
                {
                    PopulateTree(newTheme);
                }

                node.Nodes.Add(newTheme);
            }
        }
Esempio n. 24
0
        private void btnAddValuesFromValuepool_Click(object sender, EventArgs e)
        {
            ChooseValues   frmChooseValues = new ChooseValues();
            List <PxValue> valueList       = VariableFacade.GetValuesByValuePool(_valueSet.ValuePool);

            foreach (var val in _valueSet.Values)
            {
                PxValue value = PxValueSet.GetValue(valueList, val.ValueCode);
                if (value != null)
                {
                    valueList.Remove(value);
                }
            }
            frmChooseValues.DataSource = valueList;
            if (frmChooseValues.ShowDialog() == System.Windows.Forms.DialogResult.OK)
            {
                List <PxValue> selectedValues = frmChooseValues.SelectedValues;
                foreach (var sv in selectedValues)
                {
                    _valueSet.Values.Add(sv);
                }
            }
        }
Esempio n. 25
0
 private void RefreshValuePool()
 {
     valuePoolComboBox.DataSource = VariableFacade.GetValuePools();
     pxValueSetBindingSource.CurrencyManager.Refresh();
 }
Esempio n. 26
0
        private void btnDeleteNode_Click(object sender, EventArgs e)
        {
            if (MessageBox.Show("This action will delete the table from the metadata and data. Are you sure? ", "Dialog", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == System.Windows.Forms.DialogResult.Yes)
            {
                PxMenuSelection selectedMenu = (PxMenuSelection)tvMenuSelection.SelectedNode.Tag;
                int             levelNo;
                int.TryParse(selectedMenu.LevelNo, out levelNo);
                if (levelNo < 5)
                {
                    //check if node has a table
                    if (tvMenuSelection.SelectedNode.Nodes.Count > 0)
                    {
                        MessageBox.Show("Could not delete this node it has subnodes, delete those first!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    }
                    else
                    {
                        string msg = "";
                        if (VariableFacade.Delete(selectedMenu, ref msg))
                        {
                            MessageBox.Show("The node was deleted", "Information", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        }
                        else
                        {
                            MessageBox.Show(msg, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                        }
                    }
                }
                //the node is a table
                else
                {
                    string      msg  = "";
                    string      msg2 = "";
                    string      msg3 = "";
                    PxMainTable mt   = VariableFacade.GetMainTableById(selectedMenu.Menu);

                    if (VariableFacade.Delete(mt, ref msg))
                    {
                        if (VariableFacade.Delete(selectedMenu, ref msg2))
                        {
                            if (mt != null)
                            {
                                if (VariableFacade.DeleteDataTable(mt.TableId, ref msg3))
                                {
                                    MessageBox.Show("The table was deleted", "Information", MessageBoxButtons.OK, MessageBoxIcon.Information);
                                }
                                else
                                {
                                    MessageBox.Show(msg3, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                                }
                            }
                            else
                            {
                                if (VariableFacade.DeleteDataTable(selectedMenu.Menu, ref msg3))
                                {
                                    MessageBox.Show("The table was deleted", "Information", MessageBoxButtons.OK, MessageBoxIcon.Information);
                                }
                                else
                                {
                                    MessageBox.Show(msg3, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                                }
                            }
                        }
                        else
                        {
                            MessageBox.Show(msg2, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                        }
                    }

                    else
                    {
                        MessageBox.Show(msg + "\n\n" + msg2 + "\n\n" + msg3, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    }
                }
            }
        }
 private void CreateTimePeriod_Load(object sender, EventArgs e)
 {
     lbTimePeriods.DataSource = MainTable.Contents[0].TimePeriods;
     FootnoteNo = VariableFacade.GetFootnoteNextId();
 }