Server IP : 103.6.199.200 / Your IP : 18.225.56.79 Web Server : Microsoft-IIS/10.0 System : Windows NT EMPUSA 10.0 build 20348 (Windows Server 2016) i586 User : EMPUSA$ ( 0) PHP Version : 7.4.33 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : OFF | Perl : OFF | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : C:/Domains/jivisol1/masar.jivisolutions.com/wwwroot/ |
Upload File : |
using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; using DevExpress.Web; using System.Configuration; using Microsoft.ApplicationBlocks.Data; using System.Data; using System.Data.SqlClient; using JiViData; using System.Web.Security; public partial class RootMaster : System.Web.UI.MasterPage { // UserDALC _user = new UserDALC(); string constr = ConfigurationManager.ConnectionStrings["ApplicationServices"].ToString(); SecurityDALC _security = new JiViData.SecurityDALC(); protected void Page_Load(object sender, EventArgs e) { //ASPxLabel2.Text = DateTime.Now.Year + Server.HtmlDecode(" © Copyright by UBS Alliance Pte Ltd"); //System.Security.Principal.IPrincipal //HttpContext.Current.User.Identity.Name DataSet ds = _security.GetMenuByParentId(0, HttpContext.Current.User.Identity.Name); //ASPxMenu1.DataSource = ds as IHierarchicalDataSource; // ASPxMenu1.DataBind(); //BuildMenu(ASPxMenu1, AccessDataSource1); ASPxMenu1.Items.Clear(); BuildMenu(ASPxMenu1, ds); // HeadLoginName.Text = "testmm"; string DisplayName = ""; if ( Context.User.Identity.IsAuthenticated) { // DisplayName disp = new DisplayName(Context.User.Identity.Name); //SqlDataReader dr = _user.GetUserDetailsByUserName(constr, Context.User.Identity.Name); // if (dr.Read()) // { // DisplayName = dr["DisplayName"].ToString(); // } // dr.Close(); //LoginName loginName = HeadLoginView.FindControl("HeadLoginName") as LoginName; //if (loginName != null) //{ // loginName.FormatString = DisplayName; //} // NavigationMenu.Visible = true; } } protected void BuildMenu(DevExpress.Web.ASPxMenu menu, DataSet dataSource) { // Get DataView DataSourceSelectArguments arg = new DataSourceSelectArguments(); DataView dataView = dataSource.Tables[0].DefaultView; dataView.Sort = "ParentMenuId"; // Build Menu Items Dictionary<string, DevExpress.Web.MenuItem> menuItems = new Dictionary<string, DevExpress.Web.MenuItem>(); for (int i = 0; i < dataView.Count; i++) { DataRow row = dataView[i].Row; DevExpress.Web.MenuItem item = CreateMenuItem(row); string itemID = row["MenuId"].ToString(); string parentID = row["ParentMenuId"].ToString(); if (menuItems.ContainsKey(parentID)) menuItems[parentID].Items.Add(item); else { if (parentID == "0") // It's Root Item menu.Items.Add(item); } menuItems.Add(itemID, item); } } private DevExpress.Web.MenuItem CreateMenuItem(DataRow row) { DevExpress.Web.MenuItem ret = new DevExpress.Web.MenuItem(); ret.Text = row["Title"].ToString(); ret.NavigateUrl = row["Url"].ToString(); return ret; } }