protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { int parentID = 0; int selected = 0; if (string.IsNullOrEmpty(QS("selected")) || string.IsNullOrEmpty(QS("parent")) || QS("selected", 0) == 0 || QS("parent", 0) == 0) { this.ShowArgumentErrorMessageToClient(); return; } else { parentID = QS("parent", 0); selected = QS("selected", 0); ModulesEntity parent = userApp.GetModule(parentID); parentID = parent.ParentID; } ModulesEntity model = userApp.GetModule(selected); List <ModulesEntity> listparent = userApp.GetAllModules(parentID, 1, 1000, out recordCount); foreach (ModulesEntity m in listparent) { ListItem item = new ListItem(string.Format("{0} [{1}]", m.ModuleTitle, m.ModulePath), m.ID.ToString()); ddlParentModule.Items.Add(item); } InitContorls(model); Page.Title = string.Format("Edit Module({0},{1})", model.ModuleTitle, model.ModulePath); } }
protected void Page_Load(object sender, EventArgs e) { TopMenu1.ParentID = 1; UserApplication userApp = new UserApplication(); string keyPath = "/sunnet/"; string url = Request.Url.AbsolutePath.ToLower(); string topModule = url.Replace(keyPath, ""); topModule = topModule.Substring(0, topModule.IndexOf("/") + 1); topModule = keyPath + topModule; ModulesEntity moduleTop = userApp.GetModule(topModule); if (moduleTop != null) { if (UserInfo.Role == RolesEnum.CLIENT && moduleTop.ModuleTitle.Trim().ToLower() == "clients") { moduleTop.ModuleTitle = "Tickets"; } this.TopSelectedIndex = moduleTop.ID; ltlCurrentModule.Text = moduleTop.ModuleTitle; } //url += Request.Url.Query; ModulesEntity moduleCurrent = userApp.GetModule(url); if (moduleCurrent != null) { this.LeftSelectedIndex = moduleCurrent.ParentID; this.LeftSecondSelectedIndex = moduleCurrent.ID; } //CateGory CateGoryApplication cgApp = new CateGoryApplication(); List <CateGoryEntity> listCC = cgApp.GetCateGroyListByUserID(UserInfo.ID); rptCategory.DataSource = listCC; rptCategory.DataBind(); rptCateGory2.DataSource = listCC; rptCateGory2.DataBind(); // Client Or Sunnet topMenu_category.Visible = UserInfo.Role != RolesEnum.CLIENT; InitCompanyInfo(); }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { int parentID = QS("parent", 0); BindControl(); if (QS("selected", 1) == 1) { ltlMenu.Text = "> <strong>Root</strong>"; } else { ModulesEntity module = userApp.GetModule(QS("selected", 1)); ltlMenu.Text = GetPath(parentID) + string.Format(" > <strong>{0}</strong>", module.ModuleTitle); } } }
private string GetPath(int currentParent) { string parentHtml = string.Empty; ModulesEntity module = userApp.GetModule(currentParent); if (module == null) { return(""); } parentHtml = template.Replace("{parent}", module.ParentID.ToString()) .Replace("{Text}", module.ModuleTitle) .Replace("{selected}", module.ID.ToString()); if (module.ParentID != 0) { return(GetPath(module.ParentID) + " > " + parentHtml); } return(parentHtml); }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { int parentID = QS("parent", -1); int selected = QS("selected", -1); if (selected < 0) { this.ShowFailMessageToClient(); return; } if (parentID >= 0) { List <ModulesEntity> list = userApp.GetAllModules(parentID, 1, 1000, out recordCount); foreach (ModulesEntity model in list) { ListItem item = new ListItem(string.Format("{0} [{1}]", model.ModuleTitle, model.ModulePath), model.ID.ToString()); ddlParentModule.Items.Add(item); if (model.ID == selected) { InitControls(model); } } ddlParentModule.SelectedValue = selected.ToString(); } else { int id = UtilFactory.Helpers.CommonHelper.ToInt(Request.QueryString["selected"]); ModulesEntity model = userApp.GetModule(id); if (!(model == null)) { ListItem item = new ListItem(string.Format("{0} [{1}]", model.ModuleTitle, model.ModulePath), model.ID.ToString()); ddlParentModule.Items.Add(item); ddlParentModule.Enabled = false; } InitControls(model); } } }