本文整理汇总了C#中Model.Types.SystemSession.GetSession方法的典型用法代码示例。如果您正苦于以下问题:C# SystemSession.GetSession方法的具体用法?C# SystemSession.GetSession怎么用?C# SystemSession.GetSession使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Model.Types.SystemSession
的用法示例。
在下文中一共展示了SystemSession.GetSession方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetInboxFolderRules
public async Task<IEnumerable<RuleResponse>> GetInboxFolderRules(int? folderId, SystemSession session)
{
var response = new List<RuleResponse>();
var inboxRuleList = await Task.Factory.StartNew(() => (folderId == null)
? Client.InboxRuleService.getRules(session.UserId, session.GetSession())
: Client.InboxService.getInboxFolderWithRules(session.UserId, (int)folderId, session.GetSession())
.InboxRules).ConfigureAwait(false);
if (inboxRuleList != null)
{
inboxRuleList.ForEach(
x =>
{
if (x.RuleId > 0)
response.Add(new RuleResponse
{
FolderId = x.InboxId,
MessageRuleId = x.RuleId,
RuleTypeUser = (SystemRuleTypeUser)x.RuleTypeUser,
ContactList = x.ContactList,
GroupList = x.GroupList,
RuleTypeSubject = (SystemRuleTypeSubject)x.RuleTypeSubject,
Subject = x.Subject
});
});
}
return response;
}
示例2: UpsertCategoryFriends
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>();
}
示例3: ReCrop
public async Task<StatusData<string>> ReCrop(ImageCropRequest cropRequest, SystemSession session)
{
var serviceCropRequest = new ElifImageCrop { Width = cropRequest.CropDetail.Width, Height = cropRequest.CropDetail.Height, Top = cropRequest.CropDetail.Top, Bottom = cropRequest.CropDetail.Bottom, Left = cropRequest.CropDetail.Left, Right = cropRequest.CropDetail.Right, SizeCodes = (SizedCodes)cropRequest.CropDetail.SizeCode };
var response = await Task.Factory.StartNew(() => Client.ElifService.reCrop(cropRequest.FileId, serviceCropRequest, session.GetSession())).ConfigureAwait(false);
var result = new StatusData<string> { Status = response ? SystemDbStatus.Updated : SystemDbStatus.NotModified };
return result;
}
示例4: UserSearch
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;
}
示例5: GetProfileInformation
public virtual async Task<PersonalProfileResponse> GetProfileInformation(string targetUser,
SystemSession session)
{
var serviceResponse =
await
Task.Factory.StartNew(
() => Client.UserService.getProfile(session.UserId, 0, targetUser, session.GetSession()))
.ConfigureAwait(false);
var response = new PersonalProfileResponse
{
BasicInformation = new BasicInformation
{
UserId = Convert.ToInt32(serviceResponse.User.UserId),
UserName = serviceResponse.User.UserName,
UserTypeId = (SystemUserType)serviceResponse.UserInfo.UserTypeId,
Email = serviceResponse.User.Email,
FirstName = serviceResponse.UserInfoPerson.FirstName,
LastName = serviceResponse.UserInfoPerson.LastName,
FriendShipStatus = (SystemFriendshipStatus)serviceResponse.FriendshipStatus,
//(SystemFriendshipStatus)await Task.Factory.StartNew(() => _client.UserService.getFriendShipStatus(userId, targetUser, session.GetSession())),
PrimaryContactNumber = serviceResponse.User.PrimaryContactNumber,
Image = serviceResponse.UserInfo.Picture,
//ImageService.GetProfilePhoto(serviceResponse.UserInfo, (SystemImageSize)systemImageSize),
AvailableStatus = (SystemUserAvailabilityCode)Convert.ToByte(serviceResponse.User.ChatStatus),
Title = serviceResponse.UserInfoPerson.Title,
LastUpdated =
Convert.ToInt64(
(Convert.ToDateTime(serviceResponse.LastUpdated) - new DateTime(1970, 1, 1))
.TotalMilliseconds)
}
};
return response;
}
示例6: GetProfileViewSummary
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;
}
示例7: GetCompanyReviews
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;
}
示例8: GetUrl
public async Task<string> GetUrl(ImageRequest request, SystemSession session)
{
var serviceRequest = new Elif { FileId = request.FileId, AskWebp = request.AskWebp, IsProfilePic = request.IsProfilePicture, SizeCodes = (SizedCodes)request.SizeCode, Username = request.UserName };
var response = await Task.Factory.StartNew(() => Client.ElifService.getUrl(serviceRequest, session.GetSession())).ConfigureAwait(false);
// return string.IsNullOrWhiteSpace(response) ? null : response;
return response;
}
示例9: DeleteFiles
public async Task<List<string>> DeleteFiles(SingleData<List<string>> request, SystemSession session)
{
var serviceRequest = new List<Elif>();
request.Data.ForEach(x => serviceRequest.Add(new Elif { FileId = x, Username = session.UserName }));
var response = await Task.Factory.StartNew(() => Client.ElifService.deleteFiles(serviceRequest, session.GetSession())).ConfigureAwait(false);
return response;
}
示例10: GetMessageCount
public async Task<StatusData<int>> GetMessageCount(SystemSession session)
{
var result = new StatusData<int>();
var response = await Task.Factory.StartNew(() => Client.NotificationService.messageCount(session.GetSession())).ConfigureAwait(false);
result.Data = response;
return result;
}
示例11: GetMutualFriends
public async Task<PaginatedResponseExtended<IEnumerable<UserInformationBaseExtendedResponse>, int>> GetMutualFriends(PaginatedRequest<string> request, SystemSession session)
{
var serviceRequest = new MutualFriend
{
UserId = session.UserId,
TargetType = "F",
TargetUser = request.Data,
PageIndex = request.PageIndex,
PageSize = request.PageSize
};
var data = await Task.Factory.StartNew(() => Client.UserService.getMutualFriends(serviceRequest, session.GetSession())).ConfigureAwait(false);
var result = new PaginatedResponseExtended<IEnumerable<UserInformationBaseExtendedResponse>, int>
{
Page = data.MutualFriends.Select(x => new UserInformationBaseExtendedResponse
{
UserId = x.UserId,
UserName = x.UserName,
UserTypeId = (SystemUserType)x.UserTypeId,
FirstName = x.FirstName,
LastName = x.LastName,
Image = x.Picture,
Title = x.Title
}),
HasNextPage = data.HasNextPage,
Information = data.Count
};
return result;
}
示例12: GetFriendsInCategory
public async Task<PaginatedResponse<IEnumerable<FriendsInCategoryResponse>>> GetFriendsInCategory(PaginatedRequest<FriendsInCategoryRequest> request, SystemSession session)
{
var serviceRequest = new UserCategory
{
UserId = session.UserId.ToString(),
UserCategoryTypeId = request.Data.CategoryId,
InvertCatSerch = request.Data.InvertCategorySearch,
PageIndex = request.PageIndex,
PageSize = request.PageSize + 1
};
var data = await Task.Factory.StartNew(() => Client.UserService.getUserFriendsInCategory(serviceRequest, session.GetSession())).ConfigureAwait(false);
var result = new PaginatedResponse<IEnumerable<FriendsInCategoryResponse>>
{
Page = data.Select(x => new FriendsInCategoryResponse
{
UserId = x.UserId,
UserName = x.UserName,
Image = x.Picture,
FirstName = x.FirstName,
LastName = x.LastName,
Title = x.Title,
UserTypeId = (SystemUserType)x.UserTypeId,
Email = x.Email
}).Take(request.PageSize),
HasNextPage = data.Count > request.PageSize
};
return result;
}
示例13: GetProfileViewDetail
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;
}
示例14: SyncPhoneBook
public async Task<StatusData<string>> SyncPhoneBook(PhoneBookContactsRequest request, SystemSession session)
{
var contacts = new UserMobileContacts
{
CTag = request.CTag,
DeviceId = request.DeviceId,
UserId = request.UserId,
ToAddmobileContacts =
request.Add.Select(
x =>
new MobileContact
{
CountryCode = x.CountryCode,
PrimaryContactNumber = x.MobileNumber.ToString()
}).ToList(),
ToDelmobileContacts =
request.Delete.Select(
x =>
new MobileContact
{
CountryCode = x.CountryCode,
PrimaryContactNumber = x.MobileNumber.ToString()
}).ToList(),
Flush = request.Flush
};
var result = new StatusData<string>();
var response = (await Task.Factory.StartNew(() => Client.UserService.contactSync(contacts, session.GetSession())).ConfigureAwait(false));
result.Status = (SystemDbStatus)response.SystemDbStatus;
result.Data = response.CTag;
result.Message = response.DbStatusMsg;
return result;
}
示例15: Crop
////public async Task<StatusData<bool>> Crop(ImageCropRequest cropRequest, SystemSession session)
////{
//// var serviceRequest = new Elif { FileId = cropRequest.FileId, AskWebp = cropRequest.AskWebp, Username = cropRequest.UserName };
//// var serviceCropRequest = new ElifImageCrop { Width = cropRequest.CropDetail.Width, Height = cropRequest.CropDetail.Height, Top = cropRequest.CropDetail.Top, Bottom = cropRequest.CropDetail.Bottom, Left = cropRequest.CropDetail.Left, Right = cropRequest.CropDetail.Right, SizeCodes = (SizedCodes)cropRequest.CropDetail.SizeCode };
//// var response = await Task.Factory.StartNew(() => Client.ElifService.doCrop(serviceRequest, serviceCropRequest, session.GetSession())).ConfigureAwait(false);
//// var result = new StatusData<bool> { Status = response ? SystemDbStatus.Updated : SystemDbStatus.NotModified, Data = response };
//// return result;
////}
public async Task<StatusData<bool>> Crop(ImageCropRequest cropRequest, SystemSession session)
{
var result = new StatusData<bool> { Status = SystemDbStatus.Updated };
var serviceRequest = new Elif { FileId = cropRequest.FileId, AskWebp = cropRequest.AskWebp, Username = cropRequest.UserName };
var serviceCropRequest = new ElifImageCrop { Width = cropRequest.CropDetail.Width, Height = cropRequest.CropDetail.Height, Top = cropRequest.CropDetail.Top, Bottom = cropRequest.CropDetail.Bottom, Left = cropRequest.CropDetail.Left, Right = cropRequest.CropDetail.Right, SizeCodes = (SizedCodes)cropRequest.CropDetail.SizeCode };
result.Data = await Task.Factory.StartNew(() => Client.ElifService.doCrop(serviceRequest, serviceCropRequest, session.GetSession())).ConfigureAwait(false);
return result;
}