public ActionResult Articulo_View(string codArticulo)
        {
            Dat_Pedido                 datPedido = new Dat_Pedido();
            Ent_Articulo_pedido        articulo  = new Ent_Articulo_pedido();
            List <Ent_Articulo_Tallas> tallas    = new List <Ent_Articulo_Tallas>();

            //string codArticulo = "7016678";

            datPedido.listarStr_ArticuloTalla(codArticulo, 0, ref articulo, ref tallas);

            ViewBag.DataArticulo = articulo;

            return(View());
        }
示例#2
0
        public void listarStr_ArticuloTalla(string CodArticulo, decimal BasId, ref Ent_Articulo_pedido articulo, ref List <Ent_Articulo_Tallas> tallas)
        {
            try
            {
                SqlConnection cn = new SqlConnection(Ent_Conexion.conexion);
                cn.Open();
                SqlCommand oComando = new SqlCommand("USP_Leer_Articulo_MVC", cn);
                oComando.CommandType = CommandType.StoredProcedure;

                SqlParameter oArticulo = oComando.Parameters.Add("@Art_Id", SqlDbType.VarChar);
                oArticulo.Direction = ParameterDirection.Input;
                oArticulo.Value     = CodArticulo;


                SqlParameter oBasId = oComando.Parameters.Add("@bas_Id", SqlDbType.Int);
                oBasId.Direction = ParameterDirection.Input;
                oBasId.Value     = BasId;
                SqlDataAdapter da = new SqlDataAdapter(oComando);
                DataSet        ds = new DataSet("row");
                da.Fill(ds);

                articulo = new Ent_Articulo_pedido();
                articulo = (from DataRow dr in ds.Tables[0].Rows
                            select new Ent_Articulo_pedido()
                {
                    Art_id = Convert.ToString(dr["Art_id"]),
                    Art_Descripcion = Convert.ToString(dr["Art_Descripcion"]),
                    Mar_Descripcion = Convert.ToString(dr["Mar_Descripcion"]),
                    Col_Descripcion = Convert.ToString(dr["Col_Descripcion"]),
                    Cat_Pri_Descripcion = Convert.ToString(dr["Cat_Pri_Descripcion"]),
                    Cat_Descripcion = Convert.ToString(dr["Cat_Descripcion"]),
                    Sca_Descripcion = Convert.ToString(dr["Sca_Descripcion"]),
                    Art_Comision = Convert.ToDecimal(dr["Art_Comision"]),
                    Con_Fig_Percepcion = Convert.ToDecimal(dr["Con_Fig_Percepcion"]),
                    Afec_Percepcion = Convert.ToDecimal(dr["Afec_Percepcion"]),
                    Art_Pre_Sin_Igv = (dr["Art_Pre_Sin_Igv"] == null) ? 0 : Convert.ToDecimal(dr["Art_Pre_Sin_Igv"]),            //  Convert.ToDecimal(dr["Art_Pre_Sin_Igv"]),
                    Art_Pre_Con_Igv = (dr["Art_Pre_Con_Igv"] == null) ? 0 : Convert.ToDecimal(dr["Art_Pre_Con_Igv"]),            //Convert.ToDecimal(dr["Art_Pre_Con_Igv"]),
                    Art_Costo = Convert.ToDecimal(dr["Art_Costo"]),
                    Art_Mar_Id = Convert.ToString(dr["Art_Mar_Id"]),
                    Ofe_Id = Convert.ToDecimal(dr["Ofe_Id"]),
                    Ofe_MaxPares = Convert.ToDecimal(dr["Ofe_MaxPares"]),
                    Ofe_Porc = Convert.ToDecimal(dr["Ofe_Porc"]),
                    Ofe_Tipo = Convert.ToString(dr["Ofe_Tipo"]),
                    Ofe_ArtVenta = Convert.ToDecimal(dr["Ofe_ArtVenta"]),
                    Ofe_Prioridad = Convert.ToDecimal(dr["Ofe_Prioridad"]),
                    Art_Foto = Convert.ToString(dr["Art_Foto"]),
                }).First();
                articulo._ofertas = (from DataRow dr in ds.Tables[0].Rows
                                     select new Ent_Articulo_Ofertas()
                {
                    Ofe_Id = Convert.ToDecimal(dr["Ofe_Id"]),
                    Ofe_MaxPares = Convert.ToDecimal(dr["Ofe_MaxPares"]),
                    Ofe_Porc = Convert.ToDecimal(dr["Ofe_Porc"]),
                    Ofe_Tipo = Convert.ToString(dr["Ofe_Tipo"]),
                    Ofe_ArtVenta = Convert.ToDecimal(dr["Ofe_ArtVenta"]),
                    Ofe_Prioridad = Convert.ToDecimal(dr["Ofe_Prioridad"]),
                }).ToList();


                tallas = new List <Ent_Articulo_Tallas>();
                tallas = (from DataRow dr in ds.Tables[1].Rows
                          select new Ent_Articulo_Tallas()
                {
                    Stk_ArtId = Convert.ToString(dr["Stk_ArtId"]),
                    Tal_Descripcion = dr["Tal_Descripcion"].ToString(),
                    Tall_Des = dr["Tall_Des"].ToString(),
                    Tall_Cant = Convert.ToDecimal(dr["Tall_Cant"]),
                }).ToList();
                cn.Close();
            }
            catch (Exception ex)
            {
            }
        }