public void SendDeadReport(int UserId, User FatherInfo) { var mailer = new DefaultMailer(); var w = new OwnersByRecipientQuery(UserId, FatherInfo.Id).ExecuteNew2(); for (int i = 0; i < w.Count; i++) { var msg = mailer.SendWitnessDeadReport(FatherInfo.FullName(), w[i].FirstName + " " + w[i].LastName, w[i].Email); msg.Send(); } }
public static int SendInvitation(User owner) { var mailer = new DefaultMailer(); System.Random valor = new System.Random(); int newValue = valor.Next(899999) + 100000; var msg = mailer.TokenInformation(owner.Email, owner.FirstName, newValue); msg.Send(); return newValue; }
public void Handle(User owner, User dataheir, string message) { //TODO: No se puede agregar como beneficiario a uno mismo //var user = this.Find(dataheir.Email); //if (user == null) //{ //user = User.CreateDataheir(form.FirstName, form.LastName, null, null, form.Email, 0, System.DateTime.Now, 1, false, true, false); //Save(user); //AddDataheirToOwner(owner.Id, user.Id); SendInvitation(owner, dataheir, message); //} //else //{ //user.AddRole(UserRoles.Dataheir); //Update(user); //AddDataheirToOwner(owner.Id, user.Id); //TODO: Tambien enviar email indicando que ha sido agregado como testigo //} }
public void Handle(User owner, RecipientAddModel form) { //TODO: No se puede agregar como beneficiario a uno mismo var user = this.Find(form.Email); if (user == null) { user = User.CreateDataheir(form.FirstName, form.LastName, null, null, form.Email, null, null, null, null, 0, 0, null, 0, System.DateTime.Now, 1, 0, null, false, false, false, true, false); Save(user); AddRecipientToOwner(owner.Id, user.Id); SendInvitation(owner.FullName(), user, ""); } else { //user.AddRole(UserRoles.Dataheir); user.FirstName = form.FirstName; user.LastName = form.LastName; Update(user); //AddRecipientToOwner(owner.Id, user.Id); //TODO: Tambien enviar email indicando que ha sido agregado como testigo } }
public void Handle(User owner, User witness, string message) { //foreach (var witnessForm in witnessesForm) //{ // //TODO: No se puede agregar como testigo a uno mismo // var user = this.Find(witnessForm.Email); // if (user == null) // { // user = User.CreateWitness(witnessForm.FirstName, witnessForm.LastName, null, null, witnessForm.Email, 0, System.DateTime.Now, 1, false, false, true); // Save(user); // AddWitnessToOwner(owner, user); SendInvitation(owner, witness, message); //} //else //{ // user.AddRole(UserRoles.Witness); // Update(user); // AddWitnessToOwner(owner, user); // //TODO: Tambien enviar email indicando que ha sido agregado como testigo //} //} }
public User Handle(User user) { var user1 = Current.Connection.Get<User>(user.Id); SendConfirmationEmail(user); return user1; //if (UserReceivedEmailInvitation(user.Status)) //{ //TODO: ¿Si el usuario no existe, significa que la url fue manipulada? //TODO: ¿Si la cuenta ya tiene los datos completos? // if (form.Email != user.Email && ExistsUserWithSameEmail(form.Email)) // throw new ValidationException("Email", "Your Email already exists"); // if (ExistsUserWithSameUserName(form.Username)) // throw new ValidationException("UserName", "Your UserName already exists"); // user.Map(form, new[] { "Email" }); // //user.DoesNotNeedToConfirmEmail(); // Update(user); // return user; //} //else //{ // //if (ExistsUserWithSameEmail(form.Email)) // // throw new ValidationException("Email", "Your Email already exists"); // //if (ExistsUserWithSameUserName(form.Username)) // // throw new ValidationException("UserName", "Your UserName already exists"); //var owner = User.CreateOwner(form.FirstName, form.LastName, form.Username, form.Password, form.Email, 0, System.DateTime.Now, 1, true, false, false); // //Save(owner); // SendConfirmationEmail(owner); // return user1; //} }
public void SendDataheirInfo(User FatherInfo, User dataheir) { //Sent Dataheir var mailer1 = new DefaultMailer(); var msg1 = mailer1.SendDateToDataheir(dataheir.Email, FatherInfo.FullName(), dataheir.FirstName, FatherInfo.UserName, FatherInfo.Password); msg1.Send(); }
private static void SendInvitation(User owner, User witness, string message) { var mailer = new DefaultMailer(); var msg = mailer.CreateAccountWitnessInvitation(witness.Email, witness.Id, witness.FirstName, owner.FullName(), message); msg.Send(); }
private static void Save(User user) { Current.Connection.Insert(user); }
private static void AddWitnessToOwner(User owner, User witness) { var ownerWitness = new OwnerWitness(owner.Id, witness.Id); Current.Connection.Insert(ownerWitness); }
public void Update(User user) { Current.Connection.Update(user); }
private static void Update(User user) { Current.Connection.Update(user); }
public RedirectToAccountType(User user) { this.user = user; }
public static void SignIn(User user) { FormsAuthentication.SetAuthCookie(user.Id.ToString(), false); }
//private Account Find(string email) //{ // var predicate = Predicates.Field<Account>(f => f.Email, Operator.Eq, email); // return Current.Connection.GetList<Account>(predicate).SingleOrDefault(); //} public static void Save(User user) { Current.Connection.Insert(user); }
public ActionResult Signin4(MessageModel form) { User usersData = null ; DataheirCreateModel dataheirData = null; List<DataheirCreateModel> witnessData = null; if (ModelState.IsValid) { try { //storing information about new user UsersAddHandler usersAddHandler1 = new UsersAddHandler(); usersData = (User)Session["Signin1Store"]; User user = usersAddHandler1.Find(usersData.Email); //UserCreateHandler userCreateHandler = new UserCreateHandler(); //var user = Core.User.CreateOwner(usersData.FirstName, usersData.LastName, usersData.UserName, usersData.Password, usersData.Email, usersData.CountryId, 0, 0, null, 0, System.DateTime.Now, 1, 0, false, false, true, false, false); //UsersAddHandler.Save(user); //userCreateHandler.Handle(user); ////Add path for new photo //var path = "~/Swisskip/" + user.UserName; //if (!System.IO.Directory.Exists(Server.MapPath(path))) // System.IO.Directory.CreateDirectory(Server.MapPath(path)); //Session["path"] = path; ////Session["username"] = user.UserName; ////Creating a default photo //string newFile = Server.MapPath("~/Content/images/") + user.UserName + ".jpg"; //if (!System.IO.File.Exists(newFile)) // System.IO.File.Copy(Server.MapPath("~/Content/images/unknown.jpg"), Server.MapPath("~/Content/images/") + user.UserName + ".jpg"); //AuthenticationService.SignIn(user); ////Link new owner with Trial Mode - Status=1 : new owner //var user_userType1 = User_UserType.CreateRelationUserAndUserType(0, user.Id, (int)UserRoles.Owner, 0, System.DateTime.Now, 0, 0, 1); //UsersAddHandler.Save(user_userType1); dataheirData = (DataheirCreateModel)Session["Signin2Store"]; DataheirAddHandler dataheirAddHandler = new DataheirAddHandler(); //Validating Dataheir's Email already existed UsersAddHandler usersAddHandler = new UsersAddHandler(); User ExistedUser = usersAddHandler.Find(dataheirData.Email); User dataheir = new User(); //Find info already existed in DB if (ExistedUser != null && ExistedUser.Email == dataheirData.Email) { ExistedUser.IsDataheir = true; usersAddHandler.Update(ExistedUser); dataheir = ExistedUser; ExistedUser = null; } else { dataheir = Core.User.CreateDataheir(dataheirData.FirstName, dataheirData.LastName, dataheirData.UserName, dataheirData.Password, dataheirData.Email, null, null, dataheirData.CountryId, null, 0, 0, null, 0, System.DateTime.Now, 0, 0, null, false, false, false, true, false); UsersAddHandler.Save(dataheir); } //Sent Confirmation dataheirAddHandler.Handle(user, dataheir, form.DataheirMsg); //Link new owner with Trial Mode var user_userType2 = User_UserType.CreateRelationUserAndUserType(user.Id, dataheir.Id, (int)UserRoles.Dataheir, 0, System.DateTime.Now, 0, 0, 0); UsersAddHandler.Save(user_userType2); //Create Witness witnessData = (List<DataheirCreateModel>)Session["Signin3Store"]; WitnessesAddHandler witnessAddHandler = new WitnessesAddHandler(); User witness = new User(); for (int i = 0; i < witnessData.Count; i++) { //Adding validations - new! User ExistedUser1 = usersAddHandler.Find(witnessData[i].Email); if (ExistedUser1 != null && ExistedUser1.Email == witnessData[i].Email) { ExistedUser1.IsWitness = true; usersAddHandler.Update(ExistedUser1); witness = ExistedUser1; } else { witness = Core.User.CreateWitness(witnessData[i].FirstName, witnessData[i].LastName, witnessData[i].UserName, witnessData[i].Password, witnessData[i].Email, null, null, witnessData[i].CountryId, null, 0, 0, null, 0, System.DateTime.Now, 0, 0, null, false, false, false, false, true); UsersAddHandler.Save(witness); } //Sent Confirmation witnessAddHandler.Handle(user, witness, form.WitnessMsg); //Link new owner with Trial Mode var user_userType3 = User_UserType.CreateRelationUserAndUserType(user.Id, witness.Id, (int)UserRoles.Witness, 0, System.DateTime.Now, 0, 0, 0); UsersAddHandler.Save(user_userType3); witness = null; ExistedUser1 = null; } } catch (ValidationException e) { ModelState.AddModelError(e.Key, e.Message); return this.View(); } } //if (!ModelState.IsValid) // return this.View(); //if (invitationId.HasValue) //{ //User user1 = Current.Connection.Get<User>(Current.UserId); //AuthenticationService.SignIn(user1); // return new RedirectToAccountType(user); //} Session["Signin1Store"] = usersData; Session["Signin2Store"] = dataheirData; Session["Signin3Store"] = witnessData; return RedirectToAction("Signin5", "Registration"); }
public void SendConfirmationEmail(User user) { var mailer = new DefaultMailer(); var msg = mailer.NewAccountConfirmation(user.Email, user.Url, user.FullName()); msg.Send(); }
private static void SendInvitation(string ownerFullName, User recipient, string message) { var mailer = new DefaultMailer(); var msg = mailer.CreateAccountDataheirInvitation(recipient.Email, recipient.Id, recipient.FirstName, ownerFullName, message); msg.Send(); }
private static void SendInvitation(User owner, User dataheir, string message) { var mailer = new DefaultMailer(); var msg = mailer.CreateAccountDataheirInvitation(dataheir.Email, dataheir.Id, dataheir.FirstName, owner.FullName(), message); msg.Send(); }
private static void Update(User account) { Current.Connection.Update(account); }