Need Help to Convert Visual Foxpro button click event to Visual Studio C# click event

  • Thread starter Thread starter JohnnyAB2020
  • Start date Start date
J

JohnnyAB2020

Guest
Below is a click command I had in an old Visual Foxpro project I am trying to get into Visual Studio C# , basically it would go thru the employee training table and required training table if the employee had all the right training for a department it would change the field value in employee table under that department to true.

d_training fields dept, form_num, ftitle
departments fields numb, dept
employee fields e_id, firstname, lastname, dep01, dep02, dep03 thru dep45
e_training fields eid, first, last, number, title

So if required training for dept01 was 1,2,3,4 and e_training had 1,2,3,4 for that employee it would change dept01 to true in the employee table
if e_training only had 1,2,3 it would return false for the dept, it would loop thru all departments

I converted the database to access.accdb so i am using OleDbConnection to connect to the tables



SELECT 0
SELECT employee
GOTO TOP
DO WHILE .NOT. EOF()
SELECT departments
GOTO TOP
DO WHILE .NOT. EOF()
SELECT d_training.form_num, ".NULL." AS trained, ".NULL." AS eid, ".NULL." AS first, ".NULL." AS last FROM TRAINING1!D_training WHERE (d_training.dept="All_Departments" OR d_training.dept=departments.dept) ORDER BY d_training.form_num INTO CURSOR Reqtrain
SELECT e_training.number AS trained, e_training.eid, e_training.first, e_training.last FROM TRAINING1!E_training WHERE e_training.eid=employee.e_id INTO CURSOR Trained
SELECT reqtrain.form_num, trained.trained, trained.eid, trained.first, trained.last FROM Reqtrain LEFT JOIN Trained ON reqtrain.form_num=trained.trained ORDER BY reqtrain.form_num INTO CURSOR approval
SELECT approval
is_trained = .T.
IF EOF()
is_trained = .F.
ELSE
DO WHILE .NOT. EOF()
IF ISNULL(trained)
is_trained = .F.
EXIT
ENDIF
SKIP
ENDDO
ENDIF
SELECT employee
m.dep = departments.numb
REPLACE &dep WITH is_trained
SELECT departments
SKIP
ENDDO
SELECT employee
SKIP
ENDDO
thisform.refresh()
thisform.qualify.enabled = .F.


Continue reading...
 
Back
Top