I am also Clocking out the employee in another step in my code with the oTrans.ClockOut(); but have not been able to find a built in method to do the Logout.
Where are you running this code? You may have to wait until this action is completed before continuing.
Are you sure the code is firing? Add a MessageBox before it, or debug in Visual Studio.
So I enabled this code again EpiButton btnLogOut = (EpiButton)csm.GetNativeControlReference("a2f6e795-4ab3-4121-bce4-e1d5f0881b0a"); btnLogOut.PerformClick();
My Mes Screen does not update to show that the current EmpID is logged out after creating an IND labor detail record. If i could get that to work I would be good. Here is my code where I created the record and then try to log out. What am I doing wrong that does not allow the MES Main form to clear after the btnLogOut.PerformClick();?
private void MESControl_AfterFieldChange(object sender, DataColumnChangeEventArgs args)
{
// ** Argument Properties and Uses **
// args.Row["FieldName"]
// args.Column, args.ProposedValue, args.Row
// Add Event Handler Code
switch (args.Column.ColumnName)
{
case "EmployeeID":
//Open BAQ to look for Indirect Labor Record for Current Emp.
//If Record exists proceed with Customization to delete current record.
//If no Indirect Record exists create labor detail record and logout.
NewIndRecCreated = false;
UserID = ((Ice.Core.Session)oTrans.Session).UserID;
EpiDataView edvEmp = (EpiDataView)(oTrans.EpiDataViews["LaborHed"]);
//EpiDataView edvDtl = (EpiDataView)(oTrans.EpiDataViews["LaborDtl"]);
if (edvEmp == null){return;}
if (!edvEmp.HasRow){return;}
EmpID = edvEmp.dataView[edvEmp.Row]["EmployeeNum"].ToString();
int LaborHeadSeq = Convert.ToInt32(Convert.ToDouble(edvEmp.dataView[edvEmp.Row]["LaborHedSeq"].ToString()));
string baqID = "DTS-AlertIndirectRecPresent";
DynamicQueryAdapter DQAdpt = new DynamicQueryAdapter(oTrans);
if ((DQAdpt.BOConnect() == true))
{
Ice.BO.QueryExecutionDataSet execSet = DQAdpt.GetQueryExecutionParametersByID(baqID);
execSet.ExecutionParameter.Clear();
execSet.ExecutionParameter.AddExecutionParameterRow("EmpID", EmpID.ToString(), "nvarchar", false, Guid.NewGuid(), "A");
DQAdpt.ExecuteByID(baqID, execSet);
DataSet dSet = DQAdpt.QueryResults;
//If no Indirect Record exists create labor detail record and logout.
if (dSet.Tables[0].Rows.Count == 0)
{
LaborAdapter LAdpt = new LaborAdapter(oTrans);
LAdpt.BOConnect();
LAdpt.GetByID(LaborHeadSeq);
//LAdpt.GetNewLaborDtl(LaborHeadSeq); //See how many records are currently in the labor detail table
int LaborDtlIndex = LAdpt.LaborData.LaborDtl.Rows.Count;
//Start production activity
LAdpt.StartActivity(LaborHeadSeq, "I");
LAdpt.LaborData.LaborDtl.Rows[LaborDtlIndex]["LaborType"]= "I";
LAdpt.LaborData.LaborDtl.Rows[LaborDtlIndex]["LaborTypePseudo"]= "I";
LAdpt.LaborData.LaborDtl.Rows[LaborDtlIndex]["JCDept"]= "RGDept01";
LAdpt.LaborData.LaborDtl.Rows[LaborDtlIndex]["ResourceGrpID"]= "ALT";
LAdpt.LaborData.LaborDtl.Rows[LaborDtlIndex]["IndirectCode"]= "ALT";
LAdpt.LaborData.LaborDtl.Rows[LaborDtlIndex]["ExpenseCode"]= "IND";
LAdpt.Update();
LAdpt.Dispose();
LogOut();
oTrans.Refresh();
MessageBox.Show("New I Record Created");
System.Windows.Forms.Application.DoEvents();
}
}
//Reset counter to check for Indirect Records when EmpID changes.
InitializeCnt = 0;
break;
}
}
We are trying to capture indirect time for an alert meter test and there are a line of emplyoees waiting to take the test.
The process is walk up to the first MES Screen and we have a barcode scanner waiting for the Emp to scan his card.
When the card is scanned the at the “CLOCK IN” MES the Indirect labor record is created and I am trying to log out the employee while keeping the LaborDetail Record as the Active Trans. Next person walks up same process.
After the Emp takes the test on a separate iPad then the Emp walks up to the CLOCK OUT MES and scans his badge. The customization then checks to see if there is already and Indirect LaborDetail record and if so the Indirect labor record is ended it clocks the employee out.
Also, if that doesn’t get you closer, I would remove the LogOut() for testing, and after this procedure,
click the logout button and see if does what is expected.
I mean if you are invoking the Logout button click it should do what the logout button does naturally I’m not sure how / why that wouldn’t work.
If you do it by hand it works fine I take it?
Yes the button works when you click it manually.
We used an oTrans.ClockOut() for when I wanted to end the Indirect Labor Detail Record but there is no oTrans.LogOut()…