00001
00002
00003
00004
00005
00006
00007
00008 #include "generatortool.h"
00009
00010 BEGIN_EVENT_TABLE( GeneratorToolFrame, wxFrame )
00011 EVT_MENU( Menu_File_Quit, GeneratorToolFrame::OnQuit )
00012 EVT_MENU( Menu_File_About, GeneratorToolFrame::OnAbout )
00013 EVT_BUTTON(ID_BTN_LOGIN, GeneratorToolFrame::OnButtonLogin)
00014 EVT_TEXT_ENTER(ID_TCTRL_PW,GeneratorToolFrame::OnButtonLogin)
00015 EVT_BUTTON(ID_BTN_LOGOUT, GeneratorToolFrame::OnButtonLogout)
00016
00017 EVT_LISTBOX_DCLICK(ID_LB_APPLIST, GeneratorToolFrame::OnButtonLaunch)
00018 EVT_BUTTON(ID_BTN_LAUNCH, GeneratorToolFrame::OnButtonLaunch)
00019 END_EVENT_TABLE()
00020
00021
00022 IMPLEMENT_APP(GeneratorToolapp)
00023
00024 wxString myString;
00025 wxTextValidator NumericValidator = wxTextValidator(wxFILTER_NUMERIC, &myString);
00026 wxTextValidator AlphanumericValidator = wxTextValidator(wxFILTER_ALPHANUMERIC, &myString);
00027 wxTextValidator ASCIIValidator= wxTextValidator(wxFILTER_ASCII, &myString);
00028 wxHashTable formtable = wxHashTable(wxKEY_INTEGER);
00029 wxHashTable objecttable = wxHashTable(wxKEY_INTEGER);
00030
00031
00032
00033
00034 bool
00035 GeneratorToolapp::OnInit()
00036 {
00037 GeneratorToolFrame *frame = new GeneratorToolFrame( wxT( "FastApp Generator Tool" ), wxPoint(50,50), wxSize(450,356), wxTAB_TRAVERSAL|wxRESIZE_BORDER | wxRESIZE_BOX | wxMAXIMIZE_BOX,"Main Frame");
00038 frame->Centre(wxBOTH);
00039 frame->Show(TRUE);
00040 SetTopWindow(frame);
00041 return TRUE;
00042 }
00043
00044
00045
00046
00047
00048
00049
00050
00051
00052
00053
00054
00055 GeneratorToolFrame::GeneratorToolFrame( const wxString& title, const wxPoint& pos, const wxSize& size, long style,const wxString& name )
00056 : wxFrame((wxFrame *)NULL, -1, title, pos, size,style,name)
00057 {
00058
00059 wxMenu *menuFile = new wxMenu;
00060 menuFile->Append( Menu_File_About, wxT( "&About..." ) );
00061 menuFile->AppendSeparator();
00062 menuFile->Append( Menu_File_Quit, wxT( "E&xit" ) );
00063 wxMenuBar *menuBar = new wxMenuBar;
00064 menuBar->Append( menuFile, wxT( "&File" ) );
00065 SetMenuBar( menuBar );
00066 CreateStatusBar();
00067 SetStatusText( wxT( "FastApp Generator Tool (c) Ko Kok Leong" ) );
00068
00069 loginStaticText = new wxStaticText(this, -1, "Login Screen");
00070 dummy = new wxStaticText(this, -1, "");
00071 nameStaticText = new wxStaticText(this, -1, "Username:", wxDefaultPosition, wxDefaultSize, wxALIGN_RIGHT|wxALIGN_CENTRE);
00072 passwordStaticText = new wxStaticText(this, -1, "Password:", wxDefaultPosition, wxDefaultSize, wxALIGN_RIGHT);
00073 usernameTextCtrl = new wxTextCtrl(this, -1, "", wxDefaultPosition, wxDefaultSize, wxTE_PROCESS_TAB, AlphanumericValidator);
00074 passwordTextCtrl = new wxTextCtrl(this, ID_TCTRL_PW, "", wxDefaultPosition, wxDefaultSize, wxTE_PROCESS_TAB |wxTE_PROCESS_ENTER|wxTE_PASSWORD);
00075
00076 loginButton = new wxButton( this, ID_BTN_LOGIN, wxT("Login"),wxDefaultPosition,wxSize(80,30));
00077
00078 set_properties();
00079 do_layout();
00080 }
00081
00082
00083
00084
00085
00086
00087 GeneratorToolFrame::~GeneratorToolFrame()
00088 {
00089 delete [] arrAppname;
00090 delete [] arrAppid;
00091 delete [] arrSdbid;
00092 delete [] arrAppformid;
00093 }
00094
00095
00096
00097
00098
00099
00100 void
00101 GeneratorToolFrame::set_properties()
00102 {
00103 loginStaticText->SetSize(wxSize(100, 80));
00104 loginStaticText->SetFont(wxFont(14, wxSWISS, wxNORMAL, wxNORMAL, 1, ""));
00105 loginStaticText->SetToolTip("Enter User Login Name and Password");
00106 nameStaticText->SetSize(wxSize(100, 50));
00107 nameStaticText->SetFont(wxFont(13, wxSWISS, wxNORMAL, wxNORMAL, 0, ""));
00108 usernameTextCtrl->SetSize(wxSize(150, 25));
00109 usernameTextCtrl->SetToolTip("Enter User Name Here");
00110 usernameTextCtrl->SetFocus();
00111 usernameTextCtrl->SetValue("Developer");
00112 passwordStaticText->SetSize(wxSize(100, 25));
00113 passwordStaticText->SetFont(wxFont(13, wxSWISS, wxNORMAL, wxNORMAL, 0, ""));
00114 passwordTextCtrl->SetSize(wxSize(150, 25));
00115 passwordTextCtrl->SetToolTip("Enter Password Here");
00116 passwordTextCtrl->SetValue("1");
00117 }
00118
00119
00120
00121
00122
00123
00124 void
00125 GeneratorToolFrame::do_layout()
00126 {
00127 frameSizer = new wxBoxSizer(wxVERTICAL);
00128 grid_sizer_1 = new wxFlexGridSizer(4, 2, 10, 5);
00129 grid_sizer_1->Add(loginStaticText, 0, wxALIGN_BOTTOM, 0);
00130 grid_sizer_1->Add(dummy, 0, wxALIGN_RIGHT, 0);
00131 grid_sizer_1->Add(nameStaticText, 0, wxALIGN_RIGHT, 0);
00132 grid_sizer_1->Add(usernameTextCtrl, 0, 0, 0);
00133 grid_sizer_1->Add(passwordStaticText, 0, wxALIGN_RIGHT, 0);
00134 grid_sizer_1->Add(passwordTextCtrl, 0, 0, 0);
00135 grid_sizer_1->Add(dummy, 0, wxALIGN_RIGHT, 0);
00136 grid_sizer_1->Add(loginButton, 0, wxALIGN_RIGHT, 0);
00137 frameSizer->Add(grid_sizer_1, 1, wxALIGN_CENTER_HORIZONTAL, 0);
00138 SetAutoLayout(true);
00139 SetSizer(frameSizer);
00140 Layout();
00141 }
00142
00143
00144
00145
00146
00147
00148 void
00149 GeneratorToolFrame::OnQuit( wxCommandEvent& event)
00150 {
00151 Close(TRUE);
00152 }
00153
00154
00155
00156
00157
00158
00159 void
00160 GeneratorToolFrame::OnAbout( wxCommandEvent& event)
00161 {
00162 wxMessageBox( wxT( "This is the Generator Tool of FastApp.\nIt allows you to execute applications \nstored in the database.\n\n(c)Ko Kok Leong" ),
00163 wxT( "About Generator Tool" ), wxOK | wxICON_INFORMATION, this );
00164
00165 }
00166
00167
00168
00169
00170
00171
00172
00173
00174
00175
00176
00177
00178
00179
00180
00181 void GeneratorToolFrame::OnButtonLogin( wxCommandEvent& event )
00182 {
00183
00184 wxBeginBusyCursor(wxHOURGLASS_CURSOR);
00185 wxString strUname, strPword;
00186 strUname=strPword="";
00187 noforms=0;
00188 strUname = usernameTextCtrl->GetValue();
00189 strPword = passwordTextCtrl->GetValue();
00190
00191
00192 if(strUname.IsEmpty() || strPword.IsEmpty())
00193 {
00194 wxMessageBox("Please fill in both fields before proceeding.","Missing Fields",wxOK|wxICON_EXCLAMATION,this);
00195 usernameTextCtrl->Clear();
00196 passwordTextCtrl->Clear();
00197 wxEndBusyCursor();
00198 return;
00199 }
00200
00201 DbEstb();
00202
00203
00204 if(tbFa_App->Open())
00205 {
00206 tbFa_App->SetWhereClause("susername='"+strUname+"' AND spassword='"+strPword+"'");
00207 if(!tbFa_App->Query())
00208 {
00209 wxMessageBox("Problem with Query on Fa_App");
00210 }
00211 else
00212 {
00213 int nNumofapp = tbFa_App->Count();
00214 if(nNumofapp>0)
00215 {
00216 wxMessageBox("Welcome.\nPlease select your application to launch.","Successful Login",wxOK|wxICON_INFORMATION,this,50,50);
00217 arrAppname = NULL;
00218 arrAppid = arrSdbid= arrAppformid =NULL;
00219 arrAppname = new wxString[nNumofapp+1];
00220 arrAppid = arrSdbid= arrAppformid = new int[nNumofapp+1];
00221
00222 wxList UserAppList=wxList(wxKEY_INTEGER);
00223 int count=0;
00224 while(tbFa_App->GetNext())
00225 {
00226 arrAppname[count]=sAppname;
00227 arrAppid[count]=sAppid,
00228 arrSdbid[count]=sSdbid,
00229 arrAppformid[count]=sAppformid;
00230 count++;
00231 }
00232 grid_sizer_1->Clear();
00233 loginStaticText->Show(FALSE);
00234 dummy->Show(FALSE);
00235 nameStaticText->Show(FALSE);
00236 usernameTextCtrl->Show(FALSE);
00237 passwordStaticText->Show(FALSE);
00238 passwordTextCtrl->Show(FALSE);
00239 loginButton->Show(FALSE);
00240
00241
00242 applistStaticText= new wxStaticText(this, -1, "Your Applications:");
00243 applistStaticText->SetFont(wxFont(13, wxSWISS, wxNORMAL, wxNORMAL, 0, ""));
00244 appListBox =new wxListBox(this, ID_LB_APPLIST, wxDefaultPosition, wxSize(200,60), nNumofapp, arrAppname, 0, wxDefaultValidator, "Application listBox");
00245 launchButton = new wxButton( this, ID_BTN_LAUNCH, wxT("Launch"),wxDefaultPosition,wxSize(80,30));
00246 logoutButton = new wxButton( this, ID_BTN_LOGOUT, wxT("Log Out"),wxDefaultPosition,wxSize(80,30));
00247 ButtonBox = new wxBoxSizer(wxHORIZONTAL);
00248 ButtonBox->Add(logoutButton,0,wxALIGN_CENTRE,0);
00249 ButtonBox->Add(launchButton,0,wxALIGN_CENTRE,0);
00250 grid_sizer_1->Add(dummy, 0, wxALIGN_RIGHT,0);
00251 grid_sizer_1->Add(dummy, 0, wxALIGN_RIGHT,0);
00252 grid_sizer_1->Add(applistStaticText, 0, wxALIGN_RIGHT, 0);
00253 grid_sizer_1->Add(appListBox, 0, wxALIGN_RIGHT, 0);
00254 grid_sizer_1->Add(dummy, 0, wxALIGN_RIGHT, 0);
00255 grid_sizer_1->Add(ButtonBox, 0, wxALIGN_RIGHT, 0);
00256
00257
00258 }
00259 else
00260 {
00261 wxMessageBox("Either the username and/or password is wrongly entered.\nPlease try again.","Incorrect Login",wxOK,this,50,50);
00262 usernameTextCtrl->Clear();
00263 passwordTextCtrl->Clear();
00264 wxEndBusyCursor();
00265 }
00266 }
00267 }
00268 else
00269 {
00270 wxMessageBox("Database cannot be opened","Unable to establish DB Connection",wxOK,this,50,50);
00271 wxEndBusyCursor();
00272 return;
00273 }
00274 wxEndBusyCursor();
00275 SetStatusText( wxT( "Select an application to launch" ) );
00276 }
00277
00278
00279
00280
00281
00282 void GeneratorToolFrame::OnButtonLogout( wxCommandEvent& event )
00283 {
00284 grid_sizer_1->Clear();
00285 dummy->Show(FALSE);
00286 applistStaticText->Show(FALSE);
00287 appListBox->Show(FALSE);
00288 logoutButton->Show(FALSE);
00289 launchButton->Show(FALSE);
00290
00291 grid_sizer_1->Add(loginStaticText, 0, wxALIGN_RIGHT,0);
00292 grid_sizer_1->Add(dummy, 0, wxALIGN_RIGHT,0);
00293 grid_sizer_1->Add(nameStaticText, 0, wxALIGN_RIGHT, 0);
00294 grid_sizer_1->Add(usernameTextCtrl, 0, wxALIGN_RIGHT, 0);
00295 grid_sizer_1->Add(passwordStaticText, 0, wxALIGN_RIGHT, 0);
00296 grid_sizer_1->Add(passwordTextCtrl, 0, wxALIGN_RIGHT, 0);
00297 grid_sizer_1->Add(loginButton, 0, wxALIGN_RIGHT, 0);
00298
00299 loginStaticText->Show(TRUE);
00300 dummy->Show(TRUE);
00301 nameStaticText->Show(TRUE);
00302 usernameTextCtrl->Show(TRUE);
00303 passwordStaticText->Show(TRUE);
00304 passwordTextCtrl->Clear();
00305 passwordTextCtrl->Show(TRUE);
00306 loginButton->Show(TRUE);
00307 }
00308
00309
00310
00311
00312
00313
00314
00315
00316
00317
00318
00319
00320
00321
00322
00323
00324
00325
00326
00327
00328
00329 void GeneratorToolFrame::OnButtonLaunch( wxCommandEvent& event )
00330 {
00331
00332 if(appListBox->GetSelection()>=0)
00333 {
00334 int n= appListBox->GetSelection();
00335 wxString s = appListBox->GetStringSelection();
00336
00337 wxProgressDialog *Progress = new wxProgressDialog("Launching...", "Launching...", 100, this, wxPD_AUTO_HIDE | wxPD_APP_MODAL);
00338
00339 strDsnname ="";
00340 tbFa_Db->Open();
00341 tbFa_Db->SetWhereClause("dbid="+IntToWxstring(arrSdbid[n]));
00342 if(tbFa_Db->Query())
00343 {
00344 if(tbFa_Db->GetNext())
00345 {
00346 strDsnname=sDsnname;
00347
00348 UserDbConnectInf = NULL;
00349 UserDbConnectInf = new wxDbConnectInf( NULL, strDsnname, "", "", "" );
00350 if ( !UserDbConnectInf || !UserDbConnectInf->GetHenv() )
00351 {
00352 wxMessageBox("Unable to define data source connection info.", "Data Source Fault",wxOK|wxICON_HAND,this);
00353 }
00354 dbUser = NULL;
00355 dbUser = wxDbGetConnection( UserDbConnectInf );
00356
00357 }
00358 else
00359 {
00360 wxMessageBox("Cannot Get DSN Results","",wxOK|wxICON_EXCLAMATION,this);
00361 Progress->Update( 100, "Closing attempts on Connection");
00362 }
00363 }
00364 Progress->Update( 25, "Connecting to Application Database...");
00365 wxSleep(1);
00366
00367
00368
00369
00370
00371
00372
00373
00374
00375 int nNumForms =0;
00376 if(!tbFa_Appform->Open())
00377 wxMessageBox("Appform Table cannot be opened, please try again.");
00378 tbFa_Appform->SetWhereClause("appid="+IntToWxstring(arrAppformid[n]));
00379 if(tbFa_Appform->Query())
00380 nNumForms = tbFa_Appform->Count();
00381 arrFormid=new int[nNumForms];
00382 tbFa_Appform->SetWhereClause("appid="+IntToWxstring(arrAppformid[n]));
00383 if(tbFa_Appform->Query())
00384 {
00385 int k=0;
00386 while(tbFa_Appform->GetNext())
00387 {
00388 arrFormid[k]=sAF_Formid;
00389 k++;
00390
00391 }
00392 }
00393 else
00394 {
00395 wxMessageBox("Cannot execute the Query");
00396 }
00397
00398 formtable.Clear();
00399 objecttable.Clear();
00400 wxBeginBusyCursor(wxHOURGLASS_CURSOR);
00401
00402
00403
00404 Progress->Update( 75, "Rendering "+s+" GUI...");
00405 wxSleep(1);
00406
00407 if(tbFa_Form->Open()&& tbFa_Object->Open())
00408 {
00409 for(int i=0; i<nNumForms;i++)
00410 {
00411 tbFa_Form->SetWhereClause("fid = "+IntToWxstring(arrFormid[i]));
00412 if(!tbFa_Form->Query())
00413 wxMessageBox("FA_FORM Query Failed");
00414 else
00415 {
00416 while(tbFa_Form->GetNext())
00417 {
00418 InstantiateForm(sFid, sFormx, sFormy, sFormw, sFormh,sFormtype, sFormstyle, sCaption,sIsindex);
00419 tbFa_Object->SetWhereClause("formid = "+IntToWxstring(arrFormid[i]));
00420 if(!tbFa_Object->Query())
00421 wxMessageBox("Cannot Execute Render Object Query");
00422 else
00423 {
00424 while(tbFa_Object->GetNext())
00425 {
00426 InstantiateObject(sObjtype,sFormid, sObjid, sObjlabel,sObjdefault,sObjx, sObjy, sObjw, sObjh, sObjstyle,atoi(sO_Attrtype));
00427 }
00428 }
00429 }
00430 }
00431 }
00432 }
00433 else
00434 {
00435 wxMessageBox("DB Can't Open","Failed");
00436 }
00437 wxEndBusyCursor();
00438 Progress->Update( 100, "Launching Complete");
00439 return;
00440 }
00441 else
00442 {
00443 wxMessageBox("Please select a valid application first.");
00444 return;
00445 }
00446 delete UserDbConnectInf;
00447 delete [] arrFormid;
00448
00449 }
00450
00451
00452
00453
00454
00455
00456
00457
00458
00459
00460 wxString GeneratorToolFrame::IntToWxstring(int id)
00461 {
00462 wxString s;
00463 s+=wxString::Format("%d",id);
00464 return s;
00465 }
00466
00467
00468
00469
00470
00471
00472
00473
00474
00475
00476
00477
00478
00479
00480
00481
00482
00483
00484
00485
00486
00487
00488
00489
00490
00491
00492 void
00493 GeneratorToolFrame::InstantiateForm(int id, int x, int y, int w, int h, int type, int style, wxString title, int isindex)
00494 {
00495
00496
00497
00498
00499
00500
00501
00502
00503
00504 switch(type)
00505 {
00506 case 1:
00507 {
00508
00509 formtable.Put(sFid,(new wxFrame(NULL,id,title,wxPoint(x,y),wxSize(w,h),wxDEFAULT_FRAME_STYLE, "frame")));
00510 if(isindex==1)
00511 wxDynamicCast((formtable.Get(id)),wxFrame)->Show(TRUE);
00512 else
00513 wxDynamicCast((formtable.Get(id)),wxFrame)->Show(FALSE);
00514 break;
00515 }
00516 default:
00517 {
00518
00519
00520
00521 }
00522 }
00523 }
00524
00525
00526
00527
00528
00529
00530
00531
00532
00533
00534
00535
00536
00537 void
00538 GeneratorToolFrame::InstantiateObject(int type, int formid, int oid, wxString olabel,wxString odefault, int ox, int oy, int ow, int oh, int ostyle, int oAttrtype)
00539 {
00540 switch(type)
00541 {
00542 case 101:
00543 {
00544 wxWindow *parent= FindWindowById(formid,NULL);
00545 objecttable.Put(oid,(new wxButton(parent,oid,olabel,wxPoint(ox,oy),wxSize(ow,oh),ostyle)));
00546
00547
00548
00549 wxDynamicCast((objecttable.Get(oid)),wxButton)->Connect( oid, wxEVT_COMMAND_BUTTON_CLICKED,
00550 (wxObjectEventFunction) (wxEventFunction) (wxCommandEventFunction)
00551 &GeneratorToolFrame::ButtonGenericEventFunc );
00552 break;
00553 }
00554 case 100:
00555 {
00556 wxWindow *parent= FindWindowById(formid,NULL);
00557 objecttable.Put(oid,(new wxStaticText(parent,oid,olabel,wxPoint(ox,oy), wxSize(ow,oh),ostyle, "staticText")));
00558 break;
00559 }
00560 case 104:
00561 {
00562 wxWindow *parent= FindWindowById(formid,NULL);
00563 objecttable.Put(oid,(new wxStaticBox(parent,oid,olabel,wxPoint(ox,oy), wxSize(ow,oh),ostyle, "staticBox")));
00564 break;
00565 }
00566 case 5:
00567 {
00568
00569 int fid= formid;
00570 wxWindow *parent= FindWindowById(formid,NULL);
00571 objecttable.Put(oid,(new wxGrid(parent, oid, wxPoint(ox,oy), wxSize(ow,oh),1 ,"Grid")));
00572 wxDynamicCast((objecttable.Get(oid)),wxGrid)->CreateGrid(0, ostyle, wxGrid::wxGridSelectCells);
00573
00574 for(int k=0; k<ostyle;k++)
00575 {
00576 wxString temp;
00577 if(k<ostyle-1)
00578 {
00579 temp = odefault.BeforeFirst(',');
00580 odefault=odefault.AfterFirst(',');
00581 }
00582 else
00583 temp = odefault;
00584 ((wxGrid *)FindWindowById(oid,NULL))->SetLabelValue(wxHORIZONTAL, temp,k);
00585 ((wxGrid *)FindWindowById(oid,NULL))->AutoSize();
00586 }
00587 RefreshGrid(fid,oid);
00588 break;
00589 }
00590 case 107:
00591 {
00592
00593
00594
00595
00596
00597
00598
00599
00600
00601
00602
00603
00604
00605
00606
00607
00608 if(oAttrtype==1||oAttrtype==5||oAttrtype==6||oAttrtype==7)
00609 {
00610
00611 wxWindow *parent= FindWindowById(formid,NULL);
00612 objecttable.Put(oid,(new wxTextCtrl(parent, oid, "", wxPoint(ox,oy),wxSize(ow,oh), ostyle,NumericValidator)));
00613
00614 wxDynamicCast((objecttable.Get(oid)),wxTextCtrl)->Connect( oid, wxEVT_COMMAND_TEXT_UPDATED,
00615 (wxObjectEventFunction) (wxEventFunction) (wxCommandEventFunction)
00616 &GeneratorToolFrame::TextCtrlGenericEventFunc);
00617
00618 }
00619 else
00620 {
00621
00622 wxWindow *parent= FindWindowById(formid,NULL);
00623 objecttable.Put(oid,(new wxTextCtrl(parent, oid, "", wxPoint(ox,oy),wxSize(ow,oh), ostyle,ASCIIValidator)));
00624
00625 wxDynamicCast((objecttable.Get(oid)),wxTextCtrl)->Connect( oid, wxEVT_COMMAND_TEXT_UPDATED,
00626 (wxObjectEventFunction) (wxEventFunction) (wxCommandEventFunction)
00627 &GeneratorToolFrame::TextCtrlGenericEventFunc);
00628 }
00629 break;
00630 }
00631 default:
00632 {
00633
00634 }
00635 }
00636 }
00637
00638
00639 void
00640 GeneratorToolFrame::FormGenericEventFunc(wxCommandEvent& event)
00641 {
00642
00643 }
00644
00645
00646
00647
00648
00649 void
00650 GeneratorToolFrame::RefreshGrid(int formid, int objectid)
00651 {
00652
00653
00654 SDWORD cb;
00655 wxChar reqVal[255];
00656 wxString sqlStmt;
00657 int numCols;
00658
00659 wxDbConnectInf *uDbConnInf;
00660 wxDb *dbuFA;
00661 uDbConnInf = NULL;
00662 uDbConnInf = new wxDbConnectInf( NULL, "fastapp-dsn", "", "", "" );
00663 if ( !uDbConnInf || !uDbConnInf->GetHenv() )
00664 {
00665 wxMessageBox(wxT("Unable to define data source connection info."),
00666 wxT("SysDB CONNECTION ERROR..."),wxOK | wxICON_EXCLAMATION);
00667 }
00668 dbuFA = NULL;
00669 dbuFA = wxDbGetConnection( uDbConnInf );
00670 sqlStmt="SELECT objstyle,attrtable FROM fa_object WHERE objid ='"+IntToWxstring(objectid)+"' AND formid = '"+IntToWxstring(formid)+"';";
00671
00672 if (!dbuFA->ExecSql(sqlStmt.c_str()))
00673 {
00674 wxMessageBox("DB SQL STMT CANNOT EXECUTE.");
00675 return;
00676 }
00677 else
00678 {
00679 if(dbuFA->GetNext())
00680 {
00681 dbuFA->GetData(1, SQL_C_CHAR, reqVal, sizeof(reqVal), &cb);
00682
00683 numCols=atoi(reqVal);
00684 dbuFA->GetData(2, SQL_C_CHAR, reqVal, sizeof(reqVal), &cb);
00685 sqlStmt="SELECT * FROM ";
00686 sqlStmt+=reqVal;
00687 sqlStmt+=";";
00688
00689 }
00690 else
00691 {
00692 wxMessageBox("Cannot Get Next");
00693 }
00694 }
00695
00696
00697
00698
00699 wxDbConnectInf *uUserDbConnInf;
00700 uUserDbConnInf = NULL;
00701 uUserDbConnInf = new wxDbConnectInf( NULL, strDsnname, "", "", "" );
00702 if(!uUserDbConnInf || !uUserDbConnInf->GetHenv() )
00703 {
00704 wxMessageBox(wxT("Unable to define User data source connection info."),
00705 wxT("UserDB CONNECTION ERROR..."),wxOK | wxICON_EXCLAMATION);
00706 }
00707 wxDb *dbuU;
00708 dbuU = NULL;
00709 dbuU = wxDbGetConnection( uUserDbConnInf );
00710
00711
00712
00713
00714
00715 if (!dbuU->ExecSql(sqlStmt.c_str()))
00716 {
00717 wxMessageBox("DB SQL STMT CANNOT EXECUTE.");
00718 return;
00719 }
00720 else{
00721
00722 int row=0;
00723 while(dbuU->GetNext())
00724 {
00725
00726
00727
00728
00729
00730
00731 wxDynamicCast((objecttable.Get(objectid)),wxGrid)->AppendRows(1,FALSE);
00732
00733
00734
00735
00736
00737 for(int col=1; col<=numCols;col++)
00738 {
00739 if (!dbuU->GetData(col, SQL_C_CHAR, reqVal, sizeof(reqVal), &cb))
00740 {
00741 wxMessageBox("Error in Getting Data.");
00742 }
00743 else
00744 {
00745 wxDynamicCast((objecttable.Get(objectid)),wxGrid)->SetCellValue(row,col-1,reqVal);
00746 }
00747 }
00748 row++;
00749 }
00750 }
00751
00752
00753 wxDynamicCast((objecttable.Get(objectid)),wxGrid)->AutoSize();
00754
00755
00756 wxDbFreeConnection(dbuU);
00757 wxDbFreeConnection(dbuFA);
00758 }
00759
00760
00761
00762
00763
00764
00765
00766
00767
00768
00769
00770
00771
00772
00773
00774 void
00775 GeneratorToolFrame::ButtonGenericEventFunc(wxCommandEvent& event)
00776 {
00777
00778
00779
00780
00781 wxDbConnectInf *uDbConnectInf,*uUserDbConnectInf;
00782 wxDb *dbuFastApp, *dbuUser;
00783
00784 uDbConnectInf = NULL;
00785 uDbConnectInf = new wxDbConnectInf( NULL, "fastapp-dsn", "", "", "" );
00786 if ( !uDbConnectInf || !uDbConnectInf->GetHenv() )
00787 {
00788 wxMessageBox(wxT("Unable to define data source connection info."),
00789 wxT("SysDB CONNECTION ERROR..."),wxOK | wxICON_EXCLAMATION);
00790 }
00791 dbuFastApp = NULL;
00792 dbuFastApp = wxDbGetConnection( uDbConnectInf );
00793
00794
00795 uUserDbConnectInf = NULL;
00796 uUserDbConnectInf = new wxDbConnectInf( NULL, strDsnname, "", "", "" );
00797 if(!uUserDbConnectInf || !uUserDbConnectInf->GetHenv() )
00798 {
00799 wxMessageBox(wxT("Unable to define User data source connection info."),
00800 wxT("UserDB CONNECTION ERROR..."),wxOK | wxICON_EXCLAMATION);
00801 }
00802 dbuUser = NULL;
00803 dbuUser = wxDbGetConnection( uUserDbConnectInf );
00804
00805
00806
00807
00808
00809 wxString objectid = IntToWxstring(event.GetId());
00810 wxString strEventid="";
00811
00812
00813 SDWORD cb;
00814 ULONG reqQty;
00815 wxString sqlStmt;
00816 sqlStmt = "SELECT eventid FROM FA_OBJECT WHERE objid="+objectid+";";
00817
00818
00819 if (!dbuFastApp->ExecSql(sqlStmt.c_str()))
00820 {
00821 wxMessageBox("Cannot Execute SQL String");
00822 }
00823 else
00824 {
00825
00826 if (!dbuFastApp->GetNext())
00827 { wxMessageBox("Cannot Get Next in Fastapp");
00828 }
00829 if (!dbuFastApp->GetData(1, SQL_C_ULONG,&reqQty, 0, &cb))
00830 {
00831 wxMessageBox("Cannot extract data out.");
00832 }
00833 else
00834 {
00835 strEventid= IntToWxstring(reqQty);
00836 dbuFastApp->CommitTrans();
00837 }
00838
00839 if (cb == SQL_NULL_DATA)
00840 wxMessageBox("No records returned");
00841 }
00842
00843
00844
00845
00846
00847
00848 wxArrayString arrPid = wxArrayString();
00849 wxArrayString arrProcessdesc = wxArrayString();
00850
00851
00852
00853 wxChar strPid[50+1];
00854 wxChar strProcessdesc[50+1];
00855
00856
00857 wxString sqlProcessStmt;
00858 sqlProcessStmt = "SELECT pid, processdesc FROM FA_PROCESS WHERE eventid="+strEventid+" ORDER BY pid;";
00859
00860
00861
00862
00863 if (!dbuFastApp->ExecSql(sqlProcessStmt.c_str()))
00864 {
00865 wxMessageBox("Cannot Execute SQL String");
00866 }
00867 else
00868 {
00869
00870 while(dbuFastApp->GetNext())
00871 {
00872
00873 dbuFastApp->GetData(1, SQL_C_CHAR,strPid, sizeof(strPid), &cb);
00874 dbuFastApp->GetData(2, SQL_C_CHAR,strProcessdesc, sizeof(strProcessdesc), &cb);
00875
00876 arrPid.Add(strPid,1);
00877 arrProcessdesc.Add(strProcessdesc,1);
00878 dbuFastApp->CommitTrans();
00879 }
00880
00881
00882 }
00883 if(arrProcessdesc[0].IsSameAs("REFRESHGRID"))
00884 {
00885 int formid = atoi(arrProcessdesc[2].BeforeFirst(','));
00886 int gridid = atoi(arrProcessdesc[2].AfterFirst(','));
00887
00888 SDWORD cb;
00889 wxChar reqVal[255];
00890 wxString sqlStmt;
00891 int numCols;
00892 sqlStmt="SELECT objstyle,attrtable FROM fa_object WHERE objid ='"+IntToWxstring(gridid)+"' AND formid = '"+IntToWxstring(formid)+"';";
00893
00894 if (!dbuFastApp->ExecSql(sqlStmt.c_str()))
00895 {
00896 wxMessageBox("DB SQL STMT CANNOT EXECUTE.");
00897 return;
00898 }
00899 else
00900 {
00901 if(dbuFastApp->GetNext())
00902 {
00903 dbuFastApp->GetData(1, SQL_C_CHAR, reqVal, sizeof(reqVal), &cb);
00904 numCols=atoi(reqVal);
00905 dbuFastApp->GetData(2, SQL_C_CHAR, reqVal, sizeof(reqVal), &cb);
00906 sqlStmt="SELECT * FROM ";
00907 sqlStmt+=reqVal;
00908 sqlStmt+=";";
00909 }
00910 else
00911 {
00912 wxMessageBox("Cannot Get Next");
00913 }
00914 }
00915 wxGrid *targetGrid = (wxGrid *) (wxGetTopLevelParent(this)->FindWindowById(gridid));
00916
00917 if (!dbuUser->ExecSql(sqlStmt.c_str()))
00918 {
00919 wxMessageBox("DB SQL STMT CANNOT EXECUTE.");
00920 return;
00921 }
00922 else{
00923
00924 int row=0;
00925 targetGrid->DeleteRows(0,targetGrid->GetNumberRows());
00926 while(dbuUser->GetNext())
00927 {
00928 targetGrid->AppendRows(1,FALSE);
00929 for(int col=1; col<=numCols;col++)
00930 {
00931 if (!dbuUser->GetData(col, SQL_C_CHAR, reqVal, sizeof(reqVal), &cb))
00932 {
00933 wxMessageBox("Error in Getting Data.");
00934 }
00935 else
00936 {
00937 targetGrid->SetCellValue(row,col-1,reqVal);
00938 }
00939 }
00940 row++;
00941 }
00942 }
00943 targetGrid->AutoSize();
00944 }
00945 else if(arrProcessdesc[0].IsSameAs("DELETE"))
00946 {
00947
00948
00949
00950
00951
00952
00953
00954
00955 wxString $Table = arrProcessdesc[1];
00956 wxString $Object = arrProcessdesc[2];
00957 long objid = atoi($Object);
00958 wxString $condition = arrProcessdesc[3];
00959 int row= ((wxGrid *) (wxGetTopLevelParent(this)->FindWindowById(objid)))->GetGridCursorRow();
00960 if(row<0)
00961 wxMessageBox("Please Select a record to delete in the table.");
00962 else
00963 {
00964 wxString sPid = ((wxGrid *) (wxGetTopLevelParent(this)->FindWindowById(objid)))->GetCellValue(row, 0);
00965 int reply= wxMessageBox("Are you sure you want to delete this record?","Confirmation",wxYES_NO,this);
00966 if(reply==wxYES)
00967 {
00968 wxString deleteSqlStmt="DELETE FROM "+$Table+" WHERE "+$condition+" = '"+sPid+"';";
00969
00970 if (!dbuUser->ExecSql(deleteSqlStmt.c_str()))
00971 {
00972 wxMessageBox("Can't execute Delete statement");
00973
00974 }
00975 else
00976 {
00977 wxMessageBox("Record Deleted.","Deleted",wxOK, this);
00978 dbuUser->CommitTrans();
00979 }
00980 }
00981 else
00982 {
00983 return;
00984 }
00985 }
00986 }
00987 else if(arrProcessdesc[0].IsSameAs("POPUP"))
00988 {
00989 wxString $Formids = arrProcessdesc[2];
00990 int nNumforms = $Formids.Freq(',')+1;
00991 int arrFormids[nNumforms];
00992 if(nNumforms>0)
00993 {
00994 int i=0;
00995 while(i<nNumforms)
00996 {
00997 arrFormids[i]=atoi($Formids.BeforeFirst(','));
00998 $Formids=$Formids.AfterFirst(',');
00999 i++;
01000 }
01001
01002 for(int k=0;k<nNumforms;k++)
01003 {
01004 if((FindWindowById(arrFormids[k])))
01005 (FindWindowById(arrFormids[k]))->Show(TRUE);
01006 else
01007 {
01008
01009 wxChar fid[50+1],formx[50+1],formy[50+1],formw[50+1],formh[50+1],formtype[50+1],formstyle[50+1],caption[100+1];
01010 wxString formSqlstmt = "Select fid,formx,formy,formw,formh,formtype,formstyle,caption from fa_form where fid = '"+IntToWxstring(arrFormids[k])+"';";
01011 if (!dbuFastApp->ExecSql(formSqlstmt.c_str()))
01012 {
01013 wxMessageBox("DB SQL STMT CANNOT EXECUTE.");
01014 return;
01015 }
01016 else
01017 {
01018 if(dbuFastApp->GetNext())
01019 {
01020 dbuFastApp->GetData(1, SQL_C_CHAR, fid, sizeof(fid), &cb);
01021 dbuFastApp->GetData(2, SQL_C_CHAR, formx, sizeof(formx), &cb);
01022 dbuFastApp->GetData(3, SQL_C_CHAR, formy, sizeof(formy), &cb);
01023 dbuFastApp->GetData(4, SQL_C_CHAR, formw, sizeof(formw), &cb);
01024 dbuFastApp->GetData(5, SQL_C_CHAR, formh, sizeof(formh), &cb);
01025 dbuFastApp->GetData(6, SQL_C_CHAR, formtype, sizeof(formtype), &cb);
01026 dbuFastApp->GetData(7, SQL_C_CHAR, formstyle, sizeof(formstyle), &cb);
01027 dbuFastApp->GetData(8, SQL_C_CHAR, caption, sizeof(caption), &cb);
01028
01029 if(atoi(formtype) == 1)
01030 {
01031 (new wxFrame(NULL,atoi(fid),caption,wxPoint(atoi(formx),atoi(formy)),wxSize(atoi(formw),atoi(formh)),wxDEFAULT_FRAME_STYLE, "popup frame"))->Show(TRUE);
01032 }
01033
01034 wxChar formid[50+1], objid[50+1], objx[50+1], objy[50+1], objw[50+1], objh[50+1], objtype[50+1], objstyle[50+1], objlabel[50+1], objdefault[50+1], attrtype[50+1];
01035
01036 wxString objSqlStmt = "SELECT formid, objid,objx,objy,objw,objh,objtype, objstyle, objlabel, objdefault, attrtype FROM fa_object WHERE formid = '"+IntToWxstring(arrFormids[k])+"';";
01037 wxWindow *parent= FindWindowById(atoi(fid),NULL);
01038
01039 if (!dbuFastApp->ExecSql(objSqlStmt.c_str()))
01040 {
01041 wxMessageBox("DB SQL STMT CANNOT EXECUTE.");
01042 return;
01043 }
01044 else
01045 {
01046 while(dbuFastApp->GetNext())
01047 {
01048 dbuFastApp->GetData(1, SQL_C_CHAR, formid, sizeof(formid), &cb);
01049 dbuFastApp->GetData(2, SQL_C_CHAR, objid, sizeof(objid), &cb);
01050 dbuFastApp->GetData(3, SQL_C_CHAR, objx, sizeof(objx), &cb);
01051 dbuFastApp->GetData(4, SQL_C_CHAR, objy, sizeof(objy), &cb);
01052 dbuFastApp->GetData(5, SQL_C_CHAR, objw, sizeof(objw), &cb);
01053 dbuFastApp->GetData(6, SQL_C_CHAR, objh, sizeof(objh), &cb);
01054 dbuFastApp->GetData(7, SQL_C_CHAR, objtype, sizeof(objtype), &cb);
01055 dbuFastApp->GetData(8, SQL_C_CHAR, objstyle, sizeof(objstyle), &cb);
01056 dbuFastApp->GetData(9, SQL_C_CHAR, objlabel, sizeof(objlabel), &cb);
01057 dbuFastApp->GetData(10, SQL_C_CHAR,objdefault, sizeof(objdefault), &cb);
01058 dbuFastApp->GetData(11, SQL_C_CHAR,attrtype, sizeof(attrtype), &cb);
01059
01060 if(atoi(objtype) == 101)
01061 {
01062 (new wxButton(parent,atoi(objid),objlabel,wxPoint(atoi(objx),atoi(objy)),wxSize(atoi(objw),atoi(objh)),atoi(objstyle)))->Connect( atoi(objid), wxEVT_COMMAND_BUTTON_CLICKED,(wxObjectEventFunction) (wxEventFunction) (wxCommandEventFunction) &GeneratorToolFrame::ButtonGenericEventFunc );
01063 }
01064 else if(atoi(objtype)==100)
01065 {
01066 (new wxStaticText(parent,atoi(objid),objlabel,wxPoint(atoi(objx),atoi(objy)), wxSize(atoi(objw),atoi(objh)),atoi(objstyle), "staticText"));
01067 }
01068 else if(atoi(objtype)==104)
01069 {
01070 (new wxStaticBox(parent,atoi(objid),objlabel,wxPoint(atoi(objx),atoi(objy)), wxSize(atoi(objw),atoi(objh)),atoi(objstyle), "staticBox"));
01071 }
01072 else if(atoi(objtype)==5)
01073 {
01074 (new wxGrid(parent, atoi(objid), wxPoint(atoi(objx),atoi(objy)), wxSize(atoi(objw),atoi(objh)),1 ,"Grid"))->CreateGrid(0, atoi(objstyle), wxGrid::wxGridSelectCells);
01075 wxString sDefault = objdefault;
01076 for(int k=0; k<atoi(objstyle);k++)
01077 {
01078 wxString temp;
01079 if(k<atoi(objstyle)-1)
01080 {
01081 temp = sDefault.BeforeFirst(',');
01082 sDefault=sDefault.AfterFirst(',');
01083 }
01084 else
01085 temp = sDefault;
01086 ((wxGrid *)(FindWindowById(atoi(objid),NULL)))->SetLabelValue(wxHORIZONTAL, temp,k);
01087 ((wxGrid *)(FindWindowById(atoi(objid),NULL)))->AutoSize();
01088 }
01089 RefreshGrid(atoi(formid),atoi(objid));
01090 }
01091 else if(atoi(objtype)==107)
01092 {
01093 if(atoi(attrtype)==1||atoi(attrtype)==5||atoi(attrtype)==6||atoi(attrtype)==7)
01094 {
01095 objecttable.Put(atoi(objid),(new wxTextCtrl(parent, atoi(objid), "", wxPoint(atoi(objx),atoi(objy)),wxSize(atoi(objw),atoi(objh)), atoi(objstyle),NumericValidator)));
01096 }
01097 else
01098 {
01099 (new wxTextCtrl(parent, atoi(objid), "", wxPoint(atoi(objx),atoi(objy)),wxSize(atoi(objw),atoi(objh)), atoi(objstyle),ASCIIValidator));
01100 }
01101 }
01102 }
01103 }
01104 }
01105 else
01106 {
01107 wxMessageBox("Cannot Get Next");
01108 }
01109 }
01110
01111 }
01112 }
01113 }
01114 else
01115 {
01116 wxMessageBox("Less than one field");
01117 arrFormids[0]=atoi($Formids);
01118 }
01119 }
01120 else if(arrProcessdesc[0].IsSameAs("INSERT"))
01121 {
01122
01123 wxString $Table = arrProcessdesc[1];
01124 wxString $Fields = arrProcessdesc[2];
01125 wxString $Attributes = "";
01126
01127 int nNumfields = $Fields.Freq(',')+1;
01128
01129 wxArrayString arrControlIds = wxArrayString();
01130 wxArrayString arrControlValues = wxArrayString();
01131 wxArrayString arrAttr = wxArrayString();
01132
01133 if(nNumfields>0)
01134 {
01135 int i=0;
01136 while(i<nNumfields)
01137 {
01138
01139 if(i==(nNumfields-1))
01140 {
01141 arrControlIds.Add($Fields,1);
01142
01143 }
01144 else{
01145 arrControlIds.Add($Fields.BeforeFirst(','),1);
01146 $Fields=$Fields.AfterFirst(',');
01147 }
01148
01149 i++;
01150 }
01151 }
01152 else
01153 {
01154 wxMessageBox("Less than one field");
01155 arrControlIds.Add($Fields,1);
01156 }
01157
01158 $Fields="";
01159 $Attributes="";
01160
01161
01162 int numOfIds = arrControlIds.GetCount();
01163 for(int z=0; z<numOfIds; z++)
01164 {
01165
01166 int id = atoi(arrControlIds[z]);
01167 wxString input= ((wxTextCtrl *)(wxGetTopLevelParent(this)->FindWindow(id)))->GetValue();
01168
01169 if(input.IsEmpty())
01170 {
01171 wxMessageBox("Please fill in the Empty Fields", "Missing Fields", wxICON_INFORMATION,this);
01172 ((wxTextCtrl *)(wxGetTopLevelParent(this)->FindWindow(id)))->SetFocus();
01173 return;
01174 }
01175 arrControlValues.Add(input,1);
01176
01177 if(z!=(nNumfields-1))
01178 $Fields+=("'"+arrControlValues[z]+"',");
01179 else
01180 $Fields+=("'"+arrControlValues[z]+"'");
01181 }
01182
01183 for(int k=0; k<numOfIds; k++)
01184 {
01185 int id = atoi(arrControlIds[k]);
01186 SDWORD cb;
01187 wxChar reqQty[50+1];
01188 wxString strTemp = arrControlIds[k];
01189
01190
01191 wxString strAttrSqlStmt = "SELECT attr FROM FA_OBJECT WHERE objid='"+strTemp+"';";
01192
01193
01194 if (!dbuFastApp->ExecSql(strAttrSqlStmt.c_str()))
01195 {
01196 wxMessageBox("Can't execute Select Attr SQL Statement");
01197 return;
01198 }
01199 else{
01200 if (!dbuFastApp->GetNext())
01201 wxMessageBox("Aghh2");
01202 else{
01203 if (!dbuFastApp->GetData(1, SQL_C_CHAR,reqQty, sizeof(reqQty), &cb))
01204 wxMessageBox("Aghh3");
01205 else
01206 {
01207 arrAttr.Add(reqQty,1);
01208 if(k!=(numOfIds-1))
01209 $Attributes+=(arrAttr[k]+",");
01210 else
01211 $Attributes+=arrAttr[k];
01212 dbuFastApp->CommitTrans();
01213 }
01214
01215 if (cb == SQL_NULL_DATA)
01216 wxMessageBox("No records returned");
01217 }
01218 }
01219 ((wxTextCtrl *)(wxGetTopLevelParent(this)->FindWindow(id)))->Clear();
01220 }
01221
01222 wxString userSqlStmt="INSERT INTO "+$Table+" ("+$Attributes+") VALUES ("+$Fields+");";
01223
01224 if (!dbuUser->ExecSql(userSqlStmt.c_str()))
01225 {
01226 wxMessageBox("Can't execute Insert statement");
01227
01228 }
01229 else
01230 {
01231 wxMessageBox("New Record Inserted.","Insert",wxOK, this);
01232 dbuUser->CommitTrans();
01233 }
01234 arrControlIds.Clear();
01235 arrControlValues.Clear();
01236 arrAttr.Clear();
01237 }
01238 else if(arrProcessdesc[0].IsSameAs("UPDATEPOPUP"))
01239 {
01240 wxString $Table = arrProcessdesc[1];
01241 wxString origin = arrProcessdesc[2];
01242 wxString OriginFormId = origin.BeforeFirst(',');
01243 wxString OriginGridId = origin.AfterFirst(',');
01244 wxString PopupScreenId = arrProcessdesc[4];
01245
01246 wxString $Attributes= arrProcessdesc[3];
01247 int numAttribs = $Attributes.Freq(',')+1;
01248 wxArrayString arrDbAttrib = wxArrayString();
01249 wxArrayString arrDbStoredAttrib = wxArrayString();
01250
01251 for(int x =0; x<numAttribs; x++)
01252 {
01253 if(x==(numAttribs-1))
01254 arrDbAttrib.Add($Attributes,1);
01255 else
01256 {
01257 arrDbAttrib.Add($Attributes.BeforeFirst(','),1);
01258 $Attributes = $Attributes.AfterFirst(',');
01259 }
01260 }
01261
01262 wxString PopupScreenObjids= arrProcessdesc[5];
01263 int numObjs =PopupScreenObjids.Freq(',')+1;
01264 wxArrayString arrObjectIds = wxArrayString();
01265
01266 for(int x =0; x<numObjs; x++)
01267 {
01268 if(x==(numObjs-1))
01269 arrObjectIds.Add(PopupScreenObjids,1);
01270 else
01271 {
01272 arrObjectIds.Add(PopupScreenObjids.BeforeFirst(','),1);
01273 PopupScreenObjids = PopupScreenObjids.AfterFirst(',');
01274 }
01275 }
01276
01277
01278 int row= ((wxGrid *) (wxGetTopLevelParent(this)->FindWindowById(atoi(OriginGridId))))->GetGridCursorRow();
01279
01280 if(row<0)
01281 wxMessageBox("Please Select a record to delete in the table.");
01282 else
01283 {
01284 int gridid = atoi(OriginGridId);
01285 wxString sPid = ((wxGrid *) (wxGetTopLevelParent(this)->FindWindowById(gridid)))->GetCellValue(row, 0);
01286
01287 wxString ExtractSqlStmt="SELECT * FROM "+$Table+" WHERE "+arrDbAttrib[0]+" = '"+sPid+"';";
01288
01289
01290 if (!dbuUser->ExecSql(ExtractSqlStmt.c_str()))
01291 {
01292 wxMessageBox("Can't execute Delete statement");
01293 }
01294 else
01295 {
01296 while(dbuUser->GetNext())
01297 {
01298 SDWORD cb;
01299 int count=1;
01300 int numAttr = arrDbAttrib.GetCount();
01301 while(count<=numAttr)
01302 {
01303 wxChar buf[50];
01304 dbuUser->GetData(count, SQL_C_CHAR, buf, sizeof(buf), &cb);
01305
01306 arrDbStoredAttrib.Add(buf,1);
01307 count++;
01308 }
01309 }
01310
01311
01312
01313
01314
01315
01316
01317
01318
01319
01320
01321
01322 wxString strFormId = PopupScreenId;
01323 int nFormId = atoi(strFormId);
01324 if((FindWindowById(nFormId)))
01325 (FindWindowById(nFormId))->Show(TRUE);
01326 else
01327 {
01328
01329 wxChar fid[50+1],formx[50+1],formy[50+1],formw[50+1],formh[50+1],formtype[50+1],formstyle[50+1],caption[100+1];
01330 wxString formSqlstmt = "Select fid,formx,formy,formw,formh,formtype,formstyle,caption from fa_form where fid = '"+strFormId+"';";
01331 if (!dbuFastApp->ExecSql(formSqlstmt.c_str()))
01332 {
01333 wxMessageBox("DB SQL STMT CANNOT EXECUTE.");
01334 return;
01335 }
01336 else
01337 {
01338 if(dbuFastApp->GetNext())
01339 {
01340 dbuFastApp->GetData(1, SQL_C_CHAR, fid, sizeof(fid), &cb);
01341 dbuFastApp->GetData(2, SQL_C_CHAR, formx, sizeof(formx), &cb);
01342 dbuFastApp->GetData(3, SQL_C_CHAR, formy, sizeof(formy), &cb);
01343 dbuFastApp->GetData(4, SQL_C_CHAR, formw, sizeof(formw), &cb);
01344 dbuFastApp->GetData(5, SQL_C_CHAR, formh, sizeof(formh), &cb);
01345 dbuFastApp->GetData(6, SQL_C_CHAR, formtype, sizeof(formtype), &cb);
01346 dbuFastApp->GetData(7, SQL_C_CHAR, formstyle, sizeof(formstyle), &cb);
01347 dbuFastApp->GetData(8, SQL_C_CHAR, caption, sizeof(caption), &cb);
01348
01349 if(atoi(formtype) == 1)
01350 {
01351 (new wxFrame(NULL,atoi(fid),caption,wxPoint(atoi(formx),atoi(formy)),wxSize(atoi(formw),atoi(formh)),wxDEFAULT_FRAME_STYLE, "popup frame"))->Show(TRUE);
01352 }
01353
01354 wxChar formid[50+1], objid[50+1], objx[50+1], objy[50+1], objw[50+1], objh[50+1], objtype[50+1], objstyle[50+1], objlabel[50+1], objdefault[50+1], attrtype[50+1];
01355
01356 wxString objSqlStmt = "SELECT formid, objid,objx,objy,objw,objh,objtype, objstyle, objlabel, objdefault, attrtype FROM fa_object WHERE formid = '"+strFormId+"';";
01357 wxWindow *parent= FindWindowById(atoi(fid),NULL);
01358
01359 if (!dbuFastApp->ExecSql(objSqlStmt.c_str()))
01360 {
01361 wxMessageBox("DB SQL STMT CANNOT EXECUTE.");
01362 return;
01363 }
01364 else
01365 {
01366 while(dbuFastApp->GetNext())
01367 {
01368 dbuFastApp->GetData(1, SQL_C_CHAR, formid, sizeof(formid), &cb);
01369 dbuFastApp->GetData(2, SQL_C_CHAR, objid, sizeof(objid), &cb);
01370 dbuFastApp->GetData(3, SQL_C_CHAR, objx, sizeof(objx), &cb);
01371 dbuFastApp->GetData(4, SQL_C_CHAR, objy, sizeof(objy), &cb);
01372 dbuFastApp->GetData(5, SQL_C_CHAR, objw, sizeof(objw), &cb);
01373 dbuFastApp->GetData(6, SQL_C_CHAR, objh, sizeof(objh), &cb);
01374 dbuFastApp->GetData(7, SQL_C_CHAR, objtype, sizeof(objtype), &cb);
01375 dbuFastApp->GetData(8, SQL_C_CHAR, objstyle, sizeof(objstyle), &cb);
01376 dbuFastApp->GetData(9, SQL_C_CHAR, objlabel, sizeof(objlabel), &cb);
01377 dbuFastApp->GetData(10, SQL_C_CHAR,objdefault, sizeof(objdefault), &cb);
01378 dbuFastApp->GetData(11, SQL_C_CHAR,attrtype, sizeof(attrtype), &cb);
01379
01380
01381 if(atoi(objtype) == 101)
01382 {
01383 (new wxButton(parent,atoi(objid),objlabel,wxPoint(atoi(objx),atoi(objy)),wxSize(atoi(objw),atoi(objh)),atoi(objstyle)))->Connect( atoi(objid), wxEVT_COMMAND_BUTTON_CLICKED,(wxObjectEventFunction) (wxEventFunction) (wxCommandEventFunction) &GeneratorToolFrame::ButtonGenericEventFunc );
01384 }
01385 else if(atoi(objtype)==100)
01386 {
01387 (new wxStaticText(parent,atoi(objid),objlabel,wxPoint(atoi(objx),atoi(objy)), wxSize(atoi(objw),atoi(objh)),atoi(objstyle), "staticText"));
01388 }
01389 else if(atoi(objtype)==104)
01390 {
01391 (new wxStaticBox(parent,atoi(objid),objlabel,wxPoint(atoi(objx),atoi(objy)), wxSize(atoi(objw),atoi(objh)),atoi(objstyle), "staticBox"));
01392 }
01393 else if(atoi(objtype)==5)
01394 {
01395 (new wxGrid(parent, atoi(objid), wxPoint(atoi(objx),atoi(objy)), wxSize(atoi(objw),atoi(objh)),1 ,"Grid"))->CreateGrid(0, atoi(objstyle), wxGrid::wxGridSelectCells);
01396 wxString sDefault = objdefault;
01397 for(int k=0; k<atoi(objstyle);k++)
01398 {
01399 wxString temp;
01400 if(k<atoi(objstyle)-1)
01401 {
01402 temp = sDefault.BeforeFirst(',');
01403 sDefault=sDefault.AfterFirst(',');
01404 }
01405 else
01406 temp = sDefault;
01407 ((wxGrid *)(FindWindowById(atoi(objid),NULL)))->SetLabelValue(wxHORIZONTAL, temp,k);
01408 ((wxGrid *)(FindWindowById(atoi(objid),NULL)))->AutoSize();
01409 }
01410 RefreshGrid(atoi(formid),atoi(objid));
01411 }
01412 else if(atoi(objtype)==107)
01413 {
01414 if(atoi(attrtype)==1||atoi(attrtype)==5||atoi(attrtype)==6||atoi(attrtype)==7)
01415 {
01416 objecttable.Put(atoi(objid),(new wxTextCtrl(parent, atoi(objid), "", wxPoint(atoi(objx),atoi(objy)),wxSize(atoi(objw),atoi(objh)), atoi(objstyle),NumericValidator)));
01417 }
01418 else
01419 {
01420 (new wxTextCtrl(parent, atoi(objid), "", wxPoint(atoi(objx),atoi(objy)),wxSize(atoi(objw),atoi(objh)), atoi(objstyle),ASCIIValidator));
01421 }
01422
01423 int matchingIndex = arrObjectIds.Index(objid,FALSE,TRUE);
01424 if(matchingIndex!=wxNOT_FOUND)
01425 ((wxTextCtrl *) FindWindowById(atoi(arrObjectIds[matchingIndex])))->SetValue(arrDbStoredAttrib[matchingIndex]);
01426 }
01427 }
01428 }
01429 }
01430 else
01431 {
01432 wxMessageBox("Cannot Get Next");
01433 }
01434 }
01435 FindWindowById(atoi(arrObjectIds[0]))->Show(FALSE);
01436 }
01437 }
01438 }
01439
01440
01441
01442
01443
01444
01445 }
01446 else if(arrProcessdesc[0].IsSameAs("UPDATE"))
01447 {
01448 wxString $Table = arrProcessdesc[1];
01449 wxString $Objects = arrProcessdesc[2];
01450 wxString $Attributes = arrProcessdesc[3];
01451
01452 wxArrayString arrInputValues = wxArrayString();
01453 wxArrayString arrDbTableAttr = wxArrayString();
01454 wxArrayString arrObjs = wxArrayString();
01455
01456
01457 int numAttribs = $Attributes.Freq(',')+1;
01458
01459 for(int x =0; x<numAttribs; x++)
01460 {
01461 if(x==(numAttribs-1))
01462 arrDbTableAttr.Add($Attributes,1);
01463 else
01464 {
01465 arrDbTableAttr.Add($Attributes.BeforeFirst(','),1);
01466 $Attributes = $Attributes.AfterFirst(',');
01467 }
01468 }
01469
01470
01471 int numObjs = $Objects.Freq(',')+1;
01472
01473 for(int y =0; y<numObjs; y++)
01474 {
01475 if(y==(numObjs-1))
01476 arrObjs.Add($Objects,1);
01477 else
01478 {
01479 arrObjs.Add($Objects.BeforeFirst(','),1);
01480 $Objects = $Objects.AfterFirst(',');
01481 }
01482 }
01483
01484 for(int z =0; z<numObjs; z++)
01485 {
01486 wxString input= ((wxTextCtrl *)(wxGetTopLevelParent(this)->FindWindow(atoi(arrObjs[z]))))->GetValue();
01487 if(input.IsEmpty())
01488 {
01489 wxMessageBox("Please fill in the Empty Fields", "Missing Fields", wxICON_INFORMATION,this);
01490 ((wxTextCtrl *)(wxGetTopLevelParent(this)->FindWindow(atoi(arrObjs[z]))))->SetFocus();
01491 return;
01492 }
01493 arrInputValues.Add(input,1);
01494 }
01495
01496 wxString FinalAttribString;
01497 for(int x =1; x<numAttribs; x++)
01498 {
01499 if(x==numAttribs-1)
01500 FinalAttribString+= (arrDbTableAttr[x]+" = '"+arrInputValues[x]+"'");
01501 else
01502 FinalAttribString+= (arrDbTableAttr[x]+" = '"+arrInputValues[x]+"', ");
01503
01504 }
01505 for(int z =0; z<numObjs; z++)
01506 {
01507 ((wxTextCtrl *)(wxGetTopLevelParent(this)->FindWindow(atoi(arrObjs[z]))))->Clear();
01508 }
01509
01510 wxString UpdateSqlStmt = "UPDATE "+$Table+" SET "+FinalAttribString+" WHERE "+arrDbTableAttr[0]+" = '"+arrInputValues[0]+"';";
01511 if (!dbuUser->ExecSql(UpdateSqlStmt.c_str()))
01512 {
01513 wxMessageBox("Can't execute Update SQL Statement");
01514 return;
01515 }
01516 else{
01517 wxMessageBox("Attributes Updated", "Success", wxICON_INFORMATION, this);
01518 dbuUser->CommitTrans();
01519 }
01520
01521
01522
01523
01524
01525
01526 }
01527 else
01528 {
01529 wxMessageBox("Remember that the LORD is in CONTROL");
01530 }
01531
01532
01533 arrPid.Clear();
01534 arrProcessdesc.Clear();
01535
01536 wxDbFreeConnection(dbuFastApp);
01537 wxDbFreeConnection(dbuUser);
01538
01539
01540
01541 }
01542
01543
01544
01545
01546
01547 void
01548 GeneratorToolFrame::StaticTextGenericEventFunc(wxCommandEvent& event)
01549 {
01550
01551 }
01552
01553
01554
01555
01556 void
01557 GeneratorToolFrame::MenuGenericEventFunc(wxCommandEvent& event)
01558 {
01559
01560 }
01561
01562
01563
01564
01565 void
01566 GeneratorToolFrame::TextCtrlGenericEventFunc(wxCommandEvent& event)
01567 {
01568
01569 }
01570
01571
01572
01573
01574
01575
01576
01577
01578
01579
01580
01581
01582
01583
01584
01585 void
01586 GeneratorToolFrame::DbEstb()
01587 {
01588
01589
01590
01591
01592
01593 system("/home/koryan/generatortool/src/checkodbc.sh");
01594
01595
01596 DbConnectInf = NULL;
01597 DbConnectInf = new wxDbConnectInf( NULL, "fastapp-dsn", "", "", "" );
01598 if ( !DbConnectInf || !DbConnectInf->GetHenv() )
01599 {
01600 wxMessageBox(wxT("Unable to define data source connection info."),
01601 wxT("DB CONNECTION ERROR..."),wxOK | wxICON_EXCLAMATION);
01602 }
01603 dbFastApp = NULL;
01604 dbFastApp = wxDbGetConnection( DbConnectInf );
01605
01606
01607
01608
01609
01610
01611
01612 wxString tbFa_AppName = "fa_app";
01613 const UWORD numFa_AppTableColumns = 7;
01614 sAppname[0]=0;sSusername[0]=0; sSpassword[0]=0;
01615 sAppid=0;sSuserid=0;sSdbid=0;sAppformid=0;
01616 tbFa_App = NULL;
01617 tbFa_App = new wxDbTable(dbFastApp, tbFa_AppName, numFa_AppTableColumns, "", !wxDB_QUERY_ONLY, "");
01618 tbFa_App->SetColDefs(0, "appid", DB_DATA_TYPE_INTEGER, &sAppid, SQL_C_LONG, sizeof(sAppid), true, true);
01619 tbFa_App->SetColDefs(1, "appname", DB_DATA_TYPE_VARCHAR, sAppname, SQL_C_CHAR, sizeof(sAppname), true, true);
01620 tbFa_App->SetColDefs(2, "suserid", DB_DATA_TYPE_INTEGER, &sSuserid, SQL_C_LONG, sizeof(sSuserid), true, true);
01621 tbFa_App->SetColDefs(3, "sdbid", DB_DATA_TYPE_INTEGER, &sSdbid, SQL_C_LONG, sizeof(sSdbid), true, true);
01622 tbFa_App->SetColDefs(4, "appformid", DB_DATA_TYPE_INTEGER, &sAppformid, SQL_C_LONG, sizeof(sAppformid), true, true);
01623 tbFa_App->SetColDefs(5, "susername", DB_DATA_TYPE_VARCHAR, sSusername, SQL_C_CHAR, sizeof(sSusername), true, true);
01624 tbFa_App->SetColDefs(6, "spassword", DB_DATA_TYPE_VARCHAR, sSpassword, SQL_C_CHAR, sizeof(sSpassword), true, true);
01625
01626
01627 wxString tbFa_InifileName = "fa_inifile";
01628 const UWORD numFa_InifileTableColumns = 6;
01629 sLastdateupdated[0]=0;sLasttimeupdated[0]=0; sFilelocation[0]=0;sScphost[0]=0;sScpuser[0]=0;sScppw[0]=0;
01630 tbFa_Inifile = NULL;
01631 tbFa_Inifile = new wxDbTable(dbFastApp, tbFa_InifileName, numFa_InifileTableColumns, "", !wxDB_QUERY_ONLY, "");
01632 tbFa_Inifile->SetColDefs(0, "lastdateupdated", DB_DATA_TYPE_DATE, sLastdateupdated, SQL_C_CHAR, sizeof(sLastdateupdated), true, true);
01633 tbFa_Inifile->SetColDefs(1, "lasttimeupdated", DB_DATA_TYPE_VARCHAR, sLasttimeupdated, SQL_C_CHAR, sizeof(sLasttimeupdated), true, true);
01634 tbFa_Inifile->SetColDefs(2, "filelocation", DB_DATA_TYPE_VARCHAR, sFilelocation, SQL_C_CHAR, sizeof(sFilelocation), true, true);
01635 tbFa_Inifile->SetColDefs(3, "scphost", DB_DATA_TYPE_VARCHAR, sScphost, SQL_C_CHAR, sizeof(sScphost), true, true);
01636 tbFa_Inifile->SetColDefs(4, "scpuser", DB_DATA_TYPE_VARCHAR, sScpuser, SQL_C_CHAR, sizeof(sScpuser), true, true);
01637 tbFa_Inifile->SetColDefs(5, "scppw", DB_DATA_TYPE_VARCHAR, sScppw, SQL_C_CHAR, sizeof(sScppw), true, true);
01638
01639
01640 wxString tbFa_DbName = "fa_db";
01641 const UWORD numFa_DbTableColumns = 4;
01642 sDbid=0;sNooftables=0;
01643 sDbname[50+1]=0;sDsnname[0]=0;
01644 tbFa_Db = NULL;
01645 tbFa_Db = new wxDbTable(dbFastApp, tbFa_DbName, numFa_DbTableColumns, "", !wxDB_QUERY_ONLY, "");
01646 tbFa_Db->SetColDefs(0, "Dbid", DB_DATA_TYPE_INTEGER, &sDbid, SQL_C_LONG, sizeof(sDbid), true, true);
01647 tbFa_Db->SetColDefs(1, "dbname", DB_DATA_TYPE_VARCHAR, sDbname, SQL_C_CHAR, sizeof(sDbname), true, true);
01648 tbFa_Db->SetColDefs(2, "nooftables", DB_DATA_TYPE_INTEGER, &sNooftables, SQL_C_LONG, sizeof(sNooftables), true, true);
01649 tbFa_Db->SetColDefs(3, "dsnname", DB_DATA_TYPE_VARCHAR, sDsnname, SQL_C_CHAR, sizeof(sDsnname), true, true);
01650
01651
01652 wxString tbFa_TabledefName = "fa_tabledef";
01653 const UWORD numFa_TabledefTableColumns = 4;
01654 sTableid=0;sNoofcolumns=0;sTD_Deleted=0;
01655 sTablename[50+1]=0;
01656 tbFa_Tabledef = NULL;
01657 tbFa_Tabledef = new wxDbTable(dbFastApp, tbFa_TabledefName, numFa_TabledefTableColumns, "", !wxDB_QUERY_ONLY, "");
01658 tbFa_Tabledef->SetColDefs(0, "tableid", DB_DATA_TYPE_INTEGER, &sTableid, SQL_C_LONG, sizeof(sTableid), true, true);
01659 tbFa_Tabledef->SetColDefs(1, "tablename", DB_DATA_TYPE_INTEGER, sTablename, SQL_C_CHAR, sizeof(sTablename), true, true);
01660 tbFa_Tabledef->SetColDefs(2, "noofcolumns", DB_DATA_TYPE_INTEGER, &sNoofcolumns, SQL_C_LONG, sizeof(sNoofcolumns), true, true);
01661 tbFa_Tabledef->SetColDefs(3, "deleted", DB_DATA_TYPE_INTEGER, &sTD_Deleted, SQL_C_LONG, sizeof(sTD_Deleted), true, true);
01662
01663
01664 wxString tbFa_DbtableName = "fa_dbtable";
01665 const UWORD numFa_DbtableTableColumns = 2;
01666 sDBT_Dbid=0;sDBT_Tabid=0;
01667 tbFa_Dbtable = NULL;
01668 tbFa_Dbtable = new wxDbTable(dbFastApp, tbFa_DbtableName, numFa_DbtableTableColumns, "", !wxDB_QUERY_ONLY, "");
01669 tbFa_Dbtable->SetColDefs(0, "dbid", DB_DATA_TYPE_INTEGER, &sDBT_Dbid, SQL_C_LONG, sizeof(sDBT_Dbid), true, true);
01670 tbFa_Dbtable->SetColDefs(1, "tabid", DB_DATA_TYPE_INTEGER, &sDBT_Tabid, SQL_C_LONG, sizeof(sDBT_Tabid), true, true);
01671
01672
01673 wxString tbFa_ColumndefName = "fa_columndef";
01674 const UWORD numFa_ColumndefTableColumns = 9;
01675 sColid=0;sAttrtype=0;sAttrlength=0;sAttrpkey=0;sFkeytableid=0;sFkeyattrib=0;sCD_Deleted=0;
01676 sAttrname[50+1]=0;sAttrdefault[50+1]=0;
01677 tbFa_Columndef = NULL;
01678 tbFa_Columndef = new wxDbTable(dbFastApp, tbFa_ColumndefName, numFa_ColumndefTableColumns, "", !wxDB_QUERY_ONLY, "");
01679 tbFa_Columndef->SetColDefs(0, "colid", DB_DATA_TYPE_INTEGER, &sColid, SQL_C_LONG, sizeof(sColid), true, true);
01680 tbFa_Columndef->SetColDefs(1, "attrname", DB_DATA_TYPE_VARCHAR, sAttrname, SQL_C_CHAR, sizeof(sAttrname), true, true);
01681 tbFa_Columndef->SetColDefs(2, "attrtype", DB_DATA_TYPE_INTEGER, &sAttrtype, SQL_C_LONG, sizeof(sAttrtype), true, true);
01682 tbFa_Columndef->SetColDefs(3, "attrlength", DB_DATA_TYPE_INTEGER, &sAttrlength, SQL_C_LONG, sizeof(sAttrlength), true, true);
01683 tbFa_Columndef->SetColDefs(4, "attrdefault", DB_DATA_TYPE_VARCHAR,sAttrdefault,SQL_C_CHAR,sizeof(sAttrdefault), true, true);
01684 tbFa_Columndef->SetColDefs(5, "attrpkey", DB_DATA_TYPE_INTEGER, &sAttrpkey, SQL_C_LONG, sizeof(sAttrpkey), true, true);
01685 tbFa_Columndef->SetColDefs(6, "fkeytableid", DB_DATA_TYPE_INTEGER, &sFkeytableid, SQL_C_LONG, sizeof(sFkeytableid), true, true);
01686 tbFa_Columndef->SetColDefs(7, "fkeyattrib", DB_DATA_TYPE_INTEGER, &sFkeyattrib, SQL_C_LONG, sizeof(sFkeyattrib), true, true);
01687 tbFa_Columndef->SetColDefs(8, "deleted", DB_DATA_TYPE_INTEGER, &sCD_Deleted, SQL_C_LONG, sizeof(sCD_Deleted), true, true);
01688
01689
01690 wxString tbFa_TablecolName = "fa_tablecol";
01691 const UWORD numFa_TablecolTableColumns = 2;
01692 sTC_Tabid=0;sTC_Colid=0;
01693 tbFa_Tablecol = NULL;
01694 tbFa_Tablecol = new wxDbTable(dbFastApp, tbFa_TablecolName, numFa_TablecolTableColumns, "", !wxDB_QUERY_ONLY, "");
01695 tbFa_Tablecol->SetColDefs(0, "tabid", DB_DATA_TYPE_INTEGER, &sTC_Tabid, SQL_C_LONG, sizeof(sTC_Tabid), true, true);
01696 tbFa_Tablecol->SetColDefs(1, "colid", DB_DATA_TYPE_INTEGER, &sColid, SQL_C_LONG, sizeof(sTC_Colid), true, true);
01697
01698
01699 wxString tbFa_LanguageName = "fa_language";
01700 const UWORD numFa_LanguageTableColumns = 4;
01701 sLanguage[0]=0;sLstyle[0]=0;
01702 sLid=0;sFont=0;
01703 tbFa_Language = NULL;
01704 tbFa_Language = new wxDbTable(dbFastApp, tbFa_LanguageName, numFa_LanguageTableColumns, "", !wxDB_QUERY_ONLY, "");
01705 tbFa_Language->SetColDefs(0, "lid", DB_DATA_TYPE_INTEGER, &sLid, SQL_C_LONG, sizeof(sLid), true, true);
01706 tbFa_Language->SetColDefs(1, "language", DB_DATA_TYPE_VARCHAR, sLanguage, SQL_C_CHAR, sizeof(sLanguage), true, true);
01707 tbFa_Language->SetColDefs(2, "font", DB_DATA_TYPE_INTEGER, &sFont, SQL_C_LONG, sizeof(sFont), true, true);
01708 tbFa_Language->SetColDefs(3, "lstyle", DB_DATA_TYPE_VARCHAR, sLstyle, SQL_C_LONG, sizeof(sLstyle), true, true);
01709
01710
01711
01712 wxString tbFa_ProcessName = "fa_process";
01713 const UWORD numFa_ProcessTableColumns = 3;
01714 sPid[0]=0;sProcessdesc[0]=0;
01715 sEventid = 0;
01716 tbFa_Process = NULL;
01717 tbFa_Process = new wxDbTable(dbFastApp, tbFa_ProcessName, numFa_ProcessTableColumns, "", !wxDB_QUERY_ONLY, "");
01718 tbFa_Process->SetColDefs(0, "pid", DB_DATA_TYPE_INTEGER, sPid, SQL_C_CHAR, sizeof(sPid), true, true);
01719 tbFa_Process->SetColDefs(1, "processdesc", DB_DATA_TYPE_VARCHAR, sProcessdesc, SQL_C_CHAR, sizeof(sProcessdesc), true, true);
01720 tbFa_Process->SetColDefs(2, "eventid", DB_DATA_TYPE_INTEGER, &sEventid, SQL_C_LONG, sizeof(sEventid), true, true);
01721
01722
01723 wxString tbFa_FormName = "fa_form";
01724 const UWORD numFa_FormTableColumns = 12;
01725 sFid=0; sFormx=0; sFormy=0; sFormw=0; sFormh=0; sFormtype=0; sFormstyle=0; sCaption[0]=0; sInitialisation=0; sPreprocessing=0; sPostprocessing=0;sIsindex=0;
01726 tbFa_Form = NULL;
01727 tbFa_Form = new wxDbTable(dbFastApp, tbFa_FormName, numFa_FormTableColumns, "", !wxDB_QUERY_ONLY, "");
01728 tbFa_Form->SetColDefs(0, "fid", DB_DATA_TYPE_INTEGER, &sFid, SQL_C_LONG, sizeof(sFid), true, true);
01729 tbFa_Form->SetColDefs(1, "formx", DB_DATA_TYPE_INTEGER, &sFormx, SQL_C_LONG, sizeof(sFormx), true, true);
01730 tbFa_Form->SetColDefs(2, "formy", DB_DATA_TYPE_INTEGER, &sFormy, SQL_C_LONG, sizeof(sFormy), true, true);
01731 tbFa_Form->SetColDefs(3, "formw", DB_DATA_TYPE_INTEGER, &sFormw, SQL_C_LONG, sizeof(sFormw), true, true);
01732 tbFa_Form->SetColDefs(4, "formh", DB_DATA_TYPE_INTEGER, &sFormh, SQL_C_LONG, sizeof(sFormh), true, true);
01733 tbFa_Form->SetColDefs(5, "formtype", DB_DATA_TYPE_INTEGER, &sFormtype, SQL_C_LONG, sizeof(sFormtype), true, true);
01734 tbFa_Form->SetColDefs(6, "formstyle", DB_DATA_TYPE_INTEGER, &sFormstyle, SQL_C_LONG, sizeof(sFormstyle), true, true);
01735 tbFa_Form->SetColDefs(7, "caption", DB_DATA_TYPE_VARCHAR, sCaption, SQL_C_CHAR, sizeof(sCaption), true, true);
01736 tbFa_Form->SetColDefs(8, "initialisation", DB_DATA_TYPE_INTEGER, &sInitialisation, SQL_C_LONG, sizeof(sInitialisation), true, true);
01737 tbFa_Form->SetColDefs(9, "preprocessing", DB_DATA_TYPE_INTEGER, &sPreprocessing, SQL_C_LONG, sizeof(sPreprocessing), true, true);
01738 tbFa_Form->SetColDefs(10, "postprocessing", DB_DATA_TYPE_INTEGER, &sPostprocessing, SQL_C_LONG, sizeof(sPostprocessing), true, true);
01739 tbFa_Form->SetColDefs(11, "isindex", DB_DATA_TYPE_INTEGER, &sIsindex, SQL_C_LONG, sizeof(sIsindex), true, true);
01740
01741
01742 wxString tbFa_AppformName = "fa_appform";
01743 const UWORD numFa_AppformTableColumns = 2;
01744 sAF_Appid=0; sAF_Formid=0;
01745 tbFa_Appform = NULL;
01746 tbFa_Appform = new wxDbTable(dbFastApp, tbFa_AppformName, numFa_AppformTableColumns, "", !wxDB_QUERY_ONLY, "");
01747 tbFa_Appform->SetColDefs(0, "appid", DB_DATA_TYPE_INTEGER, &sAF_Appid, SQL_C_LONG, sizeof(sAF_Appid), true, true);
01748 tbFa_Appform->SetColDefs(1, "formid", DB_DATA_TYPE_INTEGER, &sAF_Formid, SQL_C_LONG, sizeof(sAF_Formid), true, true);
01749
01750
01751 wxString tbFa_ObjectName = "fa_object";
01752 const UWORD numFa_ObjectTableColumns = 16;
01753 sFormid=0; sObjid=0; sChildid=0; sLangid=0; sObjx=0; sObjy=0; sObjw=0; sObjh=0; sObjtype=0;sObjstyle=0;sOT_Eventid[0]=0;
01754 sObjlabel[0]=0; sObjdefault[0]=0;sAttrtable[0]=0;sAttr[0]=0;sO_Attrtype[0]=0;
01755
01756 tbFa_Object = NULL;
01757 tbFa_Object = new wxDbTable(dbFastApp, tbFa_ObjectName, numFa_ObjectTableColumns, "", !wxDB_QUERY_ONLY, "");
01758 tbFa_Object->SetColDefs(0, "formid", DB_DATA_TYPE_INTEGER, &sFormid, SQL_C_LONG, sizeof(sFormid), true, true);
01759 tbFa_Object->SetColDefs(1, "objid", DB_DATA_TYPE_INTEGER, &sObjid, SQL_C_LONG, sizeof(sObjid), true, true); tbFa_Object->SetColDefs(2, "childid", DB_DATA_TYPE_INTEGER, &sChildid, SQL_C_LONG, sizeof(sChildid), true, true); tbFa_Object->SetColDefs(3, "langid", DB_DATA_TYPE_INTEGER, &sLangid, SQL_C_LONG, sizeof(sLangid), true, true); tbFa_Object->SetColDefs(4, "objx", DB_DATA_TYPE_INTEGER, &sObjx, SQL_C_LONG, sizeof(sObjx), true, true); tbFa_Object->SetColDefs(5, "objy", DB_DATA_TYPE_INTEGER, &sObjy, SQL_C_LONG, sizeof(sObjy), true, true);
01760 tbFa_Object->SetColDefs(6, "objw", DB_DATA_TYPE_INTEGER, &sObjw, SQL_C_LONG, sizeof(sObjw), true, true);
01761 tbFa_Object->SetColDefs(7, "objh", DB_DATA_TYPE_INTEGER, &sObjh, SQL_C_LONG, sizeof(sObjh), true, true);
01762 tbFa_Object->SetColDefs(8, "objtype", DB_DATA_TYPE_INTEGER, &sObjtype, SQL_C_LONG, sizeof(sObjtype), true, true);
01763 tbFa_Object->SetColDefs(9, "objstyle", DB_DATA_TYPE_INTEGER, &sObjstyle, SQL_C_LONG, sizeof(sObjstyle), true, true);
01764 tbFa_Object->SetColDefs(10, "objlabel", DB_DATA_TYPE_VARCHAR, sObjlabel, SQL_C_CHAR, sizeof(sObjlabel), true, true);
01765 tbFa_Object->SetColDefs(11, "objdefault", DB_DATA_TYPE_VARCHAR, sObjdefault, SQL_C_CHAR, sizeof(sObjdefault), true, true);
01766 tbFa_Object->SetColDefs(12, "eventid", DB_DATA_TYPE_INTEGER, sOT_Eventid, SQL_C_CHAR, sizeof(sOT_Eventid), true, true);
01767 tbFa_Object->SetColDefs(13, "attrtable", DB_DATA_TYPE_VARCHAR, sAttrtable, SQL_C_CHAR, sizeof(sAttrtable), true, true);
01768 tbFa_Object->SetColDefs(14, "attr", DB_DATA_TYPE_VARCHAR, sAttr, SQL_C_CHAR, sizeof(sAttr), true, true);
01769 tbFa_Object->SetColDefs(15, "attrtype", DB_DATA_TYPE_INTEGER, sO_Attrtype, SQL_C_CHAR, sizeof(sO_Attrtype), true, true);
01770 }