/// <summary> /// Date Created: 19/08/2011 /// Created By: Marco Abejar /// (description) Get role list /// </summary> /// private void GetMenu(string KeyRoleString) { DataTable MenuDataTable = null; try { MenuDataTable = UserRightsBLL.GetMenuNotAdded(KeyRoleString); ListItem item = new ListItem("--Select Menu--", "0"); uoDropDownListMenu.Items.Add(item); uoDropDownListMenu.DataSource = MenuDataTable; uoDropDownListMenu.DataBind(); //CommonFunctions.ChangeToUpperCase(uoDropDownListMenu); } catch (Exception ex) { throw ex; } finally { if (MenuDataTable != null) { MenuDataTable.Dispose(); } } }
/// <summary> /// Date Created: 22/08/2011 /// Created By: Josephine Gad /// (description) Show/Hide view link if there is existing submenu /// </summary> /// protected bool ViewIsVisible(object colPageIDInt) { bool IsVisibleBool = true; string PageString = colPageIDInt.ToString(); PageString = (PageString == "" ? "0" : PageString); DataTable SubMenuDataTable = null; try { SubMenuDataTable = UserRightsBLL.GetSubMenuAll(PageString); if (SubMenuDataTable.Rows.Count > 0) { IsVisibleBool = true; } else { IsVisibleBool = false; } } catch (Exception ex) { throw ex; } finally { if (SubMenuDataTable != null) { SubMenuDataTable.Dispose(); } } return(IsVisibleBool); }
/// <summary> /// Date Created: 22/08/2011 /// Created By: Josephine Gad /// (description) Get menu list by Role /// </summary> /// private void GetMenu() { DataTable MenuDataTable = null; try { MenuDataTable = UserRightsBLL.GetMenu(uoDropDownListRole.SelectedValue, true); if (MenuDataTable.Rows.Count == 0) { MenuDataTable.Rows.Add(MenuDataTable.NewRow()); uoGridViewMenu.DataSource = MenuDataTable; uoGridViewMenu.DataBind(); int colInt = uoGridViewMenu.Rows[0].Cells.Count; uoGridViewMenu.HeaderRow.Cells[0].Visible = false; uoGridViewMenu.HeaderRow.Cells[2].Visible = false; uoGridViewMenu.HeaderRow.Cells[3].Visible = false; uoGridViewMenu.Rows[0].Cells.Clear(); uoGridViewMenu.Rows[0].Cells.Add(new TableCell()); uoGridViewMenu.Rows[0].Cells[0].ColumnSpan = colInt; uoGridViewMenu.Rows[0].Cells[0].Text = "No Record Found."; uoGridViewMenu.Rows[0].Cells[0].CssClass = "leftAligned"; } else { uoGridViewMenu.DataSource = MenuDataTable; uoGridViewMenu.Columns[0].Visible = true; uoGridViewMenu.DataBind(); uoGridViewMenu.Columns[0].Visible = false; if (User.IsInRole("administrator")) { //uoGridViewMenu.Columns[2].Visible = true; uoGridViewMenu.Columns[3].Visible = true; } else { //uoGridViewMenu.Columns[2].Visible = false; uoGridViewMenu.Columns[3].Visible = false; } } } catch (Exception ex) { throw ex; } finally { if (MenuDataTable != null) { MenuDataTable.Dispose(); } } }
//private void GetRegion() //{ // DataTable UserDataTable = null; // try // { // UserDataTable = UserRightsBLL.GetUserRegion(uoDropDownListUsers.SelectedValue, GlobalCode.Field2String(Session["UserName"])); // if (UserDataTable.Rows.Count == 0) // { // DataRow r = UserDataTable.NewRow(); // r["IsExist"] = false; // UserDataTable.Rows.Add(r); // uoGridViewRegions.DataSource = UserDataTable; // uoGridViewRegions.DataBind(); // int colInt = uoGridViewRegions.Rows[0].Cells.Count; // uoGridViewRegions.HeaderRow.Cells[1].Visible = false; // uoGridViewRegions.Rows[0].Cells.Clear(); // uoGridViewRegions.Rows[0].Cells.Add(new TableCell()); // uoGridViewRegions.Rows[0].Cells[0].ColumnSpan = colInt; // uoGridViewRegions.Rows[0].Cells[0].Text = "No Record Found."; // uoGridViewRegions.Rows[0].Cells[0].CssClass = "leftAligned"; // } // else // { // uoGridViewRegions.DataSource = UserDataTable; // uoGridViewRegions.DataBind(); // if (uoHiddenFieldRole.Value != TravelMartVariable.RoleAdministrator) // { // if (uoDropDownListRoles.SelectedItem.Text == TravelMartVariable.RoleAdministrator) // { // uoGridViewRegions.Columns[1].Visible = false; // } // else // { // uoGridViewRegions.Columns[1].Visible = true; // } // } // } // } // catch (Exception ex) // { // throw ex; // } // finally // { // if (UserDataTable != null) // { // UserDataTable.Dispose(); // } // } //} /// <summary> /// Date Created: 11/Jan/2013 /// Created By: Josephine Gad /// (description) Bind Region of Users /// </summary> private void BindRegionList(bool IsEmpty) { if (IsEmpty) { uoListViewRegion.DataSource = null; uoListViewRegionToAdd.DataSource = null; uoListViewRegion.DataBind(); uoListViewRegionToAdd.DataBind(); //uoTableRegion.Visible = false; uoTableRegion.Style.Add("display", "none"); } else { //uoTableRegion.Visible = true; uoTableRegion.Style.Add("display", "inline"); List <UserRegionList> RegionList = new List <UserRegionList>(); List <UserRegionToAdd> RegionToAdd = new List <UserRegionToAdd>(); uoListViewRegion.DataSource = null; uoListViewRegionToAdd.DataSource = null; UserRightsBLL.GetUserRegion(uoDropDownListUsers.SelectedValue, uoHiddenFieldUser.Value); if (Session["UserRegionList"] != null) { RegionList = (List <UserRegionList>)Session["UserRegionList"]; uoListViewRegion.DataSource = RegionList; } if (Session["UserRegionToAdd"] != null) { RegionToAdd = (List <UserRegionToAdd>)Session["UserRegionToAdd"]; uoListViewRegionToAdd.DataSource = RegionToAdd; } uoListViewRegion.DataBind(); uoListViewRegionToAdd.DataBind(); if (uoDropDownListRoles.SelectedItem.Text == TravelMartVariable.RoleHotelSpecialist) { uoButtonDelete.Visible = false; foreach (ListViewItem item in uoListViewRegion.Items) { CheckBox uoCheckBoxSelect = (CheckBox)item.FindControl("uoCheckBoxSelect"); uoCheckBoxSelect.Visible = false; } } else { uoButtonDelete.Visible = true; } } }
protected void uoButtonSave_Click(object sender, EventArgs e) { string strLogDescription; string strFunction; Int32 MenuID = UserRightsBLL.InsertMenu(GlobalCode.Field2String(Session["SelectedRoleKey"]), uoDropDownListMenu.SelectedValue, GlobalCode.Field2String(Session["UserName"])); //Insert log audit trail (Gabriel Oquialda - 17/11/2011) strLogDescription = "User menu added."; strFunction = "uoButtonSave_Click"; DateTime dateNow = CommonFunctions.GetCurrentDateTime(); BLL.AuditTrailBLL.InsertLogAuditTrail(MenuID, "", strLogDescription, strFunction, Path.GetFileName(Request.Path), CommonFunctions.GetDateTimeGMT(dateNow), DateTime.Now, GlobalCode.Field2String(Session["UserName"])); OpenParentPage(); }
protected void uoGridViewRegions_RowCommand(object sender, GridViewCommandEventArgs e) { string strLogDescription; string strFunction; if (e.CommandName == "Delete") { string MapIdString = e.CommandArgument.ToString(); UserRightsBLL.DeleteUserMapRef(MapIdString, GlobalCode.Field2String(Session["UserName"])); //Insert log audit trail (Gabriel Oquialda - 17/11/2011) strLogDescription = "User region deleted. (flagged as inactive)"; strFunction = "uoGridViewRegions_RowCommand"; DateTime dateNow = CommonFunctions.GetCurrentDateTime(); BLL.AuditTrailBLL.InsertLogAuditTrail(Convert.ToInt32(MapIdString), "", strLogDescription, strFunction, Path.GetFileName(Request.Path), CommonFunctions.GetDateTimeGMT(dateNow), DateTime.Now, GlobalCode.Field2String(Session["UserName"])); GetRegion(); } }
/// <summary> /// Date Created: 22/08/2011 /// Created By: Josephine Gad /// (description) Save submenus /// </summary> protected void uoButtonSave_Click(object sender, EventArgs e) { string UserString = GlobalCode.Field2String(Session["UserName"]); bool WithChildNodeBool; string strLogDescription; string strFunction; foreach (TreeNode Node in uoTreeViewSubmenu.Nodes) { if (Node.ChildNodes.Count > 0) { WithChildNodeBool = false; foreach (TreeNode ChildNode in Node.ChildNodes) { if (ChildNode.Checked) { Int32 MenuID = UserRightsBLL.InsertMenu(GlobalCode.Field2String(Session["SelectedRoleKey"]), ChildNode.Value, UserString); WithChildNodeBool = true; if (MenuID > 0) { //Insert log audit trail (Gabriel Oquialda - 19/03/2012) strLogDescription = "User menu added."; strFunction = "uoButtonSave_Click"; DateTime dateNow = CommonFunctions.GetCurrentDateTime(); BLL.AuditTrailBLL.InsertLogAuditTrail(MenuID, "", strLogDescription, strFunction, Path.GetFileName(Request.Path), CommonFunctions.GetDateTimeGMT(dateNow), DateTime.Now, UserString); } } else { Int32 MenuID = UserRightsBLL.DeleteMenuByRoleId(GlobalCode.Field2String(Session["SelectedRoleKey"]), ChildNode.Value, UserString); if (MenuID > 0) { //Insert log audit trail (Gabriel Oquialda - 19/03/2012) strLogDescription = "User menu deleted. (flagged as inactive)"; strFunction = "uoButtonSave_Click"; DateTime dateNow = CommonFunctions.GetCurrentDateTime(); BLL.AuditTrailBLL.InsertLogAuditTrail(MenuID, "", strLogDescription, strFunction, Path.GetFileName(Request.Path), CommonFunctions.GetDateTimeGMT(dateNow), DateTime.Now, UserString); } } } if (WithChildNodeBool) { Int32 MenuID = UserRightsBLL.InsertMenu(GlobalCode.Field2String(Session["SelectedRoleKey"]), Node.Value, UserString); if (MenuID > 0) { //Insert log audit trail (Gabriel Oquialda - 17/11/2011) strLogDescription = "User menu added."; strFunction = "uoButtonSave_Click"; DateTime dateNow = CommonFunctions.GetCurrentDateTime(); BLL.AuditTrailBLL.InsertLogAuditTrail(MenuID, "", strLogDescription, strFunction, Path.GetFileName(Request.Path), CommonFunctions.GetDateTimeGMT(dateNow), DateTime.Now, UserString); } } else { Int32 MenuID = UserRightsBLL.DeleteMenuByRoleId(GlobalCode.Field2String(Session["SelectedRoleKey"]), Node.Value, UserString); if (MenuID > 0) { //Insert log audit trail (Gabriel Oquialda - 17/11/2011) strLogDescription = "User menu deleted. (flagged as inactive)"; strFunction = "uoButtonSave_Click"; DateTime dateNow = CommonFunctions.GetCurrentDateTime(); BLL.AuditTrailBLL.InsertLogAuditTrail(MenuID, "", strLogDescription, strFunction, Path.GetFileName(Request.Path), CommonFunctions.GetDateTimeGMT(dateNow), DateTime.Now, UserString); } } } else { if (Node.Checked) { Int32 MenuID = UserRightsBLL.InsertMenu(GlobalCode.Field2String(Session["SelectedRoleKey"]), Node.Value, UserString); if (MenuID > 0) { //Insert log audit trail (Gabriel Oquialda - 17/11/2011) strLogDescription = "User menu added."; strFunction = "uoButtonSave_Click"; DateTime dateNow = CommonFunctions.GetCurrentDateTime(); BLL.AuditTrailBLL.InsertLogAuditTrail(MenuID, "", strLogDescription, strFunction, Path.GetFileName(Request.Path), CommonFunctions.GetDateTimeGMT(dateNow), DateTime.Now, UserString); } } else { Int32 MenuID = UserRightsBLL.DeleteMenuByRoleId(GlobalCode.Field2String(Session["SelectedRoleKey"]), Node.Value, UserString); if (MenuID > 0) { //Insert log audit trail (Gabriel Oquialda - 17/11/2011) strLogDescription = "User menu deleted. (flagged as inactive)"; strFunction = "uoButtonSave_Click"; DateTime dateNow = CommonFunctions.GetCurrentDateTime(); BLL.AuditTrailBLL.InsertLogAuditTrail(MenuID, "", strLogDescription, strFunction, Path.GetFileName(Request.Path), CommonFunctions.GetDateTimeGMT(dateNow), DateTime.Now, GlobalCode.Field2String(Session["UserName"])); } } } } //if () //{ // //Insert log audit trail (Gabriel Oquialda - 18/11/2011) // strLogDescription = "User menu added."; // strFunction = "uoButtonSave_Click"; // DateTime dateNow = CommonFunctions.GetCurrentDateTime(); // BLL.AuditTrailBLL.InsertLogAuditTrail(strLogDescription, strFunction, Path.GetFileName(Request.Path), // CommonFunctions.GetDateTimeGMT(dateNow), DateTime.Now, GlobalCode.Field2String(Session["UserName"])); //} //else //{ // //Insert log audit trail (Gabriel Oquialda - 18/11/2011) // strLogDescription = "User menu deleted. (flagged as inactive)"; // strFunction = "uoButtonSave_Click"; // DateTime dateNow = CommonFunctions.GetCurrentDateTime(); // BLL.AuditTrailBLL.InsertLogAuditTrail(strLogDescription, strFunction, Path.GetFileName(Request.Path), // CommonFunctions.GetDateTimeGMT(dateNow), DateTime.Now, GlobalCode.Field2String(Session["UserName"])); //} OpenParentPage(); }
/// <summary> /// Date Created: 22/08/2011 /// Created By: Josephine Gad /// (description) Get Submenu /// =================================== /// Date Modified: 21/May/2014 /// Modified By: Josephine Gad /// (description) Add sMenuDisplayName to show menu name and description /// </summary> private void GetSubmenu() { uoTreeViewSubmenu.Nodes.Clear(); DataTable SubMenuDataTable = null; DataTable ChildDataTable = null; string sMenuDisplayName; try { SubMenuDataTable = UserRightsBLL.GetSubMenuAll(Request.QueryString["mId"]); if (SubMenuDataTable.Rows.Count > 0) { uoButtonSave.Visible = true; uoDivMsg.Visible = false; //uoTreeViewSubmenu.DataSource = SubMenuDataTable; // TreeNode NewNode = new TreeNode( bool IsExistsBool = false; foreach (DataRow SubMenuRow in SubMenuDataTable.Rows) { sMenuDisplayName = SubMenuRow["colDisplayNameVarchar"].ToString() + " - " + SubMenuRow["colDescriptionVarchar"].ToString(); TreeNode NewNode = new TreeNode(sMenuDisplayName, SubMenuRow["colPageIDInt"].ToString()); NewNode.ShowCheckBox = true; IsExistsBool = UserRightsBLL.IsMenuExists(GlobalCode.Field2String(Session["SelectedRoleKey"]), SubMenuRow["colPageIDInt"].ToString()); NewNode.Checked = IsExistsBool; ChildDataTable = UserRightsBLL.GetSubMenuAll(SubMenuRow["colPageIDInt"].ToString()); foreach (DataRow ChildRow in ChildDataTable.Rows) { sMenuDisplayName = ChildRow["colDisplayNameVarchar"].ToString() + " - " + ChildRow["colDescriptionVarchar"].ToString(); TreeNode ChileNode = new TreeNode(sMenuDisplayName, ChildRow["colPageIDInt"].ToString()); ChileNode.ShowCheckBox = true; IsExistsBool = UserRightsBLL.IsMenuExists(GlobalCode.Field2String(Session["SelectedRoleKey"]), ChildRow["colPageIDInt"].ToString()); ChileNode.Checked = IsExistsBool; NewNode.ChildNodes.Add(ChileNode); } uoTreeViewSubmenu.Nodes.Add(NewNode); uoTreeViewSubmenu.NodeStyle.CssClass = "BlackText"; } } else { uoButtonSave.Visible = false; uoDivMsg.Visible = true; } //uoGridViewSubMenu.DataSource = SubMenuDataTable; //uoGridViewSubMenu.Columns[0].Visible = true; //uoGridViewSubMenu.DataBind(); //uoGridViewSubMenu.Columns[0].Visible = false; } catch (Exception ex) { throw ex; } finally { if (SubMenuDataTable != null) { SubMenuDataTable.Dispose(); } if (ChildDataTable != null) { ChildDataTable.Dispose(); } } }
/// <summary> /// Date Created: 11/Jan/2013 /// Created By: Josephine Gad /// (description) Save Region to Database /// </summary> private void SaveUserRegion() { DataTable dt = null; try { CheckBox uoCheckBoxSelect; HiddenField uoHiddenFieldRegion; Label uoLabelRegion; List <UserRegionList> listAdded = new List <UserRegionList>(); List <UserRegionToAdd> listToBeAdded = new List <UserRegionToAdd>(); //List<UserRegionList> listToAdd = new List<UserRegionList>(); //Get the list of user's region if (Session["UserRegionList"] != null) { listAdded = (List <UserRegionList>)Session["UserRegionList"]; } else { foreach (ListViewItem item in uoListViewRegion.Items) { uoCheckBoxSelect = (CheckBox)item.FindControl("uoCheckBoxSelect"); uoHiddenFieldRegion = (HiddenField)item.FindControl("uoHiddenFieldRegion"); uoLabelRegion = (Label)item.FindControl("uoLabelRegion"); bool IsExist = false; if (uoCheckBoxSelect.Enabled) { IsExist = true; } UserRegionList listAddedItem = new UserRegionList(); listAddedItem.RegionID = GlobalCode.Field2Int(uoHiddenFieldRegion.Value); listAddedItem.RegionName = uoLabelRegion.Text; listAddedItem.UserRegionID = 0; listAddedItem.IsExist = IsExist; listAdded.Add(listAddedItem); } } dt = new DataTable(); dt.Columns.Add("UserName", typeof(string)); dt.Columns.Add("RegonID", typeof(string)); for (int i = 0; i < listAdded.Count; i++) { //UserRegionToAdd item = new UserRegionToAdd(); //item.RegionID = listAdded[i].RegionID; //item.RegionName = listAdded[i].RegionName; //listToBeAdded.Add(item); DataRow r = dt.NewRow(); r["UserName"] = uoDropDownListUsers.SelectedValue; r["RegonID"] = listAdded[i].RegionID; dt.Rows.Add(r); } string strLogDescription = "Region of User added"; string strFunction = "SaveUserRegion"; //dt = getDataTable(listToBeAdded); UserRightsBLL.SaveUserRegion(dt, uoHiddenFieldUser.Value, strLogDescription, strFunction, Path.GetFileName(Request.Path)); AlertMessage("User Region successfully saved."); } catch (Exception ex) { AlertMessage(ex.Message); } finally { if (dt != null) { dt.Dispose(); } } }
/// <summary> /// Date Created: 27/10/2011 /// Created By: Josephine Gad /// (description) Get users menu by UserName /// ---------------------------------------------------------------- /// Date Modified: 16/08/2012 /// Modified By: Josephine Gad /// (description) Add each role's home page /// ---------------------------------------------------------------- /// Date Modified: 16/08/2012 /// Modified By: Jefferson Bermundo /// (description) Add Homepage for HotelVendor /// ---------------------------------------------------------------- /// Date Modified: 25/Apr/2013 /// Modified By: Josephine Gad /// (description) Change Hotel Vendor's Page to HotelConfirmManifest.aspx Page /// ---------------------------------------------------------------- /// Date Modified: 7/May/2013 /// Modified By: Marco Abejar /// (description) Change Crew Assist Page to HotelDashboardRoomType5.aspx Page /// /// ---------------------------------------------------------------- /// </summary> /// private void BindMenuByUser() { string URLString = ""; string MenuString = ""; string UserName = GlobalCode.Field2String(Session["UserName"]); //MUser.GetUserName(); string UserRole = GlobalCode.Field2String(Session["UserRole"]);; //MUser.GetUserRole(); if (Session["UserMenu"] == null) { if (Request.QueryString["ufn"] != null) { //GlobalCode.Field2String(Session["DateFrom"]) = Request.QueryString["dt"]; Session["DateFrom"] = Request.QueryString["dt"]; //URLString = "?ufn=" + Request.QueryString["ufn"]; //URLString = "?ufn" + GlobalCode.Field2String(Session["strPrevPage"]); //URLString = "?ufn=" + Request.QueryString["ufn"] + "&dt=" + GlobalCode.Field2DateTime(GlobalCode.Field2String(Session["DateFrom"])).ToString(); //gelo URLString = "?ufn=" + Request.QueryString["ufn"] + "&dt=" + Request.QueryString["dt"]; //gelo } MenuString = "<ul id =\"nav\">"; //if (UserRole != TravelMartVariable.RoleHotelSpecialist && UserRole != TravelMartVariable.RoleHotelVendor && UserRole != "") //{ // MenuString += "<li><a runat=\"server\" id=\"uoAHome\" href=\"../Manifest.aspx" + URLString + "\">Home</a></li>"; //} if (UserRole == TravelMartVariable.RoleHotelSpecialist) { MenuString += "<li><a runat=\"server\" id=\"uoAHome\" href=\"../HotelDashboardRoomType5.aspx" + URLString + "\">Home</a></li>"; } else if (UserRole == TravelMartVariable.RoleMeetGreet || UserRole == TravelMartVariable.RolePortSpecialist) { MenuString += "<li><a runat=\"server\" id=\"uoAHome\" href=\"../MeetAndGreet/MeetAndGreet.aspx" + URLString + "\">Home</a></li>"; } else if (UserRole == TravelMartVariable.RoleCrewAdmin) { MenuString += "<li><a runat=\"server\" id=\"uoAHome\" href=\"../CrewAdmin/CrewAdmin.aspx" + URLString + "\">Home</a></li>"; } else if (UserRole == TravelMartVariable.RoleHotelVendor) { MenuString += "<li><a runat=\"server\" id=\"uoAHome\" href=\"../Hotel/HotelConfirmManifest.aspx" + URLString + "\">Home</a></li>"; } else if (UserRole == TravelMartVariable.RoleSystemAnalyst) { MenuString += "<li><a runat=\"server\" id=\"uoAHome\" href=\"../SystemAnalyst/ExceptionPNR.aspx" + URLString + "\">Home</a></li>"; } else { MenuString += "<li><a runat=\"server\" id=\"uoAHome\" href=\"../Manifest.aspx" + URLString + "\">Home</a></li>"; } DataTable MenuDataTable = null; DataTable SubMenuDataTable = null; DataTable SubMenuDataTable2 = null; string PageUrlString = ""; string SubMenuString = ""; string SubMenuString2 = ""; try { MenuDataTable = UserRightsBLL.GetMenuByUser(UserName); if (MenuDataTable.Rows.Count > 0) { foreach (DataRow MenuRow in MenuDataTable.Rows) { PageUrlString = MenuRow["colPageNameVarchar"].ToString(); PageUrlString = (PageUrlString == "" ? "#" : "../" + PageUrlString + URLString); MenuString += "<li><a href=\"" + PageUrlString + "\">" + MenuRow["colDisplayNameVarchar"].ToString() + "</a>"; SubMenuDataTable = UserRightsBLL.GetSubMenuByUser(UserName, MenuRow["colPageIDInt"].ToString()); if (SubMenuDataTable.Rows.Count > 0) { SubMenuString = "<ul>"; foreach (DataRow SubMenuRow in SubMenuDataTable.Rows) { PageUrlString = SubMenuRow["colPageNameVarchar"].ToString(); PageUrlString = (PageUrlString == "" ? "#" : "../" + PageUrlString + URLString); SubMenuString += "<li><a href=\"" + PageUrlString + "\">" + SubMenuRow["colDisplayNameVarchar"].ToString() + "</a>"; SubMenuDataTable2 = UserRightsBLL.GetSubMenuByUser(UserName, SubMenuRow["colPageIDInt"].ToString()); if (SubMenuDataTable2.Rows.Count > 0) { SubMenuString2 = "<ul>"; foreach (DataRow SubMenuRow2 in SubMenuDataTable2.Rows) { PageUrlString = SubMenuRow2["colPageNameVarchar"].ToString(); PageUrlString = (PageUrlString == "" ? "#" : "../" + PageUrlString + URLString); SubMenuString2 += "<li><a href=\"" + PageUrlString + "\">" + SubMenuRow2["colDisplayNameVarchar"].ToString() + "</a></li>"; } SubMenuString2 += "</ul>"; SubMenuString += SubMenuString2; } SubMenuString += "</li>"; } SubMenuString += "</ul>"; MenuString += SubMenuString; } MenuString += "</li>"; } } } catch (Exception ex) { throw ex; } finally { if (MenuDataTable != null) { MenuDataTable.Dispose(); } if (SubMenuDataTable != null) { SubMenuDataTable.Dispose(); } if (SubMenuDataTable2 != null) { SubMenuDataTable2.Dispose(); } } if (UserRole != TravelMartVariable.RoleImmigration) { MenuString += "<li><a runat=\"server\" id=\"uoASearch\" href=\"../ManifestSearchFilter.aspx" + URLString + "\">Search</a></li>"; } MenuString += "</ul>"; Session["UserMenu"] = MenuString; //Store menu string in Cache for 10 minutes //Cache.Insert("UserMenu", MenuString, null, System.Web.Caching.Cache.NoAbsoluteExpiration, TimeSpan.FromMinutes(10)); } if (Session["CurrentDate"] == null) { Session["CurrentDate"] = Request.QueryString["dt"].ToString(); //Store menu string in Cache for 10 minutes //Cache.Insert("CurrentDate", Request.QueryString["dt"].ToString(), null, System.Web.Caching.Cache.NoAbsoluteExpiration, TimeSpan.FromMinutes(10)); } if (Session["UserMenu"] != null && Session["CurrentDate"] != null) { string sMenu = Session["UserMenu"].ToString(); string sDate = Session["CurrentDate"].ToString(); string sDateNew = Request.QueryString["dt"].ToString(); //sDate = sDate.Replace("_", "/"); if (!sDateNew.Contains("-")) { sDateNew = sDateNew.Replace("_", "/"); sMenu = sMenu.Replace(sDate, sDateNew); Session["UserMenu"] = sMenu; Session["CurrentDate"] = sDateNew; //Store menu string in Cache for 10 minutes //Cache.Insert("UserMenu", sMenu, null, System.Web.Caching.Cache.NoAbsoluteExpiration, TimeSpan.FromMinutes(10)); //Store menu selected date in Cache for 10 minutes //Cache.Insert("CurrentDate", sDateNew, null, System.Web.Caching.Cache.NoAbsoluteExpiration, TimeSpan.FromMinutes(10)); } } MenuString = GlobalCode.Field2String(Session["UserMenu"]); ucLiteralMenu.Text = MenuString; }
/// <summary> /// Date Created: 27/Nov/2012 /// Created By: Josephine Gad /// (description) Get users menu by UserName using session /// ---------------------------------------------------------------- /// Date Modified: 25/Apr/2013 /// Modified By: Josephine Gad /// (description) Change Hotel Vendor's Page to HotelConfirmManifest.aspx Page /// ---------------------------------------------------------------- /// Date Modified: 7/May/2013 /// Modified By: Marco Abejar /// (description) Change Crew Assist Page to HotelDashboardRoomType5.aspx Page ///---------------------------------------------- /// Date Modified: 07/Mar/2014 /// Modified By: Josephine Gad /// (description) Change class of menu if Service Provider ///---------------------------------------------- /// </summary> private void BindMenu() { string URLString = ""; string MenuString = ""; string UserName = GlobalCode.Field2String(Session["UserName"]); //MUser.GetUserName(); string UserRole = GlobalCode.Field2String(Session["UserRole"]);; //MUser.GetUserRole(); if (Session["UserMenu"] == null) { if (Request.QueryString["ufn"] != null) { Session["DateFrom"] = Request.QueryString["dt"]; URLString = "?ufn=" + Request.QueryString["ufn"] + "&dt=" + Request.QueryString["dt"]; //gelo } MenuString = "<ul id =\"nav\">"; if (UserRole == TravelMartVariable.RoleAdministrator) { MenuString += "<li><a runat=\"server\" id=\"uoAHome\" href=\"../HotelDashboardRoomType5.aspx" + URLString + "\">Home</a></li>"; } else if (UserRole == TravelMartVariable.RoleHotelSpecialist) { MenuString += "<li><a runat=\"server\" id=\"uoAHome\" href=\"../HotelDashboardRoomType5.aspx" + URLString + "\">Home</a></li>"; } else if (UserRole == TravelMartVariable.RolePortSpecialist) { MenuString += "<li><a runat=\"server\" id=\"uoAHome\" href=\"../PortAgent/PortAgentDashboard.aspx" + URLString + "\">Home</a></li>"; } else if (UserRole == TravelMartVariable.RoleMeetGreet) { MenuString += "<li><a runat=\"server\" id=\"uoAHome\" href=\"../MeetAndGreet/MeetAndGreet.aspx" + URLString + "\">Home</a></li>"; } else if (UserRole == TravelMartVariable.RoleCrewAdmin) { MenuString += "<li><a runat=\"server\" id=\"uoAHome\" href=\"../CrewAdmin/CrewAdmin.aspx" + URLString + "\">Home</a></li>"; } else if (UserRole == TravelMartVariable.RoleHotelVendor) { MenuString += "<li><a runat=\"server\" id=\"uoAHome\" href=\"../Hotel/HotelConfirmManifest.aspx" + URLString + "\">Home</a></li>"; } else if (UserRole == TravelMartVariable.RoleSystemAnalyst) { MenuString += "<li><a runat=\"server\" id=\"uoAHome\" href=\"../SystemAnalyst/ExceptionPNR.aspx" + URLString + "\">Home</a></li>"; } else if (UserRole == TravelMartVariable.RoleCrewAssist || UserRole == TravelMartVariable.RoleCrewAssistTeamLead) { MenuString += "<li><a runat=\"server\" id=\"uoAHome\" href=\"../CrewAssist/CrewAssist.aspx" + URLString + "\">Home</a></li>"; } else if (UserRole == TravelMartVariable.RoleVehicleVendor) { MenuString += "<li><a runat=\"server\" id=\"uoAHome\" href=\"../Vehicle/VehicleManifestByVendor.aspx" + URLString + "\">Home</a></li>"; } else if (UserRole == TravelMartVariable.RoleFinance || UserRole == TravelMartVariable.RoleCrewMedical) { MenuString += "<li><a runat=\"server\" id=\"uoAHome\" href=\"../ManifestSearchFilterPage.aspx" + URLString + "\">Home</a></li>"; } else if (UserRole == TravelMartVariable.RoleImmigration) { MenuString += "<li><a runat=\"server\" id=\"uoAHome\" href=\"../Immigration/CrewVerification.aspx" + URLString + "\">Home</a></li>"; } else { MenuString += "<li><a runat=\"server\" id=\"uoAHome\" href=\"../Manifest.aspx" + URLString + "\">Home</a></li>"; } string PageUrlString = ""; string SubMenuString = ""; string SubMenuString2 = ""; try { List <UserMenus> menuList = new List <UserMenus>(); List <UserSubMenus> subMenuList = new List <UserSubMenus>(); if (Session["UserMenuList"] != null) { menuList = (List <UserMenus>)Session["UserMenuList"]; subMenuList = (List <UserSubMenus>)Session["UserSubMenuList"]; } else { menuList = UserRightsBLL.GetMenuListByUser(UserName); subMenuList = (List <UserSubMenus>)Session["UserSubMenuList"]; } if (menuList.Count > 0) { int menuMaxCount = menuList.Count; for (int i = 0; i < menuMaxCount; i++) { PageUrlString = menuList[i].PageName;//MenuRow["colPageNameVarchar"].ToString(); PageUrlString = (PageUrlString == "" ? "#" : "../" + PageUrlString + URLString); MenuString += "<li><a href=\"" + PageUrlString + "\">" + menuList[i].DisplayName + "</a>"; List <UserSubMenus> subMenuList1stLevel = new List <UserSubMenus>(); subMenuList1stLevel = (from a in subMenuList where a.ParentIDInt == menuList[i].PageIDInt select new UserSubMenus { ParentIDInt = a.ParentIDInt, PageIDInt = a.PageIDInt, ModuleName = a.ModuleName, PageName = a.PageName, DisplayName = a.DisplayName, Sequence = a.Sequence }).ToList(); subMenuList1stLevel = subMenuList1stLevel.OrderBy(a => a.Sequence).ToList(); if (subMenuList1stLevel.Count > 0) { SubMenuString = "<ul>"; for (int i1st = 0; i1st < subMenuList1stLevel.Count; i1st++) { PageUrlString = subMenuList1stLevel[i1st].PageName; PageUrlString = (PageUrlString == "" ? "#" : "../" + PageUrlString + URLString); SubMenuString += "<li><a href=\"" + PageUrlString + "\">" + subMenuList1stLevel[i1st].DisplayName + "</a>"; List <UserSubMenus> subMenuList2ndLevel = new List <UserSubMenus>(); subMenuList2ndLevel = (from a in subMenuList where a.ParentIDInt == subMenuList1stLevel[i1st].PageIDInt select new UserSubMenus { ParentIDInt = a.ParentIDInt, PageIDInt = a.PageIDInt, ModuleName = a.ModuleName, PageName = a.PageName, DisplayName = a.DisplayName, Sequence = a.Sequence }).ToList(); subMenuList2ndLevel = subMenuList2ndLevel.OrderBy(a => a.Sequence).ToList(); if (subMenuList2ndLevel.Count > 0) { SubMenuString2 = "<ul>"; for (int i2nd = 0; i2nd < subMenuList2ndLevel.Count; i2nd++) { PageUrlString = subMenuList2ndLevel[i2nd].PageName; PageUrlString = (PageUrlString == "" ? "#" : "../" + PageUrlString + URLString); SubMenuString2 += "<li><a href=\"" + PageUrlString + "\">" + subMenuList2ndLevel[i2nd].DisplayName + "</a></li>"; } SubMenuString2 += "</ul>"; SubMenuString += SubMenuString2; } SubMenuString += "</li>"; } SubMenuString += "</ul>"; MenuString += SubMenuString; } MenuString += "</li>"; } } } catch (Exception ex) { throw ex; } if ((UserRole != TravelMartVariable.RoleFinance) && (UserRole != TravelMartVariable.RoleCrewMedical) && (UserRole != TravelMartVariable.RoleImmigration)) { MenuString += "<li><a runat=\"server\" id=\"uoASearch\" href=\"../ManifestSearchFilter.aspx" + URLString + "\">Search</a></li>"; } MenuString += "</ul>"; Session["UserMenu"] = MenuString; //Store menu string in Cache for 10 minutes //Cache.Insert("UserMenu", MenuString, null, System.Web.Caching.Cache.NoAbsoluteExpiration, TimeSpan.FromMinutes(10)); } if (Session["CurrentDate"] == null) { Session["CurrentDate"] = Request.QueryString["dt"].ToString(); //Store menu string in Cache for 10 minutes //Cache.Insert("CurrentDate", Request.QueryString["dt"].ToString(), null, System.Web.Caching.Cache.NoAbsoluteExpiration, TimeSpan.FromMinutes(10)); } if (Session["UserMenu"] != null && Session["CurrentDate"] != null) { string sMenu = Session["UserMenu"].ToString(); string sDate = Session["CurrentDate"].ToString(); if (sDate == "") { sDate = GlobalCode.Field2Date(DateTime.Now); } string sDateNew = Request.QueryString["dt"].ToString(); //sDate = sDate.Replace("_", "/"); if (!sDateNew.Contains("-")) { sDateNew = sDateNew.Replace("_", "/"); sMenu = sMenu.Replace(sDate, sDateNew); Session["UserMenu"] = sMenu; Session["CurrentDate"] = sDateNew; //Store menu string in Cache for 10 minutes //Cache.Insert("UserMenu", sMenu, null, System.Web.Caching.Cache.NoAbsoluteExpiration, TimeSpan.FromMinutes(10)); //Store menu selected date in Cache for 10 minutes //Cache.Insert("CurrentDate", sDateNew, null, System.Web.Caching.Cache.NoAbsoluteExpiration, TimeSpan.FromMinutes(10)); } } MenuString = GlobalCode.Field2String(Session["UserMenu"]); ucLiteralMenu.Text = MenuString; }