protected override void UpdateAllocated() { SortedBindingList <NominaInfo> lines = Datos_Lineas.DataSource as SortedBindingList <NominaInfo>; decimal asignado = lines.Sum(item => item.Asignado); if (_entity.EMedioPago != EMedioPago.CompensacionFactura) { _deallocated = _entity.Importe - asignado; if (_entity.Importe >= 0) { _deallocated = (_deallocated < 0) ? 0 : _deallocated; } else { _deallocated = (_deallocated > 0) ? 0 : _deallocated; } } else { _deallocated = -asignado; _entity.Importe = asignado; } NoAsignado_TB.Text = _deallocated.ToString("N2"); MarkControl(NoAsignado_TB); }
protected void UpdateAmount() { SortedBindingList <NominaInfo> lines = Datos_Lineas.DataSource as SortedBindingList <NominaInfo>; decimal allocated = lines.Sum(item => item.Asignado); if (_entity.Importe >= 0) { _entity.Importe = (_entity.Importe) > allocated ? _entity.Importe : allocated; } else { _entity.Importe = (_entity.Importe) < allocated ? _entity.Importe : allocated; } }