public List<DataFilterValueEntity> GetDataFilterValuesByDataFilter(string dataFilter, string functionID) { // 1. Get available user data filter values from database. DataTable dt = new DataTable(); DbHelper helper = new DbHelper(); DbCommand command = helper.BuildDbCommand("P_IC_DATA_FILTER_VALUES_GET_BY_FUNCTION"); helper.AssignParameterValues( command, ExtendedMembership.ApplicationName, AppContext.Current.UserName, dataFilter, functionID ); helper.Fill(dt, command); // 2. Fill available data filter values into collcection (List<DataFilterValues>) List<DataFilterValueEntity> availableDataFilterValues = new List<DataFilterValueEntity>(); if (dt.Rows.Count > 0) { foreach (DataRow row in dt.Rows) { availableDataFilterValues.Add( new DataFilterValueEntity( functionID, row["DATA_FILTER"].ToString(), row["DATA_FILTER_VALUE"].ToString(), row["DATA_FILTER_ID"].ToString(), row["DATA_FILTER_VALUE_ID"].ToString() )); } } return availableDataFilterValues; }
public List<string> GetActionsForUser(string userName) { string AppName = NCS.IConnect.Security.BusinessActions.ApplicationName; DataTable dt = new DataTable(); DbHelper helper = new DbHelper(); DbCommand command = helper.BuildDbCommand("P_IC_ACTIONS_GET_FOR_USER"); helper.AssignParameterValues( command, AppName, userName ); helper.Fill(dt, command); var list = new List<string>(); foreach (DataRow row in dt.Rows) { list.Add(row["ACTION_CODE"].ToString()); } return list; }
public List<string> GetFilterActionsByDependencyType(List<string> allUserActions, int dependencyType) { var dt = new AuthorizationDataSet.ActionDependenciesDataTable(); DbHelper helper = new DbHelper(); DbCommand command = helper.BuildDbCommand("P_IC_ACTIONS_GET_DEPENDENCIES_BY_TYPE"); helper.AssignParameterValues( command, dependencyType //dependency actions ); helper.Fill(dt, command); List<string> availableDependencyUserActions = new List<string>(); if (dt.Rows.Count > 0) { var actions = from a in allUserActions join b in dt on a equals b.ACTION_CODE select a; // foreach (DataRow row in dt.Rows) foreach (string explicitAction in actions) { // FindDependencyActionInDepth(ref availableDependencyUserActions, allUserActions, row["ACTION_CODE"].ToString(), dt); FindDependencyActionInDepth(ref availableDependencyUserActions, allUserActions, explicitAction, dt); } } return availableDependencyUserActions.Distinct().ToList(); }
public DataRow GetLogInfo(string userName, string ipAddress, string hostName, out SessionData sessionData) { //Not use this.Helper to avoid to insert log, because the method will be called by UserNameExtractionCallHanlders DbHelper dbHelper = new DbHelper(); DataTable table = new DataTable(); string sessionID = AppContext.Current.SessionID; if (string.IsNullOrEmpty(sessionID)) { sessionID = Guid.NewGuid().ToString(); } int timeoutMinutes = SessionSettings.GetServiceSetting().SessionTimeout; dbHelper.Fill(table, "P_IC_USER_INFO_FOR_LOGIN", userName, sessionID, DateTime.Now, DateTime.Now, ipAddress, hostName, timeoutMinutes, DateTime.Now); TimeSpan refreshInterval = new TimeSpan(0, 0, (int)(SessionSettings.GetServiceSetting().RefreshInterval * 60)); TimeSpan timeoutInterval = new TimeSpan(0, 0, (SessionSettings.GetServiceSetting().SessionTimeout * 60)); sessionData = new SessionData { SessionID = sessionID, RefreshInterval = refreshInterval, SessionTimeoutInterval = timeoutInterval }; return (table.Rows.Count == 0) ? null : table.Rows[0]; }
public string[] GetUsersWithFunctionAndDataFilter(string functionId, string dataFilterId,string dataFilterValueId) { // 1. Get available users from database. DataTable dt = new DataTable(); DbHelper helper = new DbHelper(); DbCommand command = helper.BuildDbCommand("P_IC_DATA_FILTER_VALUES_GET_USERS_BY_FUNCTION"); helper.AssignParameterValues( command, ExtendedMembership.ApplicationName, functionId, dataFilterId, dataFilterValueId ); helper.Fill(dt, command); // 2. Fill available username values into collcection (List<string>) List<string> userNames = new List<string>(); if (dt.Rows.Count > 0) { foreach (DataRow row in dt.Rows) { userNames.Add(row["USER_NAME"].ToString() ); } } return userNames.ToArray(); }