Time Reg at Last !
using Views;using System;
using System.Text;
using System.Windows.Forms;
using System.IO;
public class TimeReg
{
private Views.Form form = new Views.Form(formSpec);
static string formSpec =@"<Form Text = 'TimeReg'>
<vertical>
<Label Name=ESSN/>
<TextBox Name=ESSN/>
<Label Name=StartTime/>
<TextBox Name =starttime/>
<Label Name=FinishTime/>
<TextBox Name=finishtime/>
<Label Name=Vaction/>
<TextBox Name=vecation/>
<Label Name=ill/>
<TextBox Name=ill/>
<Button Name=submit/>
<Button Name=clear/>
</vertical>
</Form>";
public void Submit(int x)
{
String query= " INSERT INTO id="+x+";";
Console.WriteLine(query);
}
public void go()
{
String ctl = form.GetControl();
while (ctl!=null)
{
performAction(ctl);
ctl = form.GetControl();
}
form.CloseGUI();
}
public void performAction(String c)
{
switch (c)
{
case "submit":
String id = form.GetText("ESSN");
String name = form.GetText("starttime");
String aa = form.GetText("finishtime");
String bb = form.GetText("vecation"); ;
String cc = form.GetText("ill");
form.PutText("ESSN","");
form.PutText("starttime","");
form.PutText("finishtime","");
form.PutText("vecation","");
form.PutText("ill","");
Console.WriteLine("{0} {1} {2} {3} {4}",id,name,aa,bb,cc);
FileStream sb = new FileStream("EmployeeInfo.txt", FileMode.OpenOrCreate);
char[] b = { 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm' };
StreamWriter sw = new StreamWriter(sb);
sw.Write(b, 3, 8);
//sw.Close();
break;
default:
return;
}
}
public static void Main()
{
TimeReg sys = new TimeReg();
sys.go();
//sys.Close();
}
}
Det her er en TimeReg Application som jeg endlig lavet, problem er at jeg gerne have den skal lave alt oplysninger som blev testet ind i Console application og vises i en console skal gemmes ind i et tekst fil, den kode som jeg har lavet stadig viser oplysninger i console men laver en tøm tekxt fil.
Please help !!!
