protected void LoadAvailableOptions(MembershipUser u) { trAdmin.Visible = false; string[] roles = UserManagement.GetUserRoles_Membership(); List <string> userRoles = new List <string>(roles); //Get View options DataTable dt = WTSData.GetViewOptions(userId: this.UserId, gridName: "Default"); if (dt != null && dt.Rows.Count > 0) { ddlView_Work.DataTextField = "ViewName"; ddlView_Work.DataValueField = "GridViewID"; ddlView_Work.DataSource = dt; ddlView_Work.DataBind(); if (dt.Columns.Contains("ViewName") && dt.Columns.Contains("ViewDescription")) { ViewInfo = string.Empty; foreach (DataRow row in dt.Rows) { ViewInfo += string.Format("{0}:<br />{1}<br /><br />", row["ViewName"].ToString(), row["ViewDescription"].ToString()); } } } // 11626 - 2: get saved View Option for this user ListItem item = ddlView_Work.Items.FindByText(Session["defaultStartModule"].ToString()); //ListItem item = ddlView_Work.Items.FindByText(defaultStartGrid); if (item != null) { item.Selected = true; } else { ddlView_Work.SelectedIndex = 0; } setAdminOptions(userRoles); setMasterDataOptions(userRoles); setReportsOptions(userRoles); setWorkOptions(userRoles); setMeetingOptions(userRoles); setAOROptions(userRoles); setRQMTOptions(userRoles); setSROptions(userRoles); }
private void loadLookupData() { int UserId = UserManagement.GetUserId_FromUsername(); WTS_User u = new WTS_User(UserId); u.Load(); DataTable dt = WTSData.GetViewOptions(userId: UserId, gridName: GridType); DataTable dtSetting = u.UserSettingList_Get(u.ID, (int)UserSettingType.GridView, GridTypeEnum); if (dt != null && dt.Rows.Count > 0) { ddlView.Items.Clear(); ListItem item = null; foreach (DataRow row in dt.Rows) { item = new ListItem(); item.Text = row["ViewName"].ToString(); item.Value = row["GridViewID"].ToString(); item.Attributes.Add("OptionGroup", row["WTS_RESOURCEID"].ToString() != "" ? "Custom Views" : "Process Views"); item.Attributes.Add("MyView", row["MyView"].ToString()); item.Attributes.Add("Tier1RollupGroup", row["Tier1RollupGroup"].ToString()); item.Attributes.Add("Tier1ColumnOrder", row["Tier1ColumnOrder"].ToString()); item.Attributes.Add("Tier2ColumnOrder", row["Tier2ColumnOrder"].ToString()); item.Attributes.Add("DefaultSortType", row["Tier2SortOrder"].ToString()); item.Attributes.Add("SectionsXML", row["SectionsXML"].ToString()); // Set the default, over-write below if user has saved a view preference. if (Session["Levels"] == null && item.Text.ToString().ToLower() == "default") { if (row["SectionsXML"].ToString() != "") { XmlDocument xml = new XmlDocument(); xml.LoadXml(row["SectionsXML"].ToString()); HttpContext.Current.Session["Levels"] = xml; //------------------------------------------ } } ddlView.Items.Add(item); try { if (Session[DefaultGridViewNameSessionKey] != null) { if (ddlView.Items.FindByText(row["ViewName"].ToString()) == null) { // If user has saved view preference, save that XML to Session. if (Session[DefaultGridViewNameSessionKey].ToString().ToLower() == item.Text.ToString().ToLower()) { if (row["SectionsXML"].ToString() != "") { XmlDocument xml = new XmlDocument(); xml.LoadXml(row["SectionsXML"].ToString()); HttpContext.Current.Session["Levels"] = xml; //------------------------------------------ } } } } } catch (Exception) { // Nothing to do here, will use default. } } // 11626 - 2 > Use saved preferences: if (Session[DefaultGridViewNameSessionKey] != null && !string.IsNullOrWhiteSpace(Session[DefaultGridViewNameSessionKey].ToString()) && ddlChanged_ML != "yes") { ListItem itemGridView = ddlView.Items.FindByText(Session[DefaultGridViewNameSessionKey].ToString()); if (itemGridView != null) { itemGridView.Selected = true; } else { this.Grid_View = string.Empty; } } else // No saved view preference { if (!string.IsNullOrWhiteSpace(this.Grid_View)) { ListItem itemGridView = ddlView.Items.FindByText(this.Grid_View); if (itemGridView != null) { itemGridView.Selected = true; } else { this.Grid_View = string.Empty; } } else { if (dtSetting != null && dtSetting.Rows.Count > 0) { WTSUtility.SelectDdlItem(ddlView, dtSetting.Rows[0]["SettingValue"].ToString().Trim()); } } } if (Session[GridViewCurrentDropDownSessionKey] != null) { // Not working, may be because of "Process Views" "Custom Views" //ddlView.SelectedIndex = Convert.ToInt32(Session["CurrentDropDown"].ToString()); } if (Session[GridViewLevelsSessionKey] != null) // HttpContext.Current. { Page.ClientScript.RegisterArrayDeclaration("dtSectionsView", JsonConvert.SerializeObject(dt, Newtonsoft.Json.Formatting.None)); } } }
public static DataTable GetViewOptions() { var UserId = UserManagement.GetUserId_FromUsername(); return(WTSData.GetViewOptions(UserId, _gridView)); }
private void loadLookupData() { DataTable dt = WTSData.GetViewOptions(userId: this.UserId, gridName: ""); if (dt == null || dt.Rows.Count == 0) { return; } ListItem item = null; //default view options DataRow[] rows = dt.Select("GridName='MainView'"); if (rows != null && rows.Length > 0) { ddlMainView.Items.Clear(); ddlMainView.Attributes["GridNameID"] = rows[0]["GridNameID"].ToString(); foreach (DataRow row in rows) { item = new ListItem(); item.Text = row["ViewName"].ToString(); item.Value = row["GridViewID"].ToString(); if (ddlMainView.Items.FindByText(row["ViewName"].ToString()) == null) { ddlMainView.Items.Add(item); } } } rows = dt.Select("GridName='Default'"); if (rows != null && rows.Length > 0) { ddlView_Main.Items.Clear(); ddlView_Main.Attributes["GridNameID"] = rows[0]["GridNameID"].ToString(); foreach (DataRow row in rows) { item = new ListItem(); item.Text = row["ViewName"].ToString(); item.Value = row["GridViewID"].ToString(); if (ddlView_Main.Items.FindByText(row["ViewName"].ToString()) == null) { ddlView_Main.Items.Add(item); } } } rows = dt.Select("GridName='Workload'"); if (rows != null && rows.Length > 0) { ddlView_Workload.Items.Clear(); ddlView_Workload.Attributes["GridNameID"] = rows[0]["GridNameID"].ToString(); foreach (DataRow row in rows) { item = new ListItem(); item.Text = row["ViewName"].ToString(); item.Value = row["GridViewID"].ToString(); if (ddlView_Workload.Items.FindByText(row["ViewName"].ToString()) == null) { ddlView_Workload.Items.Add(item); } } } rows = dt.Select("GridName='Workload Crosswalk'"); if (rows != null && rows.Length > 0) { ddlView_Crosswalk.Items.Clear(); ddlView_Crosswalk.Attributes["GridNameID"] = rows[0]["GridNameID"].ToString(); foreach (DataRow row in rows) { if (row["ViewName"].ToString() != "-- New Gridview --") { item = new ListItem(); item.Text = row["ViewName"].ToString(); item.Value = row["GridViewID"].ToString(); if (ddlView_Crosswalk.Items.FindByText(row["ViewName"].ToString()) == null) { ddlView_Crosswalk.Items.Add(item); } } } } rows = dt.Select("GridName='Work Request'"); if (rows != null && rows.Length > 0) { ddlView_Request.Items.Clear(); ddlView_Request.Attributes["GridNameID"] = rows[0]["GridNameID"].ToString(); foreach (DataRow row in rows) { item = new ListItem(); item.Text = row["ViewName"].ToString(); item.Value = row["GridViewID"].ToString(); if (ddlView_Request.Items.FindByText(row["ViewName"].ToString()) == null) { ddlView_Request.Items.Add(item); } } } rows = dt.Select("GridName='Hotlist'"); if (rows != null && rows.Length > 0) { ddlView_Hotlist.Items.Clear(); ddlView_Hotlist.Attributes["GridNameID"] = rows[0]["GridNameID"].ToString(); foreach (DataRow row in rows) { item = new ListItem(); item.Text = row["ViewName"].ToString(); item.Value = row["GridViewID"].ToString(); if (ddlView_Hotlist.Items.FindByText(row["ViewName"].ToString()) == null) { ddlView_Hotlist.Items.Add(item); } } } rows = dt.Select("GridName='AOR'"); if (rows != null && rows.Length > 0) { ddlView_AOR.Items.Clear(); ddlView_AOR.Attributes["GridNameID"] = rows[0]["GridNameID"].ToString(); foreach (DataRow row in rows) { if ((int)row["viewType"] == 1 && row["ViewName"].ToString() != "-- New Gridview --") { item = new ListItem(); item.Text = row["ViewName"].ToString(); item.Value = row["GridViewID"].ToString(); if (ddlView_AOR.Items.FindByText(row["ViewName"].ToString()) == null) { ddlView_AOR.Items.Add(item); } } } } }