Пример #1
0
        public EntityResponse <AlarmDto> GetAlarm(int id)
        {
            var prms = new Dictionary <string, SqlParam>();

            prms.Add("@Id", new SqlParam()
            {
                Direction = System.Data.ParameterDirection.Input, SqlType = System.Data.SqlDbType.NVarChar, Value = id
            });
            var result      = _baseService.QueryWithMultiOutput <AlarmDto>("sp_GetSingleAlarm", prms);
            var singleAlarm = result.Item1.ToList().SingleOrDefault();

            return(new EntityResponse <AlarmDto>()
            {
                ResponseCode = ResponseCodes.Successful, EntityData = singleAlarm
            });
        }
Пример #2
0
        public EntityListResponse <UserAlarmDto> Get(int userId)
        {
            var prms = new Dictionary <string, SqlParam>();

            prms.Add("@UserId", new SqlParam()
            {
                Direction = System.Data.ParameterDirection.Input, SqlType = System.Data.SqlDbType.NVarChar, Value = userId
            });
            var result     = _baseService.QueryWithMultiOutput <UserAlarmDto>("sp_GetUserAlarms", prms);
            var userAlarms = result.Item1.ToList();

            return(new EntityListResponse <UserAlarmDto>()
            {
                ResponseCode = ResponseCodes.Successful, EntityDataList = userAlarms
            });
        }
Пример #3
0
        public EntityResponse <UserDto> Get(string PushNotificationId)
        {
            var prms = new Dictionary <string, SqlParam>();

            prms.Add("@PushNotificationId", new SqlParam()
            {
                Direction = System.Data.ParameterDirection.Input, SqlType = System.Data.SqlDbType.NVarChar, Value = PushNotificationId
            });
            var result     = _baseService.QueryWithMultiOutput <UserDto>("sp_GetUser", prms);
            var singleUser = result.Item1.ToList().SingleOrDefault();

            singleUser.Groups        = _grupService.GetGroupsByUserId(singleUser.Id).EntityDataList.ToList();
            singleUser.UserAlarmsIds = _userAlarmsService.Get(singleUser.Id).EntityDataList.ToList();
            return(new EntityResponse <UserDto>()
            {
                ResponseCode = ResponseCodes.Successful, EntityData = singleUser
            });
        }
Пример #4
0
        public EntityListResponse <RegionDto> GetRegion()
        {
            var prms       = new Dictionary <string, SqlParam>();
            var result     = _baseService.QueryWithMultiOutput <RegionDto>("sp_GetRegion", prms);
            var allregions = result.Item1.ToList();

            return(new EntityListResponse <RegionDto>()
            {
                ResponseCode = ResponseCodes.Successful, EntityDataList = allregions
            });
        }
Пример #5
0
        private bool IsPremiumUser(string phoneNumber)
        {
            bool returnResult = false;
            var  prms         = new Dictionary <string, SqlParam>();

            prms.Add("@PhoneNumber", new SqlParam()
            {
                Direction = System.Data.ParameterDirection.Input, SqlType = System.Data.SqlDbType.NVarChar, Value = phoneNumber
            });
            var result = _baseService.QueryWithMultiOutput <UserDto>("sp_IsPremiumToUser", prms);

            if (result.Item1.SingleOrDefault() == null)
            {
                returnResult = false;
            }
            else
            {
                returnResult = true;
            }
            return(returnResult);
        }