473,785 Members | 2,816 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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, txtAmountEntere d, txtAmountBalanc e. 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 1224
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<txtTot alAmount), 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
3002
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 <<<<<<<<<<<<<<CODE>>>>>>>>>>>>>>>> <html>
18
12813
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 received. No biggie, right? Well, here's my problem. I don't know how to tell access to modify everyone's account balance each month. And I can't just always assume that their monthly bill is $16 just because their balance is $16. If I do that...
0
925
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 view individual payment made with their corresponding date of paymnent, the method of payment and the amount paid. These are all under three respectivel panel in one page. What i really want to do is, If a user add payment to the database, i want...
1
1587
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 to use, see example: Use JOptionPane to take inputs from the user and display the results. Example: -------- If the user enters Amount Due = 5.52 // First Input from the User Amount Given = 10.00 // Second Input from the User ...
3
2171
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 verification, and I want to bypass the verification, but I can't figure it out. Can anyone help. - I have pasted the script below. Many thanks, Jano <? include("header.php"); ?> <? // read the post from PayPal system and add 'cmd' $req =...
0
5576
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 ******************************************************** For this teeny job, please refer to: http://feeds.reddit.com/feed/8fu/?o=25
9
2743
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 in. My business classes are, of course, decorated with the: <System.ComponentModel.DataObject() attribute. So, I drop a GridView on a webform and set its datasource to an ObjectDatasource which in turn is using one of my business logic...
8
2902
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. Interest rates can be fixed or variable and there are service charges called 'points' for taking out a loan. One 'point' is equal to 1% of the loan amount (called principal) borrowed. Taking out a loan of $150,000 with a 2 point charge will amount to a...
0
907
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 intrate, int mths){ double mnthpymnt; mnthpymnt= amnt*((intrate)*(Math.pow((1+intrate),mths))/(Math.pow((1+intrate),mths)-1)); return payment;
0
9480
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10152
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10092
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8974
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7500
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6740
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5381
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
4053
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3650
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.