|
Help with visual c# software developing? The first tab will deal with a persons details. The tab will havea combo box which will contain the names of people. The user will select a person and the drtails will be displayed in the relevent controls. A second combo box will allow the user to choose whther the person is an employee ir a client. If the person is a client, his/her name, surname, age and telephone number must be stored. The category must be stored or displayed as well.
The second tab will have a combo box which will contain the type or description of the product. The user will select type or description and the products details will be displayed. Details will be; type/description, quantity, price (these must be stored coming from textbox controls) and price including VAT (displayed in a text box)
Each tab must have add and remove buttons to remove and add new details.
Details will be stored in two separwte arraylists.
Create a product class, with constructors, properties for the type, quantity, price and a method to calculate the price including VAT.
Create a person class with properties for name, surname, age and category. Include relevent constructors.
Include two more classes (employee and client) which inherit from person class . The employee class will have a property for its position. The client class will have a property for its telephone number. Include constructors for both child classes.
Include error trapping.
Format the values displayed for pricing to a currency type.
Ensure that the price including VAT updates as the user types the price for the product
Ensure relevent comboboxes areupdated as you move from one tab to another.
I NEED HELP WITH THIS, i am doing a part time course, and i am confused on wat to do, and how to do it. I have an idea with working this, but i am confused by the above.
|
|
|
|
|
joy madalane wrote: i am confused
Okay I will bite... what exactly is confusing to you? Perhaps it is confusing because you are reading through this an thinking you have to do everything at the same time? Take one thing at a time and just do it. Nothing in your list is particularly difficult.
Probably what I would do it create your support classes first. Create a "product" class, mark it off your list. One thing down. Create the "person" class, another thing done. Just work through your list and pretty soon you will be done.
Why is common sense not common?
Never argue with an idiot. They will drag you down to their level where they are an expert.
Sometimes it takes a lot of work to be lazy
Please stand in front of my pistol, smile and wait for the flash - JSOP 2012
|
|
|
|
|
Wes Aday wrote: Create a "product" class
How do you do that? Can you send an exa...SMACK ow ow all right I'm going
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
As with any task, the first thing to do is break it down into chunks, and then concentrate on each chunk at a time.
Fortunately, this is already done.
You have a form. Add a TabControl. The first page handle person details,. so name it appropriately, and set the TabPage Text to "People" or similar.
Now look at what it needs to contain:
1) A combo box.
2) Details about the person - this will depend on the data you have stored,. so that is up to you.
3) A second combo will select the type - employee or client.
...
And so forth.
Just take it in stages, it is only complicated if you try to do it all at once.
The only thing I would say is that you should be prepared to make some wrong decisions - we all do - so don't be fixated on what you have created so far, be prepared to bin it and start again with the benefit of hindsight. (But back it up first, so you can change your mind).
Personally, I would create a Person class, and a UserControl to display the Person detail, and add one of those to the panel instead of a pile of separate controls, but that assumes that your course has reached that point.
Ideological Purity is no substitute for being able to stick your thumb down a pipe to stop the water
|
|
|
|
|
Thanx for the reply
Can i skype or email you???? I wanna ask some novice questions, just 3 questions sir
|
|
|
|
|
No - I get enough paying stuff that way already!
Ask them here - people won't be upset if you ask novice stuff, we all have to start somewhere. And you may well get multiple veiwpoints on it which can help.
Ideological Purity is no substitute for being able to stick your thumb down a pipe to stop the water
|
|
|
|
|
I am trying to implement a multi page form on a site that will be used for 3 different types of applicant. Each of these 3 types will fill in their personal details before filling in different sections of the form depending on type.
I currently have a base class with the shared personal details and derived classes for the 3 specific types. In my form however I don't know how to create the correct object based on the type of applicant without having a lot of duplicate code.
Here is a cut down example of my code. This is an example of the classes
public class BaseApplication
{
public bool FirstName { get; set; }
public bool LastName { get; set; }
public virtual void Save()
{
}
}
public class StudentApplication : BaseApplication
{
public bool SupportNeeds { get; set; }
public override void Save()
{
base.Save();
}
}
And this the part of the page where I want to create the object.
?? app;
switch (courseType)
{
case "31":
app = new StudentApplication();
break;
case "32":
app = new AdultApplication();
break;
}
app.FirstName = FirstName.Text;
app.LastName = LastName.Text;
app.SupportNeeds = SupportNeeds.Text;
app.Save();
I don't know what to declare app as as it can be one of 3 types depending on the value of courseType.
|
|
|
|
|
Create it as the base type: that way it can hold all of the derived types:
public abstract class myBase {...}
public class derived1 : myBase {...}
public class derived2 : myBase {...}
...
myBase app;
app = new derived1();
app = new derived2();
...
Ideological Purity is no substitute for being able to stick your thumb down a pipe to stop the water
|
|
|
|
|
Won't work I'm afraid. The OP has properties in the derived types that won't work here because they are more specialised.
|
|
|
|
|
The big issue you have here is that properties in the derived type aren't present in the base type, so you can't really declare app as BaseApplication. Well, you can, but you need to cast to the derived type to access the properties. What you could do is something like this though:
BaseApplication app = null;
switch (courseType)
{
case "31":
app = CreateStudentApplication();
break;
}
if (app != null)
{
app.Save();
}
....
private StudentApplication CreateStudentApplication()
{
StudentApplication app = new StudentApplication();
SetBaseInformation(app);
app.SupportNeeds = SupportNeeds.Text;
return app;
}
private void SetBaseInformation(BaseApplication application)
{
application.FirstName = FirstName.Text;
application.LastName = LastName.Text;
}
|
|
|
|
|
Psst.. strategy pattern!
..and you might want to program against a simple and small (or even multiple) interfaces
Bastard Programmer from Hell
if you can't read my code, try converting it here[^]
|
|
|
|
|
I thought of an interface but couldn't see how it would work.
Strategy pattern sounds like a proper programming thing and not something a hack merchant would be able to do
|
|
|
|
|
suzyb wrote: I thought of an interface but couldn't see how it would work.
You can have them at property-level; considered an IFirstName ?
Keep hacking, and you'll learn it as you go. Just a matter of time before you stumble over it
Bastard Programmer from Hell
if you can't read my code, try converting it here[^]
|
|
|
|
|
suzyb wrote: I don't know how to create the correct object based on the type of applicant
without having a lot of duplicate code.
Generic creation problems are often solved with the Factory Pattern.
Other than that I don't know what you mean by "duplicate" code. If the objects are different than they are different and you shouldn't attempt to generalize. If however the are the related (by design and NOT by your desire to avoid typing) then you should perhaps re-think your design/implementation.
|
|
|
|
|
i need to optimize all tables in a MySQL database automatically. can you please help to make programe c#.net
|
|
|
|
|
- What does optimize mean? What will you be doing with the tables?
- We got a database-forum
- Your question for help on C# is too broad; you make a C# app like all the others, and you can get help with specific questions. You'll have to do the writing yourself.
- Can you show us an example of a table before and after "optimization"?
Looking forward to your answers.
Bastard Programmer from Hell
if you can't read my code, try converting it here[^]
|
|
|
|
|
Hi,
In our data base have more than 150 tables available. In every day some table have delete and update operation is going. While after the delete memory is stored in temp. When I tried to open schema, it’ll take some time. I need to make faster in my schema. What can I do? That’s only I selected optimize all table in mysql.
Thanks,
P.Alagiri
|
|
|
|
|
I suggest you start in the database-forum; to check whether your indexes are correct, whether you could benefit from partitioning the data, whether your table-structure is correct.. The usual things a DB-admin does when the db is too slow.
C# has little to do with it.
Bastard Programmer from Hell
if you can't read my code, try converting it here[^]
|
|
|
|
|
Hi
I’ve a question regarding linq,
I’ve a DB contains main items (Product) and internal item(properties)
Class Product
{
String name
List<properties> propList { get; set; }
}
Class properties
{
String name
String value
}
I would like to know if it possible to create a query that apply on two or more categories on the same internal item at one time
Such as, if the product is "car" and if the car year is 2012 and color is "Red" I would like to get this record
List< Product > DB;
I know the syntax below is wrong, but this is the idea I wish to do
Enumerable< Product > itemQuery = from item in DB where item.name=="car"
where
(
from prop in item.propList
where (prop.name.Equals("Color") && prop.value == "Red") && (prop.name.Equals("Year") && prop.value == "2012")
select field
).Any()
select item;
|
|
|
|
|
First off, this should have been posted in the LinQ forum LinQ Forum[^], but as you posted here, I will answer here.
You can use the Contains keyword to find if the item's property list contains the required property, something like this:-
var itemQuery = DB.Where((i) => i.name == "car" &&
i.propList.Contains((from prop in i.propList where prop.name == "Colour " && prop.value == "Red" select prop).FirstOrDefault()) &&
i.propList.Contains((from prop in i.propList where prop.name == "Year" && prop.value == "2012" select prop).FirstOrDefault()));
although this looks ugly and seems to be a bit of a hack it will return the correct item.
Hope this helps
When I was a coder, we worked on algorithms. Today, we memorize APIs for countless libraries — those libraries have the algorithms - Eric Allman
|
|
|
|
|
Message Removed
modified 21-Aug-12 9:49am.
|
|
|
|
|
thank u all,
it is a good start to begin with
|
|
|
|
|
hi
I’ve implement your idea and it work great, thank u!
I have another question and hope you can assist
The use will choose from UI several filter criteria, so the running filter should be dynamic and not hard coded
Such as sometimes it could be collection.Filter(name1, value1)
Or
collection.Filter(name1, value1).Filter(name2, value2)
collection.Filter(name1, value1).Filter(name2, value2). Filter(name3, value3)
and so on
how can I define by code the dynamic filter?
Should I use recursive ?
int interaction = #UserFilter.count;
DoFilter(string name, string value)
{
While (interaction--)
{
collection.Filter(UserFilter[interaction].name, UserFilter[interaction].value)
DoFilter(UserFilter[interaction].name, UserFilter[interaction].value);
}
}
thanks
ronen
|
|
|
|
|
|