public void carregaClientesPorNome() { ltvClientes.Items.Clear(); try { ApiService apiserv = new ApiService(); var json = apiserv.fazRequisicaoPOST("https://slimws.tk/desktop/todosClientesPorNome", "nome=" + txtNomeCliente.Text); JavaScriptSerializer js = new JavaScriptSerializer(); Clientes[] clientes = js.Deserialize <Clientes[]>(json); for (int i = 0; i < clientes.Length; i++) { string[] subitems = new string[] { clientes[i].id.ToString(), clientes[i].nome, clientes[i].email, FormatCnpjCpf.FormatCPF(clientes[i].cpf), FormatCnpjCpf.formatTelefone(clientes[i].telefone) }; ListViewItem item = new ListViewItem(subitems); ltvClientes.Items.Add(item); } } catch (Exception err) { MessageBox.Show("Houve um erro ao tentar se conectar com o servidor. " + err); } }
public override void UpdateCompany() { string cnpjFormatted = FormatCnpjCpf.FormatCnpj(_company.GetDataCompany().Cnpj); _sql = "update cliente set " + $"tipo = '{_company.GetDataCompany().Cnpj}', " + $"abertura = '{_company.GetDataCompany().Opening}', " + $"nome = '{_company.GetDataCompany().Name}', " + $"fantasia = '{_company.GetDataCompany().FantasyName}', " + $"natureza_juridica = '{_company.GetDataCompany().JudicialNature}', " + $"logradouro = '{_company.GetDataCompany().Street}', " + $"numero = '{_company.GetDataCompany().Number}', " + $"complemento = '{_company.GetDataCompany().Complement}', " + $"cep = '{_company.GetDataCompany().ZipCode}', " + $"bairro = '{_company.GetDataCompany().Neighborhood}', " + $"municipio = '{_company.GetDataCompany().City}', " + $"porte = '{_company.GetDataCompany().Size}', " + $"uf = '{_company.GetDataCompany().State}', " + $"email = '{_company.GetDataCompany().Email}', " + $"telefone = '{_company.GetDataCompany().Telephone}', " + $"efr = '{_company.GetDataCompany().ResponsibleFederativeEntity}', " + $"situacao = '{_company.GetDataCompany().Situation}', " + $"data_stuacao = '{_company.GetDataCompany().DateSituation}', " + $"motivo_situacao = '{_company.GetDataCompany().ReasonSituation}', " + $"situacao_especial = '{_company.GetDataCompany().SpecialSituation}', " + $"data_situacao_especial = '{_company.GetDataCompany().DateSpecialSituation}', " + $"capital_social = '{_company.GetDataCompany().SocialCapital}' " + $"where cnpj = '{cnpjFormatted}'"; _dal.ExecuteSqlCommand(_sql); }
public override ICompany ConsultCompany(string cnpj) { string cnpjFormatted = FormatCnpjCpf.FormatCnpj(cnpj); _sql = $"select * from empresas where cnpj = '{cnpjFormatted}'"; DataTable data = _dal.ReturnDataTable(_sql); _company.SetDataCompany (data.Rows[0]["cnpj"].ToString(), data.Rows[0]["type"].ToString(), data.Rows[0]["size"].ToString(), data.Rows[0]["opening"].ToString(), data.Rows[0]["name"].ToString(), data.Rows[0]["fantasyName"].ToString(), data.Rows[0]["judicialNature"].ToString(), data.Rows[0]["street"].ToString(), data.Rows[0][" number"].ToString(), data.Rows[0]["complement"].ToString(), data.Rows[0]["zipCode"].ToString(), data.Rows[0]["neighborhood"].ToString(), data.Rows[0]["city"].ToString(), data.Rows[0]["state"].ToString(), data.Rows[0]["email"].ToString(), data.Rows[0]["telephone"].ToString(), data.Rows[0]["responsibleFederativeEntity"].ToString(), data.Rows[0]["situation"].ToString(), data.Rows[0]["dateSituation"].ToString(), data.Rows[0]["reasonSituation"].ToString(), data.Rows[0]["specialSituation"].ToString(), data.Rows[0]["dateSpecialSituation"].ToString(), data.Rows[0]["socialCapital"].ToString(), data.Rows[0]["lastUpdate"].ToString() ); return(_company); }
public IActionResult RegisterCompany() { string cnpj = FormatCnpjCpf.WithoutFormat(TempData["CompanyModel"] as string); var objCompany = new ConnectionReceitaws(new CompanyModel()); var registerCompany = new MySqlQueries(new CompanyModel()); registerCompany.RegisterCompany(objCompany.GetCompanyData(cnpj)); return(View()); }
public Boolean logar(String Login, String Senha) { if (VerificarSeCpfOuCnpj.verificar(Login)) { //Se for cpf ou cnpj preparar dado para pesquisar no banco Login = FormatCnpjCpf.SemFormatacao(Login); //tirando pontos if (Login.Length == 11) //formatando de acordo com o tipo { Login = FormatCnpjCpf.FormatCPF(Login); } else { Login = FormatCnpjCpf.FormatCNPJ(Login); } } String[] info = new LoginBD().Logar(Login, Senha).ToArray(); //fazendo pesquisa no banco if (info.Length < 2) { //se retornar apenas um dado ControlViews.tipoDeAcesso = info[0]; return(false); } else {//se retornar os dados corretamente ControlViews.tipoDeAcesso = info[0]; if (ControlViews.tipoDeAcesso.Equals("funcionario")) { ControlViews.idFunc = info[1]; ControlViews.cpf = info[2]; ControlViews.adm = Convert.ToBoolean(info[3]); ControlViews.cnpj = info[4]; } else if (ControlViews.tipoDeAcesso.Equals("instituicao")) { ControlViews.cnpj = info[1]; } return(true); } }