/// <summary> /// Page_Load /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void Page_Load(object sender, EventArgs e) { try { _userID = Convert.ToInt32(Session["UserID"]); _companyID = Convert.ToInt32(Session["CompanyID"]); _employeeID = Convert.ToInt32(Session["EmployeeID"]); if (!IsPostBack) { // GetUserPhoto(); commented on 25/06/2014 if (_userID == 0 && _companyID == 0) { Response.Redirect("~/Login.aspx", false); } else { DataTable dataTable = new DataTable(); //dataTable.Tables.Add("Table"); dataTable.Columns.Add("ID", typeof(int)); dataTable.Columns.Add("ParentID", typeof(int)); dataTable.Columns.Add("Text", typeof(string)); dataTable.Columns.Add("Url", typeof(string)); DataTable tree = new DataTable(); //tree = _menuDL.GetMenuParentItems(_userID, _companyID); tree = _menuDL.GetMenuItems(_userID, _companyID); foreach (DataRow row in tree.Rows) { DataRow newrow = dataTable.NewRow(); newrow["ID"] = row["id"]; newrow["Url"] = row["Url"].ToString().Replace("..", "~"); newrow["Text"] = row["Title"]; if (row["Parent"] != null && row["Title"].ToString() != "Select Company") // For Select company menu removing { if (row["Parent"].ToString() == "1" || row["Parent"].ToString() == "") { newrow["ParentID"] = 0; } else { newrow["ParentID"] = row["Parent"]; } } dataTable.Rows.Add(newrow); } AddItems(ECMenu.Items, 0, dataTable); } if (_employeeID != 0) { EmployeeDL employeeDL = new EmployeeDL(); lblProfileCount.Text = Convert.ToString(employeeDL.GetEmployeeProfileCount(_employeeID)); imgEmployeeProfileCount.AlternateText = String.Format("{0} Percent Complete", lblProfileCount.Text); imgEmployeeProfileCount.Width = Unit.Percentage(Convert.ToInt32(lblProfileCount.Text)); trProfileCount.Visible = true; } else { trProfileCount.Visible = false; } sPageName = GetPagePath(); //btnOrderImage.Visible = false; } } catch (Exception ex) { ErrorLog.LogErrorMessageToDB("Menu.ascx", "", "Page_Load", ex.Message.ToString(), new ACEConnection()); } }