Exemple #1
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public WebApi_Model.T_Product GetDetailsByID(int ProductID, bool Lazy)
        {
            WebApi_Model.T_Product product = new WebApi_Model.T_Product();
            product = dal.GetModel(ProductID);
            if (product != null)
            {
                WebApi_BLL.T_Product_Tag      tpg_bll = new T_Product_Tag();
                WebApi_BLL.T_Product_Category tpc_bll = new T_Product_Category();
                product.Product_Tag   = tpg_bll.GetModelList(" tagID in (0" + product.TagID + ")");
                product.CategoryName1 = tpc_bll.GetModel(Convert.ToInt32(product.Category1)).CategoryName;
                product.CategoryName2 = tpc_bll.GetModel(Convert.ToInt32(product.Category2)).CategoryName;

                if (!Lazy)
                {
                    WebApi_BLL.T_Product_Photo a_bll = new T_Product_Photo();
                    //图片
                    product.Product_Photo = a_bll.GetModelList(" ImgType = 0 and ProductID =" + product.ProductID);
                    //图文详情
                    product.Product_Photo_Details = a_bll.GetModelList(" ImgType = 1 and ProductID =" + product.ProductID);


                    WebApi_BLL.T_Product_Ext b_bll = new T_Product_Ext();
                    product.Product_Ext = b_bll.GetModelList(" ProductID = " + product.ProductID);

                    WebApi_BLL.T_Product_Property c_bll = new T_Product_Property();
                    product.Product_Property = c_bll.GetModelList(" ProductID = " + ProductID);
                    //product.Product_Ext =
                }
            }

            return(product);
        }
Exemple #2
0
        public IHttpActionResult GetProductByID(int ProductID, bool IsLazy)
        {
            WebApi_Model.T_Product newProduct = bll.GetDetailsByID(ProductID, IsLazy);

            //string[] a = new string[] { "1", "2", "3" };
            //string[] b = new string[] { "4", "5", "6" };
            //string[] c = new string[] { "8", "9" };
            //List<string[]> al = new List<string[]>();
            //al.Add(a);
            //al.Add(b);
            //al.Add(c);
            //string[] mmm;
            //mmm = StringHelper.BianLi(al);


            //List<WebApi_Model.T_RechargeType> list = bll.DataTableToList(bll.GetAllList().Tables[0]);
            if (newProduct == null)
            {
                return(Ok(ReturnJsonResult.GetJsonResult(-1, "没有找到商品信息", JsonConvert.SerializeObject(newProduct))));
            }
            return(Ok(ReturnJsonResult.GetJsonResult(1, "OK", JsonConvert.SerializeObject(newProduct))));
        }
Exemple #3
0
 /// <summary>
 /// 更新一条数据
 /// </summary>
 public bool Update(WebApi_Model.T_Product model)
 {
     return(dal.Update(model));
 }
Exemple #4
0
 /// <summary>
 /// 增加一条数据
 /// </summary>
 public int Add(WebApi_Model.T_Product model)
 {
     return(dal.Add(model));
 }