private void DeleteAllPageFrames(int pageId)
        {
            try
            {
                List<Frame> frames = (from f in _db.Frame
                                      where f.IDPage == pageId
                                      select f).ToList();

                db_config_frame dcf = new db_config_frame(_db, frames, pageId);

                foreach (Frame frm in dcf.AllFrames)
                {
                    dcf.Delete(frm.ID);
                }
            }
            catch { }
        }
Esempio n. 2
0
    public string GetFrame(string frameId, string ctrl)
    {
        JavaScriptSerializer js = new JavaScriptSerializer();

        string crlHash = Generic.GetHash(Generic.GetWebConfigValue("WebServiceKey"));

        if (ctrl != crlHash) return string.Empty;

        db_config_frame dcf = null;

        try
        {
            int id = Convert.ToInt32(frameId);

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

            Frame f = dcf.Get(id);

            return js.Serialize(new Dictionary<string, object>
                                                {
                                                    {"ID", f.ID},
                                                    {"PageId", f.IDPage},
                                                    {"Title", f.Title},
                                                    {"X", f.X},
                                                    {"Y", f.Y},
                                                    {"Width", f.Width},
                                                    {"Height", f.Height},
                                                    {"FrameType", f.FrameType},
                                                    {"Scroll", f.Scroll},
                                                    {"Options", f.Options},
                                                    {"IsActive", f.IsActive},
                                                    {"ScheduleInterval", f.ScheduleInterval},
                                                });
        }
        catch (Exception ex)
        {
            loging.Error("BackOffice Frames Webservice", "Get Frame", ex.Message, _logRecord);
        }
        finally
        {
            if (dcf != null)
                dcf.Close();
        }

        return js.Serialize("");
    }
        /* 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 + "...");
            }
        }
Esempio n. 4
0
    public string MoveFrame(string pageId, string frameId, string pageType, int height, string ctrl)
    {
        string crlHash = Generic.GetHash(Generic.GetWebConfigValue("WebServiceKey"));

        if (ctrl != crlHash) return string.Empty;

        db_config_frame dcf = null;

        try
        {
            int fid = Convert.ToInt32(frameId);
            int pid = Convert.ToInt32(pageId);

            dcf = new db_config_frame(pid);
            dcf.Open();

            int y = dcf.Get(fid).Y;

            List<Frame> frames = (from f in dcf.AllFrames
                                    where f.Y >= y
                                    select f).ToList();

            foreach (Frame f in frames)
            {
                f.Y = f.Y + height;
            }

            dcf.Commit();

            return "Frame moved";
        }
        catch (Exception ex)
        {
            return ex.Message;
        }
        finally
        {
            if (dcf != null)
                dcf.Close();
        }
    }
Esempio n. 5
0
    /************************ Configurations ************************/
    private void LoadFrame(string id)
    {
        try
        {
            int fId = Convert.ToInt32(id);

            db_config_frame dcf = new db_config_frame(fId, false);
            dcf.Open();

            Frame f = dcf.Get(fId);

            f_id.Value = f.ID.ToString(CultureInfo.InvariantCulture);
            f_title.Value = f.Title;
            f_x.Value = f.X.ToString(CultureInfo.InvariantCulture);
            f_y.Value = f.Y.ToString(CultureInfo.InvariantCulture);
            f_width.Value = f.Width.ToString(CultureInfo.InvariantCulture);
            f_height.Value = f.Height.ToString(CultureInfo.InvariantCulture);
            f_options.InnerHtml = f.Options;

            BuildIsActive(f.IsActive);
            BuildScrollBar(f.Scroll);
            BuildPageSelector(f.IDPage);
            BuildFrameType(f.FrameType);
            BuildScheduleInterval(f.ScheduleInterval);

            LoadFrameTypeToOpTextArea(f.FrameType);
        }
        catch (Exception ex)
        {
            Generic.JavaScriptInjector("alert('" + ex.Message + "');");
        }
    }
Esempio n. 6
0
    /// <summary>
    /// Delete frame by id
    /// </summary>
    private static void DeleteFrame(int id)
    {
        db_config_frame dcf = null;

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

            dcf.Delete(id);
        }
        catch (Exception ex)
        {
            throw new Exception("error: Delete Frame: " + ex.Message);
        }
        finally
        {
            if (dcf != null)
                dcf.Close();
        }
    }
Esempio n. 7
0
        /// <summary>
        /// Build the page width table style.
        /// </summary>
        /// <returns></returns>
        private Control BuildTableFrames()
        {
            Table tb = new Table();
            TableRow row = new TableRow() { HorizontalAlign = HorizontalAlign.Center, VerticalAlign = VerticalAlign.Top };
            TableCell cell = null;

            try
            {
                db_config_frame frames = new db_config_frame(_pageName);
                OptionItems oi = null;

                frames.Open();

                frames.AllFrames.Sort(delegate(Frame a, Frame b) { int ydiff = a.Y.CompareTo(b.Y); return (ydiff != 0) ? ydiff : a.X.CompareTo(b.X); });

                foreach (Frame frm in frames.AllFrames)
                {
                    if (frm.IsActive != 1) continue; // if is != jumps the code below

                    // adds new rows if frame Y position is bigger then the number of rows
                    while (tb.Rows.Count <= frm.Y) tb.Rows.Add(new TableRow() { HorizontalAlign = HorizontalAlign.Center, VerticalAlign = VerticalAlign.Top });

                    oi = new OptionItems(frm.Options);

                    cell = new TableCell()
                    {
                        HorizontalAlign = HorizontalAlign.Center,
                        VerticalAlign = VerticalAlign.Top,
                        RowSpan = SetRowSpan(oi.GetSingle("rowspan")),
                        ColumnSpan = SetColmnSpan(oi.GetSingle("columnspan")),
                    };

                    string frameIdHash = Generic.GetHash(frm.ID.ToString());

                    cell.Controls.Add(BuildFrameCtrl(frm, frameIdHash));

                    SetSessionFrame(frameIdHash, frm);

                    // add new cell if frame X position is bigger then number of cells
                    while (tb.Rows[frm.Y].Cells.Count <= frm.X) tb.Rows[frm.Y].Cells.Add(new TableCell());

                    tb.Rows[frm.Y].Cells.AddAt(frm.X, cell);
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }

            return tb;
        }
Esempio n. 8
0
        /**************** Table of Free Draw ****************/
        /// <summary>
        /// Build the page width frames using X, Y.
        /// </summary>
        /// <returns></returns>
        private Control BuildFreeDrawFrames()
        {
            Panel pn = new Panel();
            pn.Style.Add("margin", "0");
            pn.Style.Add("pading", "0");
            pn.BackColor = Color.Transparent;

            try
            {
                db_config_frame frames = new db_config_frame(_pageName);
                frames.Open();

                foreach (Frame frame in frames.AllFrames)
                {
                    if (frame.IsActive != 1) continue; // if is != jumps the code below

                    string frameIdHash = Generic.GetHash(frame.ID.ToString());

                    pn.Controls.Add(BuildFrameCtrl(frame, frameIdHash)); // build page frame

                    SetSessionFrame(frameIdHash, frame);
                }
            }
            catch (Exception ex)
            {
                throw new Exception("error: in build frames - " + ex.Message + " ...");
            }

            return pn;
        }