Ejemplo n.º 1
0
        public virtual void AddAction()
        {
            ItemForm.TextBox.Clear();

            if (ItemForm.ShowDialog() == DialogResult.OK)
            {
                AddAction(ItemForm.TextBox.Text);
            }
        }
Ejemplo n.º 2
0
 public virtual void ChangeAction(ListViewItem item)
 {
     ItemForm.TextBox.Clear();
     ItemForm.TextBox.Text = item.Text;
     if (ItemForm.ShowDialog() == DialogResult.OK && IsValidItem(ItemForm.TextBox.Text))
     {
         item.Text = ItemForm.TextBox.Text;
     }
 }
Ejemplo n.º 3
0
 public virtual void OnChangeAction(GenericListViewItem <T> lvitem)
 {
     ItemForm.TextBox.Clear();
     ItemForm.TextBox.Text = lvitem.Text;
     if (ItemForm.ShowDialog() == DialogResult.OK && IsValidItemText(ItemForm.TextBox.Text))
     {
         lvitem.Text = ItemForm.TextBox.Text;
     }
 }
Ejemplo n.º 4
0
        private Item OpenItemFormDialog(string formTitle, Item input = null)
        {
            Item output = null;

            using (ItemForm iform = new ItemForm(input))
            {
                iform.Text = formTitle;

                DialogResult result = iform.ShowDialog();

                if (result == DialogResult.OK)
                {
                    output = JsonConvert.DeserializeObject <Item>(iform.Data);
                }
            }

            return(output);
        }
Ejemplo n.º 5
0
        public virtual void AddAction(String text)
        {
            while (true)
            {
                if (IsValidItem(text))
                {
                    Add(text);
                }
                else
                {
                    ItemForm.TextBox.Clear();
                    ItemForm.TextBox.Text = text;

                    if (ItemForm.ShowDialog() == DialogResult.OK)
                    {
                        text = ItemForm.TextBox.Text;
                        continue;
                    }
                }

                break;
            }
        }
Ejemplo n.º 6
0
        public virtual void OnAddAction(String text)
        {
            while (true)
            {
                if (TryConvertToItem(text, out T item) && IsValidItem(item))
                {
                    TryInsert(SelectedIndices.OfType <Int32>().FirstOr(SelectedIndices.Count), item);
                }
                else
                {
                    ItemForm.TextBox.Clear();
                    ItemForm.TextBox.Text = text;

                    if (ItemForm.ShowDialog() == DialogResult.OK)
                    {
                        text = ItemForm.TextBox.Text;
                        continue;
                    }
                }

                break;
            }
        }
Ejemplo n.º 7
0
        private void Model_btn_Click(object sender, EventArgs e)
        {
            ItemForm modelmasterform = new ItemForm();

            modelmasterform.ShowDialog();
        }
Ejemplo n.º 8
0
        private void InitForm(string mode)
        {
            Form            newForm;
            DataGridViewRow selectedRow = new DataGridViewRow();

            if (mode.Equals("Edit"))
            {
                try
                {
                    selectedRow = DgvGeneric.SelectedRows[0];
                }
                catch (Exception ex)
                {
                    Console.WriteLine(ex.Message);
                    MessageBox.Show(
                        text: "Debes seleccionar una fila",
                        caption: "Error",
                        buttons: MessageBoxButtons.OK,
                        icon: MessageBoxIcon.Error);
                    return;
                }
            }

            switch (activeGrid)
            {
            case 0:
                newForm = new EmployeeForm(mode, selectedRow);
                newForm.ShowDialog();
                break;

            case 1:
                newForm = new DepartmentForm(mode, selectedRow);
                newForm.ShowDialog();
                break;

            case 2:
                newForm = new ItemForm(mode, selectedRow);
                newForm.ShowDialog();
                break;

            case 3:
                newForm = new BrandForm(mode, selectedRow);
                newForm.ShowDialog();
                break;

            case 4:
                newForm = new UnitForm(mode, selectedRow);
                newForm.ShowDialog();
                break;

            case 5:
                newForm = new ProviderForm(mode, selectedRow);
                newForm.ShowDialog();
                break;

            case 6:
                newForm = new ItemRequestForm(mode, selectedRow);
                newForm.ShowDialog();
                break;

            case 7:
                newForm = new PurchaseOrderForm(mode, selectedRow);
                newForm.ShowDialog();
                break;

            case 8:
                newForm = new UserForm(mode, selectedRow);
                newForm.ShowDialog();
                break;
            }
        }