Example #1
0
        //Get Notifications
        public object GetNotifications(long lastNotifiId, int takeCount)
        {
            try
            {
                bool IsEn          = LanguageService.IsEn;
                var  Notifications = db.GetUserNotifications(AccessToken.GetUserId(), lastNotifiId, takeCount)
                                     .Select(c => new NotificationVM
                {
                    Id            = c.Id,
                    Title         = IsEn ? c.TitleEn : c.TitleAr,
                    DateTimeSince = DateService.CaltDateTimeSince(c.DataTime)
                }).ToList();

                if (Notifications.Count == 0)
                {
                    if (lastNotifiId == 0)
                    {
                        return(new ResponseVM(RequestTypeEnumVM.Info, Token.NoResult));
                    }
                    return(new ResponseVM(RequestTypeEnumVM.Info, Token.NoResultMore));
                }

                return(new ResponseVM(RequestTypeEnumVM.Success, Token.Success, Notifications));
            }
            catch (Exception ex)
            {
                return(new ResponseVM(RequestTypeEnumVM.Error, Token.SomeErrorInServer, ex));
            }
        }
        //Get   Technical Support Notifications
        public object GetTechnicalSupportForNotifications(int skip, int take, bool?isRead)
        {
            var TechnicalSupports = db.GetTechnicalSupports(skip, take, isRead).Select(c => new
            {
                c.Id,
                c.Message,
                c.Email,
                c.IsRead,
                c.UserName,
                c.Subject,
                DateTimeSince = DateService.CaltDateTimeSince(c.CreateDateTime)
            }).ToList();

            if (TechnicalSupports.Count == 0)
            {
                if (skip == 0)
                {
                    return(new ResponseVM(RequestTypeEnumVM.Error, Token.NoResult));
                }
                return(new ResponseVM(RequestTypeEnumVM.Error, Token.NoResultMore));
            }
            return(new ResponseVM(RequestTypeEnumVM.Success, Token.Success, TechnicalSupports));
        }
Example #3
0
        public object GetNotifications(long userId, int skip, int take, bool?isRead)
        {
            var Notifications = db.GetNotificationsByFilter(skip, take, userId, isRead, true).Select(c => new
            {
                c.Id,
                c.NotificationCount,
                c.IsRead,
                Title = LanguageService.IsEn ? c.TitleEn : c.TitleAr,
                Body  = LanguageService.IsEn ? c.BodyEn : c.BodyAr,


                DateTimeSince = DateService.CaltDateTimeSince(c.DataTime),
            }).ToList();

            if (Notifications.Count() == 0)
            {
                if (skip == 0)
                {
                    return(new ResponseVM(RequestTypeEnumVM.Error, Token.NoResult));
                }
                return(new ResponseVM(RequestTypeEnumVM.Info, Token.NoResultMore));
            }
            return(new ResponseVM(RequestTypeEnumVM.Success, Token.Success, Notifications));
        }