public string Borrar()
 {
     try
     {
         string mensajeBorre = SELECCIONADA.IDPEDIDO + " " + SELECCIONADA.DESCRIPCION;
         bbdd.BorrarPedido(SELECCIONADA);
         PEDIDOS = bbdd.ObtenerPedidos(CONDICION_FIJA, false);
         return(mensajeBorre);
     }
     catch (Exception e)
     {
         throw new MisExcepciones(e.Message);
     }
 }
 public PedidosVM()
 {
     bbdd       = new ServicioBaseDatos();
     PEDIDOS    = bbdd.ObtenerPedidos(CONDICION_FIJA, false);
     FORMULARIO = new Pedido();
     // Datos para filtrado
     SITUACIONESELECCIONADA  = new SituacionPedido();
     TIPOPEDIDOESELECCIONADA = new TipoPedido();
     SITUACIONESPEDIDO       = bbdd.ObtenerSituacionPedidos(false);
     TIPOSPEDIDO             = bbdd.ObtenerTipoPedido(true);
     AÑOS = new ObservableCollection <string>();
     AÑOS.Add("");
     AÑOS.Add(DateTime.Now.Year.ToString());
     for (int i = 2020; i <= 2040; i++)
     {
         if (i.ToString() != DateTime.Now.Year.ToString())
         {
             AÑOS.Add(i.ToString());
         }
     }
     MESES = new ObservableCollection <string>();
     MESES.Add("");
     MESES.Add(DateTime.Now.Month.ToString());
     for (int i = 1; i <= 12; i++)
     {
         if (i.ToString() != DateTime.Now.Month.ToString())
         {
             MESES.Add(i.ToString());
         }
     }
 }
示例#3
0
        public ObservableCollection <Pedido> GuardarCambios()
        {
            try
            {
                string[] valores = FORMULARIO.NOMBRESITUACION.Split('-');
                FORMULARIO.IDSITUACION = Int32.Parse(valores[0]);
                valores = FORMULARIO.NOMBREPROVINCIA.Split('-');
                FORMULARIO.IDPROVINCIA = valores[0];
                valores = FORMULARIO.NOMBRETIPOPEDIDO.Split('-');
                FORMULARIO.IDTIPOPEDIDO = Int32.Parse(valores[0]);
                if (ACCION == Modo.Insertar)
                {
                    FORMULARIO.USUARIO = Properties.Settings.Default.login;
                    bbdd.InsertarPedido(FORMULARIO);
                }
                else
                {
                    bbdd.ActualizarPedido(FORMULARIO);
                }
                FORMULARIO = new Pedido();

                PEDIDOS = bbdd.ObtenerPedidos(CONDICION_FIJA, false);
                return(PEDIDOS);
            }
            catch (Exception e)
            {
                throw new MisExcepciones(e.Message);
            }
        }