Ejemplo n.º 1
0
        private void btnAddField_Click(object sender, EventArgs e)
        {
            frmGetInput = new frmInput(FieldInputPrompt, 60);

            if (frmGetInput.ShowDialog() == DialogResult.OK)
            {
                try
                {
                    FieldService.AddNew(new Field {
                        CategoryId = (int)lstCategories.SelectedValue, Label = frmGetInput.Input
                    });

                    PopulateFieldsListBox((int)lstCategories.SelectedValue);
                    lstFields.SelectedIndex = (lstFields.Items.Count - 1);
                    PopulateFieldsColumns((int)lstCategories.SelectedValue);
                    PopulateAccountRows((int)lstCategories.SelectedValue);

                    AdjustGUI();

                    SendMessage("'" + frmGetInput.Input + "' added.", Color.Green);
                }
                catch (ArgumentException ex)
                {
                    SendMessage(ex.Message, Color.Red);
                }
            }
        }
Ejemplo n.º 2
0
        private void btnAddCategory_Click(object sender, EventArgs e)
        {
            frmGetInput = new frmInput(CategoryInputPrompt, 60);

            if (frmGetInput.ShowDialog() == DialogResult.OK)
            {
                string input = frmGetInput.Input;
                try
                {
                    var category = new Category {
                        Label = input
                    };
                    CategoryService.AddNew(category);

                    PopulateCategoriesListBox(category.Id);

                    AdjustGUI();

                    SendMessage("'" + input + "' added.", Color.Green);
                }
                catch (ArgumentException ex)
                {
                    SendMessage(ex.Message, Color.Red);
                }
            }
        }
Ejemplo n.º 3
0
        private void btnRenameField_Click(object sender, EventArgs e)
        {
            frmGetInput = new frmInput(FieldInputPrompt, 60);

            if (frmGetInput.ShowDialog() == DialogResult.OK)
            {
                try
                {
                    int    selectedFieldId   = (int)lstFields.SelectedValue;
                    string selectedFieldName = lstFields.Text;

                    FieldService.Update((int)lstFields.SelectedValue, frmGetInput.Input);

                    PopulateFieldsListBox((int)lstCategories.SelectedValue);
                    PopulateFieldsColumns((int)lstCategories.SelectedValue);
                    PopulateAccountRows((int)lstCategories.SelectedValue);

                    lstFields.SelectedValue = selectedFieldId;

                    SendMessage("'" + selectedFieldName + "' renamed to '" + frmGetInput.Input + ".'", Color.Green);
                }
                catch (ArgumentException ex)
                {
                    SendMessage(ex.Message, Color.Red);
                }
            }
        }
Ejemplo n.º 4
0
        private void btnRenameCategory_Click(object sender, EventArgs e)
        {
            frmGetInput = new frmInput(CategoryInputPrompt, 60);

            if (frmGetInput.ShowDialog() == DialogResult.OK)
            {
                try
                {
                    int    selectedCategoryId = (int)lstCategories.SelectedValue;
                    string categoryName       = lstCategories.Text;

                    CategoryService.Update((int)lstCategories.SelectedValue, frmGetInput.Input.Trim());

                    PopulateCategoriesListBox(selectedCategoryId);

                    SendMessage("'" + categoryName + "' renamed to '" + frmGetInput.Input + ".'", Color.Green);
                }
                catch (ArgumentException ex)
                {
                    SendMessage(ex.Message, Color.Red);
                }
            }
        }