Example #1
0
 private void EnsureContentItemForTab(Entities.Tabs.TabInfo tabInfo)
 {
     // If tab exists but ContentItem not, then we create it
     if (tabInfo.ContentItemId == Null.NullInteger && tabInfo.TabID != Null.NullInteger)
     {
         TabController.Instance.CreateContentItem(tabInfo);
         TabController.Instance.UpdateTab(tabInfo);
     }
 }
        public static string GetRichValue(ProfilePropertyDefinition prop, string strFormat, System.Globalization.CultureInfo formatProvider)
        {
            string result = "";

            if (!String.IsNullOrEmpty(prop.PropertyValue) || DisplayDataType(prop).ToLower() == "image")
            {
                switch (DisplayDataType(prop).ToLower())
                {
                case "truefalse":
                    result = PropertyAccess.Boolean2LocalizedYesNo(Convert.ToBoolean(prop.PropertyValue), formatProvider);
                    break;

                case "date":
                case "datetime":
                    if (strFormat == string.Empty)
                    {
                        strFormat = "g";
                    }
                    result = DateTime.Parse(prop.PropertyValue).ToString(strFormat, formatProvider);
                    break;

                case "integer":
                    if (strFormat == string.Empty)
                    {
                        strFormat = "g";
                    }
                    result = int.Parse(prop.PropertyValue).ToString(strFormat, formatProvider);
                    break;

                case "page":
                    Entities.Tabs.TabController TabCtrl = new Entities.Tabs.TabController();
                    int tabid;
                    if (int.TryParse(prop.PropertyValue, out tabid))
                    {
                        Entities.Tabs.TabInfo Tab = TabCtrl.GetTab(tabid, Null.NullInteger, false);
                        if (Tab != null)
                        {
                            result = string.Format("<a href='{0}'>{1}</a>", Globals.NavigateURL(tabid), Tab.LocalizedTabName);
                        }
                    }
                    break;

                case "image":
                    //File is stored as a FileID
                    int fileID;
                    if (Int32.TryParse(prop.PropertyValue, out fileID) && fileID > 0)
                    {
                        result = Globals.LinkClick(String.Format("fileid={0}", fileID), Null.NullInteger, Null.NullInteger);
                    }
                    else
                    {
                        result = Globals.ResolveUrl("~/images/spacer.gif");
                    }
                    break;

                case "richtext":
                    result = PropertyAccess.FormatString(HttpUtility.HtmlDecode(prop.PropertyValue), strFormat);
                    break;

                default:
                    result = HttpUtility.HtmlEncode(PropertyAccess.FormatString(prop.PropertyValue, strFormat));
                    break;
                }
            }
            return(result);
        }