//产品详情
        public ActionResult Detail(string prodid)
        {
            #region 产品详情
            var ds = bll.GetModelInfo(prodid);
            if (ds != null && ds.Tables.Count > 0)
            {
                if (ds.Tables[0].Rows.Count > 0)
                {
                    ViewBag.ProModel = ds.Tables[0].Rows[0]["proModel"];
                }
                if (ds.Tables.Count > 1)
                {
                    //物性
                    ViewBag.PhysicalInfo = ds.Tables[1];
                    //从物性中匹配产品说明
                    for (var i = 0; i < ds.Tables[1].Rows.Count; i++)
                    {
                        if (ds.Tables[1].Rows[i]["lev"].ToString() == "1" && ds.Tables[1].Rows[i]["Attribute1"].ToString().Contains("产品说明"))
                        {
                            if (i + 1 <= ds.Tables[1].Rows.Count && ds.Tables[1].Rows[i + 1]["lev"].ToString() == "2")
                            {
                                ViewBag.description = ds.Tables[1].Rows[i + 1]["Attribute1"].ToString().Replace("\n", "").Replace("\r\n", "").Replace(" ", "");
                            }
                            break;
                        }
                    }
                }
                if (ds.Tables.Count > 2)
                {
                    //详情页标题:种类(Prd_SmallClass_l.Name)+型号(Product.ProModel)+产地(Product.PlaceOrigin)
                    ViewBag.Title = ds.Tables[2].Rows[0]["Title"].ToString();
                    //关键字:特性(product_l.characteristic)+用途(product_l.ProUse)
                    ViewBag.Keywords = ds.Tables[2].Rows[0]["keyword"].ToString();
                    //ViewBag.description2 =产品说明(只能用 exec readproduct '0004D924-5BD4-444F-A6D2-045D4EDB0DD3'命令中读出)
                }
            }
            #endregion

            #region 猜你喜欢和同厂家产品
            var LiveDs = bll.GetCompanyAndLiveProduct(10, prodid);
            #endregion

            ViewBag.ProdID      = prodid;
            ViewBag.LiveProdcut = LiveDs;
            return(View());
        }
Beispiel #2
0
        /// <summary>
        ///
        /// </summary>
        /// <returns></returns>
        public ActionResult ReplaceGetList()
        {
            PlasBll.ProductBll bll = new PlasBll.ProductBll();
            //产品编号
            string Rpt      = string.Empty;
            string ProTitle = "请选择产品";
            string ProGuid  = string.Empty;

            if (!string.IsNullOrEmpty(Request["Rpt"]))
            {
                Rpt = Request["Rpt"].ToString();
            }
            var    dt        = new DataTable();
            var    pt        = new DataTable();//替换属性RealKey
            string bigName   = string.Empty;
            string samllName = string.Empty;
            string RealKey   = string.Empty;

            if (!string.IsNullOrEmpty(Rpt))
            {
                var ds = bll.GetModelInfo(Rpt, "", "");
                //pt = plbll.GetAttributeAliasList_RealKey();//替换属性RealKey
                pt = plbll.NewGetAttributeAliasList_RealKey(Rpt);//替换属性RealKey(罗志强 修改使用新的存储过程查询参数数据)

                if (ds.Tables.Contains("ds") && ds.Tables[0].Rows.Count > 0)
                {
                    ProTitle = ds.Tables[0].Rows[0]["proModel"].ToString();
                    ProGuid  = ds.Tables[0].Rows[0]["productid"].ToString();
                }
                //if (ds.Tables.Contains("ds1") && ds.Tables[1].Rows.Count > 0)
                if (pt.Rows.Count > 0)
                {
                    //< !--卿思明:
                    //产品说明;注射; 注射说明; 备注 这些都不参与对比
                    //,说明,加工方法,备注不允许选择-- >
                    //< !--总体参与对比的有((RoHS 合规性;供货地区;加工方法;树脂ID(ISO 1043);特性;添加剂;填料 / 增强材料;用途 )这个是总体里要参与对比的)-->
                    var dr = pt; //ds.Tables[1];///此数据要过滤(罗志强修改使用新存储过程查询的数据)

                    DataTable  tblDatas = new DataTable("Datas");
                    DataColumn dc       = null;
                    dc = tblDatas.Columns.Add("lev", Type.GetType("System.Int32"));
                    dc = tblDatas.Columns.Add("Attribute1", Type.GetType("System.String"));
                    dc = tblDatas.Columns.Add("Attribute2", Type.GetType("System.String"));
                    dc = tblDatas.Columns.Add("Attribute3", Type.GetType("System.String"));
                    dc = tblDatas.Columns.Add("Attribute4", Type.GetType("System.String"));
                    dc = tblDatas.Columns.Add("Attribute5", Type.GetType("System.String"));
                    dc = tblDatas.Columns.Add("RealKey", Type.GetType("System.String"));
                    string  lev = string.Empty;
                    DataRow newRow;
                    for (var i = 0; i < dr.Rows.Count; i++)
                    {
                        if ((string.IsNullOrEmpty(dr.Rows[i]["Attribute2"].ToString()) && string.IsNullOrEmpty(dr.Rows[i]["RealKey"].ToString()) &&
                             string.IsNullOrEmpty(dr.Rows[i]["Attribute3"].ToString()) &&
                             string.IsNullOrEmpty(dr.Rows[i]["Attribute4"].ToString()) &&
                             string.IsNullOrEmpty(dr.Rows[i]["Attribute5"].ToString()) && dr.Rows[i]["Attribute1"].ToString().Trim() != "总体")
                            ||
                            (dr.Rows[i]["Attribute1"].ToString().Trim() == "加工方法" ||
                             dr.Rows[i]["Attribute1"].ToString().Trim() == "材料状态" ||
                             dr.Rows[i]["Attribute1"].ToString().Trim().Replace(" ", "") == "资料 1".Replace(" ", "") ||
                             dr.Rows[i]["Attribute1"].ToString().Trim().Replace(" ", "") == "搜索 UL 黄卡".Replace(" ", "") ||
                             dr.Rows[i]["Attribute1"].ToString().Trim().Replace(" ", "") == "UL 黄卡 2".Replace(" ", "") ||
                             dr.Rows[i]["Attribute1"].ToString().Trim().Replace(" ", "") == "UL文件号".Replace(" ", "")
                            )
                            )
                        {
                        }
                        else
                        {
                            //单独过滤注射
                            if (dr.Rows[i]["Attribute1"].ToString().Trim() == "注射")
                            {
                                //int.TryParse(dr.Rows[i]["lev"].ToString().Trim(), out lev);//记住注射
                                lev = "injection";
                            }
                            else
                            {
                                int count = (1 + Convert.ToInt32(dr.Rows[i]["lev"].ToString().Trim()));
                                if (count == 3 && lev == "injection")
                                {
                                }
                                else
                                {
                                    if (count == 2)//后续其他,必须清除,不然会有异常
                                    {
                                        lev = "";
                                    }
                                    newRow = tblDatas.NewRow();
                                    if (dr.Rows[i]["lev"].ToString() == "1")
                                    {
                                        bigName = dr.Rows[i]["Attribute1"].ToString().Trim();
                                    }
                                    else
                                    {
                                        samllName = dr.Rows[i]["Attribute1"].ToString().Trim();
                                    }
                                    //罗志强修改  在新的存储过程中已经查询出realkey
                                    //DataRow[] rows = pt.Select("Attribute1='" + bigName + "' and Attribute2Alias = '" + samllName + "'");
                                    //if (rows.Count() > 0)
                                    //{
                                    //    RealKey = rows[0]["RealKey"].ToString();
                                    //}
                                    newRow["lev"]        = dr.Rows[i]["lev"].ToString().Trim();
                                    newRow["Attribute1"] = dr.Rows[i]["Attribute1"].ToString().Trim();
                                    newRow["Attribute2"] = dr.Rows[i]["Attribute2"].ToString().Trim();
                                    newRow["Attribute3"] = dr.Rows[i]["Attribute3"].ToString().Trim();
                                    newRow["Attribute4"] = dr.Rows[i]["Attribute4"].ToString().Trim();
                                    newRow["Attribute5"] = dr.Rows[i]["Attribute5"].ToString().Trim();
                                    newRow["RealKey"]    = dr.Rows[i]["realkey"].ToString().Trim();// RealKey;
                                    tblDatas.Rows.Add(newRow);
                                }
                            }
                        }
                    }
                    dt = tblDatas;
                    //var spdr=dr.Select("Attribute1<>'产品说明' and Attribute1 <> '注射' and Attribute1 <> '备注'")
                }
                if (ds.Tables.Count > 2)
                {
                    //详情页标题:种类(Prd_SmallClass_l.Name)+型号(Product.ProModel)+产地(Product.PlaceOrigin)
                    ViewBag.Title = ds.Tables[2].Rows[0]["Title"].ToString();
                    //关键字:特性(product_l.characteristic)+用途(product_l.ProUse)
                    ViewBag.Keywords = ds.Tables[2].Rows[0]["keyword"].ToString();
                    //ViewBag.description2 =产品说明(只能用 exec readproduct '0004D924-5BD4-444F-A6D2-045D4EDB0DD3'命令中读出)
                }
            }
            ViewBag.PhysicalInfo = dt;
            ViewBag.ProModel     = ProTitle;
            ViewBag.ProGuid      = ProGuid;
            return(View());
        }