Ejemplo n.º 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);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public WebApi_Model.T_Product_Ext GetModel(int ProductExtID)
        {
            WebApi_Model.T_Product_Ext model = dal.GetModel(ProductExtID);
            T_Product_Property         tpp   = new T_Product_Property();

            model.HasProperty = tpp.GetModelList("PropertyID in (" + model.Property + ")");
            return(model);
        }
Ejemplo n.º 3
0
        /// <summary>
        /// 获得数据列表
        /// </summary>
        public List <WebApi_Model.T_Product_Ext> DataTableToList(DataTable dt)
        {
            List <WebApi_Model.T_Product_Ext> modelList = new List <WebApi_Model.T_Product_Ext>();
            int rowsCount = dt.Rows.Count;

            if (rowsCount > 0)
            {
                WebApi_Model.T_Product_Ext model;
                for (int n = 0; n < rowsCount; n++)
                {
                    model = dal.DataRowToModel(dt.Rows[n]);
                    if (model != null)
                    {
                        T_Product_Property tpp = new T_Product_Property();
                        model.HasProperty = tpp.GetModelList("PropertyID in (" + model.Property + ")");
                        modelList.Add(model);
                    }
                }
            }
            return(modelList);
        }