Exemplo n.º 1
0
 private void btnLogin_Click(object sender, EventArgs e)
 {
     try
     {
         if (!Acesso.bALTER_CONFIG)
         {
             if (txtSenha.Text.ToUpper().Equals("MASTERPC"))
             {
                 if ((chkNovo.Checked) && (txtNomeArquivo.Text == ""))
                 {
                     errorProvider1.SetError(txtNomeArquivo, "Insira um nome para o Arquivo");
                     txtNomeArquivo.Focus();
                     throw new Exception("Verifique as Pendências");
                 }
                 if ((cbxArquivos.cbx.Items.Count == 0) && !(chkNovo.Checked))
                 {
                     errorProvider1.SetError(txtNomeArquivo, "Insira um nome para o Arquivo");
                     chkNovo.Checked = true;
                     txtNomeArquivo.Focus();
                     throw new Exception("Verifique as Pendências");
                 }
                 if (cbxArquivos.SelectedIndex == -1 && !chkNovo.Checked)
                 {
                     cbxArquivos.Focus();
                     throw new Exception("Selecione um arquivo para configurar");
                 }
             }
             else
             {
                 txtSenha.Focus();
                 throw new Exception("Senha Incorreta");
             }
         }
         this.Hide();
         if (chkNovo.Checked)
         {
             Acesso.NM_CONFIG_TEMP = txtNomeArquivo.Text + ".xml";
         }
         else
         {
             Acesso.NM_CONFIG_TEMP = cbxArquivos.Text;
         }
         frmConfiguracao objfrm = new frmConfiguracao();
         objfrm.ShowDialog();
         this.Close();
     }
     catch (Exception ex)
     {
         new HLPexception(ex);
     }
 }
Exemplo n.º 2
0
 private void btnLogin_Click(object sender, EventArgs e)
 {
     try
     {
         if (!Acesso.bALTER_CONFIG)
         {
             if (txtSenha.Text.ToUpper().Equals("MASTERPC"))
             {
                 if ((chkNovo.Checked) && (txtNomeArquivo.Text == ""))
                 {
                     errorProvider1.SetError(txtNomeArquivo, "Insira um nome para o Arquivo");
                     txtNomeArquivo.Focus();
                     throw new Exception("Verifique as Pendências");
                 }
                 if ((cbxArquivos.cbx.Items.Count == 0) && !(chkNovo.Checked))
                 {
                     errorProvider1.SetError(txtNomeArquivo, "Insira um nome para o Arquivo");
                     chkNovo.Checked = true;
                     txtNomeArquivo.Focus();
                     throw new Exception("Verifique as Pendências");
                 }
                 if (cbxArquivos.SelectedIndex == -1 && !chkNovo.Checked)
                 {
                     cbxArquivos.Focus();
                     throw new Exception("Selecione um arquivo para configurar");
                 }
             }
             else
             {
                 txtSenha.Focus();
                 throw new Exception("Senha Incorreta");
             }
         }
         this.Hide();
         if (chkNovo.Checked)
         {
             Acesso.NM_CONFIG_TEMP = txtNomeArquivo.Text + ".xml";
         }
         else
         {
             Acesso.NM_CONFIG_TEMP = cbxArquivos.Text;
         }
         frmConfiguracao objfrm = new frmConfiguracao();
         objfrm.ShowDialog();
         this.Close();
     }
     catch (Exception ex)
     {
         new HLPexception(ex);
     }
 }