Exemplo n.º 1
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);
        }
Exemplo n.º 2
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);
        }