/// <summary> /// 应用初始化 /// </summary> /// <param name="containerBuilder">容器构建器</param> public override void Initialize(ContainerBuilder containerBuilder) { //注册标识图设置 TenantLogoSettings.RegisterSettings(tenantLogoSettingsElement); //注册ResourceAccessor的应用资源 ResourceAccessor.RegisterApplicationResourceManager(ApplicationId, "Spacebuilder.Group.Resources.Resource", typeof(Spacebuilder.Group.Resources.Resource).Assembly); InvitationType.Register(new InvitationType { Key = InvitationTypeKeys.Instance().InviteJoinGroup(), Name = "邀请参加群组", Description = "" }); InvitationType.Register(new InvitationType { Key = InvitationTypeKeys.Instance().ApplyJoinGroup(), Name = "申请加入群组", Description = "" }); containerBuilder.Register(c => new GroupActivityReceiverGetter()).Named <IActivityReceiverGetter>(ActivityOwnerTypes.Instance().Group().ToString()).SingleInstance(); //groupId与groupKey的查询器 containerBuilder.Register(c => new DefaultGroupIdToGroupKeyDictionary()).As <GroupIdToGroupKeyDictionary>().SingleInstance(); //注册全文检索搜索器 containerBuilder.Register(c => new GroupSearcher("群组", "~/App_Data/IndexFiles/Group", true, 7)).As <ISearcher>().Named <ISearcher>(GroupSearcher.CODE).SingleInstance(); ThemeService.RegisterThemeResolver(PresentAreaKeysOfBuiltIn.GroupSpace, new GroupSpaceThemeResolver()); //群组推荐 containerBuilder.Register(c => new GroupApplicationStatisticDataGetter()).Named <IApplicationStatisticDataGetter>(this.ApplicationKey).SingleInstance(); containerBuilder.Register(c => new GroupTenantAuthorizationHandler()).As <ITenantAuthorizationHandler>().SingleInstance(); }
public static void GetInvitationsFrom(BigDB bigDb, InvitationType type, string sender, Callback <Invitation[]> callback) { bigDb.LoadRange(InvitationsTable, "BySender", new object[] { (int)type, sender }, null, null, 100, invitations => { callback(invitations.Select(dbo => new Invitation(dbo)).ToArray()); }); }
/// <summary> /// Changes the invitation type shown in the invitation list (incoming to outgoing and vice versa). /// Runs when the "Toggle Invitations" button is pressed. /// </summary> private void btnToggleInvitations_Click(object sender, EventArgs e) { // Implicitly cast InvitationType to integer to toggle between the invitation types invitationState = 1 - invitationState; // Repopulate the invitations to account for the type change PopulateInvitation(); }
/// <summary> /// Sends a newly-created outgoing invitation if all fields have been filled. /// </summary> private void btnSendInvitation_Click(object sender, EventArgs e) { // If the invitation is valid, it can be sent if (CheckInvitationInput()) { // Get the life-time for the information double.TryParse(txtInvitationLifetime.Text, out double lifeTime); // Store the interest for the information (found in the interest textbox of the invitation) string interest = txtInvitationInterest.Text; // Create a dictionary of recipient states with the given recipients // No recipients have accepted the invitation yet, so set the invitation status as "Pending" for all recipients // Precondition: invited recipients are unique Dictionary <Person, InvitationStatus> recipientStates = invitedRecipients.ToDictionary(person => person, person => InvitationStatus.Pending); // Create the invitation with the given information Invitation newInvitation = new Invitation(user, recipientStates, interest, Environment.TickCount, lifeTime); // Send the invitation network.DeliverInvitation(newInvitation); // Show a status update in a MessageBox MessageBox.Show("Invitation sent!"); // Close the invitation creation elements CloseInvitationCreation(); // Set the invitation details to display the newly-sent invitation invitationState = InvitationType.Outgoing; invitationIndex = user.OutgoingInvitations.Count - 1; // Update the displayed invitation list PopulateInvitation(); } }
public static void GetInvitationsTo(BigDB bigDb, InvitationType type, string recipient, Callback <Invitation[]> callback) { bigDb.LoadRange(InvitationsTable, "ByRecipient", new object[] { (int)type, recipient }, null, null, 100, invitations => { callback(invitations.Select(dbo => new Invitation(dbo)).ToArray()); }); }
public static void DeleteInvitation(BigDB bigDb, InvitationType type, string sender, string recipient, Callback <bool> callback) { bigDb.DeleteRange(InvitationsTable, "BySenderAndRecipient", new object[] { (int)type, sender, recipient }, null, null, () => callback(true), error => callback(false)); }
public void setContactRequest(Jid contact) { type = InvitationType.FriendRequest; invitedTo = contact; Text = "Contact request"; label1.Text = contact.Bare; label2.Text = contact.Bare + " sent you a request to add them to your contact list."; }
public void setChatroomInvite(Jid sender, Jid roomJid) { type = InvitationType.ChatroomInvite; invitedTo = roomJid; invitedBy = sender; Text = "Conference invitation"; label1.Text = roomJid.Bare; label2.Text = sender.Bare + " invited you to join this conference."; }
public void Should_Construct_InvitationType() { InvitationType invitationType = new InvitationType(); _ = invitationType.InvitationTypeId; _ = invitationType.NameAr; _ = invitationType.NameEn; invitationType.ShouldNotBeNull(); }
/// <summary> /// 添加邀请 /// </summary> /// <param name="player">被邀请玩家</param> /// <param name="type">邀请类型</param> /// <param name="team">邀请队伍</param> /// <returns></returns> public bool AddInvitation(Player player, InvitationType type, GameTeam team) { if (IsInvitationExist(player, type)) { return(false); } Invitations.Add(Tuple.Create(player, type, team)); return(true); }
/// <summary> /// 查找与邀请关联的队伍 /// </summary> /// <param name="player">被邀请玩家</param> /// <param name="type">邀请类型</param> /// <returns></returns> public GameTeam FindTeam(Player player, InvitationType type) { if (!IsInvitationExist(player, type)) { return(null); } var tuple = Invitations.Single(x => (x.Item1.Id == player.Id) && (x.Item2 == type)); return(tuple.Item3); }
public static void CreateInvitation(BigDB bigDb, InvitationType type, string sender, string recipient, Callback <DatabaseObject> callback) { var newInvite = new DatabaseObject() .Set("Type", (int)type) .Set("Sender", sender) .Set("Recipient", recipient) .Set("Status", (int)InvitationStatus.Pending); bigDb.CreateObject(InvitationsTable, null, newInvite, callback); }
public string GetInvitationMessagePlaceholder(InvitationType type) { switch (type) { case InvitationType.AddMeToGroup: return("For example, \"Here's an invitation to the group I talked to you about\""); case InvitationType.Register: return("For example, \"Here's an invitation to sign up on the site I talked to you about\""); case InvitationType.FollowMe: return("For example, \"Here's an invitation to follow my profile for posts and notifications\""); default: return(""); } }
public ActionResult Invite(string receiverUid, InvitationType invitationType) { if (invitationService.SendInvitation(User.Identity.GetUserId(), receiverUid, invitationType)) { TempData["invitationInfo"] = "Your request has been sent."; } else { TempData["invitationInfo"] = "You have already a pending invitation."; } return(RedirectToAction("FindUsers")); }
public Invitation( string envelopeAddressee, InvitationType invitationType, Guid addressId, string invitationCode, bool isInvitationEnvelopePrinted = false, bool isInvitationSent = false) { Id = Guid.NewGuid(); EnvelopeAddressee = envelopeAddressee; InvitationType = invitationType; AddressId = addressId; InvitationCode = invitationCode; IsInvitationEnvelopePrinted = isInvitationEnvelopePrinted; IsInvitationSent = isInvitationSent; }
public async Task <GroupAccessCodeModel> NewInvitation(int createdByUserId, InvitationType type, int forUserId, string message, int daysValidFor) { var info = new GroupAccessCodeModel() { Type = InvitationType.Register, CreatedByUserId = createdByUserId, ForUserId = forUserId, GroupName = message, Code = Guid.NewGuid().ToString(), WhenCreated = DateTime.UtcNow, WhenExpires = DateTime.UtcNow.AddDays(daysValidFor) }; await _dbContext.GroupAccessCodes.AddAsync(info); await _dbContext.SaveChangesAsync(); return(info); }
public bool SendInvitation(string senderUId, string receiverUId, InvitationType invitationType) { if (db.Invitations.Any(e => e.InvitationFrom == senderUId && e.InvitationTo == receiverUId && e.InvitationState == InvitationState.Pending && e.InvitationType == invitationType)) { return(false); } Invitation invitation = new Invitation() { InvitationFrom = senderUId, InvitationTo = receiverUId, InvitationType = invitationType, InvitationState = InvitationState.Pending }; db.Invitations.Add(invitation); db.SaveChanges(); return(true); }
public static string InviteBOwner(string obj) { JavaScriptSerializer jss = new JavaScriptSerializer(); InvitationType it = new InvitationType(); it = jss.Deserialize <InvitationType>(obj); Guid UserID = new Guid(HttpContext.Current.Session["UserID"].ToString()); int rValue = 0; RegistrationModel.GetRegisterDetails ObjUserInfo = RegisterManager.GetProfileDetailsByUserID(UserID); string strFullName = ObjUserInfo.strFirstName + " " + ObjUserInfo.strLastName; string strEmailID = it.strEmail; string strMailSubject = "Be part of business contacts and grow your business!"; Guid OwnerInvitationID = Guid.NewGuid(); string RegistrationLink = System.Configuration.ConfigurationManager.AppSettings["SiteURL"] + "/LaunchPage.aspx?InviID=" + OwnerInvitationID + "&&mid=" + UserID; NameValueCollection mergeFields = new NameValueCollection(); mergeFields.Add("**REGISTRATIONURL**", RegistrationLink); mergeFields.Add("**ToName**", it.strName); mergeFields.Add("**FromName**", strFullName); mergeFields.Add("**FromEmail**", ObjUserInfo.strEmail); mergeFields.Add("**FromMobile**", ObjUserInfo.strMobile); ContactsModel.InviteOwner ObjOwnr = jss.Deserialize <ContactsModel.InviteOwner>(obj); string strMessageBody = EmailUtils.GetMailBody("InviteByHelpdesk.html", mergeFields); Guid InvitedToID = new Guid(); EmailUtils.SendEmail(ObjUserInfo.strEmail, strEmailID, strMailSubject, strMessageBody); //insert query ObjOwnr.guidOwnerInvitationID = OwnerInvitationID; ObjOwnr.guidInvitedByID = UserID; ObjOwnr.guidInvitedToID = InvitedToID; ObjOwnr.byteMInvitationStatus = Convert.ToByte(UIEnums.MInvitationStatus.Sent); ObjOwnr.strEmail = it.strEmail; ObjOwnr.strName = it.strName; ObjOwnr.strMobile = it.strMobile; rValue = ContactManager.InviteOwner(ObjOwnr); return(rValue.ToString()); }
public static void GetInvitation(BigDB bigDb, InvitationType type, string sender, string recipient, Callback <Invitation> callback) { bigDb.LoadSingle(InvitationsTable, "BySenderAndRecipient", new object[] { (int)type, sender, recipient }, dbo => { callback(new Invitation(dbo)); }); }
/// <summary> /// 移除邀请 /// </summary> /// <param name="player">被邀请玩家</param> /// <param name="type">邀请类型</param> public void RemoveInvitation(Player player, InvitationType type) { Invitations.RemoveAll(x => (x.Item1.Id == player.Id) && (x.Item2 == type)); }
/// <summary> /// 是否存在某个玩家的某个邀请 /// </summary> /// <param name="player">被邀请玩家</param> /// <param name="type">邀请类型</param> /// <returns></returns> public bool IsInvitationExist(Player player, InvitationType type) { return(Invitations.Exists(x => (x.Item1.Id == player.Id) && (x.Item2 == type))); }