Exemplo n.º 1
0
        private void ucPaymentType_ButtonAddClick(object sender, EventArgs e)
        {
            try
            {
                AddEditPaymentTypeForm addTypeForm;
                int newId;

                addTypeForm = new AddEditPaymentTypeForm(_paymentCategory);

                if (addTypeForm.ShowDialog() == DialogResult.OK)
                {
                    newId = _paymentType.Add(addTypeForm.CategoryId, addTypeForm.TypeName);

                    ucPaymentType.PopulateList(new SortableBindingList<IPaymentType>(_paymentType.GetTypes()));
                    ucPaymentType.SelectRow("id", newId);
                }

                addTypeForm.Dispose();
            }
            catch (Exception exception)
            {
                Error.DisplayMessage(exception);
            }
        }
Exemplo n.º 2
0
        private void ucPaymentType_ButtonEditClick(object sender, EventArgs e)
        {
            try
            {
                AddEditPaymentTypeForm editTypeForm;
                IPaymentType paymentType;

                paymentType = (IPaymentType)ucPaymentType.SelectedRow;

                editTypeForm = new AddEditPaymentTypeForm(_paymentCategory, paymentType.CategoryName, paymentType.Name);

                if (editTypeForm.ShowDialog() == DialogResult.OK)
                {
                    _paymentType.Edit(paymentType.Id, editTypeForm.CategoryId, editTypeForm.TypeName);

                    ucPaymentType.PopulateList(new SortableBindingList<IPaymentType>(_paymentType.GetTypes()));
                    ucPaymentType.SelectRow("id", paymentType.Id);
                }

                editTypeForm.Dispose();
            }
            catch (Exception exception)
            {
                Error.DisplayMessage(exception);
            }
        }