コード例 #1
0
        private void buttonEnviar_Click(object sender, EventArgs e)
        {
            if (textBoxMensagem.Text == "" || textBoxNome.Text == "")
            {
                MessageBox.Show("Preencha todos os campos", "Sistema de Gestao de Loja Informatica", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }

            Notificacao not = new Notificacao();

            not.Nome     = textBoxNome.Text;
            not.Mensagem = textBoxMensagem.Text;

            NotificacaoNegocio nn = new NotificacaoNegocio();

            string retorno = nn.Novo(not);


            try
            {
                int sucesso = Convert.ToInt32(retorno);
                MessageBox.Show("Menssagem enviada.\n\n\nPressione ESC para cancelar", "Sistema de Gestao de Loja Informatica", MessageBoxButtons.OK, MessageBoxIcon.Information);

                Close();
            }
            catch (Exception)
            {
                DialogResult dr = MessageBox.Show("Nenhuma Menssagem foi enviada.\nMensagem de Erro: " + retorno + "\n\nCorrija o erro e tente novamente ou pressione ESC para cancelar", "Sistema de Gestao de Loja Informatica", MessageBoxButtons.OKCancel, MessageBoxIcon.Information);
                if (dr == DialogResult.Cancel)
                {
                    Close();
                }
            }
        }
コード例 #2
0
 public void notificacoa()
 {
     if (statusStrip2.Visible == true)
     {
         NotificacaoNegocio nn = new NotificacaoNegocio();
         NotificacaoColecao cn = nn.Consultar();
         dataGridViewNotificacao.AutoGenerateColumns = false;
         dataGridViewNotificacao.DataSource          = null;
         dataGridViewNotificacao.DataSource          = cn;
         dataGridViewNotificacao.Update();
         dataGridViewNotificacao.Refresh();
     }
 }