/* Clone */
        /// <summary>
        /// Clone Page in the same master page
        /// </summary>
        /// <param name="id"></param>
        public void Clone(int id)
        {
            try
            {
                using (_db)
                {
                    Page p = _db.Page.Single(x => x.ID == id);

                    Page pNew = Copy(p);

                    _db.Page.InsertOnSubmit(pNew);

                    Commit();

                    pNew = _db.Page.Single(x => x.Name == pNew.Name);

                    if (p.Frame.Count > 0)
                    {
                        db_config_frame frame = new db_config_frame(_db, p.Frame.ToList(), p.ID);

                        foreach (Frame frm in frame.AllFrames)
                            frame.Clone(frm.ID, pNew.ID);
                    }

                    Commit();

                    SelectObjectsFromDb();
                }
            }
            catch (Exception ex)
            {
                throw new Exception("error: cloning master page with id " + id + " - " + ex.Message + "...");
            }
        }
Пример #2
0
    /// <summary>
    /// Copy the content of current frame to a new frame
    /// </summary>
    private static void CloneFrame(int id, int pageId)
    {
        db_config_frame dcf = null;

        try
        {
            dcf = new db_config_frame(id, false);
            dcf.Open();

            dcf.Clone(id, pageId);

        }
        catch (Exception ex)
        {
            throw new Exception("error: Clone Frame: " + ex.Message);
        }
        finally
        {
            if (dcf != null)
                dcf.Close();
        }
    }