public NormalResult <Campaign_MemberQRCodeItemEntity> CreateMemberQRCodeItem(DomainContext domainContext, Guid campaignId, Guid memberId) { NormalResult <Campaign_MemberQRCodeItemEntity> result = new NormalResult <Campaign_MemberQRCodeItemEntity>(); //判断有没有超过最大参与人数 //if (MemberQRCodeIsFullParticipant(campaignId)) //{ // result.Success = false; // result.Message = "该活动已达最大允许参与人数。"; // return result; //} Campaign_MemberQRCodeEntity campaignMemberQRCode = GetMemberQRCode(campaignId); if (campaignMemberQRCode == null) { result.Success = false; result.Message = "指定的活动不存在。"; return(result); } string landingUrl = String.Format(_campaignManager.SettingsManager.GetClientAddress(domainContext) + "Campaign/MemberQRCodeLanding/{0}?campaignId={1}&memberId={2}", campaignMemberQRCode.Domain, campaignId, memberId); GetCampaign_MemberQRCodeImageArgs args = new GetCampaign_MemberQRCodeImageArgs(); args.BackgroundImageId = campaignMemberQRCode.BackgroundImageId; args.LandingUrl = landingUrl; args.Domain = campaignMemberQRCode.Domain; args.MemberId = memberId; GetMemberQRCodeImageResult getMemberQRCodeImageResult = _campaignManager.FileService.GetMemberQRCodeImage(args); if (getMemberQRCodeImageResult.Success == false) { result.Success = false; result.Message = getMemberQRCodeImageResult.Message; return(result); } Campaign_MemberQRCodeItemEntity item = new Campaign_MemberQRCodeItemEntity(); item.CampaignId = campaignId; item.CreateTime = DateTime.Now; item.Domain = campaignMemberQRCode.Domain; item.Member = memberId; item.QRCodeUrl = _campaignManager.FileService.FileServiceUri + getMemberQRCodeImageResult.FileName; _campaignManager.DataBase.Insert(item); result.Success = true; result.Data = item; return(result); }
public void UpdateMemberQRCode(CampaignEntity campaign, Campaign_MemberQRCodeEntity memberQRCode) { if (campaign == null || memberQRCode == null) { Debug.Assert(false, "campaign == null || memberQRCode ==null"); return; } memberQRCode.CampaignId = campaign.Id; memberQRCode.Domain = campaign.Domain; _campaignManager.DataBase.UpdateList(campaign, memberQRCode); }
public Campaign_MemberQRCodeEntity GetMemberQRCode(Guid campaignId) { Campaign_MemberQRCodeEntity campaign = new Campaign_MemberQRCodeEntity(); campaign.CampaignId = campaignId; if (_campaignManager.DataBase.Fill <Campaign_MemberQRCodeEntity>(campaign)) { return(campaign); } else { return(null); } }