예제 #1
0
파일: CmsHelper.cs 프로젝트: yarivat/Admin
        public static string GetHtml(string key)
        {
            Durados.Web.Mvc.View htmlView = GetHtmlView();
            DataRow htmlRow = htmlView.GetDataRow(key);

            if (htmlRow == null)
            {
                return(string.Empty);
            }

            return(HttpContext.Current.Server.HtmlDecode(htmlView.GetDisplayValue(GetHtmlFieldName(), htmlRow)));
        }
예제 #2
0
파일: CmsHelper.cs 프로젝트: yarivat/Admin
        public static string GetContent(string key)
        {
            string content = GetHtml(key);

            if (string.IsNullOrEmpty(content))
            {
                Durados.Web.Mvc.View htmlView = GetMainHtmlView();
                DataRow htmlRow = htmlView.GetDataRow(key);

                if (htmlRow == null)
                {
                    return(string.Empty);
                }

                content = HttpContext.Current.Server.HtmlDecode(htmlView.GetDisplayValue(GetHtmlFieldName(), htmlRow));
            }

            return(content);
        }
예제 #3
0
파일: CmsHelper.cs 프로젝트: yarivat/Admin
        public static void SetHtml(string key, string value)
        {
            Durados.Web.Mvc.View htmlView = GetHtmlView();
            DataRow htmlRow = htmlView.GetDataRow(key);

            if (htmlRow == null)
            {
                if (htmlView.AllowCreate)
                {
                    Dictionary <string, object> values = new Dictionary <string, object>();
                    values.Add("Name", key);
                    values.Add("Text", value);
                    htmlView.Create(values);
                }
                else
                {
                    htmlView.AllowCreate = true;
                    try
                    {
                        Dictionary <string, object> values = new Dictionary <string, object>();
                        values.Add("Name", key);
                        values.Add("Text", value);
                        htmlView.Create(values);
                    }
                    catch { };
                    htmlView.AllowCreate = false;
                }
            }
            else
            {
                Dictionary <string, object> values = new Dictionary <string, object>();
                values.Add("Text", value);

                htmlView.Edit(values, key, null, null, null, null);
            }
        }