示例#1
0
        /// <summary>
        /// Get users previously saved filter information
        /// </summary>
        /// <param name="userId"></param>
        /// <param name="type"></param>
        /// <returns></returns>
        public async Task <string> GetUserSavedFilters(string userId, Enums.Filter type)
        {
            string userSavedFilters = string.Empty;

            try
            {
                using (var connection = CreateConnection())
                {
                    var savedState = await connection.QueryFirstOrDefaultAsync <StateDTO>(StoredProcedureNames.GET_STATE,
                                                                                          new
                    {
                        username = userId,
                        type     = (int)type
                    }, commandType : CommandType.StoredProcedure).ConfigureAwait(false);

                    if (savedState != null)
                    {
                        userSavedFilters = savedState.STATE;
                    }
                }
            }
            catch (Exception ex)
            {
                // [Todo]
                throw ex;
            }
            return(userSavedFilters);
        }
示例#2
0
        /// <summary>
        /// Delete an Event
        /// </summary>
        /// <param name="eventId"></param>
        /// <returns></returns>
        public async Task <bool> SaveState(string filterSettings, string userId, Enums.Filter type)
        {
            bool StateSaved = true;

            try
            {
                using (var connection = CreateConnection())
                {
                    var eventResult = await connection.ExecuteAsync(StoredProcedureNames.SAVE_STATE, new
                    {
                        state_id = new Guid(),
                        state    = filterSettings,
                        type     = (int)type,
                        userName = userId
                    }, commandType : CommandType.StoredProcedure);
                }
            }
            catch (Exception ex)
            {
                StateSaved = false;
            }
            return(StateSaved);
        }