This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
/// <summary> | |
/// Provides differente methods for displaying error messages to user. | |
/// </summary> | |
internal class MensagemDeErro | |
{ | |
/// <summary> | |
/// Displays the errors message returned by the database. | |
/// </summary> | |
/// <param name="resultado_conexao"></param> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/// <summary> | |
/// Adiciona o ponto do milhar e permite que o usuário insira número decimal. | |
/// </summary> | |
/// <param name="sender"></param> | |
/// <param name="e"></param> | |
private void Txt_valor_KeyUp(object sender, KeyEventArgs e) | |
{ | |
try | |
{ | |
int numero_caracteres = txt_valor.Text.ToString().Count(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using Ergonomia.Banco; | |
using Ergonomia.Classes; | |
using iTextSharp.text; | |
using iTextSharp.text.pdf; | |
using System; | |
using System.Collections.Generic; | |
//using System.Drawing; | |
using System.IO; | |
using System.Linq; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/// <summary> | |
/// Informa se existem visitas agendadas para o usuário no dia de hoje. | |
/// </summary> | |
private bool existem_visitas_hoje() | |
{ | |
return lista_visitas_de_hoje.Count > 0 ? true : false; | |
} | |
/// <summary> | |
/// Obtém as visitas do dia de hoje para um dado usuário. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Para descobrir a versão do database, utilizar o comando sql: | |
SELECT version(); | |
e você costuma trabalhar em varias maquinas e precisa um certo sincronismo de dados seria interessante colocar esse banco em um serviço de nuvem: | |
No windows abra o Pg admin e depois o editor de SQL e execute o comando: | |
show data_directory; | |
ex: ""C:/Program Files/PostgreSQL/9.3/data" | |
E execute SELECT oid from pg_database where datname ='NomeDobanco' | |
Para achar o nome da pasta do banco: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/// <summary> | |
/// Verifica se a data informada pelo usuário é válida. | |
/// </summary> | |
/// <param name="data_a_validar_">Data a ser verificada.</param> | |
/// <returns>Verdadeiro se os dados estão validados.</returns> | |
public bool a_data_eh_valida(DateTime data_a_validar_) | |
{ | |
DateTime data_a_validar = data_a_validar_.Date; | |
int dia = data_a_validar.Day; | |
int mes = data_a_validar.Month; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/// <summary> | |
/// Verifica se uma linha foi selecionada em uma listview. Caso não, exibe uma mensagem ao usuário. | |
/// </summary> | |
/// <param name="listview"></param> | |
/// <param name="acao_a_ser_feita">Ex: atualizar, remover, excluir, editar.</param> | |
/// <returns></returns> | |
public bool linha_foi_selecionada_na_list_view(ListView listview, string acao_a_ser_feita) | |
{ | |
if (listview.SelectedItems.Count == 1) | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/// <summary> | |
/// Carrega a combo box com os departamentos dos produtos; | |
/// </summary> | |
private void carrega_combo_box_departamento() | |
{ | |
banco_departamento conexao_departamento = new banco_departamento(); | |
lista_departamento = conexao_departamento.carrega_departamentos().OrderBy(c => c.cod_departamento).ToList(); | |
metodo.informa_erro_banco_dados(lista_departamento, 77); | |
if (cb_departamento.Items.Count == 0) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class Conexao_Banco | |
{ | |
public string string_conexao; | |
/// <summary> | |
/// Utiliza a Connection String informada em App.config para estabelecer a conexão com o banco de dados. | |
/// </summary> | |
public Conexao_Banco() | |
{ | |
string_conexao = System.Configuration.ConfigurationManager.ConnectionStrings["conexao_banco"].ConnectionString; |