private List <EClubes> LoadClubs(string path) { string[] strLinhas; string[] strTemp; using (var stream = new StreamReader(path)) { strLinhas = stream.ReadToEnd().Split('\n'); } System.IO.File.Delete(path.Replace(".txt", "_processado.txt")); System.IO.File.Move(path, path.Replace(".txt", "_processado.txt")); if (strLinhas.Count() < 1) { return(null); } var lstClubes = new List <EClubes>(); var eClubes = new EClubes(); foreach (string str in strLinhas) { if (string.IsNullOrEmpty(str)) { continue; } strTemp = str.Split(';'); eClubes = new EClubes(); eClubes.Codigo_Bolsa = strTemp[00].DBToInt32(); eClubes.Codigo_da_Empresa = strTemp[01].DBToInt32(); eClubes.Nome_do_Clube = strTemp[02].DBToString(); eClubes.Data = strTemp[03].DBToDateTime(); eClubes.Cotacao = strTemp[04].DBToDecimal(); eClubes.Codigo_Cliente = strTemp[05].DBToInt64(); eClubes.Nome_do_Cliente = strTemp[06].DBToString(); eClubes.Dcquantidade = strTemp[07].DBToInt32(); eClubes.Dccotacao = strTemp[08].DBToInt32(); eClubes.Data_Inicial = strTemp[09].DBToDateTime(); eClubes.Saldo_Quantidade = strTemp[10].DBToDecimal(); eClubes.Saldo_Bruto = strTemp[11].DBToDecimal(); eClubes.IR = strTemp[12].DBToDecimal(); eClubes.IOF = strTemp[13].DBToDecimal(); eClubes.Rendimento = strTemp[14].DBToDecimal(); eClubes.Performance = strTemp[15].DBToDecimal(); eClubes.Saldo_Liquido = strTemp[16].DBToDecimal(); eClubes.Saldo_Inicial = strTemp[17].DBToDecimal(); eClubes.Codigo_do_Agente = strTemp[18].DBToInt32(); eClubes.Nome_do_Agente = strTemp[19].ToString(); lstClubes.Add(eClubes); } return(lstClubes); }
public List <EClubes> ConsultarClubes(string CpfCnpj) { var eClubes = new EClubes(); var dataTable = new DataTable(); var clubeLista = new List <EClubes>(); base.AcessaDados.ConnectionStringName = base.ConexaoOMS; using (var dbCommand = base.AcessaDados.CreateCommand(CommandType.StoredProcedure, "prc_consulta_clubes")) { base.AcessaDados.AddInParameter(dbCommand, "@cpfcgc", DbType.String, CpfCnpj); dataTable = base.AcessaDados.ExecuteOracleDataTable(dbCommand); } foreach (DataRow item in dataTable.Rows) { eClubes = new EClubes(); eClubes.Nome_do_Clube = item["Nome_do_Clube"].DBToString(); eClubes.Codigo_da_Empresa = item["Codigo_da_Empresa"].DBToInt32(); eClubes.Codigo_Bolsa = item["Codigo_Bolsa"].DBToInt32(); eClubes.Data = item["Data"].DBToDateTime(); eClubes.Cotacao = item["Cotacao"].DBToDecimal(); eClubes.Codigo_Cliente = item["CODIGO_DO_CLIENTE"].DBToInt32(); eClubes.Nome_do_Cliente = item["Nome_do_Cliente"].DBToString(); eClubes.Dcquantidade = item["Dcquantidade"].DBToInt32(); eClubes.Dccotacao = item["Dccotacao"].DBToInt32(); eClubes.Data_Inicial = item["Data_Inicial"].DBToDateTime(); eClubes.Saldo_Quantidade = item["Saldo_Quantidade"].DBToDecimal(); eClubes.Saldo_Bruto = item["Saldo_Bruto"].DBToDecimal(); eClubes.IR = item["IR"].DBToDecimal(); eClubes.IOF = item["IOF"].DBToDecimal(); eClubes.Rendimento = item["Rendimento"].DBToDecimal(); eClubes.Performance = item["Performance"].DBToDecimal(); eClubes.Saldo_Liquido = item["Saldo_Liquido"].DBToDecimal(); eClubes.Saldo_Inicial = item["Saldo_Inicial"].DBToDecimal(); eClubes.Codigo_do_Agente = item["Codigo_do_Agente"].DBToInt32(); eClubes.Nome_do_Agente = item["Nome_do_Agente"].DBToString(); eClubes.CPF_CGC = item["CPFCGC"].DBToString(); eClubes.Tipo = item["Tipo"].DBToInt32(); eClubes.Data_Atualizacao = item["Data_Atualizacao"].DBToDateTime(); clubeLista.Add(eClubes); } return(clubeLista); }
private List <EClubes> Filtra(List <EClubes> lstClubes) { var lListaFiltradaClubes = from ret in lstClubes orderby ret.Codigo_Cliente, ret.Nome_do_Clube, ret.Data select ret; var auxCodigo = long.MinValue; var auxClube = string.Empty; DateTime auxData; if (lListaFiltradaClubes.ToList().Count > 0) { EClubes Clube1 = (EClubes)lListaFiltradaClubes.ToList()[0]; auxCodigo = Clube1.Codigo_Cliente.Value; auxClube = Clube1.Nome_do_Clube; auxData = Clube1.Data.Value; } List <EClubes> lstClubesReturn = new List <EClubes>(); EClubes ClubeAnterior = (EClubes)lListaFiltradaClubes.ToList()[0]; EClubes Clube; foreach (var ent in lListaFiltradaClubes) { Clube = (EClubes)ent; if (Clube.Codigo_Cliente.Value != auxCodigo || Clube.Nome_do_Clube != auxClube) { lstClubesReturn.Add(ClubeAnterior); } auxCodigo = Clube.Codigo_Cliente.Value; auxClube = Clube.Nome_do_Clube; auxData = Clube.Data.Value; ClubeAnterior = (EClubes)ent; } return(lstClubesReturn); }