Example #1
0
 private void txtCodigo_Leave(object sender, EventArgs e)
 {
     try
     {
         // Localizar usuário
         int cod;
         int.TryParse(txtCodigo.Text, out cod);
         if (cod != 0)
         {
             objGru.limpar();
             objGru.localizarLeave(cod.ToString(), "gru_codigo");
             if (objGru.gru_codigo != 0)
             {
                 carregaCampos();
                 txtCodigo.Enabled = false;
             }
             else
             {
                 limpar();
             }
         }
         else
         {
             limpar();
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message, "Erro", MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1);
     }
 }
Example #2
0
        private void btnGerar_Click(object sender, EventArgs e)
        {
            try
            {
                String dataI, dataF;
                dataI      = dtpDataInicial.Value.Year.ToString() + "/" + dtpDataInicial.Value.Day.ToString() + "/" + dtpDataInicial.Value.Month.ToString();
                dataF      = dtpDataFinal.Value.Year.ToString() + "/" + dtpDataFinal.Value.Day.ToString() + "/" + dtpDataFinal.Value.Month.ToString();
                dataInical = dtpDataInicial.Value.Date; //DateTime.Parse(dataI);
                dataFinal  = dtpDataFinal.Value.Date;   //DateTime.Parse(dataF);

                if (cbMarca.SelectedIndex > -1)
                {
                    marca = cbMarca.SelectedValue.ToString();
                    MarcasBLL objBLL = new MarcasBLL();
                    objBLL.localizarLeave(marca, "mar_codigo");
                    marca  = objBLL.mar_descricao;
                    objBLL = null;
                }
                else
                {
                    marca = "";
                }
                if (cbGrupo.SelectedIndex > -1)
                {
                    grupo = cbGrupo.SelectedValue.ToString();
                    GrupoBLL objBLL = new GrupoBLL();
                    objBLL.localizarLeave(marca, "gru_codigo");
                    grupo  = objBLL.gru_descricao;
                    objBLL = null;
                }
                else
                {
                    grupo = "";
                }

                controle = "Gerar";
                this.Close();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Erro", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }