Exemplo n.º 1
0
        public static string ToHtmlTable(this DataTable pOdt, string pColumnName, string pQueryStringColumnName, string pUrl, string pToolTip, string pCssClassName)
        {
            string htmlResult = string.Empty;
            int    i          = 0;
            string css        = string.Empty;

            if (!String.IsNullOrEmpty(pCssClassName))
            {
                css = string.Format("class='{0}'", pCssClassName);
            }

            string fullDataClmnName = pToolTip.Contains("UseAsColumnName") ? pToolTip.Replace("UseAsColumnName", string.Empty) : string.Empty;

            foreach (DataRow row in pOdt.Rows)
            {
                string bgColor = ConvertionHelper.GetHtmlTableBgColor(i++);

                string encryptedData = EngineContext.Current.Resolve <ICoreCryptography>().Encrypt(row[pQueryStringColumnName].ToString());
                string queryString   = string.Format("?{0}={1}", pQueryStringColumnName, encryptedData);
                string fullUrl       = pUrl + queryString;

                string data    = row[pColumnName].ToString();
                string toolTip = !String.IsNullOrEmpty(fullDataClmnName) ? row[fullDataClmnName].ToString() : pToolTip;

                htmlResult += string.Format("<tr><td {0}><a {4} title='{3}' href='{1}'>{2}</a></td></tr>", bgColor, fullUrl, data, toolTip, css);
            }
            htmlResult = string.Format(ConvertionHelper.TableTag, htmlResult);
            ConvertionHelper.SetHtmlTableBgColorsToDefault();
            return(htmlResult);
        }
Exemplo n.º 2
0
        /// <summary>
        /// DataTable olarak gönderilen bir verinin istenen kolonunu Html tablo olarak geri döndürür
        /// </summary>
        public static string ToHtmlTable(this DataTable pOdt, string pColumnName)
        {
            string htmlResult = string.Empty;
            int    i          = 0;

            foreach (DataRow row in pOdt.Rows)
            {
                string bgColor = ConvertionHelper.GetHtmlTableBgColor(i++);
                htmlResult += string.Format("<tr><td {1}>{0}</td></tr>", row[pColumnName], bgColor);
            }
            htmlResult = string.Format(ConvertionHelper.TableTag, htmlResult);
            ConvertionHelper.SetHtmlTableBgColorsToDefault();
            return(htmlResult);
        }
Exemplo n.º 3
0
        /// <summary>
        /// Virgüllerle ayrışmıi bir string değeri Html tablo olarak geri döndürür
        /// </summary>
        public static string ToHtmlTable(this string pValue)
        {
            string htmlResult = string.Empty;
            int    i          = 0;

            string[] parca = pValue.Split(',');

            foreach (string item in parca)
            {
                string bgColor = ConvertionHelper.GetHtmlTableBgColor(i++);
                htmlResult += string.Format("<tr><td {1}>{0}</td></tr>", item, bgColor);
            }
            htmlResult = string.Format(ConvertionHelper.TableTag, htmlResult);
            ConvertionHelper.SetHtmlTableBgColorsToDefault();
            return(htmlResult);
        }
Exemplo n.º 4
0
        public static string ToHtmlTable(this DataTable pOdt, string pColumnName, string pUrlColumnName, string pToolTip, string pCssClassName)
        {
            string htmlResult = string.Empty;
            int    i          = 0;
            string css        = string.Empty;

            if (!String.IsNullOrEmpty(pCssClassName))
            {
                css = string.Format("class='{0}'", pCssClassName);
            }

            foreach (DataRow row in pOdt.Rows)
            {
                string bgColor = ConvertionHelper.GetHtmlTableBgColor(i++);
                string adi     = row[pColumnName].ToString();
                string link    = row[pUrlColumnName].ToString();

                htmlResult += string.Format("<tr><td {0}><a {4} title='{3}' href='{1}'>{2}</a></td></tr>", bgColor, link, adi, pToolTip, css);
            }
            htmlResult = string.Format(ConvertionHelper.TableTag, htmlResult);
            ConvertionHelper.SetHtmlTableBgColorsToDefault();
            return(htmlResult);
        }