コード例 #1
0
        public void AssignUsersDataFilterValues(string[] userNames, List<DataFilterEntity> dataFilterEntities)
        {
            // Clear selected users data filter values
            this.ClearUsersDataFilterValues(userNames);

            // Assign users' data fiter values
            if (dataFilterEntities != null && dataFilterEntities.Count > 0)
            {
                List<DataFilterEntity> userDataFilterEntities = new List<DataFilterEntity>();
                foreach (string username in userNames)
                {
                    foreach (DataFilterEntity dataFilterEntity in dataFilterEntities)
                    {
                        DataFilterEntity dataFilter = new DataFilterEntity();
                        dataFilter.UserDataFilterValueID = Guid.NewGuid().ToString();
                        dataFilter.UserName = username;
                        dataFilter.RoleName = dataFilterEntity.RoleName;
                        dataFilter.DataFilterID = dataFilterEntity.DataFilterID;
                        dataFilter.DataFilterValueID = dataFilterEntity.DataFilterValueID;
                        dataFilter.RecordStatus = DataFilterRecordStatus.New;
                        userDataFilterEntities.Add(dataFilter);
                    }
                }
                MappingUserDataFilterValues(userDataFilterEntities);
            }
        }
コード例 #2
0
 /// <summary>
 /// Delete selected data filter value
 /// </summary>
 /// <param name="dataFilterEntity">dataFilterEntity</param>
 private void DeleteDataFilterValue(DataFilterEntity dataFilterEntity)
 {
     if (CheckDataFilterEntity(dataFilterEntity))
     {
         //NOTE:No transaction id
         DbHelper helper = new DbHelper();
         DbCommand command = helper.BuildDbCommand("P_IC_USERS_DATA_FILTER_VALUES_DELETE");
         helper.AssignParameterValues(
             command,
             Membership.ApplicationName,
             dataFilterEntity.UserDataFilterValueID
             );
         Helper.ExecuteNonQuery(command);
     }
 }
コード例 #3
0
        /// <summary>
        /// Determines whether [contains] [the specified input].
        /// </summary>
        /// <param name="input">The input.</param>
        /// <param name="dataFiltersForCurrentUser">The data filters for current user.</param>
        /// <returns>
        /// 	<c>true</c> if [contains] [the specified input]; otherwise, <c>false</c>.
        /// </returns>
        private bool Contains(DataFilterEntity input, List<DataFilterEntity> dataFiltersForCurrentUser)
        {
            bool isContained = false;

            foreach (DataFilterEntity udf in dataFiltersForCurrentUser)
            {
                if (udf.DataFilterID.Equals(input.DataFilterID)
                    && (udf.DataFilterValueID.Equals(input.DataFilterValueID) || udf.DataFilterValueID.Equals("*")))
                {
                    isContained = true;
                    break;
                }
            }

            return isContained;
        }
コード例 #4
0
 /// <summary>
 /// Add selected data filter value
 /// </summary>
 /// <param name="dataFilterEntity">dataFilterEntity</param>
 private void CreateDataFilterValue(DataFilterEntity dataFilterEntity)
 {
     if (CheckDataFilterEntity(dataFilterEntity))
     {
         string transactionid = NCS.IConnect.ApplicationContexts.ApplicationContextFactory.GetApplicationContext().TransactionId;
         DbHelper helper = new DbHelper();
         DbCommand command = helper.BuildDbCommand("P_IC_USERS_DATA_FILTER_VALUES_INSERT");
         helper.AssignParameterValues(
             command,
             Membership.ApplicationName,
             dataFilterEntity.UserDataFilterValueID,
             dataFilterEntity.UserName,
             dataFilterEntity.RoleName,
             dataFilterEntity.DataFilterID,
             dataFilterEntity.DataFilterValueID,
             DateTime.Now,
             transactionid,
             AppContext.Current.UserName
             );
         Helper.ExecuteNonQuery(command);
     }
 }
コード例 #5
0
 public bool CheckDataFilterEntity(DataFilterEntity dataFilterEntity)
 {
     return (dataFilterEntity != null) &&
         !String.IsNullOrEmpty(dataFilterEntity.UserDataFilterValueID) &&
         !String.IsNullOrEmpty(dataFilterEntity.UserName) &&
         !String.IsNullOrEmpty(dataFilterEntity.RoleName) &&
         !String.IsNullOrEmpty(dataFilterEntity.DataFilterID) &&
         !String.IsNullOrEmpty(dataFilterEntity.DataFilterValueID);
 }