Ejemplo n.º 1
0
        public static IEnumerable <string> GetDataTableColValueFormatGroupStr(DataTable dt, string ColumnName, string Split, int MaxLength)
        {
            var v = dt.DefaultView.ToTable(true, ColumnName);


            List <string> Result = new List <string>();

            string tmp = ""; string current = "";

            for (int i = 0; i < v.Rows.Count; i++)
            {
                current = ConvertLib.ToString(v.Rows[i][ColumnName]);
                if (tmp.Length + current.Length > MaxLength)
                {
                    Result.Add(tmp);
                    tmp = "";
                }
                tmp += Split + current;
            }
            if (!String.IsNullOrEmpty(tmp))
            {
                Result.Add(tmp);
            }

            foreach (string s in Result)
            {
                yield return(s.Substring(Split.Length));
            }
        }
Ejemplo n.º 2
0
        public static IEnumerable <string> GetDataTableColValues(DataTable dt, string ColumnName)
        {
            var v = dt.DefaultView.ToTable(true, ColumnName);

            foreach (DataRow dr in v.Rows)
            {
                yield return(ConvertLib.ToString(dr[ColumnName]));
            }
        }
Ejemplo n.º 3
0
        public static string GetDataTableColValueFormatIn(IEnumerable <string> values)
        {
            string rel = string.Empty;

            foreach (string str in values)
            {
                if (string.IsNullOrEmpty(rel))
                {
                    rel = GetFormatInValue(ConvertLib.ToString(str));
                }
                else
                {
                    rel += "," + GetFormatInValue(ConvertLib.ToString(str));
                }
            }
            return(rel);
        }
Ejemplo n.º 4
0
        public static string GetDataTableColValueFormatIn(DataTable dt, string ColumnName)
        {
            var    v   = dt.DefaultView.ToTable(true, ColumnName);
            string rel = string.Empty;

            foreach (DataRow dr in v.Rows)
            {
                if (string.IsNullOrEmpty(rel))
                {
                    rel = GetFormatInValue(ConvertLib.ToString(dr[ColumnName]));
                }
                else
                {
                    rel += "," + GetFormatInValue(ConvertLib.ToString(dr[ColumnName]));
                }
            }
            return(rel);
        }
Ejemplo n.º 5
0
        public static IEnumerable <string> GetDataTableColValueFormatGroupIn(DataTable dt, string ColumnName, int MaxLength)
        {
            var v = dt.DefaultView.ToTable(true, ColumnName);

            List <string> Result = new List <string>();

            string tmp = "", current = "";

            for (int i = 0; i < v.Rows.Count; i++)
            {
                current = GetFormatInValue(ConvertLib.ToString(v.Rows[i][ColumnName]));

                if (tmp.Length + current.Length > MaxLength)
                {
                    Result.Add(tmp);
                    tmp = "";
                }
                tmp += "," + current;
            }
            foreach (string s in Result)
            {
                yield return(s.Substring(1));
            }
        }