예제 #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);
        }
예제 #2
0
        /// <summary>
        /// 获得数据列表
        /// </summary>
        public List <WebApi_Model.T_Product_OrderDetails> DataTableToList(DataTable dt)
        {
            List <WebApi_Model.T_Product_OrderDetails> modelList = new List <WebApi_Model.T_Product_OrderDetails>();
            int rowsCount = dt.Rows.Count;

            if (rowsCount > 0)
            {
                WebApi_Model.T_Product_OrderDetails model;
                for (int n = 0; n < rowsCount; n++)
                {
                    model = dal.DataRowToModel(dt.Rows[n]);
                    T_Product tpbll = new T_Product();
                    model.Product = tpbll.GetDetailsByID((int)model.ProductID, true);
                    T_Product_Ext tpebll = new T_Product_Ext();
                    model.Product_Ext = tpebll.GetModel((int)model.ProductExtID);
                    if (model != null)
                    {
                        modelList.Add(model);
                    }
                }
            }
            return(modelList);
        }
예제 #3
0
        /// <summary>
        /// 获得数据列表
        /// </summary>
        public List <WebApi_Model.T_User_ShopCar> DataTableToList(DataTable dt)
        {
            List <WebApi_Model.T_User_ShopCar> modelList = new List <WebApi_Model.T_User_ShopCar>();
            int rowsCount = dt.Rows.Count;

            if (rowsCount > 0)
            {
                WebApi_Model.T_User_ShopCar model;
                for (int n = 0; n < rowsCount; n++)
                {
                    model = dal.DataRowToModel(dt.Rows[n]);
                    if (model != null)
                    {
                        T_Product pbll = new T_Product();
                        model.Product = pbll.GetDetailsByID((int)model.ProductID, true);
                        T_Product_Ext tpebll = new T_Product_Ext();
                        model.Product_Ext = tpebll.GetModel((int)model.ProductExtID);

                        //if (model.Product_Ext != null)
                        //{
                        //    if (model.Product_Ext.Property != null && model.Product_Ext.Property != "") {
                        //        T_Product_Property tppbll = new T_Product_Property();
                        //        List<WebApi_Model.T_Product_Property> list = new List<WebApi_Model.T_Product_Property>();
                        //        string[] key = model.Product_Ext.Property.Split(',');
                        //        for (int i = 0; i < key.Length; i++) {
                        //            list.Add(tppbll.GetModel(int.Parse(key[i])));
                        //        }
                        //        model.Product_Property = list;
                        //    }

                        //}
                        modelList.Add(model);
                    }
                }
            }
            return(modelList);
        }