Help with payment method logic

  • Thread starter Thread starter netasp
  • Start date Start date
N

netasp

hi all,
I need your help with the following scenario:
I am using VS 2005 and SQL server DB, my form has 3 textboxes

txtTotalAmount, txtAmountEntered, txtAmountBalance. If txtTotalAmount is
$20.00 for example then user can enter $2.00 in cash, $2.00 in MasterCard,
$16.00 in Cash ,..etc until total amount is reached then balance will show
to user.

I just don't know whats the best way to approach this? store everything in
public variables? public properties? Datatable fields? what is the most
effecient and less overhead call (best practice)?
If user enters the proper amount, then its an easy formula, but when you
have
multiple payments (ex: $5 in cash, $5 in Interac, $5 in visa and $20 in
cash - here is the problem!) the LAST $20 in cash is actually ONLY
$5.00(toward the balance)
that must be added to the cash value for that transaction and $15.00 must be
returned to the customer.

does anyone have a solution for this scenario?

thanks alot
 
Well you could use a number of client-side approaches. You could make a
custom validator with the javascript that you provide implementing the
logic for your page (totaling, showing balance, etc.)... and only when
the amounts are right, will your page postback.

- Vaibhav
 
Thanks V for your reply,

it's a windows application not a web, and some suggested the use of public
variables where storing all values and someone else suggested storing them
in a datatable, the app suppose to be a multi-user access, and i don't think
the use of public variable all over the application is a wise thing.

I am sure there are a lot of ppl in here who developed something similar to
this and i am very much interested to hear their input on this matter and
how did they approach it?

thanks,
 
Hi Netasp,

I have added a reply to you in microsoft.public.dotnet.languages.vb
newsgroup, please check it there. Thanks.

Best regards,
Jeffrey Tan
Microsoft Online Community Support
==================================================
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.
 
Back
Top