Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public List<List<ItNota>> SelecionaDadosItNota(out String pstrMsg, out Boolean pbooRetorno, Util.ObjTransf pobjTransf, List<Cliente> plstCliente)
- {
- List<List<ItNota>> lstListItNota = default(List<List<ItNota>>);
- SqlConnection conn = ConexaoBD.CriarConexao(out pstrMsg, out pbooRetorno);
- if (pbooRetorno)
- {
- using (conn)
- {
- using (SqlCommand cmd = new SqlCommand("uspCtzSelectDadosProd", conn))
- {
- cmd.CommandType = CommandType.StoredProcedure;
- cmd.Parameters.AddWithValue("@cd_emp", null);
- cmd.Parameters.AddWithValue("@nu_rom", null);
- cmd.Parameters.AddWithValue("@cd_clien", null);
- try
- {
- lstListItNota = new List<List<ItNota>>();
- foreach (var cliente in plstCliente)
- {
- cmd.Parameters["@cd_emp"].Value = pobjTransf.CdEmp;
- cmd.Parameters["@nu_rom"].Value = pobjTransf.NuRom;
- cmd.Parameters["@cd_clien"].Value = cliente.CdClien;
- using (SqlDataReader rd = cmd.ExecuteReader())
- {
- if (rd.HasRows)
- {
- List<ItNota> lstItNota = new List<ItNota>();
- while (rd.Read())
- {
- ItNota itNota = new ItNota();
- itNota.CdClien = cliente.CdClien;
- itNota.Seq = rd["seq"].ToString();
- itNota.Codigo = rd["codigo"].ToString();
- itNota.Descricao = rd["descricao"].ToString();
- itNota.Valor = rd["valor"].ToString();
- itNota.Nf = rd["nf"].ToString();
- itNota.Perecivel = rd["perecivel"].ToString();
- itNota.Embarcador = rd["embarcador"].ToString();
- lstItNota.Add(itNota);
- }
- lstListItNota.Add(lstItNota);
- }
- pbooRetorno = true;
- }
- }
- }
- catch (SqlException ex)
- {
- pstrMsg = ex.Message;
- pbooRetorno = false;
- }
- }
- }
- }
- else
- {
- conn.Close();
- }
- return lstListItNota;
- }
- // Busca os dados dos itens da nota
- List<List<ItNota>> lstListItNota = seleciona.SelecionaDadosItNota(out pstrMsg, out pbooRetorno, pobjTransf, lstCliente);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement