Esempio n. 1
0
    protected void BtnSave_Click(object sender, EventArgs e)
    {
        LblErr.Text = "";
        LblOk.Text = "";

        try
        {
            Menutype o1 = new PigeonCms.Menutype();
            if (base.CurrentId == 0)
            {
                form2obj(o1);
                o1 = new MenutypesManager().Insert(o1);
            }
            else
            {
                o1 = new MenutypesManager().GetByKey(base.CurrentId);
                form2obj(o1);
                new MenutypesManager().Update(o1);
            }
            Grid1.DataBind();
            LblOk.Text = Utility.GetLabel("RECORD_SAVED_MSG");
            MultiView1.ActiveViewIndex = 0;
        }
        catch (Exception e1)
        {
            LblErr.Text = Utility.GetLabel("RECORD_ERR_MSG") + "<br />" + e1.ToString();
        }
        finally
        {
        }
    }
Esempio n. 2
0
        /// <summary>
        /// load listbox menu list
        /// </summary>
        /// <param name="listMenu">the listbox obj</param>
        /// <param name="menuType">menutype filter</param>
        /// <param name="currMenuId">current menu id (will be a disbled item in list)</param>
        public static void LoadListMenu(ListBox listMenu, string menuType, int currMenuId)
        {
            listMenu.Items.Clear();
            //ListItem listGroupItem = new ListItem("Menu", "");   //value.ToString()
            //ListMenu.Items.Add(listGroupItem);

            MenutypeFilter menutypeFilter = new MenutypeFilter();
            if (!string.IsNullOrEmpty(menuType))
                menutypeFilter.MenuType = menuType;
            List<Menutype> menuTypes = new MenutypesManager().GetByFilter(menutypeFilter, "");
            foreach (Menutype menuTypeItem in menuTypes)
            {
                //ListItem separatorListItem = new ListItem(" ", "");
                //listMenu.Items.Add(separatorListItem);

                ListItem menuTypeListItem = new ListItem();
                menuTypeListItem.Value = menuTypeItem.MenuType;
                menuTypeListItem.Text = menuTypeItem.MenuType;
                menuTypeListItem.Enabled = true;
                //menuTypeListItem.Attributes.Add("disabled", "disabled");
                listMenu.Items.Add(menuTypeListItem);

                loadMenuItems(listMenu, menuTypeItem.MenuType, 0, 0, currMenuId);
            }
        }
Esempio n. 3
0
    private void loadDropMenus()
    {
        DropMenuTypesFilter.Items.Clear();

        MenutypeFilter filter = new MenutypeFilter();
        List<Menutype> recordList = new MenutypesManager().GetByFilter(filter, "");
        foreach (Menutype record1 in recordList)
        {
            DropMenuTypesFilter.Items.Add(new ListItem(record1.MenuType, record1.MenuType));
        }
    }
Esempio n. 4
0
    private void editRow(int recordId)
    {
        LblOk.Text = "";
        LblErr.Text = "";

        clearForm();
        base.CurrentId = recordId;
        if (base.CurrentId > 0)
        {
            Menutype obj = new Menutype();
            obj = new MenutypesManager().GetByKey(base.CurrentId);
            obj2form(obj);
        }
        MultiView1.ActiveViewIndex = 1;
    }
Esempio n. 5
0
    protected void Grid1_RowDataBound(object sender, GridViewRowEventArgs e)
    {
        if (e.Row.RowType == DataControlRowType.DataRow)
        {
            var item = new PigeonCms.Module();
            item = (Module)e.Row.DataItem;

            LinkButton LnkTitle = (LinkButton)e.Row.FindControl("LnkTitle");
            LnkTitle.Text = "<i class='fa fa-pgn_edit fa-fw'></i>" + Utility.Html.GetTextPreview(item.Title, 20, "");

            Literal LitModuleNameDesc = (Literal)e.Row.FindControl("LitModuleNameDesc");
            LitModuleNameDesc.Text = item.ModuleFullName + "<br>"
                + "<i>" + item.CurrView + "</i>";

            Literal LitMenuEntries = (Literal)e.Row.FindControl("LitMenuEntries");
            if (item.MenuSelection == ModulesMenuSelection.AllPages)
                LitMenuEntries.Text = Utility.GetLabel("LblAll", "All");
            else if (item.MenuSelection == ModulesMenuSelection.NoPages)
                LitMenuEntries.Text = Utility.GetLabel("LblNone", "None");
            else if (item.MenuSelection == ModulesMenuSelection.List)
            {
                string entries = "";
                foreach (string menuType in item.ModulesMenuTypes)
                {
                    var menuType1 = new Menutype();
                    menuType1 = new MenutypesManager().GetByMenuType(menuType);
                    entries += "[" + menuType1.MenuType + "], ";  //record1.MenuType + "|"
                }
                foreach (int menuId in item.ModulesMenu)
                {
                    PigeonCms.Menu record1 = new PigeonCms.Menu();
                    record1 = new MenuManager().GetByKey(menuId);
                    entries += record1.Name + ", ";  //record1.MenuType + "|"
                }
                if (entries.EndsWith(", ")) entries = entries.Substring(0, entries.Length - 2);
                LitMenuEntries.Text = Utility.Html.GetTextPreview(entries, 30, "");
            }

            Literal LitAccessTypeDesc = (Literal)e.Row.FindControl("LitAccessTypeDesc");
            LitAccessTypeDesc.Text = item.ReadAccessType.ToString();
            if (item.ReadAccessType != MenuAccesstype.Public)
            {
                string roles = "";
                foreach (string role in item.ReadRolenames)
                {
                    roles += role + ", ";
                }
                if (roles.EndsWith(", ")) roles = roles.Substring(0, roles.Length - 2);
                if (roles.Length > 0)
                    roles = " (" + roles + ")";
                LitAccessTypeDesc.Text += Utility.Html.GetTextPreview(roles, 30, "");

                //render access level
                if (!string.IsNullOrEmpty(item.ReadAccessCode))
                    LitAccessTypeDesc.Text += item.ReadAccessCode;
                if (item.ReadAccessLevel > 0)
                    LitAccessTypeDesc.Text += " (" + item.ReadAccessLevel.ToString() + ")";
            }

            //moduleContent
            var LnkModuleContent = (HyperLink)e.Row.FindControl("LnkModuleContent");
            if (!string.IsNullOrEmpty(item.EditContentUrl))
            {
                LnkModuleContent.Visible = true;
                LnkModuleContent.NavigateUrl = item.EditContentUrl;
            }

            //Published
            if (item.Published)
            {
                var img1 = e.Row.FindControl("ImgPublishedOk");
                img1.Visible = true;
            }
            else
            {
                var img1 = e.Row.FindControl("ImgPublishedKo");
                img1.Visible = true;
            }

            //Delete
            if (item.IsCore)
            {
                var img1 = e.Row.FindControl("LnkDel");
                img1.Visible = false;
            }
            else
            {
                var img1 = e.Row.FindControl("LnkDel");
                img1.Visible = true;
            }
        }
    }