public bool ModificarBD(List <ro_rol_detalle_x_rubro_acumulado_Info> Lista)
        {
            try
            {
                using (Entities_rrhh Context = new Entities_rrhh())
                {
                    foreach (var item in Lista)
                    {
                        ro_rol_detalle_x_rubro_acumulado entity = Context.ro_rol_detalle_x_rubro_acumulado.Where(q => q.IdEmpresa == item.IdEmpresa && q.IdSucursal == item.IdSucursal &&
                                                                                                                 q.IdRubro == item.IdRubro && q.IdRol == item.IdRol && q.IdEmpleado == item.IdEmpleado).FirstOrDefault();

                        if (entity == null)
                        {
                            return(false);
                        }

                        entity.Valor = item.ValorAjustado;
                        Context.SaveChanges();
                    }
                }
                return(true);
            }
            catch (Exception)
            {
                throw;
            }
        }
コード例 #2
0
        public Boolean ModificarBD(ro_rol_detalle_x_rubro_acumulado_Info info, ref string msg)
        {
            try
            {
                using (EntitiesRoles db = new EntitiesRoles())
                {
                    ro_rol_detalle_x_rubro_acumulado item = (from a in db.ro_rol_detalle_x_rubro_acumulado
                                                             where a.IdEmpresa == info.IdEmpresa && a.IdNominaTipo == info.IdNominaTipo &&
                                                             a.IdNominaTipoLiqui == info.IdNominaTipoLiqui && a.IdPeriodo == info.IdPeriodo &&
                                                             a.IdEmpleado == info.IdEmpleado && a.IdRubro == info.IdRubro
                                                             select a).FirstOrDefault();

                    item.Valor  = info.Valor;
                    item.Estado = info.Estado;

                    db.SaveChanges();
                }
                return(true);
            }
            catch (Exception ex)
            {
                string array = ToString();
                tb_sis_Log_Error_Vzen_Data oDataLog      = new tb_sis_Log_Error_Vzen_Data();
                tb_sis_Log_Error_Vzen_Info Log_Error_sis = new tb_sis_Log_Error_Vzen_Info(ex.ToString(), "", array, "", "", "", "", "", DateTime.Now);
                oDataLog.Guardar_Log_Error(Log_Error_sis, ref mensaje);
                mensaje = ex.InnerException + " " + ex.Message;
                throw new Exception(ex.InnerException.ToString());
            }
        }