|
Hello, Sir and Madam
Please help me design a database for world soccer.
World soccer has many tournaments, teams and players.
One team stay in more than one tournament.
One player can transfer from a team to the other.
Also thinking about red card, yellow card, goal, player position, club team, country team, etc.
Thank You.
Sorry for bad English.
|
|
|
|
|
god4k wrote:
Please help me design a database for world soccer
Is this a homework question???
You should design the initial database yourself. If you are still having problems post a more specific question along with the part of the design that is causing problems and maybe someone will help let you know how to correct any problems.
At the moment, your question is also too vague: "Also thinking about red card, yellow card, goal, player position, club team, country team, etc."
"You can have everything in life you want if you will just help enough other people get what they want." --Zig Ziglar
Coming soon: The Second EuroCPian Event
|
|
|
|
|
I mean database structure, tables and relations
This is not homework.
Thank You.
|
|
|
|
|
Okay, I realise you mean structure, tables and relations. The number of objects you mention is quite large, also not every one is an expert on football (soccer) so you really need to explain the rules of how each of these objects relate to each other. The explanation will help you understand the relations better your self.
As a starting point:
A team has many players
A team plays in many tournaments
A tournament has many teams
A player can play for many teams (are you including international teams?)
From this small subset we can create a structure like:
+------------+ +------+ +--------+
| |\ /| |\ /| |
| Tournament |-----| Team |-----| Player |
| |/ \| |/ \| |
+------------+ +------+ +--------+
Now, most relational database systems don't accept a many-to-many joins directly so these m2m joins have to be expanded:
+------------+ +----------------+ +------+
| | /| |\ | |
| Tournament |-----| TournamentTeam |-----| Team |
| | \| |/ | |
+------------+ +----------------+ +------+
So the keys on your the above tables are:
Tournament: TournamentID
TournamentTeam: TournamentID, TeamID
Team: TeamID
The TournamentTeam Table contains a composite primary key (i.e. one that is made up of more than one field). It also contains two foreign keys TournamentID to link to the tournament table and TeamID to link to the Team table.
Does this help you get started?
"You can have everything in life you want if you will just help enough other people get what they want." --Zig Ziglar
Coming soon: The Second EuroCPian Event
|
|
|
|
|
|
Hi,
How do I set background color for status bar?
Direct property not available.
Thankx
Priya
|
|
|
|
|
You'll have to paint the StatusBar or StatusBarPanel (whichever you use) yourself. See the StatusBar.DrawItem event documentation in the .NET Framework SDK.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
hai there,
In my project i have a user control that will display colordialogbox.
At a time user will create n- number of usercontrol and will choose different color for all different control. the color may defined or custom. My aim is to store all selected color to database.
How it is possible.
See, some times i will get user selected colors as Red,green,Blue etc. why because these colors are in color struct.
but if i choose color that is not in color struct that will give some values like this [A122,R=654,G=232 B=233]. How can i convert this values to meaningfull names that end user can identifiy easily ?
hai, feel free to contact
Sreejith SS Nair
|
|
|
|
|
sreejith ss nair wrote:
My aim is to store all selected color to database. How it is possible.
You could use int myIntColour = System.Drawing.ColorTranslator.ToWin32(myColour); to convert the colour to an int and store that value in the database. You can then use System.Drawing.ColorTranslator.FromWin32(myIntColour); to convert back to a .NET object
sreejith ss nair wrote:
but if i choose color that is not in color struct that will give some values like this [A122,R=654,G=232 B=233]. How can i convert this values to meaningfull names that end user can identifiy easily ?
If the colour is not already available as a named colour then you'll either have to make up some names yourself (a big task as there are 16.7million possible combinations) or get the user to name their own custom colours.
"You can have everything in life you want if you will just help enough other people get what they want." --Zig Ziglar
Coming soon: The Second EuroCPian Event
|
|
|
|
|
sreejith ss nair wrote:
but if i choose color that is not in color struct that will give some values like this [A122,R=654,G=232 B=233]. How can i convert this values to meaningfull names that end user can identifiy easily ?
First of all, you can't use 654 for the red component. The only legal values are 0 through 255. Second, you should use a color picker - which many are available from this site and there is a way to use the ColorEditor that you see in the PropertyGrid for color properties like ForeColor and BackColor - which makes it easy for a user to pick a color. If you want to name these colors as Colin mentioned you'll have problems since the Color methods don't support user-defined names, so you'll have to come up with your own implementation, such as implementing read-only properties with pre-defined Color instances like the named colors already on the Color struct.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
I have a listbox.
I want to get the selected item of the list and assign it as a hatchstyle to a variable
ie. hatchstyle = listbox selected item
please help
"joel"
|
|
|
|
|
See Enum.Parse . Assuming your ListBox contains a list of strings with corresponding HatchStyle enum member names, you can use something like this:
string value = listBox1.SelectedItem as string;
if (value != null)
{
try
{
HatchStyle hs = Enum.Parse(typeof(HatchStyle), value);
}
catch
{
MessageBox.Show("Invalid hatch style!");
}
}
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
this works
HatchStyle htch = (HatchStyle)this.listBox1.SelectedItem;
I dont know how but it does.
|
|
|
|
|
I have created an Windows Invoice programme in C#, with Visual Studio 2003, which has 4 textBoxes by 15 line items.
The 4 boxes are Description, Quantity, Rate, and Amount.
How do I immediately show the Amount as calculation with Quantity * Rate.
I currently can only show the calculated Amount after Saving or Updating the Invoice.
All previous help from this site has been excellent.
Thank you, in anticipation.
Fred S. Parker
Email: fred@fsparker.com.au
|
|
|
|
|
Check into the TextChanged event. It'll fire whenever the text changes in a textbox. You could probably get away with one function handling the TextChanged event for all of your Quantity and Rate textboxes. Then it's just a simple matter of Amount = Quantity * Rate.
RageInTheMachine9532
|
|
|
|
|
Dave,
Thank you for your prompt reply.
Can you point me to a pratical sample of your suggestion.
Regards,
Fred.
Fred S. Parker
Email: fred@fsparker.com.au
|
|
|
|
|
Out of curiousity, why not use a DataGrid and bind that to either a DataSet or DataTable , or to an array of some class that you could implement? The DataTable already supports expressions like this and doesn't have to be tied to a database to be usable.
It's just a thought. Dave's right, though, just handle one of the events when the TextBox loses focus and update the product of the two TextBox es in your calculated TextBox . TextChanged is probably best for this, but keep in mind that it isn't fired till the TextBox loses focus.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
Heath.
Thank you for your suggestion, but a DataGrid is not appropriate.
I have 3 other projects that require calculations, one which has a combination of 60 TextBoxes that require calculations.
Regards,
Fred.
Fred S. Parker
Email: fred@fsparker.com.au
|
|
|
|
|
Heath Stewart wrote:
TextChanged is probably best for this, but keep in mind that it isn't fired till the TextBox loses focus.
Text changed is fired whenever text is changed in the control (by either programmatic modification or user interaction). I think, you tought about Validating event which is truly raised when control loses focus.
But talking about textboxes and calculations...
You can:
1. Create data table as spoken above. But - do you want two way calculations? It means if user enter Rate and Amount, should the quantity be "reverse calculated" or not? In this case, use RowChange/ColumnChange evenmts to calculate values rather the expressions. There is one more disadvantage: You will need to bind 15 rows of the table at a time. I have been playing with it some time but not developped efficient way.
2. Create some calculator class, which can be bound with textboxes (or whatever control you want) and directly operate on datasource you want. I think, this method is much better, because you can validate data in the fly (esp. when input is bound to textbox), and calculating logic may be much more complex when you'll need it.
|
|
|
|
|
True, but his question had to do with updating a calculated field through user interface, so then my original reply is correct: the TextChanged event is only fired when the control looses focus. Trust me, I've been doing this for a very long time and it is even documented as such. The text one types isn't committed to the Text property until you leave the control and the event is fired in the set accessor for the Text property after the value is stored (rather, the WM_SETTEXT message is sent to the control with the text).
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlrfsystemwindowsformscontrolclasstextchangedtopic.asp
and cite: This event is raised if the Text property is changed by either a programmatic modification or user interaction.
Heath Stewart wrote:
so then my original reply is correct: the TextChanged event is only fired when the control looses focus
I've even coded a little toy to play with textbox events, and on my system (WinXP Pro, .Net 1.1) the TextChangedEvent is fired everytime user changes the text, not when control loses focus.
using System;<br />
using System.Windows.Forms;<br />
using System.ComponentModel;<br />
<br />
namespace WindowsApplication47<br />
{<br />
public class Form1 : System.Windows.Forms.Form<br />
{<br />
private System.Windows.Forms.TextBox tb;<br />
private System.Windows.Forms.ListBox lb;<br />
<br />
public Form1()<br />
{<br />
this.Text="TextBox events:";<br />
lb=new ListBox();<br />
lb.Dock=DockStyle.Fill;<br />
this.Controls.Add(lb);<br />
tb=new TextBox();<br />
tb.Dock=DockStyle.Top;<br />
this.Controls.Add(tb);<br />
tb.TextChanged+=new EventHandler(tb_TextChanged);<br />
tb.LostFocus+=new EventHandler(tb_LostFocus);<br />
tb.Validating+=new CancelEventHandler(tb_Validating);<br />
}<br />
private void tb_TextChanged(object sender, EventArgs e)<br />
{<br />
this.AddToList("TextChanged. Current text is:"+this.tb.Text);<br />
}<br />
private void tb_LostFocus(object sender, EventArgs e)<br />
{<br />
this.AddToList("LostFocus.");<br />
}<br />
private void tb_Validating(object sender, CancelEventArgs e)<br />
{<br />
this.AddToList("Validating.");<br />
}<br />
void AddToList(object val)<br />
{<br />
this.lb.Items.Add(val); <br />
this.lb.SelectedIndex=this.lb.Items.Count-1;<br />
}<br />
static void Main() <br />
{<br />
Application.Run(new Form1());<br />
}<br />
}<br />
}
Could you play with this toy a while and tell me where are lost focus and other events you are talking about?
btw:
This may be true if we are talking about databinding. The difference is that the control itself does not ends "editing" of the current datasource (ie. row). So then the magic formula:
this.textBox.DataBindings["Text"].BindingManagerBase.EndCurrentEdit();<br /> in TextChanged event routine makes data immediately changed in datasource.
|
|
|
|
|
The TextChanged event is not fired for every character typed - only when the text is committed, when happens when you programmatically set the Text property, when the control looses focus, or anything else that causes the typed text to be committed to the Text property.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
How can i enter data from windows form into array. How would this form look (for entering array).
|
|
|
|
|
It might be a bit advanced, but using TypeConvertors and UITypeEditors (especially the ArrayEditor) will do the best job
|
|
|
|
|
How many times are you going to ask this question?
What the form looks like entirely up to you!
You could either have a single textbox that the user has to input all the values in, seperated by some delimitter that you dictate. (Not a good idea...)
Or you could have a bunch of textboxs arranged on the form, in a kind of grid, that the user could fill in one at a time. Then you just take all those values and put them into your array.
Or, whatever else you come up with...
RageInTheMachine9532
|
|
|
|