示例#1
0
	void Awake() {

		if( prefabPista != null ) {
			pista = Instantiate<Pista>( prefabPista );
			pista.transform.position = Vector3.zero;
		}
		else{
			pista = Instantiate<Pista>( Resources.Load<Pista>( "Pistas/pista1" ) );
			pista.transform.position = Vector3.zero;
		}
		
		if( pista != null ) {
			pista.accionCheckPointAlcanzado = CheckpointAlcanzado;
		}

		auto = Instantiate<AutomovilV2>( Resources.Load<AutomovilV2>( "Autos/auto" ) );

		auto.transform.position = pista.posicionInicialAuto.position;
		auto.transform.rotation = pista.posicionInicialAuto.rotation;
		auto.enabled = false;

		labelVuelta.text = numeroVueltaActual + "/" + maxNumeroDeVuelta;
		StartCoroutine( InicioDeCarreraRutina() );

		LabelPartida.gameObject.SetActive( false );
	}
示例#2
0
        public void Guardar(PersonaNodos obj)
        {
            OracleCommand cmd = null;
            string        sql = string.Empty;

            if (obj.EsNuevo)
            {
                Pista p = PistaMgr.Instance.Info("Demandas", obj.GetEstadoString());
                obj.PkPersonaNodo = GetIdAutoNum("SQ_F_DM_PERSONA_NODO");
                obj.SecLog        = (long)p.PK_SecLog;
                sql = "INSERT INTO {0} ({1},{2},{3},{4},{5},{6})" +
                      "VALUES(:{1},:{2},:{3},:{4},:{5},:{6})";
            }
            else
            {
                sql = "UPDATE {0} SET " +
                      "{2}=:{2} ," +
                      "{3}=:{3} ," +
                      "{4}=:{4} ," +
                      "{5}=:{5} ," +
                      "{6}=:{6}  WHERE {1}=:{1}";
            }

            sql = string.Format(sql, PersonaNodos.NOMBRE_TABLA, PersonaNodos.C_PK_PERSONA_NODO,
                                PersonaNodos.C_FK_PERSONA,
                                PersonaNodos.C_FK_NODO_REAL,
                                PersonaNodos.C_SEC_LOG,
                                PersonaNodos.C_FK_NODO_PROYECTO,
                                PersonaNodos.C_PK_PERSONA_NODO_PADRE);
            cmd             = CrearCommand();
            cmd.CommandText = sql;
            cmd.BindByName  = true;
            cmd.Parameters.Add(PersonaNodos.C_PK_PERSONA_NODO, OracleDbType.Int64, obj.PkPersonaNodo, System.Data.ParameterDirection.Input);
            cmd.Parameters.Add(PersonaNodos.C_FK_PERSONA, OracleDbType.Int64, obj.FkPersona, System.Data.ParameterDirection.Input);
            cmd.Parameters.Add(PersonaNodos.C_FK_NODO_REAL, OracleDbType.Int64, obj.FkNodoReal, System.Data.ParameterDirection.Input);
            cmd.Parameters.Add(PersonaNodos.C_SEC_LOG, OracleDbType.Int64, obj.SecLog, System.Data.ParameterDirection.Input);
            cmd.Parameters.Add(PersonaNodos.C_FK_NODO_PROYECTO, OracleDbType.Int64, obj.FkNodoProyecto, System.Data.ParameterDirection.Input);
            cmd.Parameters.Add(PersonaNodos.C_PK_PERSONA_NODO_PADRE, OracleDbType.Int64, obj.PkPersonaNodoPadre, System.Data.ParameterDirection.Input);

            if (Actualizar(cmd))
            {
                obj.EsNuevo = false;
            }
        }
示例#3
0
        public void Guardar(Notificacion obj)
        {
            OracleCommand cmd = null;
            string        sql = string.Empty;

            if (obj.EsNuevo)
            {
                Pista p = PistaMgr.Instance.Info("DALSisFalla", obj.GetEstadoString());
                obj.SecLog = (long)p.PK_SecLog;
                sql        = "INSERT INTO {0} ({1},{2},{3},{4},{5},{6})" +
                             "VALUES(:{1},:{2},:{3},:{4},:{5},:{6})";
            }
            else
            {
                sql = "UPDATE {0} SET " +
                      "{3}=:{3} ," +
                      "{4}=:{4} ," +
                      "{5}=:{5} ," +
                      "{6}=:{6}  WHERE " +
                      "{1}=:{1} AND " +
                      "{2}=:{2}";
            }

            sql = string.Format(sql, Notificacion.NOMBRE_TABLA, Notificacion.C_PK_COD_FALLA,
                                Notificacion.C_PK_COD_PERSONA,
                                Notificacion.C_D_COD_ESTADO_NOTIFICACION,
                                Notificacion.C_D_COD_ESTADO,
                                Notificacion.C_SEC_LOG,
                                Notificacion.C_SINC_VER);
            cmd             = CrearCommand();
            cmd.CommandText = sql;
            cmd.BindByName  = true;
            cmd.Parameters.Add(Notificacion.C_PK_COD_FALLA, OracleDbType.Int32, obj.PkCodFalla, System.Data.ParameterDirection.Input);
            cmd.Parameters.Add(Notificacion.C_PK_COD_PERSONA, OracleDbType.Int64, obj.PkCodPersona, System.Data.ParameterDirection.Input);
            cmd.Parameters.Add(Notificacion.C_D_COD_ESTADO_NOTIFICACION, OracleDbType.Int64, obj.DCodEstadoNotificacion, System.Data.ParameterDirection.Input);
            cmd.Parameters.Add(Notificacion.C_D_COD_ESTADO, OracleDbType.Varchar2, obj.DCodEstado, System.Data.ParameterDirection.Input);
            cmd.Parameters.Add(Notificacion.C_SEC_LOG, OracleDbType.Int64, obj.SecLog, System.Data.ParameterDirection.Input);
            cmd.Parameters.Add(Notificacion.C_SINC_VER, OracleDbType.Int64, obj.SincVer, System.Data.ParameterDirection.Input);

            if (Actualizar(cmd))
            {
                obj.EsNuevo = false;
            }
        }
示例#4
0
    void Start()
    {
        rgb            = GetComponent <Rigidbody> ();
        gameManagement = (GameManagement)FindObjectOfType(typeof(GameManagement));
        groundCheck    = GameObject.Find("GroundCheck").transform;

        // Guarda os Objetos que identificas as faixas
        Pista  = (Pista)FindObjectOfType(typeof(Pista));
        sombra = GameObject.FindGameObjectWithTag("SombraPlayer").transform;
        distanciaInicialPlayerSombra = Mathf.Abs(sombra.position.y - transform.position.y);
        scaleInicialSombra           = sombra.localScale;
        // Posiciona na Faixa Inicial
        transform.position      = new Vector3(transform.position.x, transform.position.y, Pista.GetPosZFaixaAtual());
        posicaoSombra           = transform.position.y - distanciaInicialPlayerSombra;
        currentSpeed            = Speed;
        temporizadorSemControle = 0;
        posYInicial             = transform.position.y;
        hitCavalete             = null;
    }
示例#5
0
    public void ShowPista(Pista _pista)
    {
        bool encontrada;

        if (_pista.DependeDePista == "")
        {
            encontrada = true;
        }
        else
        {
            encontrada = false;
            foreach (var p in inventario.Pistas)
            {
                if (p.name == _pista.DependeDePista)
                {
                    encontrada = true;
                    break;
                }
            }
        }
        if (encontrada)
        {
            var texto = this.GetComponentInChildren <Text>();
            texto.text = _pista.Descripcion;

            var   imagenes = this.GetComponentsInChildren <Image>();
            Image imagen   = null;

            for (int c = 0; c < imagenes.GetLength(0); c++)
            {
                if (imagenes[c].name == "ImagePista")
                {
                    imagen = imagenes[c];
                }
            }

            imagen.sprite = _pista.Imagen;

            Mostrar();
            infoHablada = _pista.PistaHablada;
            PistaEncontradaSound();
        }
    }
        //Metodo de acciones submenu de configuracion de juego
        private void OpcionConfiguracion(byte op)
        {
            switch (op)
            {
            case 1:
                Console.Clear();
                jugador = CantidadJugadores();
                for (int i = 1; i <= jugador; i++)
                {
                    CrearJugador(i);
                    Carro carro = CrearCarro(i);
                    CrearConductor(i, carro);
                    CrearCarril(i, carro);
                }
                break;

            case 2:
                do
                {
                    Console.Clear();
                    Pista pista = new Pista();
                    Console.Write("Ingrese el nombre de la pista: ");
                    pista.NombrePista = Console.ReadLine();
                    Console.Write("Ingrese la distancia en KM: ");
                    pista.Distancia = int.Parse(Console.ReadLine());
                    pistaServices.CrearPista(pista);

                    Console.WriteLine("Pista creada correctamente");
                    Console.Write("\n¿Desea crear otra pista? S/N: ");
                    opPista = Console.ReadLine();
                } while (opPista.ToLower() != "n");

                break;

            case 0:
                MenuPrincipal();
                break;

            default:
                Console.WriteLine("Selección Incorrecta");
                break;
            }
        }
示例#7
0
        public void Guardar(ReduccionEmisores reduccionDeEmisores)
        {
            OracleCommand cmd = null;
            string        sql = string.Empty;

            if (reduccionDeEmisores.EsNuevo)
            {
                Pista p = PistaMgr.Instance.Info("DALProyectos", reduccionDeEmisores.GetEstadoString());
                reduccionDeEmisores.SecLog = (long)p.PK_SecLog;
                reduccionDeEmisores.PkReduccionEmisores = GetIdAutoNum("SQ_F_PR_RECUCCION_EMISORES");
                sql = "INSERT INTO {0} ({1},{2},{3},{4},{5})" +
                      "VALUES(:{1},:{2},:{3},:{4},:{5})";
            }
            else
            {
                sql = "UPDATE {0} SET " +
                      "{2}=:{2} ," +
                      "{3}=:{3} ," +
                      "{4}=:{4} ," +
                      "{5}=:{5}  WHERE {1}=:{1} ";
            }

            sql = string.Format(sql, ReduccionEmisores.NOMBRE_TABLA, ReduccionEmisores.C_PK_REDUCCION_EMISORES,
                                ReduccionEmisores.C_FK_PROYECTO,
                                ReduccionEmisores.C_REDUCCION_CO2,
                                ReduccionEmisores.C_FECHA_REGISTRO,
                                ReduccionEmisores.C_SEC_LOG);
            cmd             = CrearCommand();
            cmd.CommandText = sql;
            cmd.BindByName  = true;

            cmd.Parameters.Add(ReduccionEmisores.C_PK_REDUCCION_EMISORES, OracleDbType.Int64, reduccionDeEmisores.PkReduccionEmisores, System.Data.ParameterDirection.Input);
            cmd.Parameters.Add(ReduccionEmisores.C_FK_PROYECTO, OracleDbType.Int64, reduccionDeEmisores.FkProyecto, System.Data.ParameterDirection.Input);
            cmd.Parameters.Add(ReduccionEmisores.C_REDUCCION_CO2, OracleDbType.Double, reduccionDeEmisores.ReduccionCo2, System.Data.ParameterDirection.Input);
            cmd.Parameters.Add(ReduccionEmisores.C_FECHA_REGISTRO, OracleDbType.Date, reduccionDeEmisores.FechaDeRegistro, System.Data.ParameterDirection.Input);
            cmd.Parameters.Add(ReduccionEmisores.C_SEC_LOG, OracleDbType.Int64, reduccionDeEmisores.SecLog, System.Data.ParameterDirection.Input);

            if (Actualizar(cmd))
            {
                reduccionDeEmisores.EsNuevo = false;
            }
        }
示例#8
0
        public bool Guardar(Rol obj)
        {
            bool          resultado = true;
            OracleCommand cmd       = null;
            string        sql       = string.Empty;

            obj.CodEstado = "1";

            if (obj.EsNuevo)
            {
                Pista p = PistaMgr.Instance.Info("OraDalRolMgr", "Creando Nuevo Rol " + obj.NombreCorto);
                obj.SecLog  = (long)p.PK_SecLog;
                obj.Num_Rol = GetIdAutoNum("sec_f_au_roles");
                sql         = @"INSERT INTO f_au_roles (num_rol,nombre_corto,descripcion,jerarquia,d_cod_estado,sec_log)
                VALUES(:num_rol,:nombre_corto,:descripcion,:jerarquia,:d_cod_estado,:sec_log)";
            }
            else
            {
                sql = @"UPDATE f_au_roles SET 
                nombre_corto=:nombre_corto,
                descripcion=:descripcion,
                jerarquia=:jerarquia,
                d_cod_estado=:d_cod_estado,
                sec_log=:sec_log
                WHERE num_rol=:num_rol";
            }

            cmd             = CrearCommand();
            cmd.CommandText = sql;
            cmd.BindByName  = true;
            cmd.Parameters.Add("NUM_ROL", OracleDbType.Int64, obj.Num_Rol, System.Data.ParameterDirection.Input);
            cmd.Parameters.Add("NOMBRE_CORTO", OracleDbType.Varchar2, obj.NombreCorto, System.Data.ParameterDirection.Input);
            cmd.Parameters.Add("DESCRIPCION", OracleDbType.Varchar2, obj.Descripcion, System.Data.ParameterDirection.Input);
            cmd.Parameters.Add("JERARQUIA", OracleDbType.Int16, obj.Jerarquia, System.Data.ParameterDirection.Input);
            cmd.Parameters.Add("D_COD_ESTADO", OracleDbType.Varchar2, obj.CodEstado, System.Data.ParameterDirection.Input);
            cmd.Parameters.Add("SEC_LOG", OracleDbType.Int64, obj.SecLog, System.Data.ParameterDirection.Input);
            if (Actualizar(cmd))
            {
                obj.EsNuevo = false;
            }
            return(resultado);
        }
示例#9
0
        public ActionResult Edit([Bind(Include = "Id,Nome,dtaCadastro,Ativo")] Pista pista, bool chkConectado)
        {
            Pista Teste = PistasDAO.ProcurarbyNome(pista.Nome);

            if (chkConectado)
            {
                pista.Ativo = 0;
            }
            else
            {
                pista.Ativo = 1;
            }
            if (Teste == null || !chkConectado)
            {
                PistasDAO.Editar(pista, pista.Id);
                return(RedirectToAction("Index"));
            }
            ModelState.AddModelError("", "Pista com mesmo Nome já Cadastrada");
            return(View());
        }
示例#10
0
        public Bug(String MediaDir)
        {
            meshMounstroMiniatura = new TgcSceneLoader().loadSceneFromFile(MediaDir + @"monstruo-TgcScene.xml").Meshes[0];
            mesh = new TgcSceneLoader().loadSceneFromFile(MediaDir + @"Buggy-TgcScene.xml").Meshes[0];

            piezaAsociada = new Pieza(2, "Pieza 2", MediaDir + "\\2D\\windows\\windows_2.png", null);
            pistaAsociada = new Pista(null, MediaDir + "\\2D\\pista_sudo.png", null);

            mesh.Position  = new TGCVector3(-450, 40, 2500);
            mesh.Transform = TGCMatrix.Translation(-450, 40, 2500);
            meshMounstroMiniatura.Position  = new TGCVector3(-440, 40, 2400);
            meshMounstroMiniatura.Transform = TGCMatrix.Translation(-440, 40, 2400);
            meshMounstroMiniatura.RotateY(FastMath.PI);
            meshMounstroMiniatura.Scale = new TGCVector3(0.1f, 0.1f, 0.1f);
            posicionInicial             = mesh.Position;
            posicionInicialMounstro     = meshMounstroMiniatura.Position;

            interactuable = true;
            usado         = false;
        }
示例#11
0
        public void Guardar(VolumenVsArea volumenVsArea)
        {
            OracleCommand cmd = null;
            string        sql = string.Empty;

            if (volumenVsArea.EsNuevo)
            {
                Pista p = PistaMgr.Instance.Info("DALProyectos", volumenVsArea.GetEstadoString());
                volumenVsArea.SecLog          = (long)p.PK_SecLog;
                volumenVsArea.PkVolumenVsArea = GetIdAutoNum("SQ_F_PR_VOLUMEN_VS_AREA");
                sql = "INSERT INTO {0} ({1},{2},{3},{4},{5})" +
                      "VALUES(:{1},:{2},:{3},:{4},:{5})";
            }
            else
            {
                sql = "UPDATE {0} SET " +
                      "{2}=:{2} ," +
                      "{3}=:{3} ," +
                      "{4}=:{4} ," +
                      "{5}=:{5}  WHERE {1}=:{1} ";
            }

            sql = string.Format(sql, VolumenVsArea.NOMBRE_TABLA, VolumenVsArea.C_PK_VOLUMEN_VS_AREA,
                                VolumenVsArea.C_FK_DATO_TEC_HIDROELECTRICO,
                                VolumenVsArea.C_VOLUMEN,
                                VolumenVsArea.C_AREA,
                                VolumenVsArea.C_SEC_LOG);
            cmd             = CrearCommand();
            cmd.CommandText = sql;
            cmd.BindByName  = true;
            cmd.Parameters.Add(VolumenVsArea.C_PK_VOLUMEN_VS_AREA, OracleDbType.Int64, volumenVsArea.PkVolumenVsArea, System.Data.ParameterDirection.Input);
            cmd.Parameters.Add(VolumenVsArea.C_FK_DATO_TEC_HIDROELECTRICO, OracleDbType.Int64, volumenVsArea.FkDatoTecHidroelectrico, System.Data.ParameterDirection.Input);
            cmd.Parameters.Add(VolumenVsArea.C_VOLUMEN, OracleDbType.Double, volumenVsArea.Volumen, System.Data.ParameterDirection.Input);
            cmd.Parameters.Add(VolumenVsArea.C_AREA, OracleDbType.Double, volumenVsArea.Area, System.Data.ParameterDirection.Input);
            cmd.Parameters.Add(VolumenVsArea.C_SEC_LOG, OracleDbType.Int64, volumenVsArea.SecLog, System.Data.ParameterDirection.Input);

            if (Actualizar(cmd))
            {
                volumenVsArea.EsNuevo = false;
            }
        }
示例#12
0
        public bool ActualizarNodo(ModeloComponentes.Componente c, long pkCodNodo, long TipoRelacion)
        {
            bool  rtn = false;
            Pista p   = PistaMgr.Instance.Info("Componente", " ACTUALIZAR: Nombre Componente=" + c.NombreComponente);

            c.SecLog = (long)p.PK_SecLog;

            string sql = @" 
                UPDATE
                  f_ac_rcomponente_nodo
                SET
                 fecha_ingreso = :fecha_ingreso
                , fecha_salida  = :fecha_salida
                , sec_log       = :sec_log
                WHERE
                  pk_cod_componente     = :pk_cod_componente
                AND pk_cod_nodo         = :pk_cod_nodo
                AND d_cod_tipo_relacion = :d_cod_tipo_relacion
                ";


            OracleCommand cmd = CrearCommand(sql);

            cmd.Parameters.Add("PK_COD_COMPONENTE", OracleDbType.Long, c.PkCodComponente, ParameterDirection.Input);
            cmd.Parameters.Add("PK_COD_NODO", OracleDbType.Long, pkCodNodo, ParameterDirection.Input);
            cmd.Parameters.Add("D_COD_TIPO_RELACION", OracleDbType.Long, TipoRelacion, ParameterDirection.Input);
            cmd.Parameters.Add("FECHA_INGRESO", OracleDbType.Date, c.FechaIngreso, ParameterDirection.Input);
            if (c.TieneFechaSalida)
            {
                cmd.Parameters.Add("FECHA_SALIDA", OracleDbType.Date, c.FechaSalida, ParameterDirection.Input);
            }
            else
            {
                cmd.Parameters.Add("FECHA_SALIDA", OracleDbType.Date, DBNull.Value, ParameterDirection.Input);
            }

            cmd.Parameters.Add("SEC_LOG", OracleDbType.Long, c.SecLog, ParameterDirection.Input);
            rtn = Actualizar(cmd);

            return(rtn);
        }
示例#13
0
        public void GuardarComponente(Componente regComponente)
        {
            OracleCommand cmd = null;
            string        sql = string.Empty;

            if (regComponente.EsNuevo)
            {
                Pista p = PistaMgr.Instance.Info("Componente", "Nombre Componente=" + regComponente.NombreComponente);
                regComponente.SecLog          = (long)p.PK_SecLog;
                regComponente.PkCodComponente = GetIdAutoNum("SEC_F_AC_COMPONENTE") + 10000;
                sql = "INSERT INTO {0} ({1},{2},{3},{4},{5},{6},{7},{8},{9})" +
                      "VALUES(:{1},:{2},:{3},:{4},:{5},:{6},:{7},:{8},:{9})";
            }
            else
            {
                sql = "UPDATE {0} SET {2}=:{2} ,{3}=:{3} ,{4}=:{4} ,{5}=:{5} ,{6}=:{6} ," +
                      "{7}=:{7} ,{8}=:{8} ,{9}=:{9}  WHERE " +
                      "{1}=:{1}";
            }
            sql = string.Format(sql, Componente.NOMBRE_TABLA, Componente.C_PK_COD_COMPONENTE, Componente.C_NOMBRE_COMPONENTE,
                                Componente.C_DESCRIPCION, Componente.C_D_TIPO_COMPONENTE, Componente.C_FECHA_INGRESO,
                                Componente.C_PROPIETARIO, Componente.C_SEC_LOG, Componente.C_CODIGO_COMPONENTE,
                                Componente.C_SINC_VER);
            cmd             = CrearCommand();
            cmd.CommandText = sql;
            cmd.BindByName  = true;
            cmd.Parameters.Add(Componente.C_PK_COD_COMPONENTE, OracleDbType.Int32, regComponente.PkCodComponente, System.Data.ParameterDirection.Input);
            cmd.Parameters.Add(Componente.C_NOMBRE_COMPONENTE, OracleDbType.Varchar2, regComponente.NombreComponente, System.Data.ParameterDirection.Input);
            cmd.Parameters.Add(Componente.C_DESCRIPCION, OracleDbType.Varchar2, regComponente.Descripcion, System.Data.ParameterDirection.Input);
            cmd.Parameters.Add(Componente.C_D_TIPO_COMPONENTE, OracleDbType.Int64, regComponente.DTipoComponente, System.Data.ParameterDirection.Input);
            cmd.Parameters.Add(Componente.C_FECHA_INGRESO, OracleDbType.Date, regComponente.FechaIngreso, System.Data.ParameterDirection.Input);
            cmd.Parameters.Add(Componente.C_PROPIETARIO, OracleDbType.Int64, regComponente.Propietario, System.Data.ParameterDirection.Input);
            cmd.Parameters.Add(Componente.C_SEC_LOG, OracleDbType.Int64, regComponente.SecLog, System.Data.ParameterDirection.Input);
            cmd.Parameters.Add(Componente.C_CODIGO_COMPONENTE, OracleDbType.Varchar2, regComponente.CodigoComponente, System.Data.ParameterDirection.Input);
            cmd.Parameters.Add(Componente.C_SINC_VER, OracleDbType.Int64, regComponente.SincVer, System.Data.ParameterDirection.Input);
            // cmd.Parameters.Add(Componente.C_D_EQUIVALENCIA, OracleDbType.Int64, regComponente.DEquivalencia, System.Data.ParameterDirection.Input);
            if (Actualizar(cmd))
            {
                regComponente.EsNuevo = false;
            }
        }
        private static void VerificarAvioesCaidos(Pista pista)
        {
            var _avioesCaidosAterrissar1 = new List <Aviao>();

            _avioesCaidosAterrissar1 = pista.Pousar1.Where(p => p.NivelGasolina.HasValue && p.NivelGasolina.Value < 1).ToList();

            var _avioesCaidosAterrissar2 = new List <Aviao>();

            _avioesCaidosAterrissar2 = pista.Pousar2.Where(p => p.NivelGasolina.HasValue && p.NivelGasolina.Value < 1).ToList();

            foreach (var aviao in _avioesCaidosAterrissar1)
            {
                avioesCaidos.Add(new Tuple <int, int, int?>(aviao.Id_Aviao, pista.Id_Pista, aviao.NivelGasolina));
                RemoverAviaoCaidoFila(pista.Pousar1, aviao);
            }

            foreach (var aviao in _avioesCaidosAterrissar2)
            {
                avioesCaidos.Add(new Tuple <int, int, int?>(aviao.Id_Aviao, pista.Id_Pista, aviao.NivelGasolina));
                RemoverAviaoCaidoFila(pista.Pousar2, aviao);
            }
        }
        /// <summary>
        /// Confere se vai ser preciso realizar pouso de emergência na pista 3. Se, e somente se, for necessário (algum avião
        /// nas filas com nível de gasolina = 1) chama a função RemoverAviaoFila passando o idPista3, para pousar.
        /// </summary>
        /// <param name="pista"></param>
        private static void RealizarPousoDeEmergenciaPista3(Pista pista)
        {
            var aviaoSemGasolina = new Aviao();

            aviaoSemGasolina = pista.Pousar1.FirstOrDefault(p => p.NivelGasolina.HasValue && p.NivelGasolina.Value == 1);

            if (!pousoEmergencialPista3NaInteracao && aviaoSemGasolina != null)
            {
                RemoverAviaoFila(pista.Pousar1, idPista3, FilaEnum.Pousar, aviaoSemGasolina);
                pousoEmergencialPista3NaInteracao = true;
            }
            else if (!pousoEmergencialPista3NaInteracao && aviaoSemGasolina == null)
            {
                aviaoSemGasolina = pista.Pousar2.FirstOrDefault(p => p.NivelGasolina.HasValue && p.NivelGasolina.Value == 1);

                if (aviaoSemGasolina != null)
                {
                    RemoverAviaoFila(pista.Pousar2, idPista3, FilaEnum.Pousar, aviaoSemGasolina);
                    pousoEmergencialPista3NaInteracao = true;
                }
            }
        }
            protected override void Seed(GestionEstadio.DAL.GestionEstadioContext context)
            {
                //  This method will be called after migrating to the latest version.

                //  You can use the DbSet<T>.AddOrUpdate() helper extension method
                //  to avoid creating duplicate seed data.

                Usuario usuario = new Usuario();

                usuario.user        = "******";
                usuario.contraseña  = "administrador";
                usuario.tipoUsuario = "admin";
                context.usuario.Add(usuario);

                Estadio estadio = new Estadio();

                estadio.nombreEstadio = "Estadio xinzo";
                estadio.direccion     = "calle xinzo";
                estadio.numeroPistas  = 3;
                context.estadio.Add(estadio);

                for (int i = 0; i < estadio.numeroPistas; i++)
                {
                    Pista pista = new Pista();
                    pista.ocupada   = false;
                    pista.EstadioId = estadio.EstadioId;
                    pista.Estadio   = estadio;
                    context.pista.Add(pista);
                }

                Deporte deporte = new Deporte();

                deporte.nombreDeporte    = "Baloncesto";
                deporte.duracionPartidos = 40;
                context.deporte.Add(deporte);

                context.SaveChanges();
            }
        public void Guardar(DemandaSalidaDetalle obj)
        {
            OracleCommand cmd = null;
            string        sql = string.Empty;

            if (obj.EsNuevo)
            {
                Pista p = PistaMgr.Instance.Info("Demanda", obj.GetEstadoString());
                obj.SecLog = (long)p.PK_SecLog;
                obj.PkDemandaSalidaDetalle = GetIdAutoNum("SQ_F_DM_DEMANDA_SALIDA_DETALLE");
                sql = "INSERT INTO {0} ({1},{2},{3},{4})" +
                      "VALUES(:{1},:{2},:{3},:{4})";
            }
            else
            {
                sql = "UPDATE {0} SET " +
                      "{2}=:{2} ," +
                      "{3}=:{3} ," +
                      "{4}=:{4}  WHERE {1}=:{1} ";
            }

            sql = string.Format(sql, DemandaSalidaDetalle.NOMBRE_TABLA, DemandaSalidaDetalle.C_PK_DEMANDA_SALIDA_DETALLE,
                                DemandaSalidaDetalle.C_FK_DEMANDA_SALIDA_MAESTRO,
                                DemandaSalidaDetalle.C_FK_NODO_DEMANDA,
                                DemandaSalidaDetalle.C_SEC_LOG);
            cmd             = CrearCommand();
            cmd.CommandText = sql;
            cmd.BindByName  = true;
            cmd.Parameters.Add(DemandaSalidaDetalle.C_PK_DEMANDA_SALIDA_DETALLE, OracleDbType.Int64, obj.PkDemandaSalidaDetalle, System.Data.ParameterDirection.Input);
            cmd.Parameters.Add(DemandaSalidaDetalle.C_FK_DEMANDA_SALIDA_MAESTRO, OracleDbType.Int64, obj.FkDemandaSalidaMaestro, System.Data.ParameterDirection.Input);
            cmd.Parameters.Add(DemandaSalidaDetalle.C_FK_NODO_DEMANDA, OracleDbType.Int64, obj.FkNodoDemanda, System.Data.ParameterDirection.Input);
            cmd.Parameters.Add(DemandaSalidaDetalle.C_SEC_LOG, OracleDbType.Int64, obj.SecLog, System.Data.ParameterDirection.Input);

            if (Actualizar(cmd))
            {
                obj.EsNuevo = false;
            }
        }
示例#18
0
        public ActionResult Create([Bind(Include = "Id,Nome,dtaCadastro,Ativo")] Pista pista)
        {
            HttpCookie myCookie = Request.Cookies["Loja"];


            pista.loja = LojaDAO.ProcurarbyId(Int32.Parse(myCookie.Values["lojaId"]));

            pista.Ativo       = 1;
            pista.dtaCadastro = DateTime.Now;
            if (ModelState.IsValid)
            {
                Pista Teste = PistasDAO.ProcurarbyNome(pista.Nome);
                if (Teste == null)
                {
                    PistasDAO.AdicionarNovo(pista);
                    return(RedirectToAction("Index"));
                }
                ModelState.AddModelError("", "Pista com mesmo Nome já Cadastrada");
                return(View());
            }

            return(View(pista));
        }
        private static void InsereAviao(Pista pista, bool gerarAvioesFilaDePouso = true)
        {
            foreach (var aviao in GeraAvioes(FilaEnum.Decolar))
            {
                pista.Decolar.Enqueue(aviao);
            }

            if (gerarAvioesFilaDePouso)
            {
                foreach (var aviao in GeraAvioes(FilaEnum.Pousar))
                {
                    if (pista.Pousar1.Count > pista.Pousar2.Count)
                    {
                        pista.Pousar2.Enqueue(aviao);
                    }

                    else
                    {
                        pista.Pousar1.Enqueue(aviao);
                    }
                }
            }
        }
        public async Task <Pista> GetPista(int secuencial)
        {
            Pista = new Pista();
            var uri = new Uri(string.Format(Constants.PistasMostrarUrl, secuencial));

            try
            {
                var response = await _client.GetAsync(uri);

                if (response.IsSuccessStatusCode)
                {
                    var content = await response.Content.ReadAsStringAsync();

                    Pista = JsonConvert.DeserializeObject <Pista>(content);
                }
            }
            catch (Exception ex)
            {
                Debug.WriteLine(@"Error {0}", ex.Message);
            }

            return(Pista);
        }
示例#21
0
        public void Guardar(PersonaTipoAgente obj)
        {
            OracleCommand cmd = null;
            string        sql = string.Empty;

            if (obj.EsNuevo)
            {
                Pista p = PistaMgr.Instance.Info("Demandas", obj.GetEstadoString());
                obj.SecLog        = (long)p.PK_SecLog;
                obj.PkPersonaTipo = GetIdAutoNum("SQ_F_DM_PERSONA_TIPO");
                sql = "INSERT INTO {0} ({1},{2},{3},{4})" +
                      "VALUES(:{1},:{2},:{3},:{4})";
            }
            else
            {
                sql = "UPDATE {0} SET " +
                      "{2}=:{2} ," +
                      "{3}=:{3} ," +
                      "{4}=:{4}  WHERE {1}=:{1}";
            }

            sql = string.Format(sql, PersonaTipoAgente.NOMBRE_TABLA, PersonaTipoAgente.C_PK_PERSONA_TIPO,
                                PersonaTipoAgente.C_D_COD_TIPO_PERSONA,
                                PersonaTipoAgente.C_FK_PERSONSA,
                                PersonaTipoAgente.C_SEC_LOG);
            cmd             = CrearCommand();
            cmd.CommandText = sql;
            cmd.BindByName  = true;
            cmd.Parameters.Add(PersonaTipoAgente.C_PK_PERSONA_TIPO, OracleDbType.Long, obj.PkPersonaTipo, System.Data.ParameterDirection.Input);
            cmd.Parameters.Add(PersonaTipoAgente.C_D_COD_TIPO_PERSONA, OracleDbType.Long, obj.DCodTipoPersona, System.Data.ParameterDirection.Input);
            cmd.Parameters.Add(PersonaTipoAgente.C_FK_PERSONSA, OracleDbType.Long, obj.FkPersonsa, System.Data.ParameterDirection.Input);
            cmd.Parameters.Add(PersonaTipoAgente.C_SEC_LOG, OracleDbType.Long, obj.SecLog, System.Data.ParameterDirection.Input);
            if (Actualizar(cmd))
            {
                obj.EsNuevo = false;
            }
        }
示例#22
0
        public bool AsignarModulo(long idModulo, Rol rol)
        {
            bool   resultado = false;
            string sql       = @"INSERT INTO F_AU_RROL_MODULO(pk_num_rol,pk_cod_modulo,d_cod_estado,sec_log) 
            VALUES(:pk_num_rol,:pk_cod_modulo,:d_cod_estado,:sec_log)";

            OracleCommand cmd    = null;
            Pista         p      = PistaMgr.Instance.Info("OraDalModuloMgr", "Asignando modulo " + idModulo + " a rol " + rol.NombreCorto);
            long          secLog = (long)p.PK_SecLog;

            cmd             = CrearCommand();
            cmd.CommandText = sql;
            cmd.BindByName  = true;
            cmd.Parameters.Add("pk_num_rol", OracleDbType.Int64, rol.Num_Rol, System.Data.ParameterDirection.Input);
            cmd.Parameters.Add("pk_cod_modulo", OracleDbType.Int64, idModulo, System.Data.ParameterDirection.Input);
            cmd.Parameters.Add("D_COD_ESTADO", OracleDbType.Varchar2, "1", System.Data.ParameterDirection.Input);
            cmd.Parameters.Add("SEC_LOG", OracleDbType.Int64, secLog, System.Data.ParameterDirection.Input);
            if (Actualizar(cmd))
            {
                resultado = true;
            }

            return(resultado);
        }
        public void Guardar(DatosDemandaNodo obj)
        {
            OracleCommand cmd = null;
            string        sql = string.Empty;

            if (obj.EsNuevo)
            {
                Pista p = PistaMgr.Instance.Info("Demandas", obj.GetEstadoString());
                obj.SecLog            = (long)p.PK_SecLog;
                obj.PkDatosDemadaNodo = GetIdAutoNum("SQ_F_DM_DATOS_DEMADA_NODO");

                sql = "INSERT INTO {0} ({1},{2},{3},{4},{5},{6},{7},{8},{9},{10},{11},{12},{13},{14},{15},{16},{17},{18})" +
                      "VALUES(:{1},:{2},:{3},:{4},:{5},:{6},:{7},:{8},:{9},:{10},:{11},:{12},:{13},:{14},:{15},:{16},:{17},:{18})";
            }
            else
            {
                sql = "UPDATE {0} SET " +
                      "{2}=:{2} ," +
                      "{3}=:{3} ," +
                      "{4}=:{4} ," +
                      "{5}=:{5} ," +
                      "{6}=:{6} ," +
                      "{7}=:{7} ," +
                      "{8}=:{8} ," +
                      "{9}=:{9} ," +
                      "{10}=:{10} ," +
                      "{11}=:{11} ," +
                      "{12}=:{12} ," +
                      "{13}=:{13} ," +
                      "{14}=:{14} ," +
                      "{15}=:{15} ," +
                      "{16}=:{16} ," +
                      "{17}=:{17} ," +
                      "{18}=:{18}  WHERE {1}=:{1} ";
            }

            sql = string.Format(sql, DatosDemandaNodo.NOMBRE_TABLA, DatosDemandaNodo.C_PK_DATOS_DEMADA_NODO,
                                DatosDemandaNodo.C_ANIO,
                                DatosDemandaNodo.C_ENERO,
                                DatosDemandaNodo.C_FEBRERO,
                                DatosDemandaNodo.C_MARZO,
                                DatosDemandaNodo.C_ABRIL,
                                DatosDemandaNodo.C_MAYO,
                                DatosDemandaNodo.C_JUNIO,
                                DatosDemandaNodo.C_JULIO,
                                DatosDemandaNodo.C_AGOSTO,
                                DatosDemandaNodo.C_SEPTIEMBRE,
                                DatosDemandaNodo.C_OCTUBRE,
                                DatosDemandaNodo.C_NOVIEMBRE,
                                DatosDemandaNodo.C_DICIEMBRE,
                                DatosDemandaNodo.C_FK_PERSONA_NODO,
                                DatosDemandaNodo.C_SEC_LOG,
                                DatosDemandaNodo.C_D_COD_CATEGORIA_DATO,
                                DatosDemandaNodo.C_FK_DEMANDA_SALIDA_MAESTRO);
            cmd             = CrearCommand();
            cmd.CommandText = sql;
            cmd.BindByName  = true;
            cmd.Parameters.Add(DatosDemandaNodo.C_PK_DATOS_DEMADA_NODO, OracleDbType.Int64, obj.PkDatosDemadaNodo, System.Data.ParameterDirection.Input);
            cmd.Parameters.Add(DatosDemandaNodo.C_ANIO, OracleDbType.Int64, obj.Anio, System.Data.ParameterDirection.Input);
            cmd.Parameters.Add(DatosDemandaNodo.C_ENERO, OracleDbType.Double, obj.Enero, System.Data.ParameterDirection.Input);
            cmd.Parameters.Add(DatosDemandaNodo.C_FEBRERO, OracleDbType.Double, obj.Febrero, System.Data.ParameterDirection.Input);
            cmd.Parameters.Add(DatosDemandaNodo.C_MARZO, OracleDbType.Double, obj.Marzo, System.Data.ParameterDirection.Input);
            cmd.Parameters.Add(DatosDemandaNodo.C_ABRIL, OracleDbType.Double, obj.Abril, System.Data.ParameterDirection.Input);
            cmd.Parameters.Add(DatosDemandaNodo.C_MAYO, OracleDbType.Double, obj.Mayo, System.Data.ParameterDirection.Input);
            cmd.Parameters.Add(DatosDemandaNodo.C_JUNIO, OracleDbType.Double, obj.Junio, System.Data.ParameterDirection.Input);
            cmd.Parameters.Add(DatosDemandaNodo.C_JULIO, OracleDbType.Double, obj.Julio, System.Data.ParameterDirection.Input);
            cmd.Parameters.Add(DatosDemandaNodo.C_AGOSTO, OracleDbType.Double, obj.Agosto, System.Data.ParameterDirection.Input);
            cmd.Parameters.Add(DatosDemandaNodo.C_SEPTIEMBRE, OracleDbType.Double, obj.Septiembre, System.Data.ParameterDirection.Input);
            cmd.Parameters.Add(DatosDemandaNodo.C_OCTUBRE, OracleDbType.Double, obj.Octubre, System.Data.ParameterDirection.Input);
            cmd.Parameters.Add(DatosDemandaNodo.C_NOVIEMBRE, OracleDbType.Double, obj.Noviembre, System.Data.ParameterDirection.Input);
            cmd.Parameters.Add(DatosDemandaNodo.C_DICIEMBRE, OracleDbType.Double, obj.Diciembre, System.Data.ParameterDirection.Input);
            cmd.Parameters.Add(DatosDemandaNodo.C_FK_PERSONA_NODO, OracleDbType.Int64, obj.FkPersonaNodo, System.Data.ParameterDirection.Input);
            cmd.Parameters.Add(DatosDemandaNodo.C_SEC_LOG, OracleDbType.Int64, obj.SecLog, System.Data.ParameterDirection.Input);
            cmd.Parameters.Add(DatosDemandaNodo.C_D_COD_CATEGORIA_DATO, OracleDbType.Int64, obj.DCodCategoriaDato, System.Data.ParameterDirection.Input);
            cmd.Parameters.Add(DatosDemandaNodo.C_FK_DEMANDA_SALIDA_MAESTRO, OracleDbType.Int64, obj.FkDemandaSalidaMaestro, System.Data.ParameterDirection.Input);

            if (Actualizar(cmd))
            {
                obj.EsNuevo = false;
            }
        }
        public bool Guardar(MC_RPuntoMedicionFormatoDetalle obj)
        {
            bool          resultado = true;
            OracleCommand cmd       = null;
            string        sql       = string.Empty;

            if (obj.EsNuevo)
            {
                Pista p = PistaMgr.Instance.Info("DALSisFalla", obj.GetEstadoString());
                obj.SecLog = (long)p.PK_SecLog;
                obj.PkCodRPtoMedFtoDetalle = GetIdAutoNum("SEC_PK_RMED_CANAL");
                sql = "INSERT INTO {0} ({1},{2},{3},{4},{5},{6},{7},{8},{9},{10})" +
                      "VALUES(:{1},:{2},:{3},:{4},:{5},:{6},:{7},:{8},:{9},:{10})";
            }
            else
            {
                sql = "UPDATE {0} SET " +
                      "{2}=:{2} ," +
                      "{3}=:{3} ," +
                      "{4}=:{4} ," +
                      "{5}=:{5} ," +
                      "{6}=:{6} ," +
                      "{7}=:{7} ," +
                      "{8}=:{8} ," +
                      "{9}=:{9} ," +
                      "{10}=:{10} " +
                      "WHERE {1}=:{1}";
            }

            sql = string.Format(sql, MC_RPuntoMedicionFormatoDetalle.NOMBRE_TABLA,
                                MC_RPuntoMedicionFormatoDetalle.C_PK_RPTO_MED_FTO_DET,
                                MC_RPuntoMedicionFormatoDetalle.C_FK_COD_RPTO_MED_FTO,
                                MC_RPuntoMedicionFormatoDetalle.C_FK_COD_MAGNITUD_ELEC,
                                MC_RPuntoMedicionFormatoDetalle.C_CANAL,
                                MC_RPuntoMedicionFormatoDetalle.C_COL_ARCHIVO,
                                MC_RPuntoMedicionFormatoDetalle.C_KC,
                                MC_RPuntoMedicionFormatoDetalle.C_KCT,
                                MC_RPuntoMedicionFormatoDetalle.C_KPT,
                                MC_RPuntoMedicionFormatoDetalle.C_D_COD_ESTADO,
                                MC_RPuntoMedicionFormatoDetalle.C_SEC_LOG);
            cmd             = CrearCommand();
            cmd.CommandText = sql;
            cmd.BindByName  = true;
            cmd.Parameters.Add(MC_RPuntoMedicionFormatoDetalle.C_PK_RPTO_MED_FTO_DET, OracleDbType.Int64, obj.PkCodRPtoMedFtoDetalle, System.Data.ParameterDirection.Input);
            cmd.Parameters.Add(MC_RPuntoMedicionFormatoDetalle.C_FK_COD_RPTO_MED_FTO, OracleDbType.Int64, obj.FkCodRPtoMedFto, System.Data.ParameterDirection.Input);
            cmd.Parameters.Add(MC_RPuntoMedicionFormatoDetalle.C_FK_COD_MAGNITUD_ELEC, OracleDbType.Int64, obj.FkCodMagnitudElec, System.Data.ParameterDirection.Input);
            cmd.Parameters.Add(MC_RPuntoMedicionFormatoDetalle.C_CANAL, OracleDbType.Int64, obj.Canal, System.Data.ParameterDirection.Input);
            cmd.Parameters.Add(MC_RPuntoMedicionFormatoDetalle.C_COL_ARCHIVO, OracleDbType.Varchar2, obj.ColArchivo, System.Data.ParameterDirection.Input);
            cmd.Parameters.Add(MC_RPuntoMedicionFormatoDetalle.C_KC, OracleDbType.Double, obj.Kc, System.Data.ParameterDirection.Input);
            cmd.Parameters.Add(MC_RPuntoMedicionFormatoDetalle.C_KCT, OracleDbType.Double, obj.Kct, System.Data.ParameterDirection.Input);
            cmd.Parameters.Add(MC_RPuntoMedicionFormatoDetalle.C_KPT, OracleDbType.Double, obj.Kpt, System.Data.ParameterDirection.Input);
            cmd.Parameters.Add(MC_RPuntoMedicionFormatoDetalle.C_D_COD_ESTADO, OracleDbType.Varchar2, obj.DCodEstado, System.Data.ParameterDirection.Input);
            cmd.Parameters.Add(MC_RPuntoMedicionFormatoDetalle.C_SEC_LOG, OracleDbType.Int64, obj.SecLog, System.Data.ParameterDirection.Input);


            try
            {
                cmd.ExecuteNonQuery();
                obj.EsNuevo = false;
            }
            catch (Exception exception)
            {
                PistaMgr.Instance.Error("DALSisFalla", exception);
                resultado = false;
            }
            finally
            {
                DisposeCommand(cmd);
            }
            return(resultado);
        }
        public void Guardar(DatoTecnicoBiomasa obj)
        {
            OracleCommand cmd = null;
            string        sql = string.Empty;

            if (obj.EsNuevo)
            {
                Pista p = PistaMgr.Instance.Info("DALSisFalla", obj.GetEstadoString());
                obj.SecLog           = (long)p.PK_SecLog;
                obj.PkDatoTecBiomasa = GetIdAutoNum("SQ_F_PR_DATO_TEC_BIOMASA");
                sql = "INSERT INTO {0} ({1},{2},{3},{4},{5},{6},{7},{8},{9},{10},{11},{12},{13})" +
                      "VALUES(:{1},:{2},:{3},:{4},:{5},:{6},:{7},:{8},:{9},:{10},:{11},:{12},:{13})";
            }
            else
            {
                sql = "UPDATE {0} SET " +
                      "{2}=:{2} ," +
                      "{3}=:{3} ," +
                      "{4}=:{4} ," +
                      "{5}=:{5} ," +
                      "{6}=:{6} ," +
                      "{7}=:{7} ," +
                      "{8}=:{8} ," +
                      "{9}=:{9} ," +
                      "{10}=:{10} ," +
                      "{11}=:{11} ," +
                      "{12}=:{12} ," +
                      "{13}=:{13}  WHERE {1}=:{1}";
            }

            sql = string.Format(sql, DatoTecnicoBiomasa.NOMBRE_TABLA, DatoTecnicoBiomasa.C_PK_DATO_TEC_BIOMASA,
                                DatoTecnicoBiomasa.C_FK_PROYECTO,
                                DatoTecnicoBiomasa.C_D_COD_TECNOLOGIA_BIOMASA,
                                DatoTecnicoBiomasa.C_POTENCIA_INSTALADA,
                                DatoTecnicoBiomasa.C_NRO_UNIDADES,
                                DatoTecnicoBiomasa.C_PERIODO_OPERACION_MES_DE,
                                DatoTecnicoBiomasa.C_PERIODO_OPERACION_MES_A,
                                DatoTecnicoBiomasa.C_BIOMADA_DISPONIBLE,
                                DatoTecnicoBiomasa.C_CONSUMO_ESPECIFICO,
                                DatoTecnicoBiomasa.C_PORDER_CALORIFICO,
                                DatoTecnicoBiomasa.C_OBSERVACIONES,
                                DatoTecnicoBiomasa.C_SEC_LOG,
                                DatoTecnicoBiomasa.C_FECHA_REGISTRO);
            cmd             = CrearCommand();
            cmd.CommandText = sql;
            cmd.BindByName  = true;
            cmd.Parameters.Add(DatoTecnicoBiomasa.C_PK_DATO_TEC_BIOMASA, OracleDbType.Int64, obj.PkDatoTecBiomasa, System.Data.ParameterDirection.Input);
            cmd.Parameters.Add(DatoTecnicoBiomasa.C_FK_PROYECTO, OracleDbType.Int64, obj.FkProyecto, System.Data.ParameterDirection.Input);
            cmd.Parameters.Add(DatoTecnicoBiomasa.C_D_COD_TECNOLOGIA_BIOMASA, OracleDbType.Int64, obj.DCodTecnologiaBiomasa, System.Data.ParameterDirection.Input);
            cmd.Parameters.Add(DatoTecnicoBiomasa.C_POTENCIA_INSTALADA, OracleDbType.Double, obj.PotenciaInstalada, System.Data.ParameterDirection.Input);
            cmd.Parameters.Add(DatoTecnicoBiomasa.C_NRO_UNIDADES, OracleDbType.Int64, obj.NroUnidades, System.Data.ParameterDirection.Input);
            cmd.Parameters.Add(DatoTecnicoBiomasa.C_PERIODO_OPERACION_MES_DE, OracleDbType.Date, obj.PeriodoOperacionMesDe, System.Data.ParameterDirection.Input);
            cmd.Parameters.Add(DatoTecnicoBiomasa.C_PERIODO_OPERACION_MES_A, OracleDbType.Date, obj.PeriodoOperacionMesA, System.Data.ParameterDirection.Input);
            cmd.Parameters.Add(DatoTecnicoBiomasa.C_BIOMADA_DISPONIBLE, OracleDbType.Double, obj.BiomadaDisponible, System.Data.ParameterDirection.Input);
            cmd.Parameters.Add(DatoTecnicoBiomasa.C_CONSUMO_ESPECIFICO, OracleDbType.Double, obj.ConsumoEspecifico, System.Data.ParameterDirection.Input);
            cmd.Parameters.Add(DatoTecnicoBiomasa.C_PORDER_CALORIFICO, OracleDbType.Double, obj.PorderCalorifico, System.Data.ParameterDirection.Input);
            cmd.Parameters.Add(DatoTecnicoBiomasa.C_OBSERVACIONES, OracleDbType.Varchar2, obj.Observaciones, System.Data.ParameterDirection.Input);
            cmd.Parameters.Add(DatoTecnicoBiomasa.C_SEC_LOG, OracleDbType.Int64, obj.SecLog, System.Data.ParameterDirection.Input);
            cmd.Parameters.Add(DatoTecnicoBiomasa.C_FECHA_REGISTRO, OracleDbType.Date, obj.FechaRegistro, System.Data.ParameterDirection.Input);

            if (Actualizar(cmd))
            {
                obj.EsNuevo = false;
            }
        }
示例#26
0
        public void Guardar(DatosDemandaPersonaBloque obj)
        {
            OracleCommand cmd = null;
            string        sql = string.Empty;

            if (obj.EsNuevo)
            {
                Pista p = PistaMgr.Instance.Info("Demandas", obj.GetEstadoString());
                obj.SecLog = (long)p.PK_SecLog;
                obj.PkDatosDemPersonaBolque = GetIdAutoNum("SQ_DATOS_DEM_PERSONA_BOLQUE");
                sql = "INSERT INTO {0} ({1},{2},{3},{4},{5},{6},{7},{8},{9},{10},{11},{12},{13},{14},{15},{16},{17})" +
                      "VALUES(:{1},:{2},:{3},:{4},:{5},:{6},:{7},:{8},:{9},:{10},:{11},:{12},:{13},:{14},:{15},:{16},:{17})";
            }
            else
            {
                sql = "UPDATE {0} SET " +
                      "{2}=:{2} ," +
                      "{3}=:{3} ," +
                      "{4}=:{4} ," +
                      "{5}=:{5} ," +
                      "{6}=:{6} ," +
                      "{7}=:{7} ," +
                      "{8}=:{8} ," +
                      "{9}=:{9} ," +
                      "{10}=:{10} ," +
                      "{11}=:{11} ," +
                      "{12}=:{12} ," +
                      "{13}=:{13} ," +
                      "{14}=:{14} ," +
                      "{15}=:{15} ," +
                      "{16}=:{16} ," +
                      "{17}=:{17}  WHERE {1}=:{1} ";
            }

            sql = string.Format(sql, DatosDemandaPersonaBloque.NOMBRE_TABLA, DatosDemandaPersonaBloque.C_PK_DATOS_DEM_PERSONA_BOLQUE,
                                DatosDemandaPersonaBloque.C_ANIO,
                                DatosDemandaPersonaBloque.C_NUMERO_POR_ANIO,
                                DatosDemandaPersonaBloque.C_ENERO,
                                DatosDemandaPersonaBloque.C_FEBRERO,
                                DatosDemandaPersonaBloque.C_MARZO,
                                DatosDemandaPersonaBloque.C_ABRIL,
                                DatosDemandaPersonaBloque.C_MAYO,
                                DatosDemandaPersonaBloque.C_JUNIO,
                                DatosDemandaPersonaBloque.C_JULIO,
                                DatosDemandaPersonaBloque.C_AGOSTO,
                                DatosDemandaPersonaBloque.C_SEPTIEMBRE,
                                DatosDemandaPersonaBloque.C_OCTUBRE,
                                DatosDemandaPersonaBloque.C_NOVIEMBRE,
                                DatosDemandaPersonaBloque.C_DICIEMBRE,
                                DatosDemandaPersonaBloque.C_FK_PERSONA,
                                DatosDemandaPersonaBloque.C_SEC_LOG);
            cmd             = CrearCommand();
            cmd.CommandText = sql;
            cmd.BindByName  = true;
            cmd.Parameters.Add(DatosDemandaPersonaBloque.C_PK_DATOS_DEM_PERSONA_BOLQUE, OracleDbType.Int64, obj.PkDatosDemPersonaBolque, System.Data.ParameterDirection.Input);
            cmd.Parameters.Add(DatosDemandaPersonaBloque.C_ANIO, OracleDbType.Int32, obj.Anio, System.Data.ParameterDirection.Input);
            cmd.Parameters.Add(DatosDemandaPersonaBloque.C_NUMERO_POR_ANIO, OracleDbType.Int16, obj.NumeroPorAnio, System.Data.ParameterDirection.Input);
            cmd.Parameters.Add(DatosDemandaPersonaBloque.C_ENERO, OracleDbType.Decimal, obj.Enero, System.Data.ParameterDirection.Input);
            cmd.Parameters.Add(DatosDemandaPersonaBloque.C_FEBRERO, OracleDbType.Decimal, obj.Febrero, System.Data.ParameterDirection.Input);
            cmd.Parameters.Add(DatosDemandaPersonaBloque.C_MARZO, OracleDbType.Decimal, obj.Marzo, System.Data.ParameterDirection.Input);
            cmd.Parameters.Add(DatosDemandaPersonaBloque.C_ABRIL, OracleDbType.Decimal, obj.Abril, System.Data.ParameterDirection.Input);
            cmd.Parameters.Add(DatosDemandaPersonaBloque.C_MAYO, OracleDbType.Decimal, obj.Mayo, System.Data.ParameterDirection.Input);
            cmd.Parameters.Add(DatosDemandaPersonaBloque.C_JUNIO, OracleDbType.Decimal, obj.Junio, System.Data.ParameterDirection.Input);
            cmd.Parameters.Add(DatosDemandaPersonaBloque.C_JULIO, OracleDbType.Decimal, obj.Julio, System.Data.ParameterDirection.Input);
            cmd.Parameters.Add(DatosDemandaPersonaBloque.C_AGOSTO, OracleDbType.Decimal, obj.Agosto, System.Data.ParameterDirection.Input);
            cmd.Parameters.Add(DatosDemandaPersonaBloque.C_SEPTIEMBRE, OracleDbType.Decimal, obj.Septiembre, System.Data.ParameterDirection.Input);
            cmd.Parameters.Add(DatosDemandaPersonaBloque.C_OCTUBRE, OracleDbType.Decimal, obj.Octubre, System.Data.ParameterDirection.Input);
            cmd.Parameters.Add(DatosDemandaPersonaBloque.C_NOVIEMBRE, OracleDbType.Decimal, obj.Noviembre, System.Data.ParameterDirection.Input);
            cmd.Parameters.Add(DatosDemandaPersonaBloque.C_DICIEMBRE, OracleDbType.Decimal, obj.Diciembre, System.Data.ParameterDirection.Input);
            cmd.Parameters.Add(DatosDemandaPersonaBloque.C_FK_PERSONA, OracleDbType.Int64, obj.FkPersona, System.Data.ParameterDirection.Input);
            cmd.Parameters.Add(DatosDemandaPersonaBloque.C_SEC_LOG, OracleDbType.Int64, obj.SecLog, System.Data.ParameterDirection.Input);

            if (Actualizar(cmd))
            {
                obj.EsNuevo = false;
            }
        }
        public void Guardar(SerieHidrologica serieHidrologica)
        {
            OracleCommand cmd = null;
            string        sql = string.Empty;

            if (serieHidrologica.EsNuevo)
            {
                Pista p = PistaMgr.Instance.Info("DALProyectos", serieHidrologica.GetEstadoString());
                serieHidrologica.SecLog             = (long)p.PK_SecLog;
                serieHidrologica.PkSerieHidrologica = GetIdAutoNum("SQ_F_PR_SERIE_HIDROLOGICA");
                sql = "INSERT INTO {0} ({1},{2},{3},{4},{5},{6},{7},{8},{9},{10},{11},{12},{13},{14},{15},{16},{17})" +
                      "VALUES(:{1},:{2},:{3},:{4},:{5},:{6},:{7},:{8},:{9},:{10},:{11},:{12},:{13},:{14},:{15},:{16},:{17})";
            }
            else
            {
                sql = "UPDATE {0} SET " +
                      "{2}=:{2} ," +
                      "{3}=:{3} ," +
                      "{4}=:{4} ," +
                      "{5}=:{5} ," +
                      "{6}=:{6} ," +
                      "{7}=:{7} ," +
                      "{8}=:{8} ," +
                      "{9}=:{9} ," +
                      "{10}=:{10} ," +
                      "{11}=:{11} ," +
                      "{12}=:{12} ," +
                      "{13}=:{13} ," +
                      "{14}=:{14} ," +
                      "{15}=:{15} ," +
                      "{16}=:{16} ," +
                      "{17}=:{17}  WHERE {1}=:{1} ";
            }

            sql = string.Format(sql, SerieHidrologica.NOMBRE_TABLA, SerieHidrologica.C_PK_SERIE_HIDROLOGICA,
                                SerieHidrologica.C_FK_PROYECTO,
                                SerieHidrologica.C_ANIO,
                                SerieHidrologica.C_CAPACIDAD_ENERO,
                                SerieHidrologica.C_CAPACIDAD_FEBRERO,
                                SerieHidrologica.C_CAPACIDAD_MARZO,
                                SerieHidrologica.C_CAPACIDAD_ABRIL,
                                SerieHidrologica.C_CAPACIDAD_MAYO,
                                SerieHidrologica.C_CAPACIDAD_JUNIO,
                                SerieHidrologica.C_CAPACIDAD_JULIO,
                                SerieHidrologica.C_CAPACIDAD_AGOSTO,
                                SerieHidrologica.C_CAPACIDAD_SEPTIEMBRE,
                                SerieHidrologica.C_CAPACIDAD_OCTUBRE,
                                SerieHidrologica.C_CAPACIDAD_NOVIEMBRE,
                                SerieHidrologica.C_CAPACIDAD_DICIEMBRE,
                                SerieHidrologica.C_FECHA_REGISTRO,
                                SerieHidrologica.C_SEC_LOG);
            cmd             = CrearCommand();
            cmd.CommandText = sql;
            cmd.BindByName  = true;
            cmd.Parameters.Add(SerieHidrologica.C_PK_SERIE_HIDROLOGICA, OracleDbType.Int64, serieHidrologica.PkSerieHidrologica, System.Data.ParameterDirection.Input);
            cmd.Parameters.Add(SerieHidrologica.C_FK_PROYECTO, OracleDbType.Int64, serieHidrologica.FkProyecto, System.Data.ParameterDirection.Input);
            cmd.Parameters.Add(SerieHidrologica.C_ANIO, OracleDbType.Varchar2, serieHidrologica.Anio, System.Data.ParameterDirection.Input);
            cmd.Parameters.Add(SerieHidrologica.C_CAPACIDAD_ENERO, OracleDbType.Decimal, serieHidrologica.CapacidadEnero, System.Data.ParameterDirection.Input);
            cmd.Parameters.Add(SerieHidrologica.C_CAPACIDAD_FEBRERO, OracleDbType.Decimal, serieHidrologica.CapacidadFebrero, System.Data.ParameterDirection.Input);
            cmd.Parameters.Add(SerieHidrologica.C_CAPACIDAD_MARZO, OracleDbType.Decimal, serieHidrologica.CapacidadMarzo, System.Data.ParameterDirection.Input);
            cmd.Parameters.Add(SerieHidrologica.C_CAPACIDAD_ABRIL, OracleDbType.Decimal, serieHidrologica.CapacidadAbril, System.Data.ParameterDirection.Input);
            cmd.Parameters.Add(SerieHidrologica.C_CAPACIDAD_MAYO, OracleDbType.Decimal, serieHidrologica.CapacidadMayo, System.Data.ParameterDirection.Input);
            cmd.Parameters.Add(SerieHidrologica.C_CAPACIDAD_JUNIO, OracleDbType.Decimal, serieHidrologica.CapacidadJunio, System.Data.ParameterDirection.Input);
            cmd.Parameters.Add(SerieHidrologica.C_CAPACIDAD_JULIO, OracleDbType.Decimal, serieHidrologica.CapacidadJulio, System.Data.ParameterDirection.Input);
            cmd.Parameters.Add(SerieHidrologica.C_CAPACIDAD_AGOSTO, OracleDbType.Decimal, serieHidrologica.CapacidadAgosto, System.Data.ParameterDirection.Input);
            cmd.Parameters.Add(SerieHidrologica.C_CAPACIDAD_SEPTIEMBRE, OracleDbType.Decimal, serieHidrologica.CapacidadSeptiembre, System.Data.ParameterDirection.Input);
            cmd.Parameters.Add(SerieHidrologica.C_CAPACIDAD_OCTUBRE, OracleDbType.Decimal, serieHidrologica.CapacidadOctubre, System.Data.ParameterDirection.Input);
            cmd.Parameters.Add(SerieHidrologica.C_CAPACIDAD_NOVIEMBRE, OracleDbType.Decimal, serieHidrologica.CapacidadNoviembre, System.Data.ParameterDirection.Input);
            cmd.Parameters.Add(SerieHidrologica.C_CAPACIDAD_DICIEMBRE, OracleDbType.Decimal, serieHidrologica.CapacidadDiciembre, System.Data.ParameterDirection.Input);
            cmd.Parameters.Add(SerieHidrologica.C_FECHA_REGISTRO, OracleDbType.Date, serieHidrologica.FechaRegistro, System.Data.ParameterDirection.Input);
            cmd.Parameters.Add(SerieHidrologica.C_SEC_LOG, OracleDbType.Int64, serieHidrologica.SecLog, System.Data.ParameterDirection.Input);

            if (Actualizar(cmd))
            {
                serieHidrologica.EsNuevo = false;
            }
        }
        public void Init()
        {
            var loader = new TgcSceneLoader();

            Items                = new List <Recolectable>();
            Piezas               = new List <Pieza>();
            Objetos              = new List <Colisionable>();
            MeshARenderizar      = new List <TgcMesh>();
            meshFogatas          = new List <TgcMesh>();
            IluminacionEscenario = new List <Fogata>();



            //Instancia de skybox
            skyBox        = new TgcSkyBox();
            skyBox.Center = TGCVector3.Empty;
            skyBox.Size   = new TGCVector3(9000, 9000, 9000);

            skyBox.setFaceTexture(TgcSkyBox.SkyFaces.Up, MediaDir + "cielo.jpg");
            skyBox.setFaceTexture(TgcSkyBox.SkyFaces.Down, MediaDir + "cielo.jpg");
            skyBox.setFaceTexture(TgcSkyBox.SkyFaces.Left, MediaDir + "cielo.jpg");
            skyBox.setFaceTexture(TgcSkyBox.SkyFaces.Right, MediaDir + "cielo.jpg");

            skyBox.setFaceTexture(TgcSkyBox.SkyFaces.Front, MediaDir + "cielo.jpg");
            skyBox.setFaceTexture(TgcSkyBox.SkyFaces.Back, MediaDir + "cielo.jpg");
            skyBox.SkyEpsilon = 25f;

            skyBox.Init();

            //Instancio la vegetacion
            var scene        = loader.loadSceneFromFile(MediaDir + @"Pino-TgcScene.xml");
            var PinoOriginal = scene.Meshes[0];
            List <TGCVector3> posicionesArboles = new List <TGCVector3>();

            posicionesArboles.Add(new TGCVector3(1, 1, 1));
            posicionesArboles.Add(new TGCVector3(-3442, 1, -2736));
            posicionesArboles.Add(new TGCVector3(-3689, 1, -3039));
            posicionesArboles.Add(new TGCVector3(-3799, 1, -2719));
            posicionesArboles.Add(new TGCVector3(-3417, 1, -2480));
            posicionesArboles.Add(new TGCVector3(-2917, 1, -2433));
            posicionesArboles.Add(new TGCVector3(-3668, 1, -2025));
            posicionesArboles.Add(new TGCVector3(-3362, 1, -2009));
            posicionesArboles.Add(new TGCVector3(-3451, 1, -3786));
            posicionesArboles.Add(new TGCVector3(-4037, 1, -2329));
            posicionesArboles.Add(new TGCVector3(-2885, 1, -1826));
            posicionesArboles.Add(new TGCVector3(-4123, 1, -1581));
            posicionesArboles.Add(new TGCVector3(-3289, 1, -909));
            posicionesArboles.Add(new TGCVector3(-4261, 1, -435));
            posicionesArboles.Add(new TGCVector3(-2883, 1, -655));
            posicionesArboles.Add(new TGCVector3(-3352, 1, -1761));
            posicionesArboles.Add(new TGCVector3(-3244, 1, -2394));
            posicionesArboles.Add(new TGCVector3(-3978, 1, -2572));
            posicionesArboles.Add(new TGCVector3(-3517, 1, -1982));
            posicionesArboles.Add(new TGCVector3(-3118, 1, -1524));
            posicionesArboles.Add(new TGCVector3(-3349, 1, -980));
            posicionesArboles.Add(new TGCVector3(-4110, 1, -407));
            posicionesArboles.Add(new TGCVector3(-3304, 1, -1774));
            posicionesArboles.Add(new TGCVector3(-3139, 1, -1269));
            posicionesArboles.Add(new TGCVector3(-2140, 1, -562));
            posicionesArboles.Add(new TGCVector3(-4094, 1, -145));
            posicionesArboles.Add(new TGCVector3(-3103, 1, -1337));
            posicionesArboles.Add(new TGCVector3(-2896, 1, -1087));
            posicionesArboles.Add(new TGCVector3(-2529, 1, 10));
            posicionesArboles.Add(new TGCVector3(-3917, 1, 772));
            posicionesArboles.Add(new TGCVector3(746, 1, 157));
            posicionesArboles.Add(new TGCVector3(951, 1, 637));
            posicionesArboles.Add(new TGCVector3(1361, 1, 404));
            posicionesArboles.Add(new TGCVector3(1361, 1, 440));
            posicionesArboles.Add(new TGCVector3(-3877, 1, -678));
            posicionesArboles.Add(new TGCVector3(-3997, 1, -1079));
            posicionesArboles.Add(new TGCVector3(-3996, 1, -1617));
            posicionesArboles.Add(new TGCVector3(-3701, 1, -1505));
            posicionesArboles.Add(new TGCVector3(-3761, 1, -1069));
            posicionesArboles.Add(new TGCVector3(-3968, 1, -1952));
            posicionesArboles.Add(new TGCVector3(-3550, 1, -1562));
            posicionesArboles.Add(new TGCVector3(-3557, 1, -1192));
            posicionesArboles.Add(new TGCVector3(-3938, 1, -1048));
            posicionesArboles.Add(new TGCVector3(-3148, 1, -268));
            posicionesArboles.Add(new TGCVector3(-4120, 1, 433));
            posicionesArboles.Add(new TGCVector3(-3136, 1, -135));
            posicionesArboles.Add(new TGCVector3(-2793, 1, -476));


            var indiceArbolDirectorio = (new Random()).Next(posicionesArboles.Count, posicionesArboles.Count + 100);

            arbolesMesh = new List <TgcMesh>();
            Colisionable Arbol;

            for (var i = 0; i < posicionesArboles.Count; i++)
            {
                var Instance = PinoOriginal.createMeshInstance("Pino" + i);
                Arbol = new SinEfecto(Instance);
                Arbol.mesh.Move(0, 0, 0);
                Arbol.mesh.Scale = new TGCVector3(0.05f * i, 0.05f * i, 0.05f * i);
                Arbol.mesh.Move(posicionesArboles[i]);
                Arbol.mesh.Transform = TGCMatrix.Translation(posicionesArboles[i]);
                Objetos.Add(Arbol);
                MeshARenderizar.Add(Arbol.mesh);
                arbolesMesh.Add(Arbol.mesh);
            }

            for (var i = posicionesArboles.Count; i < posicionesArboles.Count + 100; i++)
            {
                var Instance = PinoOriginal.createMeshInstance("Pino" + i);
                if (i == indiceArbolDirectorio)
                {
                    Arbol = new ArbolDirectorio(MediaDir);
                }
                else
                {
                    Arbol = new SinEfecto(Instance);
                }

                Arbol.mesh.Move(0, 0, 0);
                Arbol.mesh.Scale = new TGCVector3(0.01f * i, 0.01f * i, 0.01f * i);
                Arbol.mesh.Move(new TGCVector3(((float)Math.Pow(i, Math.PI) % 2066) + 98, 1, ((float)Math.Pow(i, Math.E) % 3136) - 1339));
                Arbol.mesh.Transform = TGCMatrix.Translation(new TGCVector3(((float)Math.Pow(i, Math.PI) % 2066) + 98, 1, ((float)Math.Pow(i, Math.E) % 3136) - 1339));
                Objetos.Add(Arbol);
                MeshARenderizar.Add(Arbol.mesh);
                arbolesMesh.Add(Arbol.mesh);
            }
            foreach (var mesh in arbolesMesh)
            {
                mesh.AlphaBlendEnable = true;
            }

            //Instancio el terreno (Heigthmap)
            terreno = new TgcSimpleTerrain();
            var pathTextura  = MediaDir + "Textures\\mapa1.jpg";
            var pathHeighmap = MediaDir + "mapa1.jpg";

            currentScaleXZ = 100f;
            currentScaleY  = 3f;
            terreno.loadHeightmap(pathHeighmap, currentScaleXZ, currentScaleY, new TGCVector3(0, -30, 0));
            terreno.loadTexture(pathTextura);

            //Instancio el piso
            var pisoTexture = TgcTexture.createTexture(D3DDevice.Instance.Device, MediaDir + "Textures\\water2.jpg");

            Plano     = new TgcPlane(new TGCVector3(-tamanioMapa / 2, 0, -tamanioMapa / 2), new TGCVector3(tamanioMapa, 0, tamanioMapa), TgcPlane.Orientations.XZplane, pisoTexture, 50f, 50f);
            MeshPlano = Plano.toMesh("MeshPlano");
            Objetos.Add(new SinEfecto(MeshPlano));
            MeshARenderizar.Add(MeshPlano);
            piezaAsociadaLago = new Pieza(2, "Pieza 2", MediaDir + "\\2D\\windows\\windows_2.png", null);
            pistaAsociadaLago = new Pista(null, MediaDir + "\\2D\\pista_hacha.png", null);

            //Instancio la Cabania
            var sceneCabania = loader.loadSceneFromFile(MediaDir + @"cabania-TgcScene.xml");

            foreach (var Mesh in sceneCabania.Meshes)
            {
                Mesh.Move(-500, 20, 500);
                Mesh.Scale = new TGCVector3(4.5f, 4.5f, 4.5f);

                Mesh.Transform = TGCMatrix.Scaling(Mesh.Scale);

                Objetos.Add(new SinEfecto(Mesh));
                MeshARenderizar.Add(Mesh);
            }
            cabaniaBoundingBox = new TgcBoundingAxisAlignBox(new TGCVector3(-500, 20, 500), new TGCVector3(0, 1001, 1080));

            var sceneBridge = loader.loadSceneFromFile(MediaDir + @"Bridge-TgcScene.xml");

            foreach (var Mesh in sceneBridge.Meshes)
            {
                Mesh.Move(-2561, 12, 159);
                Mesh.Scale = new TGCVector3(4.5f, .75f, 1.35f);

                Mesh.Transform = TGCMatrix.Scaling(Mesh.Scale);

                Objetos.Add(new SinEfecto(Mesh));
                MeshARenderizar.Add(Mesh);
            }

            var sceneCanoa = loader.loadSceneFromFile(MediaDir + @"Canoa-TgcScene.xml");

            foreach (var Mesh in sceneCanoa.Meshes)
            {
                Mesh.Move(-482, 20, -3110);
                Mesh.Scale = new TGCVector3(1.5f, 1.5f, 1.5f);

                Mesh.Transform = TGCMatrix.Scaling(Mesh.Scale);

                Objetos.Add(new SinEfecto(Mesh));
                MeshARenderizar.Add(Mesh);
            }

            //Cabania es lugar seguro

            if (TgcCollisionUtils.testAABBAABB(personaje.mesh.BoundingBox, cabaniaBoundingBox))
            {
                personaje.tiempoDesprotegido = 0;
            }
        }
示例#29
0
        public void Guardar(Persona obj)
        {
            OracleCommand cmd = null;
            string        sql = string.Empty;

            if (obj.EsNuevo)
            {
                Pista p = PistaMgr.Instance.Info("DALSisFalla", obj.GetEstadoString());
                obj.SecLog       = (long)p.PK_SecLog;
                obj.PkCodPersona = GetIdAutoNum("SQV_F_AP_PERSONA");
                sql = "INSERT INTO {0} ({1},{2},{3},{4},{5},{6},{7},{8},{9},{10})" +
                      "VALUES(:{1},:{2},:{3},:{4},:{5},:{6},:{7},:{8},:{9},:{10})";
                _esNuevo = true;
            }
            else
            {
                _esNuevo = false;
                sql      = "UPDATE {0} SET " +
                           "{2}=:{2} ," +
                           "{3}=:{3} ," +
                           "{4}=:{4} ," +
                           "{5}=:{5} ," +
                           "{6}=:{6} ," +
                           "{7}=:{7} ," +
                           "{8}=:{8} ," +
                           "{9}=:{9} ," +
                           "{10}=:{10}  WHERE {1}=:{1} ";
            }

            sql = string.Format(sql, NOMBRE_TABLA, Persona.C_PK_COD_PERSONA,
                                Persona.C_NOM_PERSONA,
                                Persona.C_SIGLA,
                                Persona.C_D_COD_TIPO_PERSONA,
                                Persona.C_DIRECCION,
                                Persona.C_TELEFONO,
                                Persona.C_IDENTIFICACION,
                                Persona.C_D_COD_ESTADO,
                                Persona.C_SEC_LOG,
                                Persona.C_SINC_VER);
            cmd             = CrearCommand();
            cmd.CommandText = sql;
            cmd.BindByName  = true;
            cmd.Parameters.Add(Persona.C_PK_COD_PERSONA, OracleDbType.Int64, obj.PkCodPersona, System.Data.ParameterDirection.Input);
            cmd.Parameters.Add(Persona.C_NOM_PERSONA, OracleDbType.Varchar2, obj.Nombre, System.Data.ParameterDirection.Input);
            cmd.Parameters.Add(Persona.C_SIGLA, OracleDbType.Varchar2, obj.Sigla, System.Data.ParameterDirection.Input);
            cmd.Parameters.Add(Persona.C_D_COD_TIPO_PERSONA, OracleDbType.Int64, obj.DCodTipoPersona, System.Data.ParameterDirection.Input);
            cmd.Parameters.Add(Persona.C_DIRECCION, OracleDbType.Varchar2, obj.Direccion, System.Data.ParameterDirection.Input);
            cmd.Parameters.Add(Persona.C_TELEFONO, OracleDbType.Varchar2, obj.Telefono, System.Data.ParameterDirection.Input);
            cmd.Parameters.Add(Persona.C_IDENTIFICACION, OracleDbType.Varchar2, obj.Identificacion, System.Data.ParameterDirection.Input);
            cmd.Parameters.Add(Persona.C_D_COD_ESTADO, OracleDbType.Varchar2, obj.DCodEstado, System.Data.ParameterDirection.Input);
            cmd.Parameters.Add(Persona.C_SEC_LOG, OracleDbType.Int64, obj.SecLog, System.Data.ParameterDirection.Input);
            cmd.Parameters.Add(Persona.C_SINC_VER, OracleDbType.Int64, obj.SincVer, System.Data.ParameterDirection.Input);
            if (Actualizar(cmd))
            {
                obj.EsNuevo = false;
            }
            if (_esNuevo)
            {
                GuardarRPersonaRolSIN(obj.PkCodPersona);
            }
        }
示例#30
0
        public void Guardar(RegFalla regFalla)
        {
            OracleCommand cmd = null;

            if (regFalla.EsNuevo)
            {
                Pista p = PistaMgr.Instance.Info("DALSisFalla", "CodFalla=" + regFalla.CodFalla);
                regFalla.SecLog = p.PK_SecLog;

                cmd             = CrearCommand();
                cmd.CommandText =
                    @"insert into F_GF_REGFALLA 
                (PK_COD_FALLA,GESTION,PK_COD_COMPONENTE,FEC_INICIO,D_COD_CAUSA,DESCRIPCION_CORTA_FALLA,
                 D_COD_ESTADO,SEC_LOG,D_COD_ORIGEN,D_COD_TIPO_DESCONEXION,FK_COD_OPERADOR,DESCRIPCION_FALLA ,
                 FK_COD_SUPERVISOR,D_COD_PROBLEMA_GEN,D_COD_COLAPSO,SINC_VER
                 )
                values 
                (:PK_COD_FALLA,:GESTION,:PK_COD_COMPONENTE,:FEC_INICIO,:D_COD_CAUSA,:DESCRIPCION,:D_COD_ESTADO,
                 :SEC_LOG,:D_COD_ORIGEN,:D_COD_TIPO_DESCONEXION,:FK_COD_OPERADOR,:DESCRIPCION_FALLA ,
                 :FK_COD_SUPERVISOR,:D_COD_PROBLEMA_GEN,:D_COD_COLAPSO,:SINC_VER
                )";
            }
            else
            {
                cmd             = CrearCommand();
                cmd.CommandText = "update F_GF_REGFALLA set " +
                                  "GESTION=:GESTION," +
                                  "PK_COD_COMPONENTE=:PK_COD_COMPONENTE," +
                                  "FEC_INICIO=:FEC_INICIO," +
                                  "D_COD_CAUSA=:D_COD_CAUSA," +
                                  "DESCRIPCION_CORTA_FALLA=:DESCRIPCION," +
                                  "D_COD_ESTADO=:D_COD_ESTADO, " +
                                  "SEC_LOG=:SEC_LOG, " +
                                  "D_COD_ORIGEN=:D_COD_ORIGEN, " +
                                  "D_COD_TIPO_DESCONEXION=:D_COD_TIPO_DESCONEXION, " +
                                  "FK_COD_OPERADOR=:FK_COD_OPERADOR, " +
                                  "DESCRIPCION_FALLA=:DESCRIPCION_FALLA, " +
                                  "FK_COD_SUPERVISOR=:FK_COD_SUPERVISOR, " +
                                  "D_COD_PROBLEMA_GEN=:D_COD_PROBLEMA_GEN, " +
                                  "D_COD_COLAPSO=:D_COD_COLAPSO, " +
                                  "SINC_VER=:SINC_VER " +
                                  "where PK_COD_FALLA=:PK_COD_FALLA";
            }

            cmd.Parameters.Add("PK_COD_FALLA", OracleDbType.Int32, regFalla.CodFalla, System.Data.ParameterDirection.Input);
            cmd.Parameters.Add("GESTION", OracleDbType.Int16, regFalla.Gestion, System.Data.ParameterDirection.Input);
            cmd.Parameters.Add("PK_COD_COMPONENTE", OracleDbType.Decimal, regFalla.CodComponente, System.Data.ParameterDirection.Input);
            cmd.Parameters.Add("FEC_INICIO", OracleDbType.Date, regFalla.FecInicio, System.Data.ParameterDirection.Input);
            cmd.Parameters.Add("D_COD_CAUSA", OracleDbType.Int64, regFalla.CodCausa, System.Data.ParameterDirection.Input);
            cmd.Parameters.Add("DESCRIPCION", OracleDbType.Varchar2, regFalla.Descripcion, System.Data.ParameterDirection.Input);
            cmd.Parameters.Add("D_COD_ESTADO", OracleDbType.Varchar2, regFalla.CodEstado, System.Data.ParameterDirection.Input);
            cmd.Parameters.Add("SEC_LOG", OracleDbType.Decimal, regFalla.SecLog, System.Data.ParameterDirection.Input);
            cmd.Parameters.Add("D_COD_ORIGEN", OracleDbType.Int64, regFalla.CodOrigen, System.Data.ParameterDirection.Input);
            cmd.Parameters.Add("D_COD_TIPO_DESCONEXION", OracleDbType.Int64, regFalla.CodTipoDesconexion, System.Data.ParameterDirection.Input);
            cmd.Parameters.Add("FK_COD_OPERADOR", OracleDbType.Long, regFalla.Fk_cod_operador, System.Data.ParameterDirection.Input);
            cmd.Parameters.Add("DESCRIPCION_FALLA", OracleDbType.Varchar2, regFalla.DescripcionFalla, System.Data.ParameterDirection.Input);
            cmd.Parameters.Add("FK_COD_SUPERVISOR", OracleDbType.Long, regFalla.Fk_cod_supervisor, System.Data.ParameterDirection.Input);
            cmd.Parameters.Add("D_COD_PROBLEMA_GEN", OracleDbType.Long, regFalla.CodProblemasGen, System.Data.ParameterDirection.Input);
            cmd.Parameters.Add("D_COD_COLAPSO", OracleDbType.Long, regFalla.CodColapso, System.Data.ParameterDirection.Input);
            cmd.Parameters.Add("SINC_VER", OracleDbType.Long, regFalla.SincVer, System.Data.ParameterDirection.Input);
            cmd.BindByName = true;

            if (Actualizar(cmd))
            {
                regFalla.EsNuevo = false;
            }
        }
示例#31
0
        public bool Guardar(MC_IntervaloMaestro obj)
        {
            bool          resultado = true;
            OracleCommand cmd       = null;
            string        sql       = string.Empty;

            if (obj.EsNuevo)
            {
                Pista p = PistaMgr.Instance.Info("DALSisFalla", obj.GetEstadoString());
                obj.SecLog = (long)p.PK_SecLog;
                sql        = "INSERT INTO {0} ({1},{2},{3},{4},{5},{6},{7})" +
                             "VALUES(:{1},:{2},:{3},:{4},:{5},:{6},:{7})";
                obj.PkCodIntervaloMaestro = GetIdAutoNum("SEC_PK_COD_INTERVALO_M");
            }
            else
            {
                sql = "UPDATE {0} SET " +
                      "{2}=:{2} ," +
                      "{3}=:{3} ," +
                      "{4}=:{4} ," +
                      "{5}=:{5} ," +
                      "{6}=:{6}, {7}=:{7}  WHERE {1}=:{1}";
            }

            sql = string.Format(sql, MC_IntervaloMaestro.NOMBRE_TABLA, MC_IntervaloMaestro.C_PK_COD_INTERVALO_MAESTRO,
                                MC_IntervaloMaestro.C_NOMBRE,
                                MC_IntervaloMaestro.C_PERIODO_TIEMPO,
                                MC_IntervaloMaestro.C_FECHA_DESDE,
                                MC_IntervaloMaestro.C_FECHA_HASTA,
                                MC_IntervaloMaestro.C_D_COD_ESTADO,
                                MC_IntervaloMaestro.C_SEC_LOG);
            cmd             = CrearCommand();
            cmd.CommandText = sql;
            cmd.BindByName  = true;
            cmd.Parameters.Add(MC_IntervaloMaestro.C_PK_COD_INTERVALO_MAESTRO, OracleDbType.Int64, obj.PkCodIntervaloMaestro, ParameterDirection.Input);
            cmd.Parameters.Add(MC_IntervaloMaestro.C_NOMBRE, OracleDbType.Varchar2, obj.Nombre, ParameterDirection.Input);
            cmd.Parameters.Add(MC_IntervaloMaestro.C_PERIODO_TIEMPO, OracleDbType.Int32, obj.PeriodoTiempo, ParameterDirection.Input);
            cmd.Parameters.Add(MC_IntervaloMaestro.C_FECHA_DESDE, OracleDbType.Date, obj.FechaDesde, ParameterDirection.Input);
            cmd.Parameters.Add(MC_IntervaloMaestro.C_FECHA_HASTA, OracleDbType.Date, obj.FechaHasta, ParameterDirection.Input);
            cmd.Parameters.Add(MC_IntervaloMaestro.C_D_COD_ESTADO, OracleDbType.Int16, obj.DCodEstado, ParameterDirection.Input);
            cmd.Parameters.Add(MC_IntervaloMaestro.C_SEC_LOG, OracleDbType.Int64, obj.SecLog, ParameterDirection.Input);

            try
            {
                cmd.ExecuteNonQuery();
                if (obj.EsNuevo)
                {
                    obj.EsNuevo = false;
                    int totalPeriodosDia = MINUTOS_POR_DIA / obj.PeriodoTiempo;
                    int minutos          = 0;
                    for (int i = 1; i <= totalPeriodosDia; i++)
                    {
                        minutos += obj.PeriodoTiempo;
                        MC_IntervaloDetalle detalle = new MC_IntervaloDetalle();
                        detalle.FkCodIntervaloMaestro = obj.PkCodIntervaloMaestro;
                        detalle.EsNuevo         = true;
                        detalle.HoraIntervalo   = GetHora(minutos);
                        detalle.NumeroIntervalo = i;
                        MC_IntervaloDetalleMgr.Instancia.Guardar(detalle);
                    }
                }
            }
            catch (Exception exception)
            {
                PistaMgr.Instance.Error("DALSisFalla", exception);
                resultado = false;
            }
            finally
            {
                DisposeCommand(cmd);
            }

            return(resultado);
        }