Ejemplo n.º 1
0
        /// <summary>
        /// Creates new Page.
        /// </summary>
        /// <param name="SetName"></param>
        /// <param name="newName"></param>
        public static long NewPage(int PageSetID, string newName, string Style = "", string MarkColor = "rgba(208, 2, 27, 1)", long Grid = 20)
        {
            if (Style == "")
            {
                using (ClsStyleGenerator sg = new ClsStyleGenerator())
                {
                    sg.SetStyle("margin", "0px");
                    sg.SetStyle("width", "100vw");
                    sg.SetStyle("height", "100vh");
                    sg.SetStyle("background-color", "rgba(0, 0, 0, 1)");
                    sg.SetStyle("background-repeat", "no-repeat");
                    sg.SetStyle("background-position", "center");
                    sg.SetStyle("background-image", "");
                    sg.SetStyle("background-size", "contain");

                    Style = sg.GetStyleStringJson();
                }
            }

            // get max page sort
            List <DisplayPageSet> l   = ClsDisplayControler.DisplayPageSets();
            List <DisplayPage>    dpl = ClsDisplayControler.DisplayPagesForPageSet(PageSetID);
            long max = 0;

            if (dpl.Count > 0)
            {
                max = (from x in dpl select x.Sort).Max();
            }
            long newmax = max + 1;

            DisplayPage dp = new DisplayPage();

            dp.PageSetNo = PageSetID;
            dp.PageName  = newName;
            dp.Style     = Style;
            dp.Sort      = newmax;
            dp.MarkColor = MarkColor;
            dp.Grid      = Grid;

            ClsDisplayControler.AddDisplayPage(dp);

            dpl = ClsDisplayControler.DisplayPagesForPageSet(PageSetID);
            long dpid = (from x in dpl where x.PageName == newName select x.ID).FirstOrDefault();

            return(dpid);
        }