public static void NewUserRegister(AppUser user, string videoId) { string body = "New User Register At TimeFlies <br>Username :"******" <br>Email:" + user.Email + "<br><br><a href=" + Settings.Url + "/" + videoId + ">Click here to view user's profile.</a><br>"; FacebookWebContext wc = new FacebookWebContext(GlobalObjects.FBApp); FacebookWebClient fb = new FacebookWebClient(wc); fb.AccessToken = user.AccessToken; dynamic friends = fb.Get("/me/friends"); List<string> userIds = new List<string>(); foreach (dynamic friend in friends.data) userIds.Add(friend.id); IEnumerable<string> existingUserIds = ContextHelper.DataContext.Images.Where(o => userIds.Contains(o.UserId)).Select(o => o.UserId).Distinct().Take(3); if (existingUserIds.Count() > 0) { body += "Thanks<br>New user friend's at TimeFlies.by are:<br>"; foreach (string userId in existingUserIds) { AppUser usrData = ContextHelper.DataContext.User.FirstOrDefault(o => o.UserId == userId); body += usrData.FullName + " (" + usrData.Email + ") " + "<br>"; } } SendEmail(Settings.ContactEmailAddress, "New User Register At TimeFlies.by", body); //SendEmail("*****@*****.**", "New User Register At TimeFlies.by", body); }
public static void ConfirmDeleteAccount(AppUser user) { string subject = "Confirm your account deletion at Timeflies.by"; string html = String.Format(@"Hi {0}, <div> </div> Please confirm your account deletion at Timeflies.by <div> </div> <a href=""{1}&data=true"">Save Data And Delete Account</a> <div> </div> <a href=""{1}&data=false"">Delete my account</a> <div> </div> Thanks<br> Timeflies.by", user.FullName, Settings.Url + "/DeleteAccount.aspx?id=" + user.UserId); SendEmail(user.Email, subject, html); }
/// <summary> /// Create a new AppUser object. /// </summary> /// <param name="userId">Initial value of the UserId property.</param> /// <param name="email">Initial value of the Email property.</param> /// <param name="isYoutube">Initial value of the IsYoutube property.</param> /// <param name="isActive">Initial value of the IsActive property.</param> /// <param name="dateAdded">Initial value of the DateAdded property.</param> public static AppUser CreateAppUser(global::System.String userId, global::System.String email, global::System.Boolean isYoutube, global::System.Boolean isActive, global::System.DateTime dateAdded) { AppUser appUser = new AppUser(); appUser.UserId = userId; appUser.Email = email; appUser.IsYoutube = isYoutube; appUser.IsActive = isActive; appUser.DateAdded = dateAdded; return appUser; }
/// <summary> /// Deprecated Method for adding a new object to the User EntitySet. Consider using the .Add method of the associated ObjectSet<T> property instead. /// </summary> public void AddToUser(AppUser appUser) { base.AddObject("User", appUser); }
public string RegisterUser(string uid, string email, string fullname, string accessToken) { string videoId = ""; try { using (TimeFliesByEntities dc = new TimeFliesByEntities(Settings.EFConnectionString)) { AppUser user = new AppUser(); user.UserId = uid; user.Email = email; user.FullName = fullname; user.AccessToken = accessToken; user.LastLogin = DateTime.Now; user.IsActive = true; user.DateAdded = DateTime.Now; dc.AddToUser(user); Videos video = new Videos(); video.VideoId = Guid.NewGuid().ToString().Substring(0, 8); video.UserId = user.UserId; video.VideoName = "My Video"; video.Publish = "PublicFriends"; video.IsReminder = true; video.IsSentReminder = false; video.IsCompile = false; video.IsImage = false; video.IsError = false; video.IsSoundTrack = false; video.ServerReminderTime = DateTime.Now; video.DateAdded = DateTime.Now; dc.AddToVideos(video); videoId = video.VideoId; EmailService.NewUserRegister(user, videoId); } } catch (Exception ex) { EmailService.ErrorEmail(ex); videoId = ex.Message; } return videoId; }
public static void YourImages(AppUser user, string url) { string subject = "Your images at Timeflies.by"; string html = String.Format(@"Hi {0}, <div> </div> Here is a link for your images at Timeflies.by <div> </div> {1} <div> </div> Thanks <br> Timeflies.by", user.FullName, url); SendEmail(user.Email, subject, html); }