*---------------------- Location Section ------------------------ * Library: Aqueueprocess.vcx * Class: AassignQueues * Method: RunProcess() *----------------------- Usage Section -------------------------- *) Description: *) * Scope: Public * Parameters: *$ Usage: *$ * Returns: *--------------------- Maintenance Section ---------------------- * Change Log: * CREATED 06/01/2005 - NN * MODIFIED *---------------------------------------------------------------- lparameters tcQueue_Name_From, tcQueue_Name_To, ; tcDepartment_Code, tcUser, tnNumberOfDays local ltStartProcessTime, loErr ltStartProcessTime = datetime() #define START_TIME 28800 && 8 hours with this try .CreateLogfile() ** We want to have a clear log of everything .WriteToLogFile("Started to run assigning queues process") .SetDepartment(m.tcDepartment_Code) .SetNumberOfDays(m.tnNumberOfDays) .SetQueueNameFrom(m.tcQueue_Name_From) .SetQueueNameTo(m.tcQueue_Name_To) .GetUsers(m.tcUser) .GetProfiles() .GetAlreadyScheduled() * Find the FK of the UNASSIGNED QUEUE local lnQueue, lcQueue_Names_Fk, lnI lnQueue = ascan(.arrQueues, .cDepartment_Code, 1, alen(.arrQueues,1), 1) lcQueue_Names_Fk = .arrQueues [m.lnQueue, 2] && FK is the second element in the array private gcUserID gcUserID = GetUserID() for lnI = 1 to .nNumberOfDays ldScheduled_Date = ttod(.arrQDates[m.lnI]) ltScheduled_Time = dtot(m.ldScheduled_Date) + START_TIME select c_Users go top && Very important ! scan this.Assign_Accounts_To_User(m.lcQueue_Names_Fk, ; .cQueue_Name_To, c_Users.cDepartment_Code, ; c_Users.cUserID, c_Users.iUserID, ; m.ltScheduled_Time) endscan next .WriteToLogFile("Finished to run assigning queues process") catch to m.loErr .CustomError(m.loErr) endtry endwith