Beispiel #1
0
 public ContentBlock()
 {
     BaseSettings = new ContentBlockSettings();
     TextSettings = new ContentBlockSettings();
     Lists        = new ContentBlockSettingList();
     Bvin         = string.Empty;
     StoreId      = 0;
     LastUpdated  = DateTime.UtcNow;
     ColumnId     = string.Empty;
     SortOrder    = 1;
     ControlName  = string.Empty;
 }
Beispiel #2
0
        public bool FromXml(ref XmlReader xr)
        {
            var results = false;

            try
            {
                while (xr.Read())
                {
                    if (xr.IsStartElement())
                    {
                        if (!xr.IsEmptyElement)
                        {
                            switch (xr.Name)
                            {
                            case "Bvin":
                                xr.Read();
                                Bvin = xr.ReadString();
                                break;

                            case "ControlName":
                                xr.Read();
                                ControlName = xr.ReadString();
                                break;

                            case "SortOrder":
                                xr.Read();
                                SortOrder = int.Parse(xr.ReadString());
                                break;

                            case "ColumnId":
                                xr.Read();
                                ColumnId = xr.ReadString();
                                break;

                            case "SerializedSettings":
                                xr.Read();
                                var baseSettings = xr.ReadString();
                                BaseSettings = Json.ObjectFromJson <ContentBlockSettings>(baseSettings);
                                break;

                            case "TextSettings":
                                xr.Read();
                                var textSettings = xr.ReadString();
                                TextSettings = Json.ObjectFromJson <ContentBlockSettings>(textSettings);
                                break;

                            case "Lists":
                                xr.Read();
                                var jsonlist = xr.ReadString();
                                Lists = Json.ObjectFromJson <ContentBlockSettingList>(jsonlist);
                                break;
                            }
                        }
                    }
                }

                results = true;
            }

            catch (XmlException XmlEx)
            {
                EventLog.LogEvent(XmlEx);
                results = false;
            }

            return(results);
        }