Database Classes

I have a VB form with five (5) sections.  A main section for invoice_info, then a tab control with 4 tabs with a datagrid on each.  

What I'm looking for is a best practice and guidance.  Should I create seperate classes to add an invoice, retrieve and invoice, and update and invoice?  

So, I have a button "Save Invoice", when clicked, it calls the class "AddInvoice"?

I'm trying to avoid using the wizards for data sources, etc.  
LVL 1
tobin46Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

SameerJagdaleCommented:
you can have CRUD operations in "Invoice" class (if you are already aware of what these operations will do) to keep it simple! You can also check for Entity Framework.
0
tobin46Author Commented:
Ok.

The form will be used three ways, to create an invoice, view an invoice, or update an invoice.  I won't be deleting per se.  If a user wants to "delete" an invoice, I will be setting an "active_flag" to yes or no, so no records will be deleted.  

So, you're saying have one class, Invoice, then within it have my creation sub, update sub, and view sub?

0
SameerJagdaleCommented:
Yes.to keep it simple. something like

public class Invoice
{
 public bool Update()
{}
public IEnumerable GetInvoices()
{}
public bool Delete()
{}
}

OR

create an Invoice Entity

public class Invoice
{
public int InvoiceID {get;set;}
..

}

and then create a service class for operations

public class InvoiceService
{
public bool Update()
{}
public IEnumerable GetInvoices()
{}
public bool Delete()
{}

}
sorr for the c# syntax but you can make out of it.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic.NET

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.