private void feedListBox_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            salva = (sender as ListBox).SelectedItem as Objetos;

              WebBrowserTask wb = new WebBrowserTask();
              wb.Uri = new Uri(salva.link);
              wb.Show();
        }
Esempio n. 2
0
        /// <summary>
        /// Carrega as listboxes.
        /// </summary>
        private void loadItem(string cmpcogrupoatividade)
        {
            try
            {
                ListCampos ls = new ListCampos();
                ListCampo  lc = new ListCampo();
                lc.NomeCampo  = "cmpCoGrupoAtividade";
                lc.TipoCampo  = TipoCampo.Numero;
                lc.ValorCampo = cmpcogrupoatividade;
                ls.Add(lc);

                using (DataTable table = tblItemAtividade.get(Global.GetConnection(), ls))
                {
                    Objetos.LoadCombo(lstItemAtividade, table, "cmpDcItemAtividade", "cmpCoItemAtividade", "cmpDcItemAtividade", true);
                    lstItemAtividade.SelectedIndex = lstItemAtividade.Items.IndexOf(lstItemAtividade.Items.FindByValue(table.Rows[0]["cmpCoItemAtividade"].ToString()));
                    lstItemAtividade_SelectedIndexChanged(lstItemAtividade, EventArgs.Empty);
                }
            }
            catch (Exception ex)
            {
            }
        }
Esempio n. 3
0
        public void AbrirPanelEspecial()
        {
            if (panelEspecial.gameObject.GetComponent <CanvasGroup>().alpha == 0)
            {
                sonidoBoton.Play();
                Objetos.Ocultar(panelEdificiosTipo.gameObject);
                Objetos.Mostrar(panelEspecial.gameObject);

                foreach (Transform boton in panelEspecial.gameObject.transform)
                {
                    GameObject.Destroy(boton.gameObject);
                }

                foreach (Construccion edificio in juego.edificios)
                {
                    if (edificio.categoria == 6)
                    {
                        AñadirBotonEdificios(edificio, panelEspecial);
                    }
                }
            }
        }
Esempio n. 4
0
        /// <summary>
        /// Evento de seleciona ro combobox.
        /// Verifica a empresa desejada.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void cmbEmpresa_SelectedIndexChanged(object sender, EventArgs e)
        {
            try
            {
                ListCampos ls = new ListCampos();
                ListCampo  lc = new ListCampo();
                lc.NomeCampo  = "cmpCoEmpresa";
                lc.TipoCampo  = TipoCampo.Numero;
                lc.ValorCampo = ((ListItem)cmbEmpresa.SelectedItem).Value;
                ls.Add(lc);

                using (DataTable table = tblLocal.Get(Global.GetConnection(), ls))
                {
                    Objetos.LoadCombo(cmbLocal, table, "cmpNoLocal", "cmpCoLocal", "cmpNoLocal", true);
                    cmbLocal_SelectedIndexChanged(cmbLocal, EventArgs.Empty);
                }
            }
            catch (Exception ex)
            {
                Global.ShowError(Global.Title, ex);
            }
        }
Esempio n. 5
0
    public void MostrarPanelBanco()
    {
        if (panelBanco.gameObject.GetComponent <CanvasGroup>().alpha == 0)
        {
            Objetos.Mostrar(panelBanco.gameObject);

            if (BancoCredito1 == true)
            {
                botonBancoCredito1.gameObject.GetComponent <CanvasGroup>().interactable = false;
                botonBancoCredito1.hover = false;
            }

            if (BancoCredito2 == true)
            {
                botonBancoCredito2.gameObject.GetComponent <CanvasGroup>().interactable = false;
                botonBancoCredito2.hover = false;
            }
        }
        else
        {
            Objetos.Ocultar(panelBanco.gameObject);
        }
    }
Esempio n. 6
0
    public void NuevaPartida(bool facil)
    {
        sonido.RatonClick();

        if (facil == false)
        {
            ciudad.Dinero    = 500;
            ciudad.ModoFacil = false;
        }
        else
        {
            ciudad.Dinero    = 2000000;
            ciudad.ModoFacil = true;
        }

        ciudad.PoblacionActual = 0f;
        ciudad.PoblacionTope   = 0f;
        ciudad.TrabajosActual  = 0;
        ciudad.TrabajosTope    = 0;
        ciudad.Comida          = 0f;

        camara.transform.position = new Vector3(10, 60, 10);

        construir.QuitarTodosEdificios();

        escenario.PonerTerreno(null);
        escenario.PonerArboles(null, construir);

        velocidad.arranqueDia  = 70000;
        velocidad.contadorDias = 1;

        ayudaInterfaz.Cargar(ayudaInterfaz.estadoPartida);

        Objetos.Ocultar(nuevaPartida.canvas.gameObject);

        CargarInterfaz();
    }
        public bool Salvar(Cliente cliente, bool Editando)
        {
            if (cliente == null)
            {
                return(false);
            }

            if (Editando)
            {
                for (int i = 0; i < Objetos.Count; i++)
                {
                    if (Objetos[i].Equals(cliente))
                    {
                        Objetos[i] = cliente;
                    }
                }
            }
            else
            {
                Objetos.Add(cliente);
            }

            return(true);
        }
Esempio n. 8
0
        public bool Salvar(Categoria categoria, bool Editando)
        {
            if (categoria == null)
            {
                return(false);
            }

            if (Editando)
            {
                for (int i = 0; i < Objetos.Count; i++)
                {
                    if (Objetos[i].Equals(categoria))
                    {
                        Objetos[i] = categoria;
                    }
                }
            }
            else
            {
                Objetos.Add(categoria);
            }

            return(true);
        }
        /// <summary>
        ///     Genera el pasto en el mapa
        /// </summary>
        /// <param name="cantidad"></param>
        private void CreateGrass(int cantidad)
        {
            TgcMesh grass = Loader.loadSceneFromFile(MediaDir + "Meshes\\Pasto\\Pasto-TgcScene.xml").Meshes[0];

            if (null == Objetos)
            {
                Objetos = new List <InteractiveObject>();
            }

            TgcMesh instance;

            for (int i = 1; i <= cantidad; i++)
            {
                instance           = grass.createMeshInstance(grass.Name + "_" + i);
                instance.Scale     = GameUtils.getRandomScaleVector();
                instance.Position  = GameUtils.getRandomPositionVector();
                instance.Transform = Matrix.Scaling(instance.Scale) * Matrix.Translation(instance.Position);
                instance.updateBoundingBox();
                instance.AlphaBlendEnable = true;
                InteractiveObject interactiveObject = new InteractiveObject("Grass", 1, instance, InteractiveObject.Materials.Plant, InteractiveObject.ObjectTypes.Grass);
                interactiveObject.drops.Add(InventoryObject.ObjectTypes.Seed);
                Objetos.Add(interactiveObject);
            }
        }
Esempio n. 10
0
        /// <summary>
        /// Carrega a combo da tabela tblObraPavimento do banco HzCorporativo.
        /// </summary>
        private void loadObraPavimento()
        {
            try
            {
                ListCampos ls = new ListCampos();
                ListCampo  lc = new ListCampo();
                lc.NomeCampo  = "cmpCoObraGrupoLista";
                lc.TipoCampo  = TipoCampo.Numero;
                lc.ValorCampo = ((HzLibGeneral.Util.HzLogin)Session["login"]).cmpCoObraGrupoLista;
                ls.Add(lc);

                using (DataTable table = tblObraPavimento.Get(Global.GetConnection(), ls))
                {
                    Objetos.LoadCombo(cmbObraPavimento, table, "cmpDcPavimento", "cmpCoObraPavimento", "cmpNuOrdenacao", "--- Selecione o Pavimento ---", true);
                    if (table.Rows.Count > 0)
                    {
                        ViewState["cmpInLogoObra"] = table.Rows[0]["cmpInLogoObra"].ToString() == "True" ? "1" : "0";
                    }
                }


                ls            = new ListCampos();
                lc            = new ListCampo();
                lc.NomeCampo  = "cmpCoPerfil";
                lc.TipoCampo  = TipoCampo.Numero;
                lc.ValorCampo = "12";
                ls.Add(lc);

                DataTable dtTecnicos = tblUsuario.Get(Global.GetConnection(), ls);
                Objetos.LoadCombo(cmbTecnico, dtTecnicos, "cmpNoUsuario", "cmpCoUsuario", "cmpNoUsuario", "--- Selecione o Usuario ---", true);
            }
            catch (Exception ex)
            {
                Global.ShowError(Global.Title, ex);
            }
        }
Esempio n. 11
0
        public bool Salvar(Fornecedor fornecedor, bool Editando)
        {
            if (fornecedor == null)
            {
                return(false);
            }

            if (Editando)
            {
                for (int i = 0; i < Objetos.Count; i++)
                {
                    if (Objetos[i].Equals(fornecedor))
                    {
                        Objetos[i] = fornecedor;
                    }
                }
            }
            else
            {
                Objetos.Add(fornecedor);
            }

            return(true);
        }
Esempio n. 12
0
        public bool Salvar(Produto produto, bool editando)
        {
            if (produto == null)
            {
                return(false);
            }

            if (editando)
            {
                for (int i = 0; i < Objetos.Count; i++)
                {
                    if (Objetos[i].Equals(produto))
                    {
                        Objetos[i] = produto;
                    }
                }
            }
            else
            {
                Objetos.Add(produto);
            }

            return(true);
        }
Esempio n. 13
0
        public void AbrirPanelEdificios()
        {
            sonidoBoton.Play();
            CerrarPaneles();
            menuAbajoIzqInterfaz.CerrarMenu();

            if (panelEdificiosTipo.gameObject.GetComponent <CanvasGroup>().alpha == 0)
            {
                botonConstruir.gameObject.GetComponent <Image>().color = new Color(60f / 255f, 60f / 255f, 60f / 255f, 255f);
                Objetos.Mostrar(panelEdificiosTipo.gameObject);

                Animator animacion = panelEdificiosTipo.GetComponent <Animator>();

                if (animacion != null)
                {
                    animacion.Play("PanelEdificiosTipo", 0, 1f);
                }
            }
            else
            {
                botonConstruir.gameObject.GetComponent <Image>().color = colorTransparente;
                Objetos.Ocultar(panelEdificiosTipo.gameObject);
            }
        }
Esempio n. 14
0
        /// <summary>
        /// Carrega as combos.
        /// </summary>
        private void load()
        {
            try
            {
                txtDataInicial.Text = DateTime.Now.ToString("dd/MM/yyyy");
                txtDataFinal.Text   = DateTime.Now.ToString("dd/MM/yyyy");

                ListCampos ls = new ListCampos();
                ListCampo  lc = new ListCampo();
                lc.NomeCampo  = "cmpCoContratante";
                lc.TipoCampo  = TipoCampo.Numero;
                lc.ValorCampo = ((HzLibGeneral.Util.HzLogin)Session["login"]).cmpCoContratante;
                ls.Add(lc);

                using (DataTable table = tblOrigemOS.Get(Global.GetConnection(), ls))
                {
                    Objetos.LoadCombo(cmbOrigemOS, table, "cmpDcOrigemOS", "cmpCoOrigemOS", "cmpDcOrigemOS", "TODAS", true);
                }
            }
            catch (Exception ex)
            {
                Global.ShowError(Global.Title, ex);
            }
        }
Esempio n. 15
0
        /// <summary>
        ///     Genera las piedras en el mapa
        /// </summary>
        /// <param name="cantidad"></param>
        private void CreateRocks(int cantidad)
        {
            TgcMesh rock = Loader.loadSceneFromFile(MediaDir + "Meshes\\Roca\\Roca-TgcScene.xml").Meshes[0];

            if (null == Objetos)
            {
                Objetos = new List <InteractiveObject>();
            }

            TgcMesh instance;

            for (int i = 1; i <= cantidad; i++)
            {
                instance           = rock.createMeshInstance(rock.Name + "_" + i);
                instance.Scale     = GameUtils.getRandomScaleVector() * 0.2f;
                instance.Position  = GameUtils.getRandomPositionVector();
                instance.Transform = Matrix.Scaling(instance.Scale) * Matrix.Translation(instance.Position);
                instance.updateBoundingBox();
                //instance.AlphaBlendEnable = true;
                InteractiveObject interactiveObject = new InteractiveObject("Rock", 1, instance, InteractiveObject.Materials.Rock, InteractiveObject.ObjectTypes.Rock);
                interactiveObject.drops.Add(InventoryObject.ObjectTypes.Rock);
                Objetos.Add(interactiveObject);
            }
        }
Esempio n. 16
0
        /// <summary>
        /// Retorna materiais da obra (tblObraGrupoMaterial).
        /// </summary>
        private bool CarregaMaterialObra()
        {
            try
            {
                string Material = txtMaterial.Text.ToString();

                ListCampos ls = new ListCampos();
                ListCampo  lc = new ListCampo();

                lc            = new ListCampo();
                lc.NomeCampo  = "cmpCoObraGrupoLista";
                lc.TipoCampo  = TipoCampo.Numero;
                lc.ValorCampo = ((HzLibGeneral.Util.HzLogin)Session["login"]).cmpCoObraGrupoLista;
                ls.Add(lc);

                //lc.NomeCampo = "cmpCoObraGrupo";
                //lc.TipoCampo = TipoCampo.Numero;
                //lc.ValorCampo = ViewState["cmpCoObraGrupo"].ToString();
                //ls.Add(lc);

                if (Char.IsNumber(txtMaterial.Text.ToString(), 0))
                {
                    lc            = new ListCampo();
                    lc.NomeCampo  = "cmpDcItem";
                    lc.Sinal      = SinalPesquisa.Igual;
                    lc.ValorCampo = txtMaterial.Text;
                    ls.Add(lc);
                }
                else
                {
                    lc            = new ListCampo();
                    lc.NomeCampo  = "cmpDcMaterialObraGrupo COLLATE Latin1_General_CI_AI";
                    lc.TipoCampo  = TipoCampo.Like;
                    lc.Sinal      = SinalPesquisa.Like;
                    lc.Percent    = TipoPercent.InicioFim;
                    lc.ValorCampo = txtMaterial.Text;
                    ls.Add(lc);
                }
                if (rbdTipo.SelectedValue.ToString() != "2")
                {
                    lc            = new ListCampo();
                    lc.NomeCampo  = "cmpInServico";
                    lc.TipoCampo  = TipoCampo.Numero;
                    lc.ValorCampo = rbdTipo.SelectedValue.ToString();
                    ls.Add(lc);
                }

                DtMaterial = tblObraGrupoMaterial.RetornarMaterialObra(Global.GetConnection(), ls);

                using (DtMaterial)
                {
                    if (DtMaterial != null && DtMaterial.Rows.Count > 0)
                    {
                        Objetos.LoadCombo(lstMaterial1, DtMaterial, "cmpDcMaterial", "cmpCoObraGrupoMaterial", "cmpDcMaterial", true);
                        lstMaterial1.SelectedIndex = 0;
                        lstMaterial1_SelectedIndexChanged1(lstMaterial1, EventArgs.Empty);
                        return(true);
                    }
                    else
                    {
                        lstMaterial1.Items.Clear();
                        return(false);
                    }
                }
            }
            catch (Exception ex)
            {
                Global.ShowError(Global.Title, ex);
                return(false);
            }
        }
Esempio n. 17
0
        //-----------------------------------------------------

        public void CerrarTodo()
        {
            botonConstruir.gameObject.GetComponent <Image>().color = colorTransparente;
            Objetos.Ocultar(panelEdificiosTipo.gameObject);
            CerrarPaneles();
        }
Esempio n. 18
0
        public static bool UpdateObject(Object update, Objetos type)
        {
            bool sucesso = false;

            // Abre ou cria database
            using (var db = new LiteDatabase(@"DatabaseAthos.db"))
            {
                try
                {
                    switch (type)
                    {
                    case Objetos.Assunto:

                        Assunto assunto  = (Assunto)update;
                        var     assuntos = db.GetCollection <Assunto>("Assuntos");
                        var     resultA  = assuntos.Find(x => x.Id == assunto.Id).FirstOrDefault();
                        resultA.TipoAssunto = assunto.TipoAssunto;

                        assuntos.Update(resultA);
                        sucesso = true;
                        break;

                    case Objetos.Condominio:

                        Condominio condo       = (Condominio)update;
                        var        condomonios = db.GetCollection <Condominio>("Condominios");
                        var        resultC     = condomonios.Find(x => x.Id == condo.Id).FirstOrDefault();
                        resultC.NomeCondominio   = condo.NomeCondominio;
                        resultC.IdAdministradora = condo.IdAdministradora;
                        resultC.Responsavel      = condo.Responsavel;

                        condomonios.Update(resultC);
                        sucesso = true;
                        break;

                    case Objetos.Usuario:

                        Usuario usu      = (Usuario)update;
                        var     usuarios = db.GetCollection <Usuario>("Usuarios");
                        var     resultU  = usuarios.Find(x => x.Id == usu.Id).FirstOrDefault();
                        resultU.IdCondominio = usu.IdCondominio;
                        resultU.Email        = usu.Email;
                        resultU.TipoUsuario  = usu.TipoUsuario;
                        resultU.Nome         = usu.Nome;
                        usuarios.Update(resultU);
                        sucesso = true;
                        break;

                    case Objetos.Administradora:
                        Administradora adm             = (Administradora)update;
                        var            administradoras = db.GetCollection <Administradora>("Administradoras");
                        var            resultAd        = administradoras.Find(x => x.Id == adm.Id).FirstOrDefault();
                        resultAd.NomeAdministradora = adm.NomeAdministradora;
                        administradoras.Update(resultAd);
                        sucesso = true;
                        break;
                    }

                    db.Dispose();
                }
                catch (Exception e)
                {
                    return(false);
                }
            }
            return(sucesso);
        }
Esempio n. 19
0
 public void agregarObjetos(Objeto s)
 {
     Objetos.AddLast(s);
 }
        private void feedListBox_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {

              salva = (sender as ListBox).SelectedItem as Objetos;
                  
        }
Esempio n. 21
0
        public void CerrarAyuda6o7(Panel ayuda)
        {
            sonido.RatonClick();

            Objetos.Ocultar(ayuda.gameObject);
        }
Esempio n. 22
0
 private void OcultarAlerta()
 {
     Objetos.Ocultar(panelAlertas.gameObject);
 }
Esempio n. 23
0
        public void CargarInicio()
        {
            if (PlayerPrefs.HasKey("sombras") == false)
            {
                PlayerPrefs.SetInt("sombras", 1);
                toggleSombras.isOn = true;
            }
            else
            {
                if (PlayerPrefs.GetInt("sombras") == 0)
                {
                    toggleSombras.isOn = false;
                }
                else
                {
                    toggleSombras.isOn = true;
                }
            }

            if (toggleSombras.isOn == true)
            {
                QualitySettings.shadows = ShadowQuality.HardOnly;

                Objetos.Mostrar(panelGraficosSombrasCalidad.gameObject);
            }
            else
            {
                QualitySettings.shadows = ShadowQuality.Disable;

                Objetos.Ocultar(panelGraficosSombrasCalidad.gameObject);
            }

            //-----------------------------------------------------------

            idioma.TraduccionesDpSombras();

            if (PlayerPrefs.HasKey("sombrasCalidad") == false)
            {
                PlayerPrefs.SetInt("sombrasCalidad", 1);
            }

            dpSombras.value = PlayerPrefs.GetInt("sombrasCalidad");

            if (dpSombras.value == 0)
            {
                QualitySettings.shadowProjection = ShadowProjection.StableFit;
            }
            else if (dpSombras.value == 1)
            {
                QualitySettings.shadowProjection = ShadowProjection.CloseFit;
            }

            //-----------------------------------------------------------

            dpTexturas.options.Add(new Dropdown.OptionData()
            {
                text = "Full Res"
            });
            dpTexturas.options.Add(new Dropdown.OptionData()
            {
                text = "Half Res"
            });
            dpTexturas.options.Add(new Dropdown.OptionData()
            {
                text = "Quarter Res"
            });
            dpTexturas.options.Add(new Dropdown.OptionData()
            {
                text = "Eighth Res"
            });

            if (PlayerPrefs.HasKey("texturas") == false)
            {
                PlayerPrefs.SetInt("texturas", 0);
            }

            dpTexturas.value = PlayerPrefs.GetInt("texturas");

            QualitySettings.masterTextureLimit = dpTexturas.value;

            //-----------------------------------------------------------

            dpAntiAliasing.options.Add(new Dropdown.OptionData()
            {
                text = "Disasbled"
            });
            dpAntiAliasing.options.Add(new Dropdown.OptionData()
            {
                text = "2x"
            });
            dpAntiAliasing.options.Add(new Dropdown.OptionData()
            {
                text = "4x"
            });
            dpAntiAliasing.options.Add(new Dropdown.OptionData()
            {
                text = "8x"
            });

            if (PlayerPrefs.HasKey("antiAliasing") == false)
            {
                PlayerPrefs.SetInt("antiAliasing", 1);
            }

            dpAntiAliasing.value = PlayerPrefs.GetInt("antiAliasing");

            if (dpAntiAliasing.value == 0)
            {
                QualitySettings.antiAliasing = 0;
            }
            else if (dpAntiAliasing.value == 1)
            {
                QualitySettings.antiAliasing = 2;
            }
            else if (dpAntiAliasing.value == 2)
            {
                QualitySettings.antiAliasing = 4;
            }
            else if (dpAntiAliasing.value == 3)
            {
                QualitySettings.antiAliasing = 8;
            }
        }
Esempio n. 24
0
    public void Start()
    {
        TextAsset texto = Resources.Load <TextAsset>("teste");

        m_Puzzle = JsonUtility.FromJson <Objetos>(texto.text);
    }
Esempio n. 25
0
        /// <summary>
        /// Carrega dados da OS.
        /// </summary>
        private void loadOS()
        {
            try
            {
                ListCampos ls = new ListCampos();
                ListCampo  lc = new ListCampo();
                lc.NomeCampo  = "cmpIdOS";
                lc.TipoCampo  = TipoCampo.Numero;
                lc.ValorCampo = ViewState["cmpIdOS"].ToString();
                ls.Add(lc);

                using (DataTable table = tblOS.Get(Global.GetConnection(), ls))
                {
                    cmbObra.SelectedIndex = Objetos.RetornaIndiceCombo(cmbObra, long.Parse(table.Rows[0]["cmpCoObraGrupoLista"].ToString()));
                    cmbObra_SelectedIndexChanged(cmbObra, EventArgs.Empty);

                    if (table.Rows[0]["cmpIdPreventivaAgenda"].ToString() != "")
                    {
                        for (int i = cmbOrigemOS.Items.Count - 1; i >= 0; i--)
                        {
                            if (cmbOrigemOS.Items[i].Text != "PREVENTIVA")
                            {
                                cmbOrigemOS.Items.Remove(cmbOrigemOS.Items[i]);
                            }
                        }
                        lblNuPreventiva.Visible = true;
                        lblNuPreventiva.Text    = "Preventiva Número ==> " + table.Rows[0]["cmpNuPreventivaAgenda"].ToString();
                    }
                    cmbOrigemOS.SelectedIndex = Objetos.RetornaIndiceCombo(cmbOrigemOS, long.Parse(table.Rows[0]["cmpCoOrigemOS"].ToString()));

                    cmbFormaSolicitacao.SelectedIndex = Objetos.RetornaIndiceCombo(cmbFormaSolicitacao, long.Parse(table.Rows[0]["cmpIdFormaSolicitacao"].ToString()));

                    cmbTipoAtividade.SelectedIndex = Objetos.RetornaIndiceCombo(cmbTipoAtividade, long.Parse(table.Rows[0]["cmpCoTipoAtividade"].ToString()));
                    cmbTipoAtiviade_SelectedIndexChanged(cmbTipoAtividade, EventArgs.Empty);

                    cmbSolicitacao.SelectedIndex = Objetos.RetornaIndiceCombo(cmbSolicitacao, long.Parse(table.Rows[0]["cmpCoDescricaoSolicitacao"].ToString()));

                    cmbObraPavimento.SelectedIndex = Objetos.RetornaIndiceCombo(cmbObraPavimento, long.Parse(table.Rows[0]["cmpCoObraPavimento"].ToString()));

                    txtLocal.Text        = table.Rows[0]["cmpDcLocal"].ToString().Trim();
                    txtSetor.Text        = table.Rows[0]["cmpNoSetor"].ToString().Trim();
                    txtSolicitante.Text  = table.Rows[0]["cmpNoSolicitante"].ToString().Trim();
                    txtTelefone.Text     = table.Rows[0]["cmpNuTelefone"].ToString().Trim();
                    txtEmail.Text        = table.Rows[0]["cmpEeEmail"].ToString().Trim();
                    txtObservacoes.Text  = table.Rows[0]["cmpDcObservacoes"].ToString().Trim();
                    txtNuDemanda.Text    = table.Rows[0]["cmpNuDemandaCliente"].ToString().Trim();
                    ViewState["cmpIdOS"] = table.Rows[0]["cmpIdOs"].ToString();

                    imgAndamento.Visible      = true;
                    lbOSAndamento.Visible     = true;
                    grdOSAndamento.DataSource = loadOSAndamento();
                    grdOSAndamento.DataBind();

                    switch (table.Rows[0]["cmpStOS"].ToString())
                    {
                    case "S":     // Concluída
                        lblConclusao.Visible = true;
                        ImgConclusao.Visible = true;
                        txtDtInicio.Text     = (DateTime.Parse(table.Rows[0]["cmpDtInicioAtendimento"].ToString()).ToString()).Substring(0, 16);
                        txtConclusao.Text    = (DateTime.Parse(table.Rows[0]["cmpDtConclusaoAtendimento"].ToString()).ToString()).Substring(0, 16);
                        txtAtestado.Text     = table.Rows[0]["cmpNoAtestador"].ToString();
                        txtConcluido.Text    = table.Rows[0]["cmpNoExecutor"].ToString();
                        txtObs.Text          = table.Rows[0]["cmpDcObservacaoConclusao"].ToString();
                        if (table.Rows[0]["cmpInSatisfacaoCliente"].ToString() != "")
                        {
                            lblSatisfacaoServico.Text = table.Rows[0]["cmpInSatisfacaoCliente"].ToString() == "True" ? "SIM" : "NÃO";
                        }
                        break;

                    case "C":      // Cancelada
                        lblJustifica.Visible  = true;
                        ImgJustifica.Visible  = true;
                        lblJustifica.Text     = "Justificativa do Cancelamento da Ordem de Serviço";
                        TxtJustificativa.Text = table.Rows[0]["cmpDcObservacaoConclusao"].ToString();
                        break;

                    case "R":      // Reprovação Parcial
                        lblJustifica.Visible  = true;
                        ImgJustifica.Visible  = true;
                        lblJustifica.Text     = "Justificativa da Reprovação Parcial da Ordem de Serviço";
                        TxtJustificativa.Text = table.Rows[0]["cmpDcObservacaoConclusao"].ToString();
                        break;

                    case "D":     // Exclusão
                        lblJustifica.Visible  = true;
                        ImgJustifica.Visible  = true;
                        lblJustifica.Text     = "Justificativa da Exclusão da Ordem de Serviço";
                        TxtJustificativa.Text = table.Rows[0]["cmpDcObservacaoConclusao"].ToString();
                        break;
                    }

                    controlaSituacaoOS(table.Rows[0]["cmpStOS"].ToString());

                    lblNumeroOS.Text = "Ordem de Serviço Número ==> " + table.Rows[0]["cmpNuOS"].ToString();

                    txtDtAbertura.Text = table.Rows[0]["cmpDtAbertura"].ToString();
                }
            }
            catch (Exception ex)
            {
                Global.ShowError(Global.Title, ex);
            }
        }
Esempio n. 26
0
        //Sistema de dibujo
        //Objetivo: Dibujar los planos en todos los lienzos.

        private void dibujar()
        {
            //Cronometro de progress bar
            Stopwatch cropro = new Stopwatch();

            cropro.Start();



            Random azar = new Random();
            //Variable para busqueda de origen
            int x_ori = Convert.ToInt32(ui_min_ancho_casa.Value) * 100, y_ori = Convert.ToInt32(ui_min_alto_casa.Value) * 100;

            List <Info_forma>        lista_casas = new List <Info_forma>();
            List <Composicion_calle> lista_comp_calles = new List <Composicion_calle>();
            List <Point>             lista_puntos_calles = new List <Point>();

            //Subsitema #1: calculo de area ciudad

            //Calculo del margen del area de dibujo, para que las formas no sobresalgan
            int margen_ancho = Convert.ToInt32(ui_max_ancho_casa.Value) * 100;
            int margen_alto  = Convert.ToInt32(ui_max_alto_casa.Value) * 100;

            //-------

            int ancho_lienzo = 0, alto_lienzo = 0, area = 0;

            List <int> anchos = new List <int>();
            List <int> altos  = new List <int>();

            for (int i = 0; i < ui_cantidad_casas.Value; i++)
            {
                anchos.Add(azar.Next(Convert.ToInt32(ui_min_ancho_casa.Value), Convert.ToInt32(ui_max_ancho_casa.Value) + 1));
                altos.Add(azar.Next(Convert.ToInt32(ui_min_alto_casa.Value), Convert.ToInt32(ui_max_alto_casa.Value) + 1));
            }
            for (int x = 0; x < ui_cantidad_casas.Value; x++)
            {
                int precalculo = (anchos[x] * altos[x]) * 100;
                area = area + precalculo;
            }

            ancho_lienzo = alto_lienzo = (int)Math.Sqrt(area) * 10;

            float por_ancho = (float)(ancho_lienzo * (Convert.ToInt32(ui_porcentaje_sin_casas.Value) * 0.01));

            ancho_lienzo = (int)(ancho_lienzo + por_ancho);
            ancho_lienzo = ancho_lienzo + margen_ancho;

            float por_alto = (float)(alto_lienzo * (Convert.ToInt32(ui_porcentaje_sin_casas.Value) * 0.01));

            alto_lienzo = (int)(alto_lienzo + por_alto);
            alto_lienzo = alto_lienzo + margen_alto;

            //Mostrar area de ciudad

            ui_label_m2.Text = Convert.ToString((ancho_lienzo / 100 * alto_lienzo / 100));

            //Llamada a la función que crea los lienzos

            crear_pages_area_casas(ancho_lienzo, alto_lienzo);

            //Pintado en el fondo del picture box

            PictureBox primer_nivel = (PictureBox)TabControl.TabPages[0].Controls.Find("Planta 0", true)[0];
            Graphics   fondo        = Graphics.FromImage(primer_nivel.Image);
            Brush      brocha_fondo = new SolidBrush(Color.DarkGreen);

            fondo.FillRectangle(brocha_fondo, new Rectangle(new Point(0, 0), new Size(ancho_lienzo, alto_lienzo)));


            //Subsistema # 2 creación de calles

            if (ui_calle_cuadricula.Checked == true)
            {
                //Se dibujan las veredas (Calle base)
                int dist_entre_cll = Convert.ToInt32(ui_espacio_calles.Value) * 100;

                for (int y = dist_entre_cll; y < alto_lienzo; y += dist_entre_cll)
                {
                    int ancho_calle  = azar.Next(Convert.ToInt32(ui_min_ancho_calle.Value), Convert.ToInt32(ui_max_ancho_calle.Value));
                    int ancho_vereda = azar.Next(Convert.ToInt32(ui_min_ancho_ver.Value), Convert.ToInt32(ui_max_ancho_ver.Value));
                    lista_comp_calles.Add(new Composicion_calle(new Pen(Color.White, (ancho_calle + ancho_vereda) * 100), new Pen(Color.FromArgb(88, 88, 88), ancho_calle * 100), new Point(0, y), new Point(ancho_lienzo, y)));
                }
                for (int x = dist_entre_cll; x < ancho_lienzo; x += dist_entre_cll)
                {
                    int ancho_calle  = azar.Next(Convert.ToInt32(ui_min_ancho_calle.Value), Convert.ToInt32(ui_max_ancho_calle.Value));
                    int ancho_vereda = azar.Next(Convert.ToInt32(ui_min_ancho_ver.Value), Convert.ToInt32(ui_max_ancho_ver.Value));
                    lista_comp_calles.Add(new Composicion_calle(new Pen(Color.White, (ancho_calle + ancho_vereda) * 100), new Pen(Color.FromArgb(88, 88, 88), ancho_calle * 100), new Point(x, 0), new Point(x, alto_lienzo)));
                }
                for (int i = 0; i < lista_comp_calles.Count; i++)
                {
                    fondo.DrawLine(lista_comp_calles[i].calle_base, lista_comp_calles[i].inicio, lista_comp_calles[i].fin);
                    primer_nivel.Refresh();
                }

                //Subsistema # 2.1 Deteccion de pixeles blancos "Pixeles de linea base"
                lista_puntos_calles = Herramienta.obtener_coor_pixel_blancos((Bitmap)primer_nivel.Image);

                //Se dibujan las calles
                for (int i = 0; i < lista_comp_calles.Count; i++)
                {
                    fondo.DrawLine(lista_comp_calles[i].calle, lista_comp_calles[i].inicio, lista_comp_calles[i].fin);
                    primer_nivel.Refresh();
                }
            }
            else if (ui_calle_incompleta.Checked == true)
            {
                //Se dibujan las veredas (Calle base)
                int dist_entre_cll = Convert.ToInt32(ui_espacio_calles.Value) * 100;
                int longitud_x     = ancho_lienzo / dist_entre_cll;
                int longitud_y     = alto_lienzo / dist_entre_cll;
                //Pen dash_street = new Pen(Color.Yellow,20);
                //dash_street.DashStyle = DashStyle.Dash;

                for (int y = dist_entre_cll; y < alto_lienzo; y += dist_entre_cll)
                {
                    int ancho_calle  = azar.Next(Convert.ToInt32(ui_min_ancho_calle.Value), Convert.ToInt32(ui_max_ancho_calle.Value));
                    int ancho_vereda = azar.Next(Convert.ToInt32(ui_min_ancho_ver.Value), Convert.ToInt32(ui_max_ancho_ver.Value));
                    lista_comp_calles.Add(new Composicion_calle(new Pen(Color.White, (ancho_calle + ancho_vereda) * 100), new Pen(Color.FromArgb(88, 88, 88), ancho_calle * 100), new Point(azar.Next(0, longitud_x - 1) * dist_entre_cll, y), new Point(azar.Next(3, longitud_x + 2) * dist_entre_cll, y)));
                }
                for (int x = dist_entre_cll; x < ancho_lienzo; x += dist_entre_cll)
                {
                    int ancho_calle  = azar.Next(Convert.ToInt32(ui_min_ancho_calle.Value), Convert.ToInt32(ui_max_ancho_calle.Value));
                    int ancho_vereda = azar.Next(Convert.ToInt32(ui_min_ancho_ver.Value), Convert.ToInt32(ui_max_ancho_ver.Value));
                    lista_comp_calles.Add(new Composicion_calle(new Pen(Color.White, (ancho_calle + ancho_vereda) * 100), new Pen(Color.FromArgb(88, 88, 88), ancho_calle * 100), new Point(x, azar.Next(0, longitud_y - 1)), new Point(x, azar.Next(3, longitud_y + 2) * dist_entre_cll)));
                }
                for (int i = 0; i < lista_comp_calles.Count; i++)
                {
                    fondo.DrawLine(lista_comp_calles[i].calle_base, lista_comp_calles[i].inicio, lista_comp_calles[i].fin);
                    primer_nivel.Refresh();
                }

                //Subsistema # 2.1 Deteccion de pixeles blancos "Pixeles de linea base"
                lista_puntos_calles = Herramienta.obtener_coor_pixel_blancos((Bitmap)primer_nivel.Image);

                //Se dibujan las calles
                for (int i = 0; i < lista_comp_calles.Count; i++)
                {
                    fondo.DrawLine(lista_comp_calles[i].calle, lista_comp_calles[i].inicio, lista_comp_calles[i].fin);
                    //fondo.DrawLine(dash_street, lista_comp_calles[i].inicio, lista_comp_calles[i].fin);
                    primer_nivel.Refresh();
                }
            }
            else if (ui_calle_curvilineal.Checked == true)
            {
            }
            else if (ui_calle_callejones.Checked == true)
            {
            }



            //MessageBox.Show(Convert.ToString(lista_puntos_calles.Count));


            //Subsistema # 3 de recoleccion de datos: casas

            Stopwatch cronometro = new Stopwatch();

            cronometro.Start();



            for (int ubicacion_datos = 0; ubicacion_datos < ui_cantidad_casas.Value; ubicacion_datos++)
            {
                //Actualización del progress bar #1

                barra.Value = (int)cropro.Elapsed.TotalSeconds;



                if (cronometro.ElapsedMilliseconds >= Convert.ToInt32(ui_tiempo_espera.Value) * 1000)
                {
                    MessageBox.Show("Superó el tiempo limite ", "Operación cancelada", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                    return;
                }


                //Guardo en una variable el valor para los grados
                int grados = 0;
                if (ui_checkbox_girar.Checked)
                {
                    grados = azar.Next(0, 361);
                }
                else
                {
                    int seleccionar = azar.Next(0, 4);
                    switch (seleccionar)
                    {
                    case 0: grados = 90;
                        break;

                    case 1: grados = 180;
                        break;

                    case 2: grados = 270;
                        break;

                    case 3: grados = 360;
                        break;
                    }
                }

                List <String> nombres_de_formas = new List <string>();
                nombres_de_formas.Add("ui_forma_casa_rectangular");
                //nombres_de_formas.Add("ui_forma_casa_hexagonal");
                nombres_de_formas.Add("ui_forma_casa_deformada");
                nombres_de_formas.Add("ui_forma_casa_deformada_chaflan");

                String vano_ventana_seleccionado = ui_group_box_vanos_ventanas.Controls.OfType <RadioButton>().FirstOrDefault(r => r.Checked).Name;

                //En caso de que una de las casas no encaje y pasaron mas de 10 segundos cambiara su tamaño

                if (cronometro.ElapsedMilliseconds > Convert.ToInt32(ui_tiempo_espera.Value) * 1000 - (Convert.ToInt32(ui_tiempo_espera.Value) * 1000 * 0.1)) //Espera el 90% del tiempo de respuesta
                {
                    anchos[ubicacion_datos] = azar.Next(Convert.ToInt32(ui_min_ancho_casa.Value), Convert.ToInt32(ui_max_ancho_casa.Value) + 1);
                    altos[ubicacion_datos]  = azar.Next(Convert.ToInt32(ui_min_alto_casa.Value), Convert.ToInt32(ui_max_alto_casa.Value) + 1);
                }

                //Subsistema 3.1 seleccion de punto origen segun la distribución

                Point origen = new Point();

                String distribucion_seleccionado = ui_group_box_distribucion.Controls.OfType <RadioButton>().FirstOrDefault(r => r.Checked).Name;

                switch (distribucion_seleccionado)
                {
                case "ui_distribucion_aleatoria":
                    origen = Herramienta.seleccionar_punto_cuadricula(ancho_lienzo - margen_ancho, alto_lienzo - margen_alto, 100, Convert.ToInt32(ui_min_ancho_casa.Value) * 100, Convert.ToInt32(ui_min_alto_casa.Value) * 100);
                    //100 es el multiplo
                    break;

                case "ui_distribucion_columnas":
                    if (y_ori >= (alto_lienzo - Convert.ToInt32(ui_max_alto_casa.Value) * 100) - 400)
                    {
                        x_ori = x_ori + 100;
                        y_ori = Convert.ToInt32(ui_min_alto_casa.Value) * 100;
                    }
                    origen = new Point(x_ori, y_ori);
                    y_ori  = y_ori + 100;
                    break;

                case "ui_distribucion_filas":
                    if (x_ori >= (ancho_lienzo - Convert.ToInt32(ui_max_ancho_casa.Value) * 100) - 400)
                    {
                        x_ori = Convert.ToInt32(ui_min_ancho_casa.Value) * 100;
                        y_ori = y_ori + 100;
                    }
                    origen = new Point(x_ori, y_ori);
                    x_ori  = x_ori + 100;
                    break;
                }

                //Aqui empieza la recollecion de la informacion para las casas

                Info_forma nueva_casa = new Info_forma
                                        (
                    ancho_lienzo,
                    alto_lienzo,
                    anchos[ubicacion_datos],
                    altos[ubicacion_datos],
                    azar.Next(Convert.ToInt32(ui_min_grosor_pared.Value), Convert.ToInt32(ui_max_grosor_pared.Value)),
                    origen, //origen de la forma (casa)
                    new Point(),
                    azar.Next(Convert.ToInt32(ui_pilar_cubico_med_min.Value), Convert.ToInt32(ui_pilar_cubico_med_max.Value)),
                    azar.Next(Convert.ToInt32(ui_pilar_round_med_min.Value), Convert.ToInt32(ui_pilar_round_med_max.Value)),
                    azar.Next(1, Convert.ToInt32(ui_cantidad_pisos.Value) + 1),
                    grados,
                    azar.Next(10, 20), // Este numero se multiplica por el valor de la columna Ej 3 espacio = 90 (30CM)
                    azar.Next(1, 5),
                    ui_checkbox_girar.Checked,
                    Posibilidad,
                    Distancia,
                    ui_pegar_casas.Checked,
                    vano_ventana_seleccionado,
                    nombres_de_formas[azar.Next(0, nombres_de_formas.Count)],
                    azar.Next(Convert.ToInt32(ui_pilar_prox_min.Value), Convert.ToInt32(ui_pilar_prox_max.Value)),
                    azar.Next(Convert.ToInt32(ui_vano_puerta_cant_min.Value), Convert.ToInt32(ui_vano_puerta_cant_max.Value))
                                        );

                nueva_casa.resp_alto_forma  = nueva_casa.alto_forma;
                nueva_casa.resp_ancho_forma = nueva_casa.ancho_forma;


                //Subsistema 3.2 #Filtros

                bool interruptor = false;

                //Verificar si existe interseccion entre casas
                //Esta verificación me deja una gran leccion 29/11/20 :)

                for (int x = 0; x < lista_casas.Count; x++)
                {
                    Parallel.For(0, nueva_casa.area_puntos.Count - 1, (i, state) =>
                    {
                        if (lista_casas[x].area_puntos.Contains(nueva_casa.area_puntos[i]))
                        {
                            //Existe interseccion
                            interruptor = true;
                            state.Break();
                        }
                    });
                }


                //Verifica si existe interseccion entre casas y calles

                if (nueva_casa != null)
                {
                    Parallel.For(0, nueva_casa.area_puntos.Count - 1, (i, state) =>
                    {
                        if (lista_puntos_calles.Contains(nueva_casa.area_puntos[i]))
                        {
                            //Existe interseccion
                            interruptor = true;
                            state.Break();
                        }
                    });
                }

                if (interruptor)
                {
                    ubicacion_datos--;
                    continue;
                }
                else
                {
                    // Si no se encontraron intersecciones agrega la info de forma
                    //nueva_casa.area_post();
                    lista_casas.Add(nueva_casa);

                    if (ui_objetos_elevador.Checked == true)
                    {
                        //Valida que el elevador este dentro del espacio de la forma
                        bool encontrado = false;
                        do
                        {
                            nueva_casa.origen_elevador  = Herramienta.seleccionar_punto_cuadricula(nueva_casa.po.X + nueva_casa.ancho_forma * 100, nueva_casa.po.Y + nueva_casa.alto_forma * 100, 100, nueva_casa.po.X, nueva_casa.po.Y);
                            nueva_casa.espacio_elevador = new Rectangle(nueva_casa.origen_elevador.X, nueva_casa.origen_elevador.Y, 2 * 100, 2 * 100);
                            Rectangle resultado = Rectangle.Intersect(nueva_casa.espacio_elevador, nueva_casa.espacio_forma);
                            if (resultado == nueva_casa.espacio_elevador)
                            {
                                encontrado = true;
                            }
                        } while (encontrado == false);
                    }
                }
            }

            //Subsistema #4 superposiciones
            //Encuentro el nombre del radiobutton de la forma que ha escogido el usuario

            String forma_seleccionada = ui_groupbox_forma_casas.Controls.OfType <RadioButton>().FirstOrDefault(r => r.Checked).Name;

            //Pintar lienzos con los datos almacenados, dependiedo de la superposicion

            if (ui_superposicion_esc_cons.Checked == true)
            {
                for (int i = 0; i < ui_cantidad_pisos.Value; i++)
                {
                    for (int recorrer = 0; recorrer < ui_cantidad_casas.Value; recorrer++)
                    {
                        string nombre_page = "Planta " + i;
                        Formas.forma(forma_seleccionada, lista_casas[recorrer], (PictureBox)TabControl.TabPages[i].Controls.Find(nombre_page, true)[0]);

                        //Primero se guardan los nombre de los checkbox activo es una lista

                        List <String> nombres_checkbox = new List <string>();
                        foreach (CheckBox c in ui_groupbox_objetos.Controls.OfType <CheckBox>())
                        {
                            if (c.Checked == true)
                            {
                                nombres_checkbox.Add(c.Name);
                            }
                        }

                        //Después de pintar las casas, se pintan los objetos
                        Objetos.objeto(nombres_checkbox, lista_casas[recorrer], (PictureBox)TabControl.TabPages[i].Controls.Find(nombre_page, true)[0]);

                        //Esta variable es modificada una vez que PB se haya dibujado
                        lista_casas[recorrer].ubicacion_pb = false;

                        //Actualización del progress bar #1

                        barra.Value = (int)cropro.Elapsed.TotalSeconds;
                    }
                }
            }
            else if (ui_superposicion_esc_cons_var.Checked == true)
            {
                for (int i = 0; i < ui_cantidad_pisos.Value; i++)
                {
                    for (int recorrer = 0; recorrer < ui_cantidad_casas.Value; recorrer++)
                    {
                        if (lista_casas[recorrer].pisos_reales > 0)
                        {
                            string nombre_page = "Planta " + i;
                            Formas.forma(forma_seleccionada, lista_casas[recorrer], (PictureBox)TabControl.TabPages[i].Controls.Find(nombre_page, true)[0]);

                            //Primero se guardan los nombre de los checkbox activo es una lista

                            List <String> nombres_checkbox = new List <string>();
                            foreach (CheckBox c in ui_groupbox_objetos.Controls.OfType <CheckBox>())
                            {
                                if (c.Checked == true)
                                {
                                    nombres_checkbox.Add(c.Name);
                                }
                            }

                            //Después de pintar las casas, se pintan los objetos
                            Objetos.objeto(nombres_checkbox, lista_casas[recorrer], (PictureBox)TabControl.TabPages[i].Controls.Find(nombre_page, true)[0]);

                            //Esta variable es modificada una vez que PB se haya dibujado
                            lista_casas[recorrer].ubicacion_pb = false;
                        }
                        lista_casas[recorrer].pisos_reales = lista_casas[recorrer].pisos_reales - 1;

                        //Actualización del progress bar #1

                        barra.Value = (int)cropro.Elapsed.TotalSeconds;
                    }
                }
            }
            else if (ui_superposicion_piramidal.Checked == true)
            {
                for (int i = 0; i < ui_cantidad_pisos.Value; i++)
                {
                    for (int recorrer = 0; recorrer < ui_cantidad_casas.Value; recorrer++)
                    {
                        if (i > 0)
                        {
                            int valor_reduccion = 0;
                            if (ui_superposicion_rad_valor_fijo.Checked == true)
                            {
                                valor_reduccion = Convert.ToInt32(ui_superposicion_valor_fijo.Value);
                            }
                            else if (ui_superposicion_rad_valor_por_rango.Checked == true)
                            {
                                int limite = Math.Min(lista_casas[recorrer].alto_forma, lista_casas[recorrer].ancho_forma);
                                //Esto es para manejar la excepcion probar un break
                                if (limite < 0)
                                {
                                    limite = 0;
                                }

                                int modo = 0;
                                valor_reduccion = azar.Next(modo, limite + 1);
                            }
                            lista_casas[recorrer].nuevo_origen = new Point(lista_casas[recorrer].po.X + ((valor_reduccion * 100) / 2), lista_casas[recorrer].po.Y + ((valor_reduccion * 100) / 2));
                            lista_casas[recorrer].po           = lista_casas[recorrer].nuevo_origen;
                            lista_casas[recorrer].ancho_forma  = lista_casas[recorrer].ancho_forma - valor_reduccion;
                            lista_casas[recorrer].alto_forma   = lista_casas[recorrer].alto_forma - valor_reduccion;
                        }

                        if (lista_casas[recorrer].ancho_forma > 2 && lista_casas[recorrer].alto_forma > 2)
                        {
                            string nombre_page = "Planta " + i;
                            Formas.forma(forma_seleccionada, lista_casas[recorrer], (PictureBox)TabControl.TabPages[i].Controls.Find(nombre_page, true)[0]);

                            //Después de pintar las casas, se pintan los objetos

                            //Primero se guardan los nombre de los checkbox activo es una lista

                            List <String> nombres_checkbox = new List <string>();
                            foreach (CheckBox c in ui_groupbox_objetos.Controls.OfType <CheckBox>())
                            {
                                if (c.Checked == true)
                                {
                                    nombres_checkbox.Add(c.Name);
                                }
                            }

                            Objetos.objeto(nombres_checkbox, lista_casas[recorrer], (PictureBox)TabControl.TabPages[i].Controls.Find(nombre_page, true)[0]);

                            //Esta variable es modificada una vez que PB se haya dibujado
                            lista_casas[recorrer].ubicacion_pb = false;
                        }


                        //Actualización del progress bar #1

                        barra.Value = (int)cropro.Elapsed.TotalSeconds;
                    }
                }
            }
            MessageBox.Show("Completado exitosamente", "Información", MessageBoxButtons.OK, MessageBoxIcon.Information);
            barra.Value = 0;
        }
Esempio n. 27
0
    void Update()
    {
        if (canvas.gameObject.GetComponent <CanvasGroup>().alpha == 1)
        {
            if (Input.GetKeyDown(teclaMenu))
            {
                abajoIzqInterfaz.AbrirMenu();
            }

            if (Input.GetMouseButtonDown(1))
            {
                if (construirActivar == true)
                {
                    construirActivar = false;
                    vistaPrevia.QuitarTodosEdificios();
                    construirInterfaz.RatonSaleBotonEdificios();

                    edificioSeleccionado = null;

                    panelCoste.gameObject.GetComponent <CanvasGroup>().alpha = 0;
                }

                if (demolerActivar == true)
                {
                    demolerActivar = false;
                    construir.DemolerCambiarColores(0);
                }
            }

            if (edificioSeleccionado != null)
            {
                if (construirActivar == true)
                {
                    if (Input.GetKeyDown(teclaRotacionEdificioDerecha))
                    {
                        int rotacion = edificioSeleccionado.rotacionColocacion + 90;

                        if (rotacion > 0)
                        {
                            rotacion = -270;
                        }

                        edificioSeleccionado.rotacionColocacion = rotacion;
                    }

                    if (Input.GetKeyDown(teclaRotacionEdificioIzquierda))
                    {
                        int rotacion = edificioSeleccionado.rotacionColocacion - 90;

                        if (rotacion < -270)
                        {
                            rotacion = 0;
                        }

                        edificioSeleccionado.rotacionColocacion = rotacion;
                    }

                    if (Input.GetKey(teclaArrastrarConstruccion))
                    {
                        if (edificioSeleccionado.id == 6)
                        {
                            EdificioVistaPrevia(true, 1);
                        }
                        else if (edificioSeleccionado.id == 12)
                        {
                            EdificioVistaPrevia(true, 2);
                        }
                    }
                    else
                    {
                        mantenerEjeX = true;
                        mantenerEjeZ = true;

                        foreach (Construccion2 edificio in edificiosSeleccionados)
                        {
                            vistaPrevia.QuitarEdificio(edificio.edificio, edificio.posicion);
                        }

                        edificiosSeleccionados.Clear();
                        EdificioVistaPrevia(false, 0);
                    }
                }

                if (Input.GetMouseButtonDown(0))
                {
                    EdificioConstruir(0);
                }
            }

            if (demolerActivar == true)
            {
                EdificioVistaPreviaDemoler();

                if (Input.GetMouseButtonDown(0))
                {
                    EdificioConstruir(1);
                }
            }
        }

        //-----------------------------------------------

        if (canvas.gameObject.GetComponent <CanvasGroup>().alpha == 1)
        {
            if (Input.GetKeyDown(teclaOcultarInterfaz))
            {
                ocultarEnseñarInterfaz = true;
                Objetos.Ocultar(canvas.gameObject);
            }
        }
        else
        {
            if (Input.GetKeyDown(teclaOcultarInterfaz) && ocultarEnseñarInterfaz == true)
            {
                ocultarEnseñarInterfaz = false;
                Objetos.Mostrar(canvas.gameObject);
            }
        }

        //-----------------------------------------------

        if (panelCoste.gameObject.GetComponent <CanvasGroup>().alpha == 1)
        {
            Vector3 posicion = Input.mousePosition;
            posicion.x = posicion.x + 10;
            posicion.y = posicion.y - 35;

            panelCoste.gameObject.transform.position = posicion;
        }
    }
    public override void OnInspectorGUI()
    {
        serializedObject.Update();

        EditorGUILayout.LabelField("Insira o prefab das Opções :");
        EditorGUILayout.PropertyField(Prefabricavel, true);

        EditorGUILayout.LabelField("Insira a quantidade de Opções abaixo.");
        EditorGUILayout.Space();
        EditorGUILayout.PropertyField(Tamanho, true);
        if (Tamanho.intValue < 1)
        {
            Tamanho.intValue = 1;
        }

        if (Tamanho.intValue > 0)
        {
            mostrarTipos = true;
        }
        else
        {
            mostrarTipos = false;
        }
        EditorGUILayout.Space();
        #region Resize
        if (Tamanho.intValue != ListaNomes.arraySize)
        {
            while (Tamanho.intValue > ListaNomes.arraySize)
            {
                ListaNomes.InsertArrayElementAtIndex(ListaNomes.arraySize);
            }
            while (Tamanho.intValue < ListaNomes.arraySize)
            {
                ListaNomes.DeleteArrayElementAtIndex(ListaNomes.arraySize - 1);
            }
        }
        if (Tamanho.intValue != ListaDestinos.arraySize)
        {
            while (Tamanho.intValue > ListaDestinos.arraySize)
            {
                ListaDestinos.InsertArrayElementAtIndex(ListaDestinos.arraySize);
            }
            while (Tamanho.intValue < ListaDestinos.arraySize)
            {
                ListaDestinos.DeleteArrayElementAtIndex(ListaDestinos.arraySize - 1);
            }
        }
        if (Tamanho.intValue != ListaTipos.arraySize)
        {
            while (Tamanho.intValue > ListaTipos.arraySize)
            {
                ListaTipos.InsertArrayElementAtIndex(ListaTipos.arraySize);
            }
            while (Tamanho.intValue < ListaTipos.arraySize)
            {
                ListaTipos.DeleteArrayElementAtIndex(ListaTipos.arraySize - 1);
            }
        }
        if (Tamanho.intValue != Objetos.arraySize)
        {
            while (Tamanho.intValue > Objetos.arraySize)
            {
                Objetos.InsertArrayElementAtIndex(Objetos.arraySize);
            }
            while (Tamanho.intValue < Objetos.arraySize)
            {
                Objetos.DeleteArrayElementAtIndex(Objetos.arraySize - 1);
            }
        }
        if (Tamanho.intValue != IndexSize.arraySize)
        {
            while (Tamanho.intValue > IndexSize.arraySize)
            {
                IndexSize.InsertArrayElementAtIndex(IndexSize.arraySize);
            }
            while (Tamanho.intValue < IndexSize.arraySize)
            {
                IndexSize.DeleteArrayElementAtIndex(IndexSize.arraySize - 1);
            }
        }
        #endregion


        #region Arrumar
        EditorGUILayout.Space();
        #region Elementos
        EditorGUILayout.LabelField("----Começo----");
        try
        {
            for (int i = 0; i < Tamanho.intValue; i++)
            {
                EditorGUILayout.LabelField("Escreva o nome: ");
                EditorGUILayout.PropertyField(ListaNomes.GetArrayElementAtIndex(i), mostrarTipos);
                EditorGUILayout.LabelField("Seleciona o tipo: ");
                EditorGUILayout.PropertyField(ListaTipos.GetArrayElementAtIndex(i), mostrarTipos);
                if (menu.TipoDeOpcoes[i] == TipoOpcoes.AtivarGameObject)
                {
                    EditorGUILayout.LabelField("Coloque o GameObject à ser ativado: ");
                    if (menu.Destino[i].GetType() == typeof(MonoBehaviour))
                    {
                        menu.Destino.RemoveAt(i);
                    }
                    EditorGUILayout.PropertyField(ListaDestinos.GetArrayElementAtIndex(i));
                }
                if (menu.TipoDeOpcoes[i] == TipoOpcoes.AtivarScript)
                {
                    EditorGUILayout.LabelField("Coloque o GameObject aonde está o script: ");

                    EditorGUILayout.PropertyField(Objetos.GetArrayElementAtIndex(i));
                    if (menu.obj[i] != null)
                    {
                        string[] opcoes = new string[menu.obj[i].GetComponents <MonoBehaviour>().Length];
                        for (int j = 0; j < opcoes.Length; j++)
                        {
                            opcoes[j] = menu.obj[i].GetComponents <MonoBehaviour>()[j].ToString();
                        }

                        IndexSize.GetArrayElementAtIndex(i).intValue = EditorGUILayout.Popup(IndexSize.GetArrayElementAtIndex(i).intValue, opcoes);
                        menu.Destino[i] = menu.obj[i].GetComponents <MonoBehaviour>()[IndexSize.GetArrayElementAtIndex(i).intValue];
                        EditorGUILayout.LabelField("Script selecionado : " + menu.Destino[i]);
                    }
                }
                if (menu.TipoDeOpcoes[i] == TipoOpcoes.Back)
                {
                    if (menu.Destino[i].GetType() == typeof(MonoBehaviour))
                    {
                        menu.Destino.RemoveAt(i);
                    }
                    EditorGUILayout.LabelField("Coloque o destino para voltar: ");
                    EditorGUILayout.PropertyField(ListaDestinos.GetArrayElementAtIndex(i));
                }
                if (menu.TipoDeOpcoes[i] == TipoOpcoes.Confirm)
                {
                    EditorGUILayout.LabelField("Coloque o GameObject aonde está o script: ");

                    EditorGUILayout.PropertyField(Objetos.GetArrayElementAtIndex(i));
                    if (menu.obj[i] != null)
                    {
                        string[] opcoes = new string[menu.obj[i].GetComponents <MonoBehaviour>().Length];
                        for (int j = 0; j < opcoes.Length; j++)
                        {
                            opcoes[j] = menu.obj[i].GetComponents <MonoBehaviour>()[j].ToString();
                        }

                        IndexSize.GetArrayElementAtIndex(i).intValue = EditorGUILayout.Popup(IndexSize.GetArrayElementAtIndex(i).intValue, opcoes);
                        menu.Destino[i] = menu.obj[i].GetComponents <MonoBehaviour>()[IndexSize.GetArrayElementAtIndex(i).intValue];
                        EditorGUILayout.LabelField("Script selecionado : " + menu.Destino[i]);
                    }
                    if (menu.TipoDeOpcoes[i] == TipoOpcoes.Sair)
                    {
                        if (menu.Destino[i].GetType() == typeof(MonoBehaviour))
                        {
                            menu.Destino.RemoveAt(i);
                        }
                        EditorGUILayout.LabelField("Coloque o destino para sair: ");
                        EditorGUILayout.PropertyField(ListaDestinos.GetArrayElementAtIndex(i));
                    }
                    if (menu.TipoDeOpcoes[i] == TipoOpcoes.SairTotalmente)
                    {
                        if (menu.Destino[i].GetType() == typeof(MonoBehaviour))
                        {
                            menu.Destino.RemoveAt(i);
                        }
                        EditorGUILayout.LabelField("Coloque o destino para ser desativado: ");
                        EditorGUILayout.PropertyField(ListaDestinos.GetArrayElementAtIndex(i));
                    }
                    EditorGUILayout.Space();
                    if (i + 1 == Tamanho.intValue)
                    {
                        EditorGUILayout.LabelField("----Fim----");
                    }
                    else
                    {
                        EditorGUILayout.LabelField("----Outro----");
                    }
                }
            }
        }
        catch
        {
        }
        #endregion
        #endregion
        serializedObject.ApplyModifiedProperties();
    }
Esempio n. 29
0
    // Update is called once per frame
    void FixedUpdate()
    {
        //COGER UN OBJETO
        Ray ray = Camera.main.ViewportPointToRay(new Vector3(0.5f, 0.5f, 0)); // al medio de la pantalla
        RaycastHit hit;
        if (Physics.Raycast(ray, out hit, catchDistance))
        {
            GameObject selectedObject = hit.collider.gameObject;

            //OBJETO COLLECTABLE
            if (selectedObject.tag.Equals ("Collectable")) {
                //SI esta mirando a un objeto coleccionable muestra feedback
                pick.enabled = true;
                pick.text = basePick + " " + selectedObject.name + buttonText;
                //SI pulsa B lo cogemos
                if (OVRInput.GetDown (OVRInput.Button.Two)/*DEBUG CONTROLL*/ || Input.GetButtonDown ("Fire1")) {
                    switch (selectedObject.name) {
                    case "Linterna":
                        hasLinterna = true;
                        activeObject = Objetos.Linterna;
                        crosshair.enabled = false;
                        pistolaObj.SetActive (false);
                        linternaObj.SetActive (true);
                        linternaObj.GetComponent<AudioSource>().PlayOneShot(linternaOn, Random.Range(0.6f, 1f)); //Se reproduce una vez el sonido linternaOff con un volumen entre 0.6 y 1
                        break;
                    case "Pistola":
                        hasPistola = true;
                        crosshair.enabled = true;
                        activeObject = Objetos.Pistola;
                        linternaObj.SetActive (false);
                        pistolaObj.SetActive (true);
                        pistolaObj.GetComponent<AudioSource>().PlayOneShot(pistolaOn, Random.Range(0.6f, 1f)); //Se reproduce una vez el sonido pistolaOff con un volumen entre 0.6 y 1
                        break;
                    }
                    Destroy (selectedObject);
                }
            } else {
                pick.enabled = false;
            }

            //PUERTA
            if (selectedObject.tag.Equals ("Door")) {
                if (OVRInput.GetDown (OVRInput.Button.Two)/*DEBUG CONTROLL*/ || Input.GetButtonDown ("Fire1"))
                    selectedObject.SendMessage ("Toogle");
            }
        }
        else
            pick.enabled = false;

        //TOOGLE LINTERNA
        if (hasLinterna && (Input.GetKeyDown(KeyCode.E) || OVRInput.GetDown(OVRInput.Button.Three)) /* X */) {

            if (this.activeObject == Objetos.Linterna) {
                activeObject = Objetos.Mano;
                linternaObj.SetActive (false);
                linternaObj.GetComponent<AudioSource>().PlayOneShot(linternaOff, Random.Range(0.6f, 1f)); //Se reproduce una vez el sonido linternaOn con un volumen entre 0.6 y 1
            }
            else {
                activeObject = Objetos.Linterna;
                crosshair.enabled = false;
                pistolaObj.SetActive (false);
                linternaObj.SetActive (true);
                linternaObj.GetComponent<AudioSource>().PlayOneShot(linternaOn, Random.Range(0.6f, 1f)); //Se reproduce una vez el sonido linternaOff con un volumen entre 0.6 y 1

            }
        }

        //TOOGLE PISTOLA
        if (hasPistola && (Input.GetKeyDown(KeyCode.Q) || OVRInput.GetDown(OVRInput.Button.Four)) /* Y */) {

            if (this.activeObject == Objetos.Pistola) {
                crosshair.enabled = false;
                activeObject = Objetos.Mano;
                pistolaObj.SetActive (false);
                pistolaObj.GetComponent<AudioSource>().PlayOneShot(pistolaOff, Random.Range(0.6f, 1f)); //Se reproduce una vez el sonido pistolaOn con un volumen entre 0.6 y 1

            }
            else {
                crosshair.enabled = true;
                activeObject = Objetos.Pistola;
                linternaObj.SetActive (false);
                pistolaObj.SetActive (true);
                pistolaObj.GetComponent<AudioSource>().PlayOneShot(pistolaOn, Random.Range(0.6f, 1f)); //Se reproduce una vez el sonido pistolaOff con un volumen entre 0.6 y 1

            }
        }
    }
Esempio n. 30
0
 public bool AddObjetos(Objetos objeto)
 {
     Containner.AddToObjetos(objeto);
     return Containner.SaveChanges() > 0;
 }
Esempio n. 31
0
        //protected static void Redirect(string url, string target, string windowFeatures)
        //{
        //    "frmErro.aspx?id=" + ConfigurationManager.AppSettings["RelPdf"] + filename, "_blank", ""

        //    HttpContext.Current.RewritePath("~/frmErro.aspx?file=" + ConfigurationManager.AppSettings["RelPdf"] + filename, "_blank", "");

        //    HttpContext context = HttpContext.Current;
        //    if ((String.IsNullOrEmpty(target) || target.Equals("_self", StringComparison.OrdinalIgnoreCase)) && String.IsNullOrEmpty(windowFeatures))
        //    {
        //        context.Response.Redirect(url);
        //    }
        //    else
        //    {
        //        var page = (Page)context.Handler;
        //        if (page == null)
        //            throw new InvalidOperationException("Cannot redirect to new window outside Page context.");

        //        url = page.ResolveClientUrl(url);
        //        string script = !String.IsNullOrEmpty(windowFeatures) ? @"window.open(""{0}"", ""{1}"", ""{2}"");" : @"window.open(""{0}"", ""{1}"");";
        //        script = String.Format(script, url, target, windowFeatures);
        //        ScriptManager.RegisterStartupScript(page, typeof(Page), "Redirect", script, true);
        //    }
        //}

        /// <summary>
        /// Carrega as atividades das obras de acordo com a periodicidade e o
        /// grupo de atividade.
        /// </summary>
        public void loadObraAtividades()
        {
            try
            {
                ListCampos ls = new ListCampos();
                ListCampo  lc = new ListCampo();
                lc.NomeCampo  = "cmpCoObraGrupoLista";
                lc.TipoCampo  = TipoCampo.Numero;
                lc.ValorCampo = ((ListItem)cmbObra.SelectedItem).Value;
                ls.Add(lc);

                lc            = new ListCampo();
                lc.NomeCampo  = "cmpCoPeriodicidade";
                lc.TipoCampo  = TipoCampo.Numero;
                lc.ValorCampo = ((ListItem)cmbPeriodicidade.SelectedItem).Value;
                ls.Add(lc);

                lc            = new ListCampo();
                lc.NomeCampo  = "cmpCoTipoAtividade";
                lc.TipoCampo  = TipoCampo.Numero;
                lc.ValorCampo = ((ListItem)cmbTipoAtividade.SelectedItem).Value;
                ls.Add(lc);

                lc            = new ListCampo();
                lc.NomeCampo  = "cmpTpPreventiva";
                lc.TipoCampo  = TipoCampo.String;
                lc.ValorCampo = ((ListItem)rdbType.SelectedItem).Value;
                ls.Add(lc);

                lc            = new ListCampo();
                lc.NomeCampo  = "cmpCoGrupoAtividade";
                lc.TipoCampo  = TipoCampo.String;
                lc.ValorCampo = ((ListItem)cmbGrupoAtividade.SelectedItem).Value;
                ls.Add(lc);

                lc            = new ListCampo();
                lc.NomeCampo  = "[cmpCoPreventivaEspelho]";
                lc.TipoCampo  = TipoCampo.Null;
                lc.ValorCampo = null;
                ls.Add(lc);

                using (DataTable table = tblPreventiva.GetAll(Global.GetConnection(), ls))
                {
                    if (table != null && table.Rows.Count > 0)
                    {
                        Objetos.LoadCombo(lstAtividadeObra, table, "cmpDcItemAtividadePreventiva", "cmpCoPreventivaAtividade", "cmpDcItemAtividadePreventiva", true);
                        lstAtividadeObra.SelectedIndex = lstAtividadeObra.Items.IndexOf(lstAtividadeObra.Items.FindByValue(table.Rows[0]["cmpCoPreventivaAtividade"].ToString()));
                        lstAtividadeObra_SelectedIndexChanged(lstAtividadeObra, EventArgs.Empty);

                        tblPreventivaEquipamentocs PrevEquip = new tblPreventivaEquipamentocs();
                        DataTable dt = PrevEquip.GetPreventivaEquipamento(Global.GetConnection(), int.Parse(ViewState["cmpCoPreventiva"].ToString()), int.Parse(cmbGrupoAtividade.SelectedItem.Value));
                        if (dt.Rows.Count > 0)
                        {
                            txtEquipamento.Text            = dt.Rows[0]["CmpDcEquipamento"].ToString() + "|" + dt.Rows[0]["cmpDcLocalEquipamento"].ToString();
                            ViewState["IdEquipamentoObra"] = dt.Rows[0]["CmpDcEquipamento"].ToString();
                        }
                        else
                        {
                            //ViewState["IdEquipamentoObra"] = null;
                            // txtEquipamento.Text = null;
                        }
                    }
                }
                using (DataTable table = tblPreventiva.GetAllNotIN(Global.GetConnection(), ((ListItem)cmbObra.SelectedItem).Value, ((ListItem)cmbPeriodicidade.SelectedItem).Value, ((ListItem)rdbType.SelectedItem).Value, ((ListItem)cmbGrupoAtividade.SelectedItem).Value))
                {
                    if (table != null && table.Rows.Count > 0)
                    {
                        Objetos.LoadCombo(lstItemAtividade, table, "cmpDcItemAtividade", "cmpCoItemAtividade", "cmpDcItemAtividade", true);
                        lstItemAtividade.SelectedIndex = lstItemAtividade.Items.IndexOf(lstItemAtividade.Items.FindByValue(table.Rows[0]["cmpCoItemAtividade"].ToString()));
                        lstItemAtividade_SelectedIndexChanged(lstItemAtividade, EventArgs.Empty);
                    }
                }
            }
            catch (Exception ex)
            {
                Global.ShowError(Global.Title, ex);
            }
        }
Esempio n. 32
0
 public bool EditObjeto(Objetos page)
 {
     return Containner.SaveChanges() > 0;
 }
Esempio n. 33
0
 public void CerrarMenu()
 {
     botonMenu.gameObject.GetComponent <Image>().color = colorTransparente;
     Objetos.Ocultar(panelMenu.gameObject);
 }
Esempio n. 34
0
        /// <summary>
        /// Carrega as combos.
        /// </summary>
        private void load()
        {
            try
            {
                Objetos.LoadCombo(cmbTipoServico, tblTipoServicoObra.Get(Global.GetConnection()), "cmpDcTipoServico", "cmpIdTipoServico", "cmpDcTipoServico", "-- Selecione um serviço", true);
                loadObra();

                using (DataTable tbl = tblDataHoraServidor.Get(Global.GetConnection()))
                {
                    Objetos.LoadCombo(cmbAno, tblAno.Get(Global.GetConnection()), "cmpNuAno", "cmpNuAno", "cmpNuAno", "--Selecione--", true);
                    cmbAno.SelectedIndex = Objetos.RetornaIndiceCombo(cmbAno, long.Parse(tbl.Rows[0]["cmpAnoAtual"].ToString()));
                    Objetos.LoadCombo(cmbMes, tblMes.GetAll(Global.GetConnection()), "cmpDcMes", "cmpIdMes", "cmpIdMes", "--Selecione--", true);
                    cmbMes.SelectedIndex = Objetos.RetornaIndiceCombo(cmbMes, long.Parse(tbl.Rows[0]["cmpMesAtual"].ToString()));
                }



                //Combo da emissão da nota
                //string[,] Elementos = new string[,] { { "0", "Selecione o item" }, { "A", "Em Aberto" }, { "E", "Emitido" }, { "P", "Pendente" } };
                //cmbEmiFatura.Items.Clear();

                //for (int i = 0; i <= Elementos.GetUpperBound(0); i++)
                //{
                //    li = new ListItem();
                //    li.Value = Elementos[i, 0];
                //    li.Text = Elementos[i, 1];
                //    cmbEmiFatura.Items.Add(li);
                //}

                //Combo da entrega documento no cliente
                //Array.Clear(Elementos, 0, 8);

                //Elementos = new string[,] { { "0", "Selecione o item" }, { "A", "Em Aberto" }, { "E", "Emitido" }, { "P", "Pendente" } };
                //cmbEntFatura.Items.Clear();

                //for (int i = 0; i <= Elementos.GetUpperBound(0); i++)
                //{
                //    li = new ListItem();
                //    li.Value = Elementos[i, 0];
                //    li.Text = Elementos[i, 1];
                //    cmbEntFatura.Items.Add(li);
                //}

                //Combo do recebimento da fatura
                //Array.Clear(Elementos, 0,8);

                //Elementos = new string[,] { { "0", "Selecione o item" }, { "RA", "Recebimento em Aberto" }, { "RT", "Recebimento Total" }, { "RP", "Recebimento Parcial" }, { "PE", "Recebimento Pendente" } };
                //cmbRecFatura.Items.Clear();

                //for (int i = 0; i <= Elementos.GetUpperBound(0); i++)
                //{
                //    li = new ListItem();
                //    li.Value = Elementos[i, 0];
                //    li.Text = Elementos[i, 1];
                //    cmbRecFatura.Items.Add(li);
                //}
            }
            catch (Exception ex)
            {
                Global.ShowError(Global.Title, ex);
            }
        }