public void cadastrar(object sender, EventArgs e) { postCnpj = cnpj.Text; postRazaoSocial = razaoSocial.Text; postTel = tel.Text; postCel = cel.Text; postEnd = endereco.Text; postComplemento = complemento.Text; postCep = cep.Text; postDesc = descricao.Value; postZonaAtend = zonaAtendimento.Text; int idCidade = Int32.Parse(cidadesDD.Text); Cidade cid = cidadeDAO.selectCidadePorId(idCidade); if (numero.Text != "") { postNum = Int32.Parse(numero.Text); } else { postNum = 0; } if (qtdFunc.Text != "") { postQtdFunc = Int32.Parse(qtdFunc.Text); } else { postQtdFunc = 0; } string busca = postEnd + ", " + postNum + " " + cid.Nome; double lat = new ApiCoordenadas().pegarLat(busca); double lng = new ApiCoordenadas().pegarLng(busca); MySqlDateTime mysqldt = new MySqlDateTime(DateTime.Now.ToString("yyyy/MM/dd hh:mm:ss")); Empresa emp = new Empresa(1, 1, 1, 1, postCnpj, postRazaoSocial, postTel, postCel, postEnd, postNum, postComplemento, postCep, lat, lng, cid, mysqldt, postDesc, postQtdFunc, 0, 0, 0, 0, 80, 0, postZonaAtend, mysqldt, 1); EmpresaCadastroValidator validator = new EmpresaCadastroValidator(); ValidationResult result = validator.Validate(emp); if (result.IsValid) { new EmpresaDAO().insertEmpresa(emp); emp = new EmpresaDAO().selectEmpPorCNPJ(postCnpj); Session["sIdEmp"] = emp.Id; EmpresaSaldo saldo = new EmpresaSaldo(0, emp.Id, 0, 0, 0); new EmpresaSaldoDAO().insertEmpSaldo(saldo); Response.Redirect("userEmpCadastro.aspx?acao=primCad"); } else { mensagem = result.ToString(" & "); } }
public void Cadastrar(object sender, EventArgs e) { int idCidade = Int32.Parse(cidade.Text); usuario = new Usuario() { Login = login.Text, Senha = senha.Text, Nome = nome.Text, Email = email.Text, Cpf = cpf.Text, Cep = cep.Text, Endereco = endereco.Text, Complemento = complemento.Text, Numero = Int32.Parse(numero.Text), Tel1 = telefone.Text, Tel2 = celular.Text, Cidade = cidadeDAO.selectCidadePorId(idCidade), Reputacao = 0 }; banco.insertUser(usuario); Response.Redirect("loginCliente.aspx"); }