public static void ObtenerExtensionArte(ArteController arteCont, IMAGEN_ARTE_ESTILO arteEstilo, POSummary ItemSummary, string descripcion, IMAGEN_ARTE arte) { if (arte != null && arte.extensionArte != "") { int tam_var = arte.extensionArte.Length; string nombreEstiloArt = arte.extensionArte.Substring(0, tam_var - 4); if (descripcion == nombreEstiloArt && arte.extensionArte != null && arte.extensionArte != "") { ItemSummary.nombreArte = arte.extensionArte; } else { arteCont.BuscarRutaImagenEstilo(descripcion, arteEstilo); if (arteEstilo != null && arteEstilo.extensionArt != null) { int tam_var2 = arteEstilo.extensionArt.Length; string nomEsdesctiloArt = arteEstilo.extensionArt.Substring(0, tam_var2 - 4); if (descripcion == nomEsdesctiloArt && arteEstilo.extensionArt != null) { ItemSummary.nombreArte = arteEstilo.extensionArt; } else { ItemSummary.nombreArte = arte.extensionArte; } } else { ItemSummary.nombreArte = arte.extensionArte; } } } else { arteCont.BuscarRutaImagenEstilo(descripcion, arteEstilo); if (arteEstilo != null && arteEstilo.extensionArt != null) { int tam_var2 = arteEstilo.extensionArt.Length; string nomEsdesctiloArt = arteEstilo.extensionArt.Substring(0, tam_var2 - 4); if (descripcion == nomEsdesctiloArt && arteEstilo.extensionArt != null) { ItemSummary.nombreArte = arteEstilo.extensionArt; } } else { ItemSummary.nombreArte = arte.extensionArte; } } }
public IEnumerable <POSummary> ListadoInfEstilo(int?id) { ArteController arteCont = new ArteController(); ItemTallaData objTallas = new ItemTallaData(); PedidosData objPedido = new PedidosData(); ItemDescripcionData objDesc = new ItemDescripcionData(); MyDbContext db = new MyDbContext(); Conexion conn = new Conexion(); List <POSummary> listSummary = new List <POSummary>(); try { SqlCommand comando = new SqlCommand(); SqlDataReader leer = null; comando.Connection = conn.AbrirConexion(); comando.CommandText = "Listar_Item_Por_Pedido"; //Info_Estilo comando.CommandType = CommandType.StoredProcedure; comando.Parameters.AddWithValue("@Id", id); leer = comando.ExecuteReader(); while (leer.Read()) { IMAGEN_ARTE_ESTILO arteEstilo = new IMAGEN_ARTE_ESTILO(); POSummary ItemSummary = new POSummary(); ItemDescripcion Desc = new ItemDescripcion(); CatColores colores = new CatColores(); CatEspecialidades Especialidad = new CatEspecialidades(); CatTela Tela = new CatTela { Tela = leer["FABRIC"].ToString() }; Desc.Descripcion = leer["DESCRIPCION_ITEM"].ToString(); colores.CodigoColor = leer["CODIGO_COLOR"].ToString(); colores.DescripcionColor = leer["DESCRIPCION"].ToString(); Especialidad.Especialidad = leer["SPECIALTIES"].ToString(); ItemSummary.EstiloItem = leer["ITEM_STYLE"].ToString(); ItemSummary.Cantidad = Convert.ToInt32(leer["QTY"]); ItemSummary.Price = leer["PRICE"].ToString(); ItemSummary.Total = leer["TOTAL"].ToString(); ItemSummary.IdItems = Convert.ToInt32(leer["ID_PO_SUMMARY"]); ItemSummary.CatColores = colores; ItemSummary.ItemDescripcion = Desc; ItemSummary.CatEspecialidades = Especialidad; ItemSummary.CatTela = Tela; ItemSummary.PedidosId = Convert.ToInt32(leer["ID_PEDIDOS"]); OrdenesCompra listaPO = objPedido.ConsultarListaPO(ItemSummary.PedidosId); //List<ItemTalla> listaTallas = objTallas.ListadoTallasPorEstilo(ItemSummary.IdItems).ToList(); List <ItemTalla> listaTallas = objTallas.ListadoTallasDetallesPorEstilos(ItemSummary.IdItems).ToList(); string descripcion = ItemSummary.EstiloItem.TrimEnd() + "_" + colores.CodigoColor.TrimEnd(); int idEstilo = objDesc.ObtenerIdEstilo(ItemSummary.EstiloItem); var arte = db.ImagenArte.Where(x => x.IdEstilo == idEstilo).FirstOrDefault(); ObtenerExtensionArte(arteCont, arteEstilo, ItemSummary, descripcion, arte); ItemSummary.Pedidos = listaPO; ItemSummary.ListarTallasPorEstilo = listaTallas; listSummary.Add(ItemSummary); } leer.Close(); } finally { conn.CerrarConexion(); conn.Dispose(); } return(listSummary); }