Beispiel #1
0
        //private void timer1_Tick(object sender, EventArgs e)
        //{
        //    data.Text = DateTime.Now.ToShortDateString() + "  |  " + DateTime.Now.ToShortTimeString();
        //}

        private void clienteToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if (Application.OpenForms.OfType <frmCadastroCliente>().Count() > 0)
            {
                MessageBox.Show("Este formulário já está aberto!", "Erro", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
            }
            else
            {
                frmCadastroCliente objCad = new frmCadastroCliente();
                //objCad.MdiParent = this;
                objCad.Show();
            }
        }
        private void btEdit_Click(object sender, EventArgs e)
        {
            if (dgRes.SelectedCells.Count > 0)
            {
                ClassCliente cc = new ClassCliente();
                cc.RetornClie(Convert.ToInt32(dgRes.SelectedRows[0].Cells[0].Value));
                frmCadastroCliente fc = new frmCadastroCliente();

                fc.txtCod.Text       = cc.CodCliente.ToString();
                fc.dataCad.Text      = cc.DataCadCliente.ToString();
                fc.txtNome.Text      = cc.NomeCliente;
                fc.txtNomeSoc.Text   = cc.NomeSocCliente;
                fc.txtDataNasc.Text  = cc.DataNascClie.ToString("dd-MM-yyyy");
                fc.txtTel1.Text      = cc.TelCliente1;
                fc.txtTel2.Text      = cc.TelCliente2;
                fc.txtCpf.Text       = cc.CpfCliente;
                fc.CB_OREMISSOR.Text = cc.OrgEmiClie;
                fc.txtRg.Text        = cc.RgClie;
                fc.txtEnd.Text       = cc.EndRuaCliente;
                fc.txtCidade.Text    = cc.EndCityCliente;
                fc.CbEst.Text        = cc.EndEstadoCliente;
                fc.txtCep.Text       = cc.EndCepCliente;

                fc.chkAtivo.Enabled = true;
                if (cc.StatusClieI == 1)
                {
                    fc.chkAtivo.Checked = true;
                }
                else
                {
                    fc.chkAtivo.Checked = false;
                }

                if (cc.SexoCliente == 1)
                {
                    fc.radFem.Checked = true;
                }
                else
                {
                    fc.radMasc.Checked = true;
                }

                fc.btCad.Visible   = false;
                fc.BtAtt.Visible   = true;
                fc.btClear.Visible = false;
                fc.ShowDialog();
                btPesq_Click(this, new EventArgs());
            }
        }