Example #1
0
 public ActionResult UpdateUserPersonalInfo(AspNetUser user)
 {
     if (BLLUsers.GetUserByEmail(user.Email) != null && BLLUsers.GetUserByEmail(user.Email).Id != User.Identity.GetId())
     {
         TempData["Error"] = "Adresse mail déjà existante, vous ne pouvez pas utiliser la même adresse mail pour plusieurs compte utilisateur";
         return(RedirectToAction("Profil"));
     }
     BLLUsers.UpdateUserPersonalInfo(user);
     return(RedirectToAction("Profil"));
 }
Example #2
0
        public static void CaseRefused(string to, string text, string emailUrl, Guid guid)
        {
            var replacements = new Dictionary <string, string>();

            var user = BLLUsers.GetUserByEmail(to);

            replacements.Add("|*REASON*|", text);
            replacements.Add("|*EMAILLINK*|", emailUrl);
            replacements.Add("|*TO*|", user != null ? user.DisplayName : to);

            MailSender.SendMessage(to, "[Fast Arbitre] Refus de demande d'arbitrage", MailSender.GetHtmlAndReplaceData("~/Emails/Dossier.Refus.html", replacements), guid);
        }
Example #3
0
        public static void Sentence(string to, int conflictId, string url, string fileUrl, string emailUrl, Guid guid)
        {
            var replacements = new Dictionary <string, string>();

            var user     = BLLUsers.GetUserByEmail(to);
            var conflict = BLLConflicts.GetConflict(conflictId);

            replacements.Add("|*EMAILLINK*|", emailUrl);
            replacements.Add("|*TO*|", user != null ? user.DisplayName : to);
            replacements.Add("|*REFDOSSIER*|", conflictId.ToString());
            replacements.Add("|*ADVERSAIRE*|", conflict.UsersInConflicts.First(c => c.IdUser == c.Conflict.IdCreationUser).User.DisplayName);
            replacements.Add("|*CLIENT*|", conflict.UsersInConflicts.First(c => c.IdUser != c.Conflict.IdCreationUser).User.DisplayName);
            replacements.Add("|*URL*|", url);
            MailSender.SendMessage(to, "[FastArbitre] Mise à disposition de la sentence arbitrale", MailSender.GetHtmlAndReplaceData("~/Emails/Sentence.html", replacements), guid);
        }
Example #4
0
        public static void VisioMultipleDateChoice(string to, string confTitle, int conflictId, string url, string emailUrl, Guid guid)
        {
            var replacements = new Dictionary <string, string>();

            var conflict = BLLConflicts.GetConflict(conflictId);
            var user     = BLLUsers.GetUserByEmail(to);


            replacements.Add("|*EMAILLINK*|", emailUrl);
            replacements.Add("|*TITLE*|", "Choix de la date");
            replacements.Add("|*TO*|", user.DisplayName);
            replacements.Add("|*CLIENT*|", conflict.UsersInConflicts.First(c => c.IdUser != c.Conflict.IdCreationUser).User.DisplayName);
            replacements.Add("|*REFDOSSIER*|", conflictId.ToString());
            replacements.Add("|*ADVERSAIRE*|", conflict.UsersInConflicts.First(c => c.IdUser == c.Conflict.IdCreationUser).User.DisplayName);
            replacements.Add("|*URL*|", url);

            MailSender.SendMessage(to, "[FastArbitre] Choix de la date", MailSender.GetHtmlAndReplaceData("~/Emails/Visio.MultipleDate.html", replacements), guid);
        }
Example #5
0
        public static void VisioProgrammed(string to, int conflictId, string url, string confTitle, MeetingProposition meetingProp, string emailUrl, Guid guid)
        {
            var replacements = new Dictionary <string, string>();

            var conflict = BLLConflicts.GetConflict(conflictId);
            var user     = BLLUsers.GetUserByEmail(to);

            replacements.Add("|*EMAILLINK*|", emailUrl);
            replacements.Add("|*REFDOSSIER*|", conflictId.ToString());
            replacements.Add("|*CLIENT*|", conflict.UsersInConflicts.First(c => c.IdUser != c.Conflict.IdCreationUser).User.DisplayName);
            replacements.Add("|*ADVERSAIRE*|", conflict.UsersInConflicts.First(c => c.IdUser == c.Conflict.IdCreationUser).User.DisplayName);
            replacements.Add("|*DATE*|", meetingProp.DateTimeProposition.ToLongDateString() + " à " + meetingProp.DateTimeProposition.Hour + ":" + meetingProp.DateTimeProposition.Minute);
            replacements.Add("|*URL*|", url);
            replacements.Add("|*LOGIN*|", user.FirstName.Replace(" ", ".").ToLower() + "." + user.LastName.Replace(" ", ".").ToLower());
            replacements.Add("|*PWD*|", to);

            MailSender.SendMessage(to, "[FastArbitre] Notez la date de votre visioconférence", MailSender.GetHtmlAndReplaceData("~/Emails/Visio.Dated.html", replacements), guid);
        }
Example #6
0
        public static void LawyerCalledOnCase(string to, string lawyerName, int conflictId, string clientName, string url, string login, string password, string emailUrl, Guid guid)
        {
            var replacements = new Dictionary <string, string>();

            var user     = BLLUsers.GetUserByEmail(to);
            var conflict = BLLConflicts.GetConflict(conflictId);

            replacements.Add("|*EMAILLINK*|", emailUrl);
            replacements.Add("|*LAWYER*|", lawyerName);
            replacements.Add("|*FROM*|", user != null ? user.DisplayName : to);
            replacements.Add("|*REFDOSSIER*|", conflictId.ToString());
            replacements.Add("|*ADVERSAIRE*|", conflict.UsersInConflicts.First(c => c.IdUser == c.Conflict.IdCreationUser).User.DisplayName);
            replacements.Add("|*CLIENT*|", conflict.UsersInConflicts.First(c => c.IdUser != c.Conflict.IdCreationUser).User.DisplayName);
            replacements.Add("|*LOGIN*|", login);
            replacements.Add("|*PWD*|", password);

            MailSender.SendMessage(to, "[FastArbitre] Un client vous a désigné comme avocat", MailSender.GetHtmlAndReplaceData("~/Emails/Template.Simple.html", replacements), guid);
        }
Example #7
0
        public static void LawyerStartedCase(string to, string lawyerName, int conflictId, string url, string emailUrl, Guid guid)
        {
            var replacements = new Dictionary <string, string>();

            var user     = BLLUsers.GetUserByEmail(to);
            var conflict = BLLConflicts.GetConflict(conflictId);

            replacements.Add("|*EMAILLINK*|", emailUrl);
            replacements.Add("|*TO*|", user != null ? user.DisplayName : to);
            replacements.Add("|*AVOCAT*|", lawyerName);
            replacements.Add("|*REFDOSSIER*|", conflictId.ToString());
            replacements.Add("|*ADVERSAIRE*|", conflict.UsersInConflicts.First(c => c.IdUser == c.Conflict.IdCreationUser).User.DisplayName);
            replacements.Add("|*CLIENT*|", conflict.UsersInConflicts.First(c => c.IdUser != c.Conflict.IdCreationUser).User.DisplayName);
            replacements.Add("|*URL*|", url);


            MailSender.SendMessage(to, "[FastArbitre] Me " + lawyerName + " a engagé une procédure en votre nom",
                                   MailSender.GetHtmlAndReplaceData("~/Emails/Proc.By.Lawyer.html", replacements), guid);
        }
Example #8
0
        public async Task <ActionResult> ExternalLoginCallback(string returnUrl)
        {
            var loginInfo = await AuthenticationManager.GetExternalLoginInfoAsync();

            if (loginInfo == null)
            {
                return(RedirectToAction("Login"));
            }

            // Sign in the user with this external login provider if the user already has a login
            var result = await SignInManager.ExternalSignInAsync(loginInfo, isPersistent : false);

            switch (result)
            {
            case SignInStatus.Success:
                if (!String.IsNullOrWhiteSpace(returnUrl))
                {
                    return(Redirect(returnUrl));
                }
                return(RedirectToAction("Profil", "Account"));

            case SignInStatus.LockedOut:
                return(View("Lockout"));

            case SignInStatus.RequiresVerification:
                return(RedirectToAction("SendCode", new { ReturnUrl = returnUrl, RememberMe = false }));

            case SignInStatus.Failure:
            default:
                // If the user does not have an account, then prompt the user to create an account
                ViewBag.ReturnUrl     = returnUrl;
                ViewBag.LoginProvider = loginInfo.Login.LoginProvider;

                ApplicationUser au = null;

                if (loginInfo.Login.LoginProvider.ToLower() == "facebook")
                {
                    au = new ApplicationUser
                    {
                        UserName   = loginInfo.Email,
                        Email      = loginInfo.Email,
                        CreateDate = DateTime.Now,
                        FirstName  = loginInfo.ExternalIdentity.Claims.First(x => x.Type == "first_name").Value,
                        LastName   = loginInfo.ExternalIdentity.Claims.First(x => x.Type == "last_name").Value,
                    };
                }
                else
                {
                    au = new ApplicationUser
                    {
                        UserName   = loginInfo.ExternalIdentity.Claims.First(x => x.Type == "http://schemas.xmlsoap.org/ws/2005/05/identity/claims/name").Value,
                        Email      = loginInfo.ExternalIdentity.Claims.First(x => x.Type == "http://schemas.xmlsoap.org/ws/2005/05/identity/claims/emailaddress").Value,
                        CreateDate = DateTime.Now,
                        FirstName  = loginInfo.ExternalIdentity.Claims.First(x => x.Type == "http://schemas.xmlsoap.org/ws/2005/05/identity/claims/givenname").Value,
                        LastName   = loginInfo.ExternalIdentity.Claims.First(x => x.Type == "http://schemas.xmlsoap.org/ws/2005/05/identity/claims/surname").Value,
                    };
                }

                var existingUser = BLLUsers.GetUserByEmail(loginInfo.Email);
                if (existingUser != null)
                {
                    BLLUsers.AssociateUserAccounts(loginInfo.Login.LoginProvider, loginInfo.Login.ProviderKey, existingUser.Id);

                    if (loginInfo.Login.LoginProvider == "facebook")
                    {
                        existingUser.PhotoPath = String.Format("http://graph.facebook.com/{0}/picture", loginInfo.ExternalIdentity.Claims.First(x => x.Type == "id").Value);
                        BLLUsers.UpdateUser(existingUser);
                    }
                    au.Id = existingUser.Id;
                    await SignInManager.SignInAsync(au, isPersistent : false, rememberBrowser : false);

                    return(RedirectToAction("Profil", "Account"));
                }


                var res = await UserManager.CreateAsync(au);

                if (res.Succeeded)
                {
                    res = await UserManager.AddLoginAsync(au.Id, loginInfo.Login);

                    var u = BLLUsers.GetUserById(au.Id);
                    if (loginInfo.Login.LoginProvider == "facebook")
                    {
                        u.PhotoPath = String.Format("http://graph.facebook.com/{0}/picture", loginInfo.ExternalIdentity.Claims.First(x => x.Type == "id").Value);
                        BLLUsers.UpdateUser(u);
                    }
                    if (res.Succeeded)
                    {
                        await SignInManager.SignInAsync(au, isPersistent : false, rememberBrowser : false);

                        return(RedirectToAction("Profil", "Account"));
                    }
                    else
                    {
                        return(View("ExternalLoginFailure"));
                    }
                }
                else
                {
                    return(View("ExternalLoginFailure"));
                }
            }
        }