コード例 #1
0
        public void Crear(int ventaid, string Nombre = null, string Url = null, string Fecha = null)
        {
            try
            {
                var informe = new informes()
                {
                    Nombre  = Nombre,
                    Url     = Url,
                    Fecha   = DateTime.Parse(Fecha),
                    IdVenta = ventaid
                };

                _db.informes.Add(informe);
                _db.SaveChanges();
            }
            catch (Exception)
            {
                throw;
            }
        }
コード例 #2
0
        public ActionResult Index(informes ing)
        {
            if (!ModelState.IsValid)
            {
                return(View());
            }

            try
            {
                using (var db = new HuelladeCarbonoEntities1())
                {
                    db.informes.Add(ing);
                    db.SaveChanges();

                    return(View(ing));
                }
            }
            catch (Exception)
            {
                throw;
            }
        }
コード例 #3
0
ファイル: ObrasManager.cs プロジェクト: Bakiet/DAP
        //public CuentaConUsuarioMaestro FindWithUsuarioMaestro(int id)
        //{
        //    var query = (from c in _db.cuentas
        //                 from u in c.aspnetusers1
        //                 where u.Tipo == UsuarioManager.Tipo.MaestroProveedor
        //                 && c.Id == id
        //                 select new CuentaConUsuarioMaestro { Cuenta = c, UsuarioMaestro = u });

        //    return query.FirstOrDefault();
        //}

        public obras Crear(string nombre           = null, string personajuridica = null, string direccionfacturacion = null,
                           string direccionoficina = null, string direccionobra   = null, string telefonooficina      = null, string contacto = null, string contacto2 = null
                           , string email          = null, string email2 = null, string foto = null, string mapa = null)
        {
            try
            {
                var obra = new obras()
                {
                    Nombre               = nombre,
                    PersonaJuridica      = personajuridica,
                    DireccionFacturacion = direccionfacturacion,
                    DireccionOficina     = direccionoficina,
                    DireccionObra        = direccionobra,
                    TelefonoOficina      = telefonooficina,
                    Contacto             = contacto,
                    Contacto2            = contacto2,
                    Email  = email,
                    Email2 = email2,
                    foto   = foto,
                    mapa   = mapa
                };

                var id = _db.obras.Add(obra);
                _db.SaveChanges();


                var ascensorprivado = new equipos()
                {
                    Nombre  = "ASCENSOR PRIVADO",
                    obra_id = id.Id
                };
                var idequipoap = _db.equipos.Add(ascensorprivado);
                _db.SaveChanges();

                var previo = new previos()
                {
                    FechaFirmaContrato                 = DateTime.Now,
                    FechaPagoInicialFabrica            = DateTime.Now,
                    FechaPagoInicialEquipo             = DateTime.Now,
                    FechaConstruccion                  = DateTime.Now,
                    FechaSalidaFabrica                 = DateTime.Now,
                    FechaSalidaBuque                   = DateTime.Now,
                    FechaLlegadaBuque                  = DateTime.Now,
                    FechaPeriodoNacionalizacion        = DateTime.Now,
                    FechaSalidaPuertoObra              = DateTime.Now,
                    FechaDescargaResguardo             = DateTime.Now,
                    ActivacionProtocoloGarantiaFabrica = "no",
                    FechaInicioMontaje                 = DateTime.Now,
                    FechaEntregaSoso                   = DateTime.Now,
                    FechaCulminacionMontaje            = DateTime.Now,
                    FechaConfiguracion                 = DateTime.Now,
                    FechaPeriodoPrueba                 = DateTime.Now,
                    FechaInspeccion = DateTime.Now,
                    equipo_id       = idequipoap.Id
                };
                _db.previos.Add(previo);
                _db.SaveChanges();

                /* var ascensorservicio = new equipos()
                 *               {
                 *
                 *                       Nombre = "ASCENSOR DE SERVICIO",
                 *                       obra_id = id.Id
                 *
                 *               };
                 * var idequipoas = _db.equipos.Add(ascensorservicio);
                 *               _db.SaveChanges();
                 *
                 * var previoas = new previos()
                 * {
                 *   equipo_id = idequipoas.Id
                 * };
                 * var previo_id = _db.previos.Add(previoas);
                 * _db.SaveChanges();*/

                var protocolo = new protocolos()
                {
                    obra_id  = id.Id,
                    IdPrevio = previo.Id
                };
                _db.protocolos.Add(protocolo);
                _db.SaveChanges();

                /*var herramienta = new herramientas()
                 * {
                 *  obra_id = id.Id,
                 *  previo_id = previo.Id
                 * };
                 * _db.herramientas.Add(herramienta);
                 * _db.SaveChanges();*/
/*
 *              var montacarro = new equipos()
 *                              {
 *
 *                                      Nombre = "MONTA CARRO",
 *                                      obra_id = id.Id
 *
 *                              };
 *              var idequipomc = _db.equipos.Add(montacarro);
 *                              _db.SaveChanges();
 *
 *              var previomc = new previos()
 *              {
 *                  equipo_id = idequipomc.Id
 *              };
 *              _db.previos.Add(previomc);
 *              _db.SaveChanges();
 */
                var ventamanprev = new ventas()
                {
                    Descripcion = "MANTENIMIENTOS PREVENTIVOS",
                    IdObra      = id.Id
                };
                var idventamp = _db.ventas.Add(ventamanprev);
                _db.SaveChanges();

                var ventamancorrec = new ventas()
                {
                    Descripcion = "MANTENIMIENTOS CORRECTIVOS",
                    IdObra      = id.Id
                };
                var idventamc = _db.ventas.Add(ventamancorrec);
                _db.SaveChanges();

                var ventainfor = new ventas()
                {
                    Descripcion = "INFORMES GENERALES",
                    IdObra      = id.Id
                };
                var idventainforme = _db.ventas.Add(ventainfor);
                _db.SaveChanges();

                var ventarepo = new ventas()
                {
                    Descripcion = "REPORTES DE SUGERENCIAS",
                    IdObra      = id.Id
                };
                var idventasugerencia = _db.ventas.Add(ventarepo);
                _db.SaveChanges();

                var mp = new mantenimientopreventivo()
                {
                    IdVenta = idventamp.Id
                };
                _db.mantenimientopreventivo.Add(mp);
                _db.SaveChanges();

                var mc = new mantenimientocorrectivo()
                {
                    IdVenta = idventamc.Id
                };
                _db.mantenimientocorrectivo.Add(mc);
                _db.SaveChanges();


                var informe = new informes()
                {
                    IdVenta = idventainforme.Id,
                    Url     = "null", Nombre = "null",
                    Fecha   = DateTime.Now
                };
                _db.informes.Add(informe);
                _db.SaveChanges();

                var sugerencia = new sugerencias()
                {
                    IdVenta              = idventasugerencia.Id,
                    Descripcion          = "null",
                    Caracteristica       = "null",
                    Numero               = "null",
                    AccionesRecomendadas = "null",
                    AccionesTomadas      = "null",
                    GerenciaResponsable  = "null",
                    Fecha = DateTime.Now
                };
                _db.sugerencias.Add(sugerencia);
                _db.SaveChanges();

                return(id);
            }
            catch (Exception)
            {
                throw;
            }
        }