Beispiel #1
0
        /// <summary>
        /// 专题分类初始化
        /// </summary>
        /// <param name="iclist">专题类集合</param>
        /// <param name="dt">数据表</param>
        /// <param name="categrrycode">分类code</param>
        private static void InitSpecialTopicCategory(List <DataRow> iclist, DataTable dt,
                                                     String categrrycode)
        {
            if (dt == null || dt.Rows.Count == 0)
            {
                return;
            }
            List <DataRow> results = new List <DataRow>();
            List <DataRow> res     = new List <DataRow>();

            //DataTableExtentions.DataTableToArray(dt).Where(item => Normal.ParseString(item["CATEGORYCODE"]).Trim() == categrrycode.Trim()).ToList();
            foreach (DataRow dataRow in DataTableExtentions.DataTableToArray(dt))
            {
                if (Normal.ParseString(dataRow["CATEGORYCODE"]).Trim() == categrrycode.Trim())
                {
                    res.Add(dataRow);
                    break;
                }
            }
            if (res.Count > 0)
            {
                results.Add(res[0]);
                GetChildsSpecialtopicCategories(results, res.ToArray(), dt);
            }
            iclist.AddRange(results.ToArray());
            results.Clear();
            results = null;
            dt.AcceptChanges();
        }
Beispiel #2
0
        /// <summary>
        /// 得出子专题的分类号
        /// </summary>
        /// <param name="results">数据行集合</param>
        /// <param name="drs">数据行数组</param>
        /// <param name="dataTable">数据表</param>
        private static void GetChildsSpecialtopicCategories(List <DataRow> results, DataRow[] drs, DataTable dataTable)
        {
            if (drs != null && drs.Length > 0)
            {
                List <DataRow> rows = new List <DataRow>();
                foreach (var dataRow in drs)
                {
                    //var res = allRows.Where(item => Normal.ParseString(item["PCATEGORYCODE"]) ==Normal.ParseString( dataRow["CATEGORYCODE"])).ToArray();
                    //if (res.Length > 0)
                    //{
                    foreach (DataRow item in dataTable.Rows)
                    {
                        if (Normal.ParseString(item["PCATEGORYCODE"]) == Normal.ParseString(dataRow["CATEGORYCODE"]))
                        {
                            rows.Add(item);
                            results.Add(item);
                        }
                    }
                    //  rows.AddRange(res);
                    //  results.AddRange(res);
                    //}
                }

                if (rows.Count > 0)
                {
                    GetChildsSpecialtopicCategories(results, rows.ToArray(), dataTable);
                }
                rows.Clear();
            }
        }
Beispiel #3
0
        /// <summary>
        /// 文本显示 (多行)
        /// </summary>
        /// <param name="obj">要处理的数据</param>
        /// <returns>返回处理后的数据</returns>
        public static String ListStrs(object obj)
        {
            char ch1 = (char)13; // 换行
            char ch2 = (char)32; // 空格

            return(ParseString(obj).Replace("<", "&lt;")
                   .Replace(">", "&gt;")
                   .Replace(ParseString(ch1), "<br>").Replace(
                       Normal.ParseString(ch2), "&nbsp;"));
        }