Exemplo n.º 1
0
        private void DGservicos_CellClick(object sender, DataGridViewCellEventArgs e)
        {
            CBcliente.SelectedIndex  = CBcliente.FindString(DGservicos.CurrentRow.Cells[0].Value.ToString());
            CBsituacao.SelectedIndex = CBsituacao.FindString(DGservicos.CurrentRow.Cells[2].Value.ToString());
            TXTservicos.Text         = DGservicos.CurrentRow.Cells[1].Value.ToString();
            TXTobs.Text   = DGservicos.CurrentRow.Cells[6].Value.ToString();;
            TXTvalor.Text = DGservicos.CurrentRow.Cells[5].Value.ToString();;

            sql = "select * from tb03_movimentacoes where tb03_cod_servico = " + DGservicos.CurrentRow.Cells[7].Value.ToString();
            model.open();
            model.Execsql(sql);
            if (model.resultado.HasRows)
            {
                TXTvalor.Enabled = false;
                BTdel.Visible    = false;
                label6.Visible   = false;
            }
            else
            {
                BTdel.Visible  = true;
                label6.Visible = true;
            }
            model.close();

            BTadd.ButtonText  = "Salvar edição";
            BTcancela.Visible = true;

            DGservicos.ClearSelection();
        }
        private void DGservicos_DoubleClick(object sender, EventArgs e)
        {
            Detalhes det = new Detalhes(this);

            det.ShowDialog();

            DGservicos.ClearSelection();
        }
Exemplo n.º 3
0
        private void Add_servicos_Load(object sender, EventArgs e)
        {
            sql = "select * from tb01_clientes order by tb01_nome";
            model.open();
            model.Execsql(sql);
            carregaComboBox();
            model.close();

            sql = "select * from tb01_clientes, tb02_servicos where tb01_cod = tb02_cod_cliente order by tb02_data_cadastro desc";
            model.open();
            model.Execsql(sql);
            carregaGrid();
            model.close();

            DGservicos.ClearSelection();
        }
        private void BTpesquisa_Click(object sender, EventArgs e)
        {
            filtro();

            TXTservico.Text        = "";
            TXTobs.Text            = "";
            combobox.SelectedIndex = -1;
            TXTstatus.Text         = "";
            TXTvalor.Text          = "";
            TXTpago.Text           = "";
            TXTpagar.Text          = "";

            itens[0] = "";
            itens[1] = "";

            BTaddValor.Visible = false;

            DGservicos.ClearSelection();
        }
        private void DGservicos_CellClick(object sender, DataGridViewCellEventArgs e)
        {
            TXTservico.Text = DGservicos.CurrentRow.Cells[1].Value.ToString();
            TXTobs.Text     = DGservicos.CurrentRow.Cells[4].Value.ToString();
            combobox.Text   = DGservicos.CurrentRow.Cells[2].Value.ToString();
            TXTstatus.Text  = DGservicos.CurrentRow.Cells[7].Value.ToString();
            TXTvalor.Text   = DGservicos.CurrentRow.Cells[5].Value.ToString();
            TXTpago.Text    = DGservicos.CurrentRow.Cells[6].Value.ToString();
            TXTpagar.Text   = (Convert.ToDouble(TXTvalor.Text) - Convert.ToDouble(TXTpago.Text)).ToString();

            itens[0] = combobox.Text;
            itens[1] = TXTpagar.Text;

            if (TXTstatus.Text == "Pendente")
            {
                BTaddValor.Visible = true;
            }

            DGservicos.ClearSelection();
        }
 public void carregaGrid()
 {
     DGservicos.Rows.Clear();
     if (model.resultado.HasRows)
     {
         while (model.resultado.Read())
         {
             DGservicos.Rows.Add(
                 model.resultado["tb01_nome"].ToString(),
                 model.resultado["tb02_servicos"].ToString(),
                 model.resultado["tb02_situacao"].ToString(),
                 model.resultado["tb02_data_cadastro"].ToString(),
                 model.resultado["tb02_obs"].ToString(),
                 model.resultado["tb02_valor"].ToString(),
                 model.resultado["tb02_valor_pago"].ToString(),
                 model.resultado["tb02_status"].ToString(),
                 model.resultado["tb02_cod"].ToString()
                 );
         }
     }
     DGservicos.ClearSelection();
 }