예제 #1
0
        private List <Vw_RomaneoOrdenPago> _GetEntitiesLiquidaciones(Expression <Func <Vw_RomaneoOrdenPago, bool> > pred, decimal valor, LiquidacionesQueryType type)
        {
            using (var context = new CooperativaProduccionEntities())
            {
                var calculadordepago = context.ParamPagos.Single();

                if (type == LiquidacionesQueryType.PorPorcentaje)
                {
                    calculadordepago.porciento = valor;
                    calculadordepago.porkilo   = 0;
                }
                else if (type == LiquidacionesQueryType.PorKilo)
                {
                    calculadordepago.porciento = 0;
                    calculadordepago.porkilo   = valor;
                }

                context.Entry(calculadordepago).State = System.Data.Entity.EntityState.Modified;
                context.SaveChanges();
            }

            using (var context = new CooperativaProduccionEntities())
            {
                var entities = context.Vw_RomaneoOrdenPago
                               .Where(x =>
                                      x.OrdenPagoId == null &&
                                      x.RomaneoPendiente == false)
                               .Where(pred)
                               .OrderByDescending(x => x.FechaAfipLiquidacion)
                               .ThenBy(x => x.nrofet)
                               .ToList();

                return(entities);
            }
        }
예제 #2
0
        private void EliminarUsuario(Guid UsuarioId)
        {
            if (gridViewUsuario.SelectedRowsCount > 0)
            {
                var usuario = Context.Usuario.Find(UsuarioId);
                if (!String.IsNullOrEmpty(usuario.Password))
                {
                    Context.Entry(usuario).State = EntityState.Deleted;
                    Context.SaveChanges();

                    MessageBox.Show("Usuario eliminado.",
                                    "Confirmación", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    ListarUsuarios();
                    Limpiar();
                    Deshabilitar();
                }
            }
            else
            {
                MessageBox.Show("No se ha seleccionado ningun registro.",
                                "Se requiere", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }