Hello I have a issue to discuss that recently I have a made a C# program for Rental Car Management, although its very easy cause all it contained was SQL statements manipulating the data form database. The issues starts when I gather all the elements or functions and display them to be accessed by one Main window where I can access all the different elements of the programs. I am showing you the code for this part, My teacher says its bit complicated and he would have done it simpler and differently.
I will appreciate any help comments to improve this.
namespace CMS1 // The Main NameSpace which is used for referencing rest of the program.
{
class CMS
{
// Structure of the Form mad with Views FileSystem.
Views.Form entry;
string formSpec = @"<Form Text=Main BackColor = silver>
<vertical>
<horizontal>
<Button Name='ManageEmployee'Width=170 Height=40 Font = Bold10 />
<Button Name='ManageContract'Width=170 Height=40 Font = Bold10 />
</horizontal>
<vertical>
<horizontal>
<Button Name='ManageCustomer'Width=170 Height=40 Font = Bold10 />
<Button Name='ManagePayment'Width=170 Height=40 Font = Bold10 />
</horizontal>
</vertical>
<vertical>
<horizontal>
<Button Name='ManageCar'Width=170 Height=40 Font = Bold10 />
<Button Name='ManageCarCatagories'Width=170 Height=40 Font = Bold10 />
</horizontal>
</vertical>
<horizontal>
<Space Width= 130 /><Button Name='Exit'/>
</horizontal>
</vertical>
</form>";
// a Method wich calls all other Programs from one single main.
public void ActionPerformed( string c )
{
switch (c)
{
case "ManageCustomer":
ManageCustomer m1= new ManageCustomer();
m1.Go();
break;
case "ManageContract":
ManageContract m2 = new ManageContract();
m2.Go();
break;
case "ManageEmployee":
ManageEmployee m3 = new ManageEmployee();
m3.Go();
break;
case "ManagePayment":
ManagePayment m4 = new ManagePayment();
m4.Go();
break;
case "ManageCar":
ManageCar m5 = new ManageCar();
m5.Go();
break;
case"ManageCarCatagories":
ManageCarCatagories m6 = new ManageCarCatagories();
m6.Go();
break;
case "Exit":
entry.CloseGUI();
break;
default:
return;
}
}
//This method calls the forms forward to be displayed.
//every thing OK up til here, no problems, but all the problems start after this.
public void Go()
{
entry = new Views.Form(formSpec);
for( ; ; ) // he thinks this is not right!!!
{
string c = entry.GetControl();
if (c==null) break;
ActionPerformed(c);
}
entry.CloseGUI();
}
kind regards
JG
No one has replied yet! Why not be the first?
Sign in or Join us (it's free).