Esempio n. 1
0
        public List <obras> FindObras(int id)
        {
            envios eq = new envios();

            eq = _db.envios.Where(e => e.Id == id).FirstOrDefault();

            return(_db.obras.ToList());
        }
Esempio n. 2
0
        public void Crear(int?obraid, string obra = null, string tipocomponente    = null, DateTime?fechapedido   = null,
                          DateTime?fechasalida    = null, string tracking          = null, string empresaenvio    = null, string statusenvio    = null, string numerobulto = null
                          , string pesototal      = null, string codigoarancelario = null, string solicitado      = null, string costoproducto  = null, string statuspago  = null,
                          string numerofactura    = null, string statusentrega     = null, string entregaproducto = null, DateTime?fechaentrega = null)
        {
            //if(obra == null)
            //{
            //    obra = "null";
            //}if(tipocomponente == null)
            //{
            //    tipocomponente = "null";
            //}if(fechapedido == null)
            //{
            //    fechapedido = DateTime.Now.ToString();
            //}if(fechasalida == null)
            //{
            //    fechasalida = DateTime.Now.ToString();
            //}
            //if (tracking == null)
            //{
            //    tracking = "null";
            //}if(empresaenvio == null)
            //{
            //    empresaenvio = "null";
            //}if(statusenvio == null)
            //{
            //    statusenvio = "EN TRANSITO";
            //}if(numerobulto == null)
            //{
            //    numerobulto = "null";
            //}if(pesototal == null)
            //{
            //    pesototal = "null";
            //}if(codigoarancelario == null)
            //{
            //    codigoarancelario = "null";
            //}if(solicitado == null)
            //{
            //    solicitado = "null";
            //}
            //if (costoproducto == null)
            //{
            //    costoproducto = "null";
            //}if(statuspago == null)
            //{
            //    statuspago = "NO CANCELADO";
            //}
            //if (numerofactura == null)
            //{
            //    numerofactura = "null";
            //}
            //if (entregaproducto == null)
            //{
            //    entregaproducto = "null";
            //}
            //if (fechaentrega == null)
            //{
            //    fechaentrega = DateTime.Now.ToString();
            //}

            try
            {
                var envio = new envios()
                {
                    Obra              = obra,
                    TipoComponente    = tipocomponente,
                    FechaPedido       = fechapedido,
                    FechaSalida       = fechasalida,
                    Tracking          = tracking,
                    EmpresaEnvio      = empresaenvio,
                    StatusEnvio       = statusenvio,
                    NumeroBulto       = numerobulto,
                    PesoTotal         = pesototal,
                    CodigoArancelario = codigoarancelario,
                    Solicitado        = solicitado,
                    CostoProducto     = costoproducto,
                    StatusPago        = statuspago,
                    NumeroFactura     = numerofactura,
                    StatusEntrega     = statusentrega,
                    EntregaProducto   = entregaproducto,
                    FechaEntrega      = fechaentrega,
                    obra_id           = obraid
                };

                _db.envios.Add(envio);
                _db.SaveChanges();
            }
            catch (Exception)
            {
                throw;
            }
        }