var tt = ds.LaborHed.FirstOrDefault(r=>r.Added());
bool flag = false;
if( tt != null )
{
string empID = tt.EmployeeNum;
var activeLabor = (from lh in Db.LaborHed
where lh.EmployeeNum == empID && lh.ActiveTrans == true
select lh).FirstOrDefault();
if (activeLabor != null)
{
throw new Ice.Common.BusinessObjectException("You already have an active job. Finish the current job before starting a new one.");
flag = true;
}
}
else
{
// Lanzar un error si no se encontrĂł ningĂşn registro
throw new Ice.Common.BusinessObjectException("No record of work activity was found.");
}
return flag;
Can someone tell me why it doesn’t throw the exception when we start production?
If I’m reading your question correctly, you want your operators to ONLY be able to clock into a single job at a time.
If that is the case, then the field you need to check is LaborDtl.ActiveTrans… not LaborHed.ActiveTrans. The LaborDtl table is what stores job labor activity… LaborHed stores the daily clockin/clockout (typically used for payroll reporting).