Example #1
0
        private void tsSalvar_Click(object sender, EventArgs e)
        {
            CliFor   clfr = new CliFor();
            Endereco end  = new Endereco();
            Email    mail = new Email();
            Telefone tel  = new Telefone();

            //usuario
            clfr.Id       = Convert.ToInt32(cod);
            clfr.Fantasia = txtFantasia.Text;

            //endereço
            end.Cep        = txtCep.Text;
            end.Logradouro = txtLogradouro.Text;
            end.Cidade     = txtMunicipio.Text;
            end.Bairro     = txtBairro.Text;

            //telefone
            tel.Fixo    = txtTel.Text;
            tel.Celular = txtCel.Text;

            //email
            mail.Mail = txtEmail.Text;

            try
            {
                CliForModel login    = new CliForModel();
                string      mensagem = login.alterar(clfr, end, mail, tel);
                if (mensagem != "")
                {
                    MessageBox.Show(mensagem);
                    this.Close();
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("Erro: " + ex);
            }
        }
Example #2
0
        private void tsSalvar_Click(object sender, EventArgs e)
        {
            var      cli  = new CliFor();
            Endereco end  = new Endereco();
            Email    mail = new Email();
            Telefone tel  = new Telefone();

            //usuario
            cli.Id = Convert.ToInt32(cod);
            if (maskCpf.Visible == false)
            {
                cli.Identificacao = maskCnpj.Text;
            }
            else
            {
                cli.Identificacao = maskCpf.Text;
            }
            if (cbCliente.Checked == true && cbFornecedor.Checked == true)
            {
                cli.Tipo = "Cliente/Fornecedor";
            }
            else if (cbCliente.Checked == true && cbFornecedor.Checked == false)
            {
                cli.Tipo = "Cliente";
            }
            else if (cbCliente.Checked == false && cbFornecedor.Checked == true)
            {
                cli.Tipo = "Fornecedor";
            }
            //imobiliaria
            if (txtRazao.Enabled)
            {
                cli.Razao = txtRazao.Text;
            }
            else
            {
                cli.Razao = "";
            }
            cli.Fantasia = txtFantasia.Text;


            //endereço
            end.Cep        = txtCep.Text;
            end.Logradouro = txtLogradouro.Text;
            end.Cidade     = txtMunicipio.Text;
            end.Bairro     = txtBairro.Text;
            end.Uf         = cbUF.Text;
            end.Numero     = txtNumero.Text;

            //telefone
            tel.Fixo    = txtTel.Text;
            tel.Celular = txtCel.Text;

            //email
            mail.Mail = txtEmail.Text;

            try
            {
                var    login    = new CliForModel();
                string mensagem = login.alterar(cli, end, mail, tel);
                MessageBox.Show(mensagem);
            }
            catch (Exception ex)
            {
                MessageBox.Show("Erro: " + ex);
            }
        }