473,394 Members | 1,829 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

Help with logic - system payment method

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?
If user enters the proper amount, then its 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
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
Jul 9 '06 #1
2 1208
Hi Netasp,

Thanks for your post!

I am not sure I understand you completely. Based on my understanding, you
are developing some payment application with .Net winform, you want to find
a best way to store the values and results efficiently. If I have
misunderstood your concern, please feel free to tell me, thanks.

The solution options you posted are all valid, the choice is based on your
specific scenario and context.

If your application accesses the stored values frequently and your concern
lies in performance side, you'd better eliminate all kinds of disk I/O
storage. Although DataBase is a highly optimized application for I/O
operation, any disk I/O operation will be slower than memory access, so
you'd better store the values in the class variables/properties. There is
no need to mark the variables/properties as public unless certain code out
of the form class needs to access them, I think private is enough for
privacy. Whether you should use variables or properties depends on whether
you want to place any additionally logic around these variables. For
example, in assigning the value to the variable, you want to give it a
validation to ensure the value falls in certain boundary(such as
0=<value<txtTotalAmount), you'd better use a property and place the
validation logic in the property's get/set accessors. At last, you may feel
free to write a logic class to wrap all these variables/properties, this
will make your code easier to maintain.

I see that you are concerning multi-user concurrency accessing the
variables/properties at the same time. In Windows, any instance of an
application will be executed in memory as a process, and multiple running
instances of the same application will be recognized as different
processes, they have different copies of data in memory, so different
users will not have race-condition problem. So if you do not employ
mutlithreading in the application, there will be no concurrency issue.

Ok, normally highly performance is required only by server-side
applications, such as Asp.net/WebService, this is because they will service
tens of thousands of client requests. Regarding .Net winform application,
it normally remains as a client application, which only serves not many
users concurrently. In this case, performance is not a big issue. In this
cause, if you need to store a large number of data, memory usage maybe a
bigger issue than performance. In this case, you'd better store part of the
large data in disk to reduce the application memory footprint. DataBase or
per-user configuration files are both suitable for this. For security
reason(since performance is not the top #1 issue now), I think storing the
values in per-user configuration is a good idea, because the user
configuration file will be stored in windows profiler folder, which is not
accessible to other users(except Administrators, which is the owner of the
machine so he can access everything :-)).

Finally, if your application also has not much concern over memory usage,
you may choose whatever options you like, sure, the variables/properties
way is the easiest to implement.

You may give your application context and condition a judge and choose a
suitable solution based on the text I posted above.

Hope it helps.

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.

Jul 10 '06 #2
Hi Netasp,

Does my reply help you? If you still have anything unclear, please feel
free to tell me, 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.

Jul 12 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: Craig Keightley | last post by:
Please help, i have attached my page which worksin IE but i cannnot get the drop down menu to fucntion in firefox. Any one have any ideas why? Many Thanks Craig ...
18
by: Jeremy Weiss | last post by:
I'm trying to build a database that will handle the monthly billing needs of a small company. I'm charting everything out and here's what I see: table for customers sub table to track payments...
0
by: paapa21 | last post by:
I have got a page that shows student payment information. On the page the user can view total amount paid by student, amount outstanding and the course fee; add paymnent to the database; and also...
1
by: Benton2862 | last post by:
I need help with and array for a program that acts like a cash register. The user will input an items price and then there payment. It will tell you the change and then tell you what kinda of change...
3
by: Jano | last post by:
Hi - Happy New Year! I have a web-site which accepted paypal payment for membership. No-one's buying so I want to make it free. The page which inputs the member details into the database needs...
0
by: gunimpi | last post by:
http://www.vbforums.com/showthread.php?p=2745431#post2745431 ******************************************************** VB6 OR VBA & Webbrowser DOM Tiny $50 Mini Project Programmer help wanted...
9
by: SAL | last post by:
Hello, I have a Dataset that I have table adapters in I designed using the designer (DataLayer). I have a business logic layer that immulates the DataLayer which may/may not have additional logic...
8
by: Energizer100 | last post by:
My assignment is LoanTable Background: When buying a home, a very important financial consideration that many buyers face is obtaining a qualifying loan from a financial institution. ...
0
by: paj171 | last post by:
I have a assignment and I cant figure out why the payment value cannot be resolved.. Can anyone help? import java.util.*; public class HW8 { public static double payment(double amnt, double...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.