public void InsertLayout(BaseLayoutElement layout) { CheckAndConnect(); if (ContainsKey(layout.Id)) { throw new Exception(string.Format("Layout [{0}] with key [{1}] already exists", layout.Name, layout.Id)); } LayoutRecord layoutObject = new LayoutRecord(layout.Id, layout.Name, layout.IsSelected, layout.PathToXml); AllLayouts.Insert(layoutObject); Logger.Debug("Layout [{0}] has been inserted successfully", layoutObject); }
public void SaveLayout(BaseLayoutElement layout) { if (ContainsKey(layout.Id)) { LayoutRecord layoutObject = AllLayouts.FindOne(l => l.LayoutKey == layout.Id); layoutObject.Name = layout.Name; layoutObject.IsSelected = layout.IsSelected; layoutObject.PathToXml = layout.PathToXml; AllLayouts.Update(layoutObject); Logger.Debug("Layout [{0}] has been updated successfully", layoutObject); } else { LayoutRecord layoutObject = new LayoutRecord(layout.Id, layout.Name, layout.IsSelected, layout.PathToXml); AllLayouts.Insert(layoutObject); Logger.Debug("Layout [{0}] has been inserted successfully", layoutObject); } }