public void ToggleAction(bool showInList, CswEnumNbtActionName actionName) { string databaseActionName = CswNbtAction.ActionNameEnumToString(actionName); CswTableUpdate actionTU = _CswNbtResources.makeCswTableUpdate("toggleActionVisibility", "actions"); DataTable actionsDT = actionTU.getTable("where actionname = '" + databaseActionName + "'"); foreach (DataRow row in actionsDT.Rows) { row["showinlist"] = CswConvert.ToDbVal(showInList); } actionTU.update(actionsDT); }
} // _getView() private void _reauthenticate() { if (_AuthenticationStatus == CswEnumAuthenticationStatus.Authenticated) { // Set audit context if (false == string.IsNullOrEmpty(_AuthenticationRequest.CurrentViewId)) { CswNbtView ContextView = _getView(_AuthenticationRequest.CurrentViewId); if (ContextView != null) { _CswNbtResources.AuditContext = ContextView.ViewName + " (" + ContextView.ViewId.ToString() + ")"; } } else if (false == string.IsNullOrEmpty(_AuthenticationRequest.CurrentActionName)) { CswNbtAction ContextAction = _CswNbtResources.Actions[CswNbtAction.ActionNameStringToEnum(_AuthenticationRequest.CurrentActionName)]; if (ContextAction != null) { _CswNbtResources.AuditContext = CswNbtAction.ActionNameEnumToString(ContextAction.Name) + " (Action_" + ContextAction.ActionId.ToString() + ")"; } } } }
public override void setItemDataForUI(DataRow LandingPageRow, LandingPageData.Request Request) { bool finishLoading = false; //this will be set to true if and only if there's a valid link to be made String DisplayText = LandingPageRow["displaytext"].ToString(); Int32 ViewId = CswConvert.ToInt32(LandingPageRow["to_nodeviewid"]); if (ViewId != Int32.MinValue) { CswNbtViewId NodeViewId = new CswNbtViewId(ViewId); CswNbtView ThisView = _CswNbtResources.ViewSelect.restoreView(NodeViewId); if (null != ThisView && ThisView.IsFullyEnabled() && ThisView.IsVisible()) { finishLoading = true; _ItemData.Text = LandingPageRow["displaytext"].ToString() != string.Empty ? LandingPageRow["displaytext"].ToString() : ThisView.ViewName; _ItemData.ViewId = NodeViewId.ToString(); _ItemData.ViewMode = ThisView.ViewMode.ToString().ToLower(); if (ThisView.Root.ChildRelationships.Count > 0 && ThisView.Root.ChildRelationships[0] != null) { _ItemData.ButtonIcon = CswNbtMetaDataObjectClass.IconPrefix100 + ThisView.Root.ChildRelationships[0].SecondIconFileName; } _ItemData.Type = "view"; } } Int32 ActionId = CswConvert.ToInt32(LandingPageRow["to_actionid"]); if (ActionId != Int32.MinValue) { CswNbtAction ThisAction = _CswNbtResources.Actions[ActionId]; if (null != ThisAction) { if (_CswNbtResources.Permit.can(ThisAction.Name)) { finishLoading = true; _ItemData.Text = false == String.IsNullOrEmpty(DisplayText) ? DisplayText : CswNbtAction.ActionNameEnumToString(ThisAction.Name); _ItemData.ActionId = ActionId.ToString(); _ItemData.ActionName = ThisAction.Name.ToString(); _ItemData.ActionUrl = ThisAction.Url; _ItemData.ButtonIcon = CswNbtMetaDataObjectClass.IconPrefix100 + ThisAction.IconFileName; _ItemData.Type = "action"; } } } Int32 ReportId = CswConvert.ToInt32(LandingPageRow["to_reportid"]); if (ReportId != Int32.MinValue) { CswPrimaryKey ReportPk = new CswPrimaryKey("nodes", ReportId); CswNbtNode ThisReportNode = _CswNbtResources.Nodes[ReportPk]; if (null != ThisReportNode) { finishLoading = true; _ItemData.Text = false == String.IsNullOrEmpty(DisplayText) ? DisplayText : ThisReportNode.NodeName; _ItemData.ReportId = ReportPk.ToString(); _ItemData.Type = "report"; _ItemData.ButtonIcon = CswNbtMetaDataObjectClass.IconPrefix100 + ThisReportNode.getNodeType().IconFileName; } } Int32 SearchId = CswConvert.ToInt32(LandingPageRow["to_searchid"]); if (SearchId != Int32.MinValue) { CswPrimaryKey SearchPk = new CswPrimaryKey("search", SearchId); CswNbtSearch Search = _CswNbtResources.SearchManager.restoreSearch(SearchPk); if (null != Search) { finishLoading = true; _ItemData.Text = Search.Name; _ItemData.ReportId = SearchPk.ToString(); _ItemData.Type = "search"; _ItemData.ButtonIcon = CswNbtMetaDataObjectClass.IconPrefix100 + "magglass.png"; } } //we only want to send the item back with a landingpageid if it contains a valid link if (finishLoading) { _setCommonItemDataForUI(LandingPageRow); } }
}//_initResources() public CswEnumAuthenticationStatus authenticate() { CswEnumAuthenticationStatus Ret = CswEnumAuthenticationStatus.Unknown; //We're keeping this logic here, because we don't want to contaminate NbtLogic with the necessary web libraries required to support CswSessionResourcesNbt if (null != _AuthenticationRequest && _AuthenticationRequest.IsValid()) { if (false == CswTools.IsValidUsername(_AuthenticationRequest.CustomerId)) { Ret = CswEnumAuthenticationStatus.NonExistentAccessId; } else { Ret = _SessionAuthenticate.authenticate(); } } else { Ret = _CswSessionResourcesNbt.attemptRefresh(); } //Set audit context if (Ret == CswEnumAuthenticationStatus.Authenticated && null != _HttpContext.Request.Cookies) { string ContextViewId = string.Empty; string ContextActionName = string.Empty; if (null != _HttpContext.Request.Cookies["csw_currentviewid"]) { ContextViewId = _HttpContext.Request.Cookies["csw_currentviewid"].Value; } if (null != _HttpContext.Request.Cookies["csw_currentactionname"]) { ContextActionName = _HttpContext.Request.Cookies["csw_currentactionname"].Value; } if (string.Empty != ContextViewId) { CswNbtView ContextView = null; if (CswNbtViewId.isViewIdString(ContextViewId)) { CswNbtViewId realViewid = new CswNbtViewId(ContextViewId); ContextView = _CswNbtResources.ViewSelect.restoreView(realViewid); } else if (CswNbtSessionDataId.isSessionDataIdString(ContextViewId)) { CswNbtSessionDataId SessionViewid = new CswNbtSessionDataId(ContextViewId); ContextView = _CswNbtResources.ViewSelect.getSessionView(SessionViewid); } if (null != ContextView) { _CswNbtResources.AuditContext = ContextView.ViewName + " (" + ContextView.ViewId.ToString() + ")"; } } else if (string.Empty != ContextActionName) { CswNbtAction ContextAction = _CswNbtResources.Actions[CswNbtAction.ActionNameStringToEnum(ContextActionName)]; if (null != ContextAction) { _CswNbtResources.AuditContext = CswNbtAction.ActionNameEnumToString(ContextAction.Name) + " (Action_" + ContextAction.ActionId.ToString() + ")"; } } } _CswNbtResources.ServerInitTime = _Timer.ElapsedDurationInMilliseconds; return(Ret); }//autheticate