public async Task<PaginatedResponse<IEnumerable<NotificationResponse>>> GetNotificationList(NotificationRequest request, int pageIndex, int pageSize, SystemSession session)
        {
            var serviceRequest = new NotificationMob { TypeId = request.FilterType, RequestDirection = request.RequestDirection, NrTypes = request.NotificationRequestTypes, DisplayOnlyId = (int)request.NotificationRequestId.GetValueOrDefault(), SetAsRead = true, PageIndex = pageIndex, PageSize = pageSize, UserId = session.UserId, UserName = session.UserName };
            var response = await Task.Factory.StartNew(() => Client.UserService.getAllNotifications(serviceRequest, session.GetSession())).ConfigureAwait(false);
            var result =
                new PaginatedResponse<IEnumerable<NotificationResponse>>
                {
                    HasNextPage = response.HasNextPage,
                    Page =
                        response.Notifications.Select(
                            x =>
                                new NotificationResponse
                                {
                                    NotificationId = x.NotificationId,
                                    NotifierId = x.UserId,
                                    NotifierUserName = x.UserName,
                                    ReadDate = Convert.ToDateTime(x.ReadDate),
                                    SentDate = Convert.ToDateTime(x.SentDate),
                                    TypeId = x.TypeId,
                                    Type = x.Type,
                                    Name = x.Name,
                                    Picture = x.PictureUrl,
                                    Title = x.Title,
                                    Notification = x.Notification,
                                    MutualFriendId = x.MutualFrdId,
                                    MutualFriendName = x.MutualFrdName,
                                    MutualFriendCount = x.MutualFrdCount,
                                    GroupId = x.GroupId,
                                    GroupName = x.GroupName,
                                    EventId = x.EventId,
                                    EventName = x.EventName,
                                    ClickedDate = Convert.ToDateTime(x.ClickDate)
                                })
                };

            return result;
        }
예제 #2
0
        public void Read(TProtocol iprot)
        {
            TField field;

            iprot.ReadStructBegin();
            while (true)
            {
                field = iprot.ReadFieldBegin();
                if (field.Type == TType.Stop)
                {
                    break;
                }
                switch (field.ID)
                {
                case 1:
                    if (field.Type == TType.Bool)
                    {
                        HasNextPage = iprot.ReadBool();
                    }
                    else
                    {
                        TProtocolUtil.Skip(iprot, field.Type);
                    }
                    break;

                case 2:
                    if (field.Type == TType.List)
                    {
                        {
                            Notifications = new List <NotificationMob>();
                            TList _list104 = iprot.ReadListBegin();
                            for (int _i105 = 0; _i105 < _list104.Count; ++_i105)
                            {
                                NotificationMob _elem106;
                                _elem106 = new NotificationMob();
                                _elem106.Read(iprot);
                                Notifications.Add(_elem106);
                            }
                            iprot.ReadListEnd();
                        }
                    }
                    else
                    {
                        TProtocolUtil.Skip(iprot, field.Type);
                    }
                    break;

                case 3:
                    if (field.Type == TType.I32)
                    {
                        PageIndex = iprot.ReadI32();
                    }
                    else
                    {
                        TProtocolUtil.Skip(iprot, field.Type);
                    }
                    break;

                case 4:
                    if (field.Type == TType.I32)
                    {
                        PageSize = iprot.ReadI32();
                    }
                    else
                    {
                        TProtocolUtil.Skip(iprot, field.Type);
                    }
                    break;

                case 5:
                    if (field.Type == TType.I32)
                    {
                        NotificationCount = iprot.ReadI32();
                    }
                    else
                    {
                        TProtocolUtil.Skip(iprot, field.Type);
                    }
                    break;

                case 6:
                    if (field.Type == TType.I32)
                    {
                        RequestCount = iprot.ReadI32();
                    }
                    else
                    {
                        TProtocolUtil.Skip(iprot, field.Type);
                    }
                    break;

                case 7:
                    if (field.Type == TType.String)
                    {
                        UserName = iprot.ReadString();
                    }
                    else
                    {
                        TProtocolUtil.Skip(iprot, field.Type);
                    }
                    break;

                default:
                    TProtocolUtil.Skip(iprot, field.Type);
                    break;
                }
                iprot.ReadFieldEnd();
            }
            iprot.ReadStructEnd();
        }
 public void Read (TProtocol iprot)
 {
   TField field;
   iprot.ReadStructBegin();
   while (true)
   {
     field = iprot.ReadFieldBegin();
     if (field.Type == TType.Stop) { 
       break;
     }
     switch (field.ID)
     {
       case 1:
         if (field.Type == TType.Bool) {
           HasNextPage = iprot.ReadBool();
         } else { 
           TProtocolUtil.Skip(iprot, field.Type);
         }
         break;
       case 2:
         if (field.Type == TType.List) {
           {
             Notifications = new List<NotificationMob>();
             TList _list104 = iprot.ReadListBegin();
             for( int _i105 = 0; _i105 < _list104.Count; ++_i105)
             {
               NotificationMob _elem106;
               _elem106 = new NotificationMob();
               _elem106.Read(iprot);
               Notifications.Add(_elem106);
             }
             iprot.ReadListEnd();
           }
         } else { 
           TProtocolUtil.Skip(iprot, field.Type);
         }
         break;
       case 3:
         if (field.Type == TType.I32) {
           PageIndex = iprot.ReadI32();
         } else { 
           TProtocolUtil.Skip(iprot, field.Type);
         }
         break;
       case 4:
         if (field.Type == TType.I32) {
           PageSize = iprot.ReadI32();
         } else { 
           TProtocolUtil.Skip(iprot, field.Type);
         }
         break;
       case 5:
         if (field.Type == TType.I32) {
           NotificationCount = iprot.ReadI32();
         } else { 
           TProtocolUtil.Skip(iprot, field.Type);
         }
         break;
       case 6:
         if (field.Type == TType.I32) {
           RequestCount = iprot.ReadI32();
         } else { 
           TProtocolUtil.Skip(iprot, field.Type);
         }
         break;
       case 7:
         if (field.Type == TType.String) {
           UserName = iprot.ReadString();
         } else { 
           TProtocolUtil.Skip(iprot, field.Type);
         }
         break;
       default: 
         TProtocolUtil.Skip(iprot, field.Type);
         break;
     }
     iprot.ReadFieldEnd();
   }
   iprot.ReadStructEnd();
 }
예제 #4
0
 public void send_getAllNotifications(NotificationMob notificationMob, Session session)
 #endif
 {
   oprot_.WriteMessageBegin(new TMessage("getAllNotifications", TMessageType.Call, seqid_));
   getAllNotifications_args args = new getAllNotifications_args();
   args.NotificationMob = notificationMob;
   args.Session = session;
   args.Write(oprot_);
   oprot_.WriteMessageEnd();
   #if SILVERLIGHT
   return oprot_.Transport.BeginFlush(callback, state);
   #else
   oprot_.Transport.Flush();
   #endif
 }
예제 #5
0
 public IAsyncResult send_getAllNotifications(AsyncCallback callback, object state, NotificationMob notificationMob, Session session)
예제 #6
0
      public NotificationMobList getAllNotifications(NotificationMob notificationMob, Session session)
      {
        #if !SILVERLIGHT
        send_getAllNotifications(notificationMob, session);
        return recv_getAllNotifications();

        #else
        var asyncResult = Begin_getAllNotifications(null, null, notificationMob, session);
        return End_getAllNotifications(asyncResult);

        #endif
      }
예제 #7
0
 public IAsyncResult Begin_getAllNotifications(AsyncCallback callback, object state, NotificationMob notificationMob, Session session)
 {
   return send_getAllNotifications(callback, state, notificationMob, session);
 }
예제 #8
0
 public void Read (TProtocol iprot)
 {
   TField field;
   iprot.ReadStructBegin();
   while (true)
   {
     field = iprot.ReadFieldBegin();
     if (field.Type == TType.Stop) { 
       break;
     }
     switch (field.ID)
     {
       case 1:
         if (field.Type == TType.Struct) {
           NotificationMob = new NotificationMob();
           NotificationMob.Read(iprot);
         } else { 
           TProtocolUtil.Skip(iprot, field.Type);
         }
         break;
       case 2:
         if (field.Type == TType.Struct) {
           Session = new Session();
           Session.Read(iprot);
         } else { 
           TProtocolUtil.Skip(iprot, field.Type);
         }
         break;
       default: 
         TProtocolUtil.Skip(iprot, field.Type);
         break;
     }
     iprot.ReadFieldEnd();
   }
   iprot.ReadStructEnd();
 }