Esempio n. 1
0
        public override string ToString()
        {
            var ev = Extravalue;

            if (ev == null)
            {
                ev = new ExtraValue();
            }
            switch (Type)
            {
            case "Bit":
                if (Extravalue == null)
                {
                    if (!Standard)
                    {
                        return("Click to edit");
                    }
                    else
                    {
                        return("false");
                    }
                }
                return(ev.BitValue.ToString());

            case "Code":
                return(ev.StrValue);

            case "Text":
            case "Text2":
            case "Data":
                return((ev.Data ?? "").Trim());

            case "Attr":
                return("Attributes");

            case "Date":
                return(ev.DateValue.FormatDate());

            case "Bits":
            {
                var q = from e in Model.ListExtraValues()
                        where e.BitValue == true
                        where e.Id == Id
                        where Codes.Contains(e.Field)
                        select NoPrefix(e.Field);

                return(string.Join("\n", q));
            }

            case "Int":
                return(ev.IntValue.ToString2("d"));
            }
            return("");
        }
Esempio n. 2
0
        public override string ToString()
        {
            var ev = Extravalue;

            if (ev == null)
            {
                ev = new ExtraValue();
            }
            switch (Type)
            {
            case "Bit":
                if (Extravalue == null)
                {
                    if (!Standard)
                    {
                        return("Click to edit");
                    }
                    else
                    {
                        return("false");
                    }
                }
                return(ev.BitValue.ToString());

            case "Code":
                return(ev.StrValue);

            case "Text":
            case "Text2":
            case "Data":
                return((ev.Data ?? "").Trim());

            case "Attr":
                return("Attributes");

            case "Date":
                return(ev.DateValue.FormatDate());

            case "Bits":
            {
                var q = (from e in Model.ListExtraValues()
                         where e.BitValue == true
                         where e.Id == Id
                         where Codes.Select(x => x.Text).Contains(e.Field)
                         select NoPrefix(e.Field)).ToList();

                if (DbUtil.Db.Setting("UX-RenderCheckboxBullets"))
                {
                    if (q.ToList().Count == 0)
                    {
                        return(string.Empty);
                    }

                    var bullets = string.Join("</span></li><li><span>", q);
                    return("<ul class=\"extra-value-list\"><li><span>" + bullets + "</span></li></ul>");
                }

                return(string.Join("<br/>", q));
            }

            case "Int":
                return(ev.IntValue.ToString2("d"));
            }
            return("");
        }