示例#1
0
        private void carregarInfTrabalhador()
        {
            #region Carregar dados do trabalhador nos itens do groupBox
            try
            {
                Trabalhadores t = trabalhadoresDAO.select(Convert.ToInt16(dataGridView.CurrentRow.Cells["ID"].Value.ToString()));

                textNome.Text = t.Nome;
                textNome.Focus();
                textEmail.Text = t.Email;

                if (t.Cpf.Length < 14)
                {
                    textDocumento.Text = "";
                }
                else
                {
                    textDocumento.Text = t.Cpf;
                }

                Cidades cid = cidadesDAO.selectCidade(t.Cidade.Id);
                textUF.Text = cid.Estado.Nome;

                textServico.Text  = t.Servico;
                textCidade.Text   = t.Cidade.Nome;
                textEndereco.Text = t.Endereco;
                textTel.Text      = t.Telefone;
                textTel2.Text     = t.Telefone2;
            }
            catch
            {
            }
            #endregion
        }
    void Start()
    {
        gm = GameObject.Find("GameManager").GetComponent <GameManager> ();
        cm = GameObject.Find("GameManager").GetComponent <Criptomoedas> ();
        tb = GameObject.Find("GameManager").GetComponent <Trabalhadores> ();
        rc = GameObject.Find("GameManager").GetComponent <Recompesas> ();


        saveMeuDinheiro        = PlayerPrefs.GetFloat("SaveMeuDinheiro");
        gm.valorMeuDinheiro    = saveMeuDinheiro;
        SaveMeuBitcoin         = PlayerPrefs.GetInt("SaveMeuBitcoin");
        gm.valorMeuBitcoin     = SaveMeuBitcoin;
        SaveMeuDodgecoin       = PlayerPrefs.GetInt("SaveMeuDodgecoin");
        gm.valorMeuDodgecoin   = SaveMeuDodgecoin;
        SaveMeuLitecoin        = PlayerPrefs.GetInt("SaveMeuLitecoin");
        gm.valorLitecoin       = SaveMeuLitecoin;
        SaveQtdTrabalhadores   = PlayerPrefs.GetInt("SaveQtdTrabalhadores");
        tb.qtdTrabalhadores    = SaveQtdTrabalhadores;
        SaveValorTrabalhadores = PlayerPrefs.GetInt("SaveValorTrabalhadores");
        tb.valorTrabalhador    = SaveValorTrabalhadores;
        SavePodeTrabalhar      = PlayerPrefs.GetInt("SaveBoolTrabalhar");
        tb.podeMinerar         = SavePodeTrabalhar;

        PlayerPrefs.SetInt("SaveBoolTrabalhar", tb.valorTrabalhador);
        gm.AtualizaValores();
        cm.AtualizarCotacaoCoins();
        tb.txtQtdTrabalhadores.text = tb.qtdTrabalhadores.ToString();

        if (tb.podeMinerar == 3)
        {
            StartCoroutine(tb.QtdTrabalhadores());
        }
    }
示例#3
0
        private void carregarInfTrabalhador()
        {
            #region Carregar dados do trabalhador nos itens do groupBox
            try
            {
                Trabalhadores t = trabalhadoresDAO.select(Convert.ToInt16(dataGridView.CurrentRow.Cells["ID"].Value.ToString()));
                textNome.Text = t.Nome;
                textNome.Focus();
                textEmail.Text       = t.Email;
                maskedDocumento.Text = t.Cpf;

                Cidades cid = cidadesDAO.selectCidade(t.Cidade.Id);
                comboUF.SelectedValue = cid.Estado.Id;

                comboServico.Text         = t.Servico;
                comboCidade.SelectedValue = t.Cidade.Id;
                textEndereco.Text         = t.Endereco;
                textTel.Text  = t.Telefone;
                textTel2.Text = t.Telefone2;
            }
            catch
            {
            }
            #endregion
        }
 void Start()
 {
     gm = GameObject.Find("GameManager").GetComponent <GameManager> ();
     cm = GameObject.Find("GameManager").GetComponent <Criptomoedas> ();
     tb = GameObject.Find("GameManager").GetComponent <Trabalhadores> ();
     rc = GameObject.Find("GameManager").GetComponent <Recompesas> ();
     StartCoroutine(SalvarOJogo());
 }
        public void insert(Trabalhadores trabalhadorInf)
        {
            trabalhadorInf.Cidade = db.Cidades.Where(x => x.Id == trabalhadorInf.Cidade.Id).First();
            db.Trabalhadores.Add(trabalhadorInf);
            db.SaveChanges();

            // Inserção de log de inclusão de trabalhador
            logsDAO.insert(8);
        }
示例#6
0
 // Start is called before the first frame update
 void Start()
 {
     sit           = gameObject.GetComponent <Situation>();
     trabalhadores = trabalhadoresTela.GetComponent <Trabalhadores>();
     conquist      = dados.GetComponent <Conquist>();
     ItiateVar();
     current = this;
     StartPopulation();
 }
        public void delete(int id)
        {
            Trabalhadores trabalhadorExc = db.Trabalhadores.Where(x => x.Id == id).First();

            trabalhadorExc.Excluido = true;
            db.SaveChanges();

            // Inserção de log de exclusão de trabalhador
            logsDAO.insert(10);
        }
示例#8
0
    // Use this for initialization
    void Start()
    {
        cm = GameObject.Find("GameManager").GetComponent <Criptomoedas> ();
        gm = GameObject.Find("GameManager").GetComponent <GameManager> ();
        tb = GameObject.Find("GameManager").GetComponent <Trabalhadores> ();

        linguote = GameObject.Find("IMG linguote").GetComponent <Image> ();
        picareta = GameObject.Find("IMG picareta").GetComponent <Image> ();
        temRec1  = false;
        temRec2  = false;
        temRec3  = false;
    }
示例#9
0
        private void btAdicionar_Click(object sender, EventArgs e)
        {
            foreach (DataGridViewRow row in dataGridTrab.Rows)
            {
                if (Convert.ToBoolean(row.Cells[3].Value))
                {
                    Obras obra = new Obras();
                    obra = obrasDAO.select().Where(x => x.Id == Convert.ToInt16(textId.Text)).First();
                    Trabalhadores trab = new Trabalhadores();
                    trab = trabalhadoresDAO.select().Where(x => x.Id == Convert.ToInt16(row.Cells[0].Value)).First();
                    ObrasTrabalhadores ot = new ObrasTrabalhadores();
                    ot.Obra        = obra;
                    ot.Trabalhador = trab;
                    otDAO.insert(ot);
                }
            }

            carregarOT();
        }
        public void update(Trabalhadores trabalhadorInf)
        {
            trabalhadorInf.Cidade = db.Cidades.Where(x => x.Id == trabalhadorInf.Cidade.Id).First();

            Trabalhadores trabalhadorAlt = db.Trabalhadores.Where(x => x.Id == trabalhadorInf.Id).First();

            trabalhadorAlt.Cidade    = trabalhadorInf.Cidade;
            trabalhadorAlt.Nome      = trabalhadorInf.Nome;
            trabalhadorAlt.Email     = trabalhadorInf.Email;
            trabalhadorAlt.Cpf       = trabalhadorInf.Cpf;
            trabalhadorAlt.Servico   = trabalhadorInf.Servico;
            trabalhadorAlt.Endereco  = trabalhadorInf.Endereco;
            trabalhadorAlt.Telefone  = trabalhadorInf.Telefone;
            trabalhadorAlt.Telefone2 = trabalhadorInf.Telefone2;
            db.SaveChanges();

            // Inserção de log de alteração de trabalhador
            logsDAO.insert(9);
        }
示例#11
0
        private void salvarTrabalhador()
        {
            #region Validação de campos
            errorProvider.SetError(textNome, string.Empty);
            errorProvider.SetError(textEmail, string.Empty);
            errorProvider.SetError(comboServico, string.Empty);
            errorProvider.SetError(maskedDocumento, string.Empty);
            errorProvider.SetError(comboUF, string.Empty);
            errorProvider.SetError(comboCidade, string.Empty);
            errorProvider.SetError(textTel, string.Empty);

            int verif = 0;

            if (textNome.Text.Trim().Equals(""))
            {
                errorProvider.SetError(textNome, "Digite um nome válido");
                verif++;
            }

            if (!textEmail.Text.Trim().Equals(""))
            {
                Regex rg = new Regex(@"^[A-Za-z0-9](([_\.\-]?[a-zA-Z0-9]+)*)@([A-Za-z0-9]+)(([\.\-]?[a-zA-Z0-9]+)*)\.([A-Za-z]{2,})$");

                if (!rg.IsMatch(textEmail.Text))
                {
                    errorProvider.SetError(textEmail, "Digite um e-mail válido");
                    verif++;
                }
            }

            if (comboServico.Text.Trim().Equals(""))
            {
                errorProvider.SetError(comboServico, "Informe o serviço que o profissional oferece");
                verif++;
            }

            // Substituir espaços em branco por ""(nada)
            if (Regex.Replace(maskedDocumento.Text, @"\s+", "").Length > 3 && Regex.Replace(maskedDocumento.Text, @"\s+", "").Length <= 13)
            {
                errorProvider.SetError(maskedDocumento, "Informe um CPF válido");
                verif++;
            }

            if (maskedDocumento.MaskCompleted == true)
            {
                if (validarDocumento("CPF", maskedDocumento.Text) == false)
                {
                    errorProvider.SetError(maskedDocumento, "Informe um CPF válido");
                    verif++;
                }
            }

            if (comboUF.SelectedIndex == -1)
            {
                errorProvider.SetError(comboUF, "Selecione uma Unidade da Federação");
                verif++;
            }

            if (comboCidade.SelectedIndex == -1)
            {
                errorProvider.SetError(comboCidade, "Selecione uma cidade");
                verif++;
            }

            if (textTel.Text.Trim().Equals("") && textTel2.Text.Trim().Equals(""))
            {
                errorProvider.SetError(textTel, "Digite um número de telefone válido");
                textTel.Focus();
                return;
            }

            if (verif > 0)
            {
                return;
            }
            #endregion

            #region Colocar os dados do trabalhador em um objeto
            try
            {
                trabalhador          = new Trabalhadores();
                trabalhador.Nome     = textNome.Text.Trim();
                trabalhador.Servico  = comboServico.Text.Trim();
                trabalhador.Cpf      = maskedDocumento.Text;
                trabalhador.Endereco = textEndereco.Text.Trim();
                trabalhador.Cidade   = cidadesDAO.selectPorEstado(Convert.ToInt16(comboUF.SelectedValue)).Where(x => x.Id == Convert.ToInt16(comboCidade.SelectedValue)).First();
                trabalhador.Email    = textEmail.Text.Trim();

                if (!textTel.Text.Trim().Equals("") && !textTel2.Text.Trim().Equals(""))
                {
                    trabalhador.Telefone  = textTel.Text;
                    trabalhador.Telefone2 = textTel2.Text;
                }
                else if (!textTel.Text.Trim().Equals(""))
                {
                    trabalhador.Telefone = textTel.Text;
                }
                else
                {
                    trabalhador.Telefone = textTel2.Text;
                }
            }
            catch
            {
                //MessageBox.Show(ex.Message);
            }
            #endregion

            switch (groupBoxTrab.Text)
            {
            case "Inclusão de Trabalhador":
                #region Inclusão de trabalhador
                try
                {
                    trabalhadoresDAO.insert(trabalhador);
                }
                catch
                {
                    //MessageBox.Show(ex.Message);
                }
                #endregion
                break;

            case "Alteração de Trabalhador":
                #region Alteração dos dados do trabalhador
                try
                {
                    trabalhador.Id = Convert.ToInt16(dataGridView.CurrentRow.Cells["ID"].Value.ToString());
                    trabalhadoresDAO.update(trabalhador);
                }
                catch
                {
                    //MessageBox.Show(ex.Message);
                }
                #endregion
                break;
            }

            limparCampos();
            carregarTrabalhadores();
        }