public static void AtualizarCliente() { try { string comando = "Update tbl_contato set nome = '" + Nome + "', " + "razaosocial = '" + RazaoSocial + "', telefone = '" + Telefone + "', " + "contato = '" + Contato + "', setor = '" + Setor + "', " + "cpf = '" + CPF + "', rg = '" + RG + "', cnpj = '" + CNPJ + "', " + "inscricaoestadual = '" + InscricaoEstadual + "', inscricaomunicipal = '" + InscricaoMunicipal + "', " + "site = '" + Site + "', email = '" + Email + "', endereco = '" + Endereco + "', " + "bairro = '" + Bairro + "', cidade = '" + Cidade + "', estado = '" + Estado + "', " + "cep = '" + CEP + "', complemento = '" + Complemento + "', " + "pontoreferencia = '" + PontoReferencia + "', obs = '" + Obs + "'" + "where id = '" + ID + "';"; Sistema.ExecutaComando(comando); comando = "Update tbl_contato_contrato set contrato = " + Contrato + " where contato = " + ID + ";"; Sistema.ExecutaComando(comando); } catch (Exception) { ListaErro.RetornaErro(38); return; } finally { Log.AlterarCliente(); ListaMensagens.RetornaMensagem(11, MessageBoxIcon.Information); } }
public static bool AnexarArquivo(string caminhoArquivo) { bool resultado = false; try { string formato = Path.GetExtension(caminhoArquivo).ToUpper(); string nomeArquivo = Path.GetFileNameWithoutExtension(caminhoArquivo); string nomeArquivoCompleto = nomeArquivo + formato; string enderecoServidor = Encoding.UTF8.GetString(Convert.FromBase64String(Sistema.EnderecoServidor)); string caminhoPasta = "\\\\" + enderecoServidor + "\\GerenciadorTarefas\\Anexos\\" + id.ToString(); string destino = caminhoPasta + "\\" + nomeArquivoCompleto; if (!Directory.Exists(caminhoPasta)) { Directory.CreateDirectory(caminhoPasta); } FileInfo arquivo = new FileInfo(destino); if (!arquivo.Exists) { try { File.Copy(caminhoArquivo, destino); resultado = true; } catch (Exception) { ListaErro.RetornaErro(65); return(resultado); } finally { if (resultado) { string comando = "Select id from tbl_tarefa_anexos " + "where tarefa = '" + id.ToString() + "' and nome = '" + nomeArquivoCompleto + "';"; if (string.IsNullOrEmpty(Sistema.ConsultaSimples(comando))) { Sistema.ExecutaComando("insert into tbl_tarefa_anexos values(0," + id.ToString() + "," + "'" + nomeArquivoCompleto + "');"); } else { ListaMensagens.RetornaMensagem(35, MessageBoxIcon.Information); resultado = false; } } } } else { ListaMensagens.RetornaMensagem(34, MessageBoxIcon.Information); } } catch (Exception) { } return(resultado); }