public static Product Select(string codigoBarras, string operacao) { string cmd = ""; if (operacao.Equals(CONSULTA_TOTAL)) { cmd = string.Format("select * from selecionar_produto('{0}')", codigoBarras); } else if (operacao.Equals(CONSULTA_VENDA)) { cmd = string.Format("select * from selecionar_produto_venda('{0}')", codigoBarras); } DataTable dt = GenericDAO.Select(cmd); if (dt != null) { if (dt.Rows.Count > 0) { if (operacao.Equals(CONSULTA_TOTAL)) { return(new Product(dt.Rows[0]["codigo_barras"].ToString(), dt.Rows[0]["descricao"].ToString(), Int32.Parse(dt.Rows[0]["estoque"].ToString()), dt.Rows[0]["unidade"].ToString(), Convert.ToDouble(dt.Rows[0]["preco_custo"].ToString()), Convert.ToDouble(dt.Rows[0]["preco_venda"].ToString()))); } if (operacao.Equals(CONSULTA_VENDA)) { return(new Product(dt.Rows[0]["codigo_barras"].ToString(), dt.Rows[0]["descricao"].ToString(), Int32.Parse(dt.Rows[0]["estoque"].ToString()), dt.Rows[0]["unidade"].ToString(), Convert.ToDouble(dt.Rows[0]["preco_venda"].ToString()))); } return(null); } } return(null); }
public static Customer SelectWithBill(string cpf) { string cmd = string.Format("select * from selecionar_todos_item_conta_nao_pagas_cliente('{0}')", cpf); DataTable dt = GenericDAO.Select(cmd); List <BillItem> items = new List <BillItem>(); if (dt != null) { for (int i = 0; i < dt.Rows.Count; i++) { items.Add(new BillItem(Convert.ToDateTime(dt.Rows[i][2].ToString()), double.Parse(dt.Rows[i][3].ToString()))); } } if (dt != null) { if (dt.Rows.Count > 0) { return(new Customer(dt.Rows[0]["nome"].ToString(), dt.Rows[0]["pessoa_cpf"].ToString(), new Bill(items))); } } return(null); }
public static User Select(string cpf) { string cmd = string.Format("select * from selecionar_funcionario('{0}')", cpf); DataTable dt = GenericDAO.Select(cmd); if (dt.Rows.Count > 0) { return(new User(dt.Rows[0]["id"].ToString(), dt.Rows[0]["login"].ToString(), dt.Rows[0]["senha"].ToString(), dt.Rows[0]["nome"].ToString())); } return(null); }
public static DataTable Select(string id_venda) { string cmd = string.Format("select * from selecionar_todos_item_venda('{0}')", id_venda); DataTable dt = GenericDAO.Select(cmd); if (dt.Rows.Count > 0) { return(dt); } else { return(null); } }
public static DataTable SelectAll() { string cmd = string.Format("select * from selecionar_todos_funcionarios()"); DataTable dt = GenericDAO.Select(cmd); if (dt.Rows.Count > 0) { return(dt); } else { return(null); } }
public static DataTable Select() { string cmd = string.Format("select * from selecionar_todos_clientes()"); DataTable dt = GenericDAO.Select(cmd); if (dt != null) { if (dt.Rows.Count > 0) { return(formatDataSet(dt)); } } return(null); }
public static Customer Select(string cpf) { string cmd = string.Format("select * from selecionar_cliente('{0}')", cpf); DataTable dt = GenericDAO.Select(cmd); if (dt != null) { if (dt.Rows.Count > 0) { return(new Customer(dt.Rows[0]["nome"].ToString(), dt.Rows[0]["cpf"].ToString(), dt.Rows[0]["rg"].ToString(), dt.Rows[0]["sexo"].ToString(), Convert.ToDateTime(dt.Rows[0]["nascimento"].ToString()), dt.Rows[0]["telefone"].ToString(), dt.Rows[0]["celular"].ToString(), new Address(dt.Rows[0]["rua"].ToString(), dt.Rows[0]["numero"].ToString(), dt.Rows[0]["complemento"].ToString(), dt.Rows[0]["bairro"].ToString(), dt.Rows[0]["cidade"].ToString(), dt.Rows[0]["estado"].ToString()))); } } return(null); }
public static Sale Select(string id) { string cmd = string.Format("select * from selecionar_venda('{0}')", id); DataTable dt = GenericDAO.Select(cmd); if (dt.Rows.Count > 0) { return(new Sale(dt.Rows[0]["id"].ToString(), Convert.ToDateTime(dt.Rows[0]["data"].ToString()), new Customer(dt.Rows[0]["nome"].ToString(), dt.Rows[0]["pessoa_cpf"].ToString()), Convert.ToDouble(dt.Rows[0]["total_dinheiro"].ToString()), Convert.ToDouble(dt.Rows[0]["total_cartao"].ToString()), Convert.ToDouble(dt.Rows[0]["valor_total"].ToString()))); } else { return(null); } }
public static DataTable Select(string operacao) { string cmd = ""; if (operacao.Equals(CONSULTA_TOTAL)) { cmd = string.Format("select * from selecionar_todos_produtos()"); } else if (operacao.Equals(CONSULTA_VENDA)) { cmd = string.Format("select * from selecionar_todos_produtos_venda()"); } DataTable dt = GenericDAO.Select(cmd); if (dt.Rows.Count > 0) { return(dt); } else { return(null); } }
public static DataTable Select(DateTime start, DateTime end) { string cmd = string.Format("select * from selecionar_todas_vendas_periodo('{0}','{1}')", start, end); return(GenericDAO.Select(cmd)); }
public static DataTable Select() { string cmd = string.Format("select * from selecionar_todas_vendas()"); return(GenericDAO.Select(cmd)); }