Beispiel #1
0
        private void lblRemover_Click(object sender, EventArgs e)
        {
            if (lblId.Text != "0")
            {
                Camadas.BLL.Compra       compra = new Camadas.BLL.Compra();
                Camadas.BLL.ChaveProduto cp     = new Camadas.BLL.ChaveProduto();

                if (compra.DetectedGame(Convert.ToInt32(lblId.Text)) && cp.DetectedGame(Convert.ToInt32(lblId.Text)))
                {
                    Camadas.BLL.Jogo bllJogo = new Camadas.BLL.Jogo();
                    bllJogo.Delete(getJogo());
                    dgvJogos.DataSource = bllJogo.Select();
                    Limpar();
                }
                else
                {
                    if (!compra.DetectedGame(Convert.ToInt32(lblId.Text)))
                    {
                        string msg = "Este Jogo está no histórico de compras!";
                        MessageBox.Show(msg, "Aviso", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    }
                    else
                    {
                        string msg = "Este Jogo possui uma Chave de Produto!";
                        MessageBox.Show(msg, "Aviso", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    }
                }
            }
            else
            {
                string msg = "selecione um jogo na tabela";
                MessageBox.Show(msg, "Delete", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }
Beispiel #2
0
 private void lblGravar_Click(object sender, EventArgs e)
 {
     if (Verifica())
     {
         Camadas.MODEL.ChaveProduto cp = new Camadas.MODEL.ChaveProduto();
         cp.idJogo = Convert.ToInt32(lblid.Text);
         cp.chave  = txtChave.Text;
         cp.status = Convert.ToChar(txtStatus.Text);
         Camadas.BLL.ChaveProduto bllCp = new Camadas.BLL.ChaveProduto();
         bllCp.Insert(cp);
         dgvChaves.DataSource = bllCp.Select();
     }
 }
Beispiel #3
0
        private void frmChaves_Load(object sender, EventArgs e)
        {
            Camadas.BLL.ChaveProduto cp = new Camadas.BLL.ChaveProduto();

            dgvChaves.DataSource = cp.Select();

            Camadas.BLL.Jogo jogo = new Camadas.BLL.Jogo();
            cmbJogos.DisplayMember = "nome";
            cmbJogos.ValueMember   = "id";
            cmbJogos.DataSource    = jogo.Select();
            lblid.Enabled          = false;
            lblid.Text             = cmbJogos.SelectedValue.ToString();
        }
Beispiel #4
0
 private void lblEditar_Click(object sender, EventArgs e)
 {
     if (lblCodigo.Text != "0")
     {
         Camadas.MODEL.ChaveProduto cp = new Camadas.MODEL.ChaveProduto();
         cp.codigo = Convert.ToInt32(lblCodigo.Text);
         cp.idJogo = Convert.ToInt32(lblid.Text);
         cp.chave  = txtChave.Text;
         cp.status = Convert.ToChar(txtStatus.Text);
         Camadas.BLL.ChaveProduto bllCp = new Camadas.BLL.ChaveProduto();
         bllCp.Update(cp);
         dgvChaves.DataSource = bllCp.Select();
         Limpar();
     }
     else
     {
         string msg = "Selecione um item da tabela";
         MessageBox.Show(msg, "Aviso!", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }