private void DeleteDetailB(IList<EPerContrato> col, bool filterModified)
        {
            if (col == null)
                return;

            IDOUpdate objDO = new RHDOMnt.PerContrato();
            IEnumerable<EPerContrato> colSel = null;

            if (filterModified)
            {
                var deleteItems = from itm in col
                                  where itm.EntityState == EntityState.Deleted
                                  select itm;

                colSel = (IEnumerable<EPerContrato>)deleteItems;
            }
            else
            {
                var deleteItems = from itm in col
                                  select itm;

                colSel = (IEnumerable<EPerContrato>)deleteItems;
            }
            foreach (EPerContrato objE in colSel)
                objDO.Delete(objE);
        }
        private void UpdateDetailB(IList<EPerContrato> col, object[] primKey)
        {
            if (col == null)
                return;

            IDOUpdate objDO = new RHDOMnt.PerContrato();
            RHDOMnt.Personal objDOPer = new RHDOMnt.Personal();
            EPersonal NewEPersonal = new EPersonal();

            foreach (EPerContrato objE in col)
            {

                object[] objRet = null;

                if (primKey != null)
                {
                    objE.IdPersonal = primKey[0].ToString();
                }

                switch (objE.EntityState)
                {

                    case EntityState.Added:
                        objRet = objDO.Insert(objE);

                        NewEPersonal.IdEmpresa = objE.IdEmpresa;
                        NewEPersonal.IdPersonal = objE.IdPersonal;
                        NewEPersonal.IdSituEmple = ConstSituacionEmpleado.ACTIVO_SUBSIDIADO;
                        NewEPersonal.IdMotivFin = "";
                        NewEPersonal.FeCese = null;
                        if (objE.StProrroga == ConstFlagEstado.ACTIVADO)
                        {
                            NewEPersonal.FeIngpla = null;
                        }
                        else
                        {
                            NewEPersonal.FeIngpla = objE.FeInicio;
                        }

                        objDOPer.UpdateEstadoFechaCese(NewEPersonal);

                        break;

                    case EntityState.Modified:
                        if (objE.StAnulado == ConstFlagEstado.DESACTIVADO)
                            objDO.Update(objE);
                        if (objE.StContrato == ConstFlagEstado.ACTIVADO)
                        {

                            NewEPersonal.IdEmpresa = objE.IdEmpresa;
                            NewEPersonal.IdPersonal = objE.IdPersonal;
                            NewEPersonal.IdSituEmple = ConstSituacionEmpleado.BAJA;
                            NewEPersonal.FeCese = objE.FeCese;
                            NewEPersonal.FeIngpla = null;
                            NewEPersonal.IdMotivFin = objE.IdMotivFin;
                            objDOPer.UpdateEstadoFechaCese(NewEPersonal);
                        }
                        else
                            objDO.Delete(objE);
                        break;

                }

            }
        }
        public string[] UpdateDataPerContrato(IEntityBase value)
        {
            EPersonalSet objE = (EPersonalSet)value;
            object[] objRet = null;

            try
            {

                using (TransactionScope tx = new TransactionScope())
                {

                    this.UpdateDetailB(objE.ColPerContrato, objRet);
                    IDOUpdate objDO = new RHDOMnt.PerContrato();
                    RHDOQry.PerContrato objEPC = new RHDOQry.PerContrato();

                    foreach (EPerContrato colobjE in objE.ColPerContrato)
                    {
                        EPerContrato colobjENew = new EPerContrato();
                        colobjE.NuSecuen = colobjE.NuSecuen - 1;
                        colobjENew = (EPerContrato)objEPC.GetByKey(colobjE);
                        if (colobjENew != null)
                        {
                            colobjENew.StContrato = ConstFlagEstado.ACTIVADO;
                            colobjENew.IdMotivFin = ConstMotivoCese.TERMINO;
                            objDO.Update(colobjENew);
                        }

                    }

                    tx.Complete();

                }

                if (objRet == null)
                    return null;

                return new String[] { objRet[0].ToString() };

            }
            catch (Exception ex)
            {

                throw ex;

            }
        }