Skip to content

Instantly share code, notes, and snippets.

@facilita-tecnologia
Created November 21, 2018 12:17
Show Gist options
  • Save facilita-tecnologia/7354b4ef60f9ac792c42e7d34b58a374 to your computer and use it in GitHub Desktop.
Save facilita-tecnologia/7354b4ef60f9ac792c42e7d34b58a374 to your computer and use it in GitHub Desktop.
Metodos de configurações
public void Inicializar_Tipo_Certificado(int Valor)
{
ComboboxItem a1 = new ComboboxItem();
a1.Text = "1 - Certificado A1";
a1.Valor_inteiro = 0;
ComboboxItem a1_arquivo = new ComboboxItem();
a1_arquivo.Text = "2 - Certificado A1 em Arquivo";
a1_arquivo.Valor_inteiro = 1;
ComboboxItem a3 = new ComboboxItem();
a3.Text = "3 - Certificado A3";
a3.Valor_inteiro = 2;
switch (Valor)
{
case 0:
Tipo_Certificado.Items.Add(a1);
Tipo_Certificado.Items.Add(a1_arquivo);
Tipo_Certificado.Items.Add(a3);
Tipo_Certificado.SelectedIndex = 0;
break;
case 1:
Tipo_Certificado.Items.Add(a1_arquivo);
Tipo_Certificado.Items.Add(a1);
Tipo_Certificado.Items.Add(a3);
Tipo_Certificado.SelectedIndex = 0;
break;
case 2:
Tipo_Certificado.Items.Add(a3);
Tipo_Certificado.Items.Add(a1);
Tipo_Certificado.Items.Add(a1_arquivo);
Tipo_Certificado.SelectedIndex = 0;
break;
default:
Tipo_Certificado.Items.Add(a1);
Tipo_Certificado.Items.Add(a1_arquivo);
Tipo_Certificado.Items.Add(a3);
Tipo_Certificado.SelectedIndex = 0;
break;
}
}
public void Inicializar_Ambiente_NFe(int Valor)
{
ComboboxItem Producao = new ComboboxItem();
Producao.Text = "1 - Produção";
Producao.Valor_inteiro = 1;
ComboboxItem Homologacao = new ComboboxItem();
Homologacao.Text = "2 - Homologação";
Homologacao.Valor_inteiro = 2;
switch (Valor)
{
case 1:
tpAmb.Items.Add(Producao);
tpAmb.Items.Add(Homologacao);
tpAmb.SelectedIndex = 0;
break;
case 2:
tpAmb.Items.Add(Homologacao);
tpAmb.Items.Add(Producao);
tpAmb.SelectedIndex = 0;
break;
default:
tpAmb.Items.Add(Producao);
tpAmb.Items.Add(Homologacao);
tpAmb.SelectedIndex = 0;
break;
}
}
public void Inicializar_Versao_NFe(int Valor)
{
ComboboxItem Versao_3 = new ComboboxItem();
Versao_3.Text = "1 - Versão 3.10";
Versao_3.Valor_inteiro = 3;
ComboboxItem Versao_4 = new ComboboxItem();
Versao_4.Text = "2 - Versão 4.00";
Versao_4.Valor_inteiro = 4;
switch (Valor)
{
case 3:
cb_Versao_NFe.Items.Add(Versao_3);
cb_Versao_NFe.Items.Add(Versao_4);
cb_Versao_NFe.SelectedIndex = 0;
break;
case 4:
cb_Versao_NFe.Items.Add(Versao_4);
cb_Versao_NFe.Items.Add(Versao_3);
cb_Versao_NFe.SelectedIndex = 0;
break;
default:
cb_Versao_NFe.Items.Add(Versao_3);
cb_Versao_NFe.Items.Add(Versao_4);
cb_Versao_NFe.SelectedIndex = 0;
break;
}
}
public void Inicializar_Ambiente_NFCe(int Valor)
{
ComboboxItem Producao = new ComboboxItem();
Producao.Text = "1 - Produção";
Producao.Valor_inteiro = 1;
ComboboxItem Homologacao = new ComboboxItem();
Homologacao.Text = "2 - Homologação";
Homologacao.Valor_inteiro = 2;
switch (Valor)
{
case 1:
cb_Ambiente_NFCe.Items.Add(Producao);
cb_Ambiente_NFCe.Items.Add(Homologacao);
cb_Ambiente_NFCe.SelectedIndex = 0;
break;
case 2:
cb_Ambiente_NFCe.Items.Add(Homologacao);
cb_Ambiente_NFCe.Items.Add(Producao);
cb_Ambiente_NFCe.SelectedIndex = 0;
break;
default:
cb_Ambiente_NFCe.Items.Add(Producao);
cb_Ambiente_NFCe.Items.Add(Homologacao);
cb_Ambiente_NFCe.SelectedIndex = 0;
break;
}
}
public void Inicializar_Versao_NFCe(int Valor)
{
ComboboxItem Versao_3 = new ComboboxItem();
Versao_3.Text = "1 - Versão 3.10";
Versao_3.Valor_inteiro = 3;
ComboboxItem Versao_4 = new ComboboxItem();
Versao_4.Text = "2 - Versão 4.00";
Versao_4.Valor_inteiro = 4;
switch (Valor)
{
case 3:
cb_Versao_NFCe.Items.Add(Versao_3);
cb_Versao_NFCe.Items.Add(Versao_4);
cb_Versao_NFCe.SelectedIndex = 0;
break;
case 4:
cb_Versao_NFCe.Items.Add(Versao_4);
cb_Versao_NFCe.Items.Add(Versao_3);
cb_Versao_NFCe.SelectedIndex = 0;
break;
default:
cb_Versao_NFCe.Items.Add(Versao_3);
cb_Versao_NFCe.Items.Add(Versao_4);
cb_Versao_NFCe.SelectedIndex = 0;
break;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment