/// <summary> /// When a system user wants selects a family to join a FamilyRequest notification /// should be sent to the createdby user of the family with the from information /// being that of the requesting system user /// </summary> /// <returns></returns> public static Notification FamilyRequest(Principal prinicipal, int toMemberId, string familyName, int familyId) { var message = String.Format(MessageLines.FamilyRequest, prinicipal.Username, familyName); var apitext = String.Format("Add {0} to the {1} family", prinicipal.Username, familyName); var api = String.Format("{0}/family/{1}/member/{2}", "http://localhost/rest2", familyId, prinicipal.MemberID); return NotificationRepository.NotificationRequest(toMemberId, SubjectLines.FamilyRequest,message, api, apitext, "POST"); }
public static Principal GetPrincipal(string token) { char[] delim = { ',' }; var x = DecryptContext(token); var context = x.Split(delim); var principal = new Principal() { EnterpriseID = Convert.ToInt32(context[0]), BusinessUnitID = Convert.ToInt32(context[1]), MemberID = Convert.ToInt32(context[2]) }; const string sql = @"select Username, ProviderUserKey from dbo.Member with (nolock) where EnterpriseID = @EnterpriseID and BusinessUnitID = @BusinessUnitID and MemberID = @MemberID"; var sqlParams = new[] { new SqlParameter("@EnterpriseID", SqlDbType.Int) { Value = principal.EnterpriseID }, new SqlParameter("@BusinessUnitID", SqlDbType.Int) { Value = principal.BusinessUnitID }, new SqlParameter("@MemberID", SqlDbType.Int) { Value = principal.MemberID } }; var row = DBConnection.ExecuteQuery(sql, sqlParams); if (row != null) { if (row.Count > 0) { principal.ProviderUserKey = (Guid)row["ProviderUserKey"]; principal.Username = row["Username"].ToString(); } } return principal; }
/// <summary> /// When a system user confirms a family request a family request confirmed notification /// should be sent to the family request from system user /// </summary> /// <returns></returns> public static Notification FamilyRequestConfirmed(Principal prinicipal, int toMemberId, string familyName) { var subject = String.Format(SubjectLines.FamilyRequestConfirmed, familyName); var message = String.Format(MessageLines.FamilyRequestConfirmed, familyName); return NotificationRepository.NotificationMessage(toMemberId, subject, message); }
public static Principal GetPrincipal(Guid providerUserKey) { var principal = new Principal(); const string sql = @"select EnterpriseId, BusinessUnitId, MemberId, Username from dbo.Member with (nolock) where ProviderUserKey = @ProviderUserKey and IsActive = 1"; var sqlParams = new[] { new SqlParameter("@ProviderUserKey", SqlDbType.UniqueIdentifier) { Value = providerUserKey } }; var row = DBConnection.ExecuteQuery(sql, sqlParams); if (row != null) { if (row.Count > 0) { principal.EnterpriseID = (int)row["EnterpriseId"]; principal.BusinessUnitID = (int)row["BusinessUnitId"]; principal.MemberID = (int)row["MemberId"]; principal.Username = row["Username"].ToString(); principal.ProviderUserKey = providerUserKey; } } return principal; }