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 { } }
private void obj2form(Menutype obj) { TxtMenuType.Text = obj.MenuType; TxtTitle.Text = obj.Title; TxtDescription.Text = obj.Description; }
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; }
private void form2obj(Menutype obj) { obj.Id = base.CurrentId; obj.MenuType = TxtMenuType.Text; obj.Title = TxtTitle.Text; obj.Description = TxtDescription.Text; }
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; } } }