public async Task<PaginatedResponse<IEnumerable<CompanyReviewResponse>>> GetCompanyReviews(SingleData<int> request, int pageIndex, int pageSize, SystemSession session)
        {
            var serviceRequest = new CompanyReview
            {
                CompanyId = request.Data,
                OffSet = pageIndex,
                PageSize = pageSize

            };
            var response = await Task.Factory.StartNew(() => Client.UserService.getCompanyReviews(serviceRequest, session.GetSession())).ConfigureAwait(false);
            var result = new PaginatedResponse<IEnumerable<CompanyReviewResponse>>
            {
                HasNextPage = response.HasNextPage,
                Page = response.CompanyReviews.Select(
                 x => new CompanyReviewResponse
                 {
                     CompanyReviewGuid = x.CompanyReviewGUID != null ? Guid.Parse(x.CompanyReviewGUID) : Guid.Empty,
                     User = new UserResponse
                     {
                         UserId = x.UserId,
                         UserName = x.Username,
                         Name = x.Name,
                         Picture = x.PictureUrl
                     },
                     Star = x.Star,
                     Title = x.Title,
                     Comment = x.Comment,
                     DateCommented = x.DateCommented != null ? Convert.ToDateTime(x.DateCommented) : (DateTime?)null,
                     IsApproved = x.IsApproved
                 })

            };
            return result;
        }
        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)
                    {
                        {
                            CompanyReviews = new List <CompanyReview>();
                            TList _list16 = iprot.ReadListBegin();
                            for (int _i17 = 0; _i17 < _list16.Count; ++_i17)
                            {
                                CompanyReview _elem18;
                                _elem18 = new CompanyReview();
                                _elem18.Read(iprot);
                                CompanyReviews.Add(_elem18);
                            }
                            iprot.ReadListEnd();
                        }
                    }
                    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) {
           {
             CompanyReviews = new List<CompanyReview>();
             TList _list16 = iprot.ReadListBegin();
             for( int _i17 = 0; _i17 < _list16.Count; ++_i17)
             {
               CompanyReview _elem18;
               _elem18 = new CompanyReview();
               _elem18.Read(iprot);
               CompanyReviews.Add(_elem18);
             }
             iprot.ReadListEnd();
           }
         } else { 
           TProtocolUtil.Skip(iprot, field.Type);
         }
         break;
       default: 
         TProtocolUtil.Skip(iprot, field.Type);
         break;
     }
     iprot.ReadFieldEnd();
   }
   iprot.ReadStructEnd();
 }
        public async Task<StatusData<string>> UpsertCompanyReview(CompanyReviewRequest request, int mode, SystemSession session)
        {
            var serviceRequest = new CompanyReview
            {
                UserId = session.UserId,
                CompanyId = request.CompanyId,
                Mode = mode,
                Star = request.Star,
                Title = request.Title,
                Comment = request.Comment,
                CompanyReviewGUID = request.CompanyReviewGuid

            };
            var response = (await Task.Factory.StartNew(() => Client.UserService.setCompanyReview(serviceRequest, session.GetSession())).ConfigureAwait(false)).GetStatusData<string>();
            return response;
        }
Ejemplo n.º 5
0
 public IAsyncResult send_getCompanyReviews(AsyncCallback callback, object state, CompanyReview companyReview, Session session)
Ejemplo n.º 6
0
 public void send_getCompanyReviews(CompanyReview companyReview, Session session)
 #endif
 {
   oprot_.WriteMessageBegin(new TMessage("getCompanyReviews", TMessageType.Call, seqid_));
   getCompanyReviews_args args = new getCompanyReviews_args();
   args.CompanyReview = companyReview;
   args.Session = session;
   args.Write(oprot_);
   oprot_.WriteMessageEnd();
   #if SILVERLIGHT
   return oprot_.Transport.BeginFlush(callback, state);
   #else
   oprot_.Transport.Flush();
   #endif
 }
Ejemplo n.º 7
0
      public CompanyReviewList getCompanyReviews(CompanyReview companyReview, Session session)
      {
        #if !SILVERLIGHT
        send_getCompanyReviews(companyReview, session);
        return recv_getCompanyReviews();

        #else
        var asyncResult = Begin_getCompanyReviews(null, null, companyReview, session);
        return End_getCompanyReviews(asyncResult);

        #endif
      }
Ejemplo n.º 8
0
 public IAsyncResult Begin_getCompanyReviews(AsyncCallback callback, object state, CompanyReview companyReview, Session session)
 {
   return send_getCompanyReviews(callback, state, companyReview, session);
 }
Ejemplo n.º 9
0
      public DbStatus setCompanyReview(CompanyReview review, Session session)
      {
        #if !SILVERLIGHT
        send_setCompanyReview(review, session);
        return recv_setCompanyReview();

        #else
        var asyncResult = Begin_setCompanyReview(null, null, review, session);
        return End_setCompanyReview(asyncResult);

        #endif
      }
Ejemplo n.º 10
0
 public IAsyncResult Begin_setCompanyReview(AsyncCallback callback, object state, CompanyReview review, Session session)
 {
   return send_setCompanyReview(callback, state, review, session);
 }
Ejemplo n.º 11
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) {
           CompanyReview = new CompanyReview();
           CompanyReview.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();
 }