Ejemplo n.º 1
0
        public async Task <StatusData <string> > UpdateBasicContactPerson(BasicContactPersonWebRequest request, SystemSession session)
        {
            var serviceRequest = new UserInfoPerson
            {
                UserId     = session.UserName,
                FirstName  = request.FirstName,
                LastName   = request.LastName,
                BirthDate  = request.BirthDate.ToString(),
                ReligionId = new Religion {
                    Name = request.Religion
                },
                Nationality = new Nationality {
                    Name = request.Nationality
                },
                Interests            = request.Interests,
                Title                = request.Title,
                RelationshipStatusId = new RelationshipStatus {
                    RelationshipStatusId = (int)request.RelationshipStatusId
                },
                Gender = ((byte)request.Gender).ToString()
            };

            var response =
                (await
                 Task.Factory.StartNew(
                     () => Client.UserService.setBasicContactPersion(serviceRequest, session.GetSession()))
                 .ConfigureAwait(false)).GetStatusData <string>();

            return(response);
        }
        public async Task <StatusData <DepartmentResponse> > UpsertDepartment(DepartmentRequest request, int mode, SystemSession session)
        {
            var serviceRequest = new Department
            {
                DepartmentId   = request.DepartmentId,
                FromCompanyId  = request.FromCompanyId,
                ToCompanyId    = request.ToCompanyId,
                DepartmentName = request.DepartmentName,
                EmployeeIds    = request.EmployeeIds,
                Mode           = mode
            };
            var response = await Task.Factory.StartNew(() => Client.UserService.upsertDepartment(serviceRequest, session.GetSession())).ConfigureAwait(false);

            var result = new StatusData <DepartmentResponse> {
                Status = (SystemDbStatus)response.DbStatus.DbStatusCode, Message = response.DbStatus.DbStatusMsg, SubStatus = response.DbStatus.DbSubStatusCode
            };

            if (result.Status.IsOperationSuccessful())
            {
                result.Data = new DepartmentResponse
                {
                    DepartmentId = response.DepartmentId
                };
                // result.Data.DepartmentId = response.DepartmentId;
            }
            return(result);
        }
        public async Task <PaginatedResponse <IEnumerable <EmployeeViewResponse> > > GetEmployees(EmployeeViewRequest request, int pageIndex, int pageSize, SystemSession session)
        {
            var serviceRequest = new Employees
            {
                UserId     = request.TargetUserId,
                FilterId   = request.FilterId,
                Offset     = pageIndex,
                PageSize   = pageSize,
                SearchTerm = request.SearchTerm
            };
            var response = await Task.Factory.StartNew(() => Client.UserService.getEmployees(serviceRequest, session.GetSession())).ConfigureAwait(false);

            var result = new PaginatedResponse <IEnumerable <EmployeeViewResponse> >
            {
                HasNextPage = response.HasNextPage,
                Page        = response.CompanyEmployeeInfos.Select(
                    x => new EmployeeViewResponse
                {
                    User = new UserResponse
                    {
                        UserId   = x.UserId,
                        UserName = x.Username,
                        Name     = x.Firstname + " " + x.Lastname,
                        Picture  = x.Picture
                    },
                    Position = new GeneralKvPair <int?, string>
                    {
                        Id    = x.PositionId,
                        Value = x.Position
                    },
                    EmploymentId   = x.EmploymentId,
                    EmployeeTypeId = x.EmployeeTypeId,
                    EmploymentDate = new BeginEndDate
                    {
                        BeginDate = Convert.ToDateTime(x.StartDate),
                        EndDate   = x.EndDate != null ? Convert.ToDateTime(x.EndDate) : (DateTime?)null
                    },
                    IsExecutiveBody = x.IsExecutiveBody,
                    Added           = x.Added != null ? Convert.ToDateTime(x.Added) : (DateTime?)null,
                    IsApproved      = x.ApprovedStatus
                })
            };

            return(result);
        }
        public async Task <StatusData <string> > UpsertCategoryFriends(CategoryFriends request, SystemDbStatus mode, SystemSession session)
        {
            var userCategory = new UserCategory {
                UserId = session.UserId.ToString(), UserCategoryTypeId = request.CategoryId
            };
            var friends = request.Friends != null && request.Friends.Any() ? String.Join(",", request.Friends) : null;
            var result  = (mode == SystemDbStatus.Inserted
                        ? await
                           Task.Factory.StartNew(
                               () => Client.UserService.insertInCategory(userCategory, friends, session.GetSession())).ConfigureAwait(false)
                        : await
                           Task.Factory.StartNew(
                               () => Client.UserService.removeFromCategory(userCategory, friends, session.GetSession())).ConfigureAwait(false));

            return(result.GetStatusData <string>());
        }
        public async Task <StatusData <string> > UpdateCategory(CategoryUpdateRequest request, SystemSession session)
        {
            var userCategory = new UserCategory {
                UserId = session.UserId.ToString(), UserCategoryTypeId = request.CategoryId, Name = request.Name, Description = request.Description
            };
            var result = (await Task.Factory.StartNew(() => Client.UserService.editCategoryMeta(userCategory, session.GetSession())).ConfigureAwait(false)).GetStatusData <string>();

            return(result);
        }
        public async Task <IEnumerable <CategoryResponse> > GetUserCategoryList(SystemSession session)
        {
            var result = await Task.Factory.StartNew(() => Client.UserService.categoryList(session.UserId, session.GetSession())).ConfigureAwait(false);

            return(result.Select(c => new CategoryResponse
            {
                Name = c.Name,
                CategoryId = c.UserCategoryTypeId,
                Description = c.Description,
                // Users = c.Friends.ToList().Select(x => Convert.ToInt32(x)),
                Friends = c.Friends == null ? new List <int>() : c.Friends.ToList().Select(x => Convert.ToInt32(x)),
                IsSystemDefaultCategory = c.IsSystemDefault
            }));
        }
        public async Task <IEnumerable <SettingResponse> > ActiveDeviceList(SystemSession session)
        {
            var response = await Task.Factory.StartNew(() => Client.SessionService.getSession(session.GetSession())).ConfigureAwait(false);

            var result = response.Select(x => new SettingResponse
            {
                LastActivity = x.LastActivity,
                DeviceId     = x.DeviceId,
                ModelName    = x.ModelName,
                Token        = x.SessionToken,
                DeviceType   = x.DeviceType
            });

            return(result);
        }
 public async Task <StatusData <string> > ChangePassword(ChangePasswordRequest request, SystemSession session)
 {
     return((await Task.Factory.StartNew(() => Client.UserService.updatePassword(request.Password, request.NewPassword, session.GetSession())).ConfigureAwait(false)).GetStatusData <string>());
 }
        public async Task <StatusData <UpsertCompanyEmployeeResponse> > UpsertCompanyEmployee(UpsertCompanyEmployeeRequest request, byte mode, SystemSession session)
        {
            var serviceRequest = new CompanyEmployeeInfo
            {
                UserId          = session.UserId,
                Username        = session.UserName,
                Mode            = mode,
                EmployeeId      = request.EmployeeId,
                EmployeeTypeId  = request.EmployeeTypeId,
                PositionId      = request.PositionId,
                StartDate       = request.StartDate.ToString(),
                EndDate         = request.EndDate.ToString(),
                IsExecutiveBody = request.IsExecutiveBody,
                IsPromoted      = request.IsPromoted
            };
            var response = await Task.Factory.StartNew(() => Client.UserService.upsertCompanyEmployee(serviceRequest, session.GetSession())).ConfigureAwait(false);

            var result = new StatusData <UpsertCompanyEmployeeResponse> {
                Status = (SystemDbStatus)response.DbStatus.DbStatusCode, Message = response.DbStatus.DbStatusMsg, SubStatus = response.DbStatus.DbSubStatusCode
            };

            if (result.Status.IsOperationSuccessful())
            {
                result.Data = new UpsertCompanyEmployeeResponse
                {
                    CompanyUserId = response.CompanyUserId
                };
            }
            return(result);
        }
        public async Task <IEnumerable <CompanyEmployeeViewResponse> > GetCompanyEmployee(string employee, SystemSession session)
        {
            var response = await Task.Factory.StartNew(() => Client.UserService.getCompanyEmployee(session.UserId, employee, session.GetSession())).ConfigureAwait(false);

            var result = response.Select(x => new CompanyEmployeeViewResponse
            {
                User = new UserResponse
                {
                    UserId   = x.UserId,
                    UserName = x.Username,
                    Name     = x.Name,
                    Picture  = x.Picture
                },
                Position = new GeneralKvPair <int?, string>
                {
                    Id    = x.PositionId,
                    Value = x.Position
                },
                IsExecutiveBody = x.IsExecutiveBody,
                EmploymentDate  = new BeginEndDate
                {
                    BeginDate = Convert.ToDateTime(x.StartDate),
                    EndDate   = x.EndDate != null ? Convert.ToDateTime(x.EndDate) : (DateTime?)null
                },
                EmployeeTypeId = x.EmployeeTypeId,
                Added          = x.Added != null ? Convert.ToDateTime(x.Added) : (DateTime?)null,
                IsApproved     = x.ApprovedStatus
            });

            return(result);
        }
        public async Task <IEnumerable <CompanyTreeViewResponse> > GetCompanyTree(CompanyTreeViewRequest request, SystemSession session)
        {
            var serviceRequest = new CompanyTree
            {
                UserId               = session.UserId,
                IgnoreSisters        = request.IgnoreSisters,
                ShowChildCompanyOnly = request.ShowChildCompaniesOnly
            };
            var response = await Task.Factory.StartNew(() => Client.UserService.getCompanyTree(serviceRequest, session.GetSession())).ConfigureAwait(false);

            var result = response.Select(x => new CompanyTreeViewResponse
            {
                UserId      = x.UserId,
                ChildId     = x.ChildId,
                Name        = x.Name,
                Level       = x.Level,
                IsRequestee = x.IsRequestee
            });

            return(result);
        }
        public async Task <PaginatedResponse <IEnumerable <ResignationViewResponse> > > GetResignationRequest(int pageIndex, int pageSize, SystemSession session)
        {
            var serviceRequest = new Employees
            {
                UserId   = session.UserId,
                Offset   = pageIndex,
                PageSize = pageSize
            };
            var response = await Task.Factory.StartNew(() => Client.UserService.getResignationRequest(serviceRequest, session.GetSession())).ConfigureAwait(false);

            var result = new PaginatedResponse <IEnumerable <ResignationViewResponse> >
            {
                HasNextPage = response.HasNextPage,
                Page        = response.Employees.Select(
                    x => new ResignationViewResponse
                {
                    PersonEmploymentId = x.PersonEmploymentId,
                    User = new UserResponse
                    {
                        UserId   = x.UserId,
                        UserName = x.Username,
                        Name     = x.Name,
                        Picture  = x.Picture
                    },
                    Position = x.Position,
                    EndDate  = x.EndDate != null ? Convert.ToDateTime(x.EndDate) : (DateTime?)null
                })
            };

            return(result);
        }
        public async Task <StatusData <string> > UpsertEmployeeRating(EmployeeRatingRequest request, SystemSession session)
        {
            var serviceRequest = new Skill
            {
                UserId      = session.UserId,
                EmployeeIds = request.EmployeeId != null?string.Join(",", request.EmployeeId) : null,
                                  Rating = request.Rating
            };
            var response = (await Task.Factory.StartNew(() => Client.UserService.upsertEmployeeRating(serviceRequest, session.GetSession())).ConfigureAwait(false)).GetStatusData <string>();

            return(response);
        }
        public async Task <StatusData <string> > UpdateBasicContactCompany(BasicContactBusinessRequest request, SystemSession session)
        {
            var serviceRequest = new BusinessBasicDetails
            {
                UserId      = session.UserId,
                About       = request.About,
                CompanyName = request.CompanyName,
                Street      = request.Street,
                Town        = request.Town,
                CityId      = request.CityId,
                Phone       = request.Phone,
                Fax         = request.Fax,
                Email       = request.Email,
                Web         = request.Web
            };
            var response = (await Task.Factory.StartNew(() => Client.UserService.setBusinessBaiscDetail(serviceRequest, session.GetSession())).ConfigureAwait(false)).GetStatusData <string>();

            return(response);
        }
        public async Task <IEnumerable <EmployeeRatingViewResponse> > GetEmployeeRating(EmployeeRatingViewRequest request, SystemSession session)
        {
            var serviceRequest = new EmployeeRatings
            {
                UserId      = request.TargetUserId,
                EmployeeIds = request.EmployeeId != null?string.Join(",", request.EmployeeId) : null,
                                  Rating = request.Rating
            };

            var response = await Task.Factory.StartNew(() => Client.UserService.getEmployeeRatings(serviceRequest, session.GetSession())).ConfigureAwait(false);

            var result = response.Select(x => new EmployeeRatingViewResponse
            {
                CompanyUserRatingId = x.CompanyUserRatingId,
                User = new UserResponse
                {
                    UserId   = x.UserId,
                    UserName = x.Username,
                    Name     = x.Name,
                    Picture  = x.Picture
                },
                Rating  = x.Rating,
                Added   = x.AddedDate != null ? Convert.ToDateTime(x.AddedDate) : (DateTime?)null,
                Positon = x.Position
            });

            return(result);
        }
        public async Task <PaginatedResponseExtended <IEnumerable <ViewerDetailResponse>, int> > GetProfileViewDetail(PaginatedRequest <GeneralKvPair <SystemProfileViewType, int> > request, SystemSession session)
        {
            var serviceRequest = new ProfileView
            {
                UserId    = request.UserId,
                ViewType  = (byte)request.Data.Id,
                TypeId    = request.Data.Value,
                PageIndex = request.PageIndex,
                PageSize  = request.PageSize
            };

            var response = await Task.Factory.StartNew(() => Client.UserService.profileViewDetail(serviceRequest, session.GetSession())).ConfigureAwait(false);

            var data = response.ProfileViews.Select(x => new ViewerDetailResponse
            {
                UserId           = x.UserId,
                UserTypeId       = (SystemUserType)x.UserTypeId,
                UserName         = x.Username,
                FirstName        = x.FirstName,
                LastName         = x.LastName,
                Image            = x.Picture,
                FriendshipStatus = (SystemFriendshipStatus)x.IsConnected,
                Observed         = x.Observed,
                Title            = x.Title,
                ViewedDate       = Convert.ToDateTime(x.ViewDate)
            });
            var result = new PaginatedResponseExtended <IEnumerable <ViewerDetailResponse>, int>
            {
                Page        = data,
                HasNextPage = response.HasNextPage,
                Information = response.ViewCount
            };

            return(result);
        }
Ejemplo n.º 17
0
        public async Task <StatusData <string> > UpsertSetting(UserSettingRequest request, int mode, SystemSession session)
        {
            List <string> distinctEntries = null;

            if (request.Entries != null)
            {
                distinctEntries = request.Entries.Distinct().ToList().ConvertAll(Convert.ToString);
            }
            var serviceRequest = new SettingPerson
            {
                UserId            = session.UserId.ToString(),
                SettingTypePerson = new SettingTypePerson
                {
                    SettingTypeId = (byte)request.SettingTypeId,
                    SettingGroup  = request.SettingGroupId
                },
                SettingValue = request.Value,
                Entries      = distinctEntries,
                Mode         = mode
            };

            var response = (await Task.Factory.StartNew(() => Client.SettingService.updateSetting(serviceRequest, session.GetSession())).ConfigureAwait(false)).GetStatusData <string>();

            return(response);
        }
        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);
        }
Ejemplo n.º 19
0
        public async Task <StatusData <bool> > LogOut(List <GeneralKvPair <string, string> > request, SystemSession session)
        {
            var result = new StatusData <bool> {
                Status = SystemDbStatus.Deleted
            };
            var serviceRequest = JsonConvert.SerializeObject(request.Select(x => new { authToken = x.Value }));

            result.Data = await Task.Factory.StartNew(() => Client.SessionService.sessionKickOut(session.GetSession(), serviceRequest)).ConfigureAwait(false);

            return(result);
        }
        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.º 21
0
        public async Task <IQueryable <UserSettingResponse> > GetSettings(byte?settingTypeId, bool isWeb, SystemSession session)
        {
            var response = new List <UserSettingResponse>();

            if (settingTypeId != null)
            {
                var serviceSingleResponse = await Task.Factory.StartNew(() => Client.SettingService.getSettingForMobile(session.UserId, isWeb ? 1 : 2, (int)settingTypeId, session.GetSession())).ConfigureAwait(false);

                return(new List <UserSettingResponse>
                {
                    new UserSettingResponse
                    {
                        SettingTypeId = (byte)serviceSingleResponse.SettingTypePerson.SettingTypeId,
                        Name = serviceSingleResponse.SettingTypePerson.Name,
                        Value = serviceSingleResponse.SettingValue,
                        // SettingGroupId = serviceSingleResponse.SettingTypePerson.SettingGroup,
                        Entries = serviceSingleResponse.Entries != null?serviceSingleResponse.Entries.ConvertAll(Convert.ToInt32) : null,
                                      Description = serviceSingleResponse.SettingTypePerson.Description,
                                      SettingGroup = serviceSingleResponse.SettingTypePerson.SettingGroup,
                                      DisplayGroup = serviceSingleResponse.SettingTypePerson.DisplayGroup,
                                      DisplayOrder = serviceSingleResponse.SettingTypePerson.DisplayOrder,
                                      DefaultValue = serviceSingleResponse.SettingTypePerson.DefaultValue
                    }
                }.AsQueryable());
            }
            var serviceResponse = await Task.Factory.StartNew(() => Client.SettingService.getSettingsForMobile(session.UserId, isWeb ? 1 : 2, session.GetSession())).ConfigureAwait(false);

            serviceResponse.ForEach(x => response.Add(new UserSettingResponse
            {
                SettingTypeId = (byte)x.SettingTypePerson.SettingTypeId,
                Name          = x.SettingTypePerson.Name,
                Value         = x.SettingValue,
                // SettingGroupId = x.SettingTypePerson.SettingGroup,
                Entries      = x.Entries != null ? x.Entries.ConvertAll(Convert.ToInt32) : null,
                Description  = x.SettingTypePerson.Description,
                SettingGroup = x.SettingTypePerson.SettingGroup,
                DisplayGroup = x.SettingTypePerson.DisplayGroup,
                DisplayOrder = x.SettingTypePerson.DisplayOrder,
                DefaultValue = x.SettingTypePerson.DefaultValue
            }));
            return(response.AsQueryable());
        }
        /// <summary>
        /// Enlists employees of the current company(UDF FNGETCOMPANYEMPLOYEES)
        /// </summary>
        /// <param name="request"></param>
        /// <param name="session"></param>
        /// <returns></returns>
        public async Task <IEnumerable <CompanyEmployeeResponse> > GetCompanyEmployeeList(CompanyEmployeeRequest request, SystemSession session)
        {
            var response = await Task.Factory.StartNew(() => Client.UserService.viewCompanyEmployee(request.TargetUser, request.SearchTerm, session.GetSession())).ConfigureAwait(false);

            var result = response.Select(x => new CompanyEmployeeResponse
            {
                CompanyId       = x.CompanyId,
                EmployeeId      = x.EmployeeId,
                UserName        = x.Username,
                StartDate       = x.StartDate,
                PositionId      = x.PositionId,
                Position        = x.PositionName,
                Rating          = x.Rating,
                CompanyUserId   = x.CompanyUserId,
                Name            = x.CompanyName,
                EmployeeTypeId  = x.EmployeeTypeId,
                IsExecutiveBody = x.IsExecutiveBody
            });

            return(result);
        }
        public async Task <StatusData <byte?> > InsertCategory(CategoryAddRequest request, SystemSession session)
        {
            var userCategory = new UserCategory {
                UserId = session.UserId.ToString(), Name = request.Name, Description = request.Description
            };
            var result          = new StatusData <byte?>();
            var friends         = request.Friends != null && request.Friends.Any() ? String.Join(",", request.Friends) : null;
            var serviceResponse = await Task.Factory.StartNew(() => Client.UserService.createNewCategory(userCategory, friends, session.GetSession())).ConfigureAwait(false);

            result.Data      = (byte?)serviceResponse.UserCategoryTypeId;
            result.Message   = serviceResponse.DbStatusMsg;
            result.Status    = (SystemDbStatus)serviceResponse.DbStatusCode;
            result.SubStatus = serviceResponse.DbSubStatusCode;
            return(result);
        }
        public async Task <InformationResponse <IEnumerable <ViewerPanelResponse>, int> > GetProfileViewPanel(int userId, SystemSession session)
        {
            var serviceRequest = new ProfileView
            {
                UserId = userId
            };

            var response = await Task.Factory.StartNew(() => Client.UserService.profileViewPanel(serviceRequest, session.GetSession())).ConfigureAwait(false);

            var data = response.ProfileViews.Select(x => new ViewerPanelResponse
            {
                UserId      = x.UserId,
                UserTypeId  = (SystemUserType)x.UserTypeId,
                UserName    = x.Username,
                FirstName   = x.FirstName,
                LastName    = x.LastName,
                Image       = x.Picture,
                Observed    = x.Observed,
                Title       = x.Title,
                ViewedDate  = Convert.ToDateTime(x.ViewDate),
                Position    = x.PositionName,
                ViewerCount = x.ViewersCount
            });
            var result = new InformationResponse <IEnumerable <ViewerPanelResponse>, int>
            {
                Page        = data,
                Information = response.TotalTypes
            };

            return(result);
        }
 public async Task <StatusData <string> > DeleteCategory(DeleteCategory request, SystemSession session)
 {
     return((await Task.Factory.StartNew(() => Client.UserService.deleteMultipleCategories(request.UserId, request.CategoryList, session.GetSession())).ConfigureAwait(false)).GetStatusData <string>());
 }
        public async Task <AboutResponse> GetUserAbout(string targetUser, SystemSession session)
        {
            AboutResponse response = null;
            var           result   = await Task.Factory.StartNew(() => Client.UserService.getUserAbout(targetUser, session.GetSession())).ConfigureAwait(false);

            if (result != null)
            {
                response = new AboutResponse
                {
                    Headline = result.HeadLine,
                    About    = result.About
                };
            }
            return(response);
        }
Ejemplo n.º 27
0
        public async Task <StatusData <string> > UpdatePassword(string oldpassword, string newpassword, SystemSession session)
        {
            var response = new StatusData <string> {
                Status = SystemDbStatus.Updated
            };

            var user = await Task.Factory.StartNew(() => Client.UserService.updatePassword(oldpassword, newpassword, session.GetSession())).ConfigureAwait(false);

            if (user == null)
            {
                response.Status = SystemDbStatus.NotFound;
                return(response);
            }
            response.Status  = (SystemDbStatus)user.DbStatusCode;
            response.Message = user.DbStatusMsg;
            return(response);
        }
        public async Task <StatusData <string> > UpdateUserAbout(AboutRequest request, SystemSession session)
        {
            var response = (await Task.Factory.StartNew(() => Client.UserService.updateUserAbout(session.UserId.ToString(), request.Headline, request.About, session.GetSession())).ConfigureAwait(false)).GetStatusData <string>();

            return(response);
        }
Ejemplo n.º 29
0
        public async Task <UserSearchResponse> UserSearch(UserSearchRequest request, SystemSession session)
        {
            var serviceRequest = new UserSearchQuery
            {
                Query  = request.Query,
                Cursor = request.Cursor,
                Limit  = request.Limit
            };

            var response = await Task.Factory.StartNew(() => Client.SearchService.userSearch(serviceRequest, session.GetSession())).ConfigureAwait(false);

            var result = new UserSearchResponse
            {
                Cursor = response.Cursor,
                Limit  = response.Limit,
                Count  = response.Count,

                User = response.Users != null?response.Users.Select(x => new UserInformationBaseExtendedResponse
                {
                    FirstName  = x.UserInfoPerson.FirstName,
                    LastName   = x.UserInfoPerson.LastName,
                    Image      = x.UserInfo.Picture,
                    Title      = x.UserInfo.Title,
                    UserId     = Convert.ToInt32(x.UserInfoPerson.UserId),
                    UserName   = x.UserName,
                    UserTypeId = (SystemUserType)x.UserInfo.UserTypeId
                }) : null
            };

            return(result);
        }
        public async Task <PaginatedResponseExtended <IEnumerable <ViewSummaryResponse>, int> > GetProfileViewSummary(PaginatedRequest <int> request, SystemSession session)
        {
            var serviceRequest = new ProfileView
            {
                UserId    = request.UserId,
                ViewType  = request.Data,
                PageIndex = request.PageIndex,
                PageSize  = request.PageSize
            };

            var response = await Task.Factory.StartNew(() => Client.UserService.profileViewSummary(serviceRequest, session.GetSession())).ConfigureAwait(false);

            var data = response.ProfileViews.Select(x => new ViewSummaryResponse
            {
                TypeId       = x.TypeId,
                Name         = x.FirstName,
                ViewCount    = x.ViewersCount,
                NewViewCount = x.NewViews,
                LastViewed   = Convert.ToDateTime(x.ViewDate)
            });
            var result = new PaginatedResponseExtended <IEnumerable <ViewSummaryResponse>, int>
            {
                Page        = data,
                HasNextPage = response.HasNextPage,
                Information = response.ViewCount
            };

            return(result);
        }