Good morning,
I want to do a validation on the Approved Engineering check in the work module, when I customize it throws me the error that the EpiGuid control does not exist.
I have the Guid copied from the properties (84417923-8f49-4614-9cbf-61c916907fea) but I don’t know where to initialize it.
this is my code
private void oTrans_jobAdapter_BeforeAdapterMethod(object sender, BeforeAdapterMethodArgs args)
{
EpiCheckBox checkBox = (EpiCheckBox)csm.GetNativeControlReference("7909df8c-6112-4c63-aab9-89b87cd35f4b");
**EpiCheckBox checkBox4 = (EpiCheckBox)csm.GetNativeControlReference("84417923-8f49-4614-9cbf-61c916907fea");**
** bool checkBoxValue4 = checkBox4.Checked;**
bool checkBoxValue = checkBox.Checked;
switch (args.MethodName)
{
//controlar que no agueguen materiales con el check aprobador true
case "GetNewJobMtl":
if (checkBoxValue == true)
{
args.Cancel = true;
MessageBox.Show("No puede agregar material, el subensamble esta cerrado");
} else
{
/*Do nothing*/
}
//recorre los subensambles creados por las vistas y controla que no agreguen materiales
this.curJobAsmbl = ((EpiDataView)(this.oTrans.EpiDataViews["CurrAsm"]));
System.Data.DataRow edvCurrAsmRow = curJobAsmbl.CurrentDataRow;
//MessageBox.Show(edvCurrAsmRow["aprobado_esmb_c"].ToString());
int currentAssembly = Convert.ToInt32(edvCurrAsmRow["AssemblySeq"].ToString());
this.curJobAsmblJobAsm = ((EpiDataView)(this.oTrans.EpiDataViews["JobAsmbl"]));
DataTable dtOrderDtl = this.curJobAsmblJobAsm.dataView.Table;
foreach(DataRow row in dtOrderDtl.Rows)
{
if (Convert.ToInt32(row["AssemblySeq"])== currentAssembly)
{
if (Convert.ToBoolean(row["aprobado_asmb_c"])== true)
{
args.Cancel = true;
MessageBox.Show("No puede agregar material, el subensamble esta cerrado");
}
else
{
/*Do nothing*/
}
}
}
break;
//controla que no asugnen nuevas opraciones de el subensable esta true
/*case "GetNewJobOper":
if (checkBoxValue == true)
{
args.Cancel = true;
MessageBox.Show("No puede agregar operaciones, el subensamble esta cerrado");
} else
{
}
break;
//recorre los subensambles creados por las vistas y controla que no agreguen materiales
this.curJobAsmbl = ((EpiDataView)(this.oTrans.EpiDataViews["CurrAsm"]));
System.Data.DataRow edvCurrAsmRow = curJobAsmbl.CurrentDataRow;
//MessageBox.Show(edvCurrAsmRow["aprobado_esmb_c"].ToString());
int currentAssembly = Convert.ToInt32(edvCurrAsmRow["AssemblySeq"].ToString());
this.curJobAsmblJobAsm = ((EpiDataView)(this.oTrans.EpiDataViews["JobAsmbl"]));
DataTable dtOrderDtl = this.curJobAsmblJobAsm.dataView.Table;
foreach(DataRow row in dtOrderDtl.Rows)
{
if (Convert.ToInt32(row["AssemblySeq"])== currentAssembly)
{
if (Convert.ToBoolean(row["aprobado_asmb_c"])== true)
{
args.Cancel = true;
MessageBox.Show("No puede agregar material, el subensamble esta cerrado");
}
else
{
}
}
}*/
//MessageBox.Show("llego aca");
//controla que no hagan cambios en los subensambles si no es usuario aprobador y el check esta true
case "Update":
this.curJobHead = ((EpiDataView)(this.oTrans.EpiDataViews["JobHead"]));
System.Data.DataRow edvUserCharRowJobH = curJobHead.CurrentDataRow;
this.curJobAsmblUserApro = ((EpiDataView)(this.oTrans.EpiDataViews["CallContextClientData"]));
System.Data.DataRow edvUserCharRowJobAs = curJobAsmblUserApro.CurrentDataRow;
string useraprobadorhed = (edvUserCharRowJobH["UserChar1"].ToString());
string useraprobadorass = (edvUserCharRowJobAs["CurrentUserId"].ToString());
//EpiCheckBox checkBox2 = (EpiCheckBox)csm.GetNativeControlReference("7909df8c-6112-4c63-aab9-89b87cd35f4b");
//bool checkBoxValue1 = checkBox2.Checked;
if (useraprobadorhed != useraprobadorass)
{
//checkBoxValue = true;
if (checkBoxValue == true)
//if(checkBox2.Checked == true);
{
args.Cancel = true;
MessageBox.Show("No es el usuario aprobador");
}
}
else
{
//MessageBox.Show("Subensamble guardado con exito");
}
if (checkBoxValue == false)
{
**if (checkBoxValue4 == true)**
{
args.Cancel = true;
MessageBox.Show("Se debe Aprobar el Subensamble ");
}
}
else
{
//MessageBox.Show("Subensamble guardado con exito");
}
break;
}
}