public static List<string> GetVisitProductByType(int type) { HolycaDataContext ctx = new HolycaDataContext(); List<string> tmpProducts = new List<string>(); switch (type) { case 1: return (from c in ctx.Vi_Web_Pdt_Lists where (c.intFirstCategory == 10) && (c.intSecondCategory == 0x40) select string.Format("pdtid={0}", c.intProductID)).Distinct<string>().ToList<string>(); case 2: return (from c in ctx.Vi_Web_Pdt_Lists where (c.intFirstCategory == 10) && (c.intSecondCategory == 0x3e) select string.Format("pdtid={0}", c.intProductID)).Distinct<string>().ToList<string>(); case 3: return (from c in ctx.Vi_Web_Pdt_Lists where (c.intFirstCategory == 10) && (c.intSecondCategory == 0x3f) select string.Format("pdtid={0}", c.intProductID)).Distinct<string>().ToList<string>(); case 4: return (from c in ctx.Vi_Web_Pdt_Lists where (c.intFirstCategory == 2) && (c.intSecondCategory == 0x19) select string.Format("pdtid={0}", c.intProductID)).Distinct<string>().ToList<string>(); case 5: return (from c in ctx.Vi_Web_Pdt_Lists where (c.intFirstCategory == 11) && (c.intScore >= 300) select string.Format("pdtid={0}", c.intProductID)).Distinct<string>().ToList<string>(); case 6: return (from c in ctx.Vi_Web_Pdt_Lists where ((c.intFirstCategory == 6) && (c.intSecondCategory == 40)) && (c.vchProductName.Contains("吸奶器") || c.vchProductName.Contains("吸乳器")) select string.Format("pdtid={0}", c.intProductID)).Distinct<string>().ToList<string>(); case 7: return (from c in ctx.Vi_Web_Pdt_Lists where ((c.intFirstCategory == 6) && (c.intSecondCategory == 0x29)) && (c.vchProductName.Contains("消毒锅") || c.vchProductName.Contains("消毒器")) select string.Format("pdtid={0}", c.intProductID)).Distinct<string>().ToList<string>(); case 8: return (from c in ctx.Vi_Web_Pdt_Lists where ((c.intFirstCategory == 11) && (c.intSecondCategory == 70)) && (c.intBrandID == 0x1bb) select string.Format("pdtid={0}", c.intProductID)).Distinct<string>().ToList<string>(); case 9: return (from c in ctx.Vi_Web_Pdt_Lists where c.intBrandID == 0x256 select string.Format("pdtid={0}", c.intProductID)).Distinct<string>().ToList<string>(); case 10: return (from c in ctx.Vi_Web_Pdt_Lists where c.intBrandID == 0x202 select string.Format("pdtid={0}", c.intProductID)).Distinct<string>().ToList<string>(); case 11: return (from c in ctx.Vi_Web_Pdt_Lists where c.intBrandID == 0x13f select string.Format("pdtid={0}", c.intProductID)).Distinct<string>().ToList<string>(); } return tmpProducts; }
public static string GetProductCode(int productid) { string productCode = ""; HolycaDataContext ctx = new HolycaDataContext(); if (Queryable.Any<Pdt_Base_Info>(ctx.Pdt_Base_Infos, p => p.intProductID == productid)) { productCode = Queryable.FirstOrDefault<Pdt_Base_Info>(ctx.Pdt_Base_Infos, p => p.intProductID == productid).vchproductcode; } return productCode; }