Ejemplo n.º 1
0
        public ActionResult DatePropositions(int conflictId, List <DateTime> rdv, string visioTitle, string visioDescription, string estimateDuration)
        {
            var conflict = BLLConflicts.GetConflictWithUsers(conflictId);
            var evt      = BLLConflicts.AddEvent(new Event()
            {
                IdUser      = User.Identity.GetId(),
                DateBegin   = DateTime.Parse("01/01/0001"),
                Name        = visioTitle,
                Description = visioDescription,
                Type        = (int)EventTypeEnum.Visio,
                IdConflict  = conflictId
            });

            var visioDebate = new MeetingDebate();

            visioDebate.CreateDate       = DateTime.Now;
            visioDebate.Description      = visioDescription;
            visioDebate.IdConflict       = conflictId;
            visioDebate.EstimateDuration = estimateDuration;
            visioDebate.Link             = "http://openfire-444e60hk.cloudapp.net:7443/ofmeet/?b=1-1461653024012";
            visioDebate.Title            = visioTitle;
            visioDebate.IdEvent          = evt.Id;
            visioDebate = BLLDebates.AddMeetingDate(visioDebate);
            BLLMeetingDoodle.AddMeetingDebatePropositions(visioDebate.Id, rdv.Select(c => new MeetingProposition()
            {
                IdMeetingDebate = visioDebate.Id, DateTimeProposition = c
            }).ToList());
            return(RedirectToAction("Conflict", "Viewer", new { conflictId = conflictId }));
        }
Ejemplo n.º 2
0
        public ContentResult UploadFileFromDefault()
        {
            var              conflictId = int.Parse(Request.Form["conflictId"]);
            string           uid        = Request.Form["uid"];
            List <ProofFile> fileIds    = new List <ProofFile>();

            foreach (string file in Request.Files)
            {
                HttpPostedFileBase hpf = Request.Files[file] as HttpPostedFileBase;
                if (hpf.ContentLength == 0)
                {
                    continue;
                }

                var blockBlob = AzureFileHelper.AddFile(conflictId, hpf);



                var f = new ProofFile();
                f.FilePath   = blockBlob.Uri.AbsoluteUri;
                f.IdConflict = conflictId;
                f.Name       = blockBlob.Name;
                f.uid        = uid;
                f            = BLLConflicts.AddFile(f);
                fileIds.Add(f);
            }
            return(new ContentResult()
            {
                Content = JsonHelper.GetJsonString(fileIds), ContentType = "application/json"
            });
        }
Ejemplo n.º 3
0
        public ActionResult WriteProcedureClosure(int conflictId, int debateId, HttpPostedFileBase FileClause)
        {
            var debat = BLLDebates.GetDebate(debateId);
            var evt   = BLLConflicts.AddEvent(new Event()
            {
                DateBegin   = DateTime.Now,
                Description = "Ordonnance pour la procédure d'incidence \"" + debat.Title + "\" ",
                IdConflict  = conflictId,
                Name        = "Ordonnance de procédure d'incidence",
                Type        = (int)EventTypeEnum.OfficialDocuments,
                IdUser      = User.Identity.GetId()
            });

            var azureFile = AzureFileHelper.AddFile(conflictId, FileClause);
            var prooFile  = BLLConflicts.AddFile(new ProofFile()
            {
                Description = "Sentence",
                FilePath    = azureFile.Uri.AbsoluteUri,
                FileType    = (int)FileTypeEnum.PDF,
                IdConflict  = conflictId,
                Name        = "Ordonnance_Procedure_Incidence_N°_" + debateId,
                UploadDate  = DateTime.Now,
            }, evt.Id);

            BLLLegalDocuments.AddLegalDocument(new LegalDocument()
            {
                IdConflict = conflictId, Filename = "Ordonnance_Procedure_Incidence_N°_" + debateId, Url = azureFile.Uri.AbsoluteUri, Type = (int)LegalDocumentTypeEnum.OrdonnanceProcedure
            });

            BLLDebates.CloseDebate(debateId);

            return(RedirectToAction("Conflict", "Viewer", new { conflictId = conflictId }));
        }
Ejemplo n.º 4
0
        public static Stream GenerateMissionAct(int conflictId)
        {
            Conflict conflict  = BLLConflicts.GetConflictForArbitration(conflictId);
            var      demandeur = conflict.UsersInConflicts.First(c => c.IdUser == conflict.IdCreationUser);

            if (demandeur.IsLawyer != null && demandeur.IsLawyer.Value)
            {
                demandeur = conflict.UsersInConflicts.First(c => c.IdLawyer == conflict.IdCreationUser);
            }
            var defendeur = conflict.UsersInConflicts.First(c => (c.IsLawyer == null || !c.IsLawyer.Value) && c.IdUser != demandeur.IdUser);

            var stream = File.OpenWrite(HttpContext.Current.Server.MapPath("~/Templates/C1.Acte De Mission.docx"));

            using (DocX document = DocX.Load(stream))
            {
                document.ReplaceText("[N° du Litige]", conflict.Id.ToString());
                document.ReplaceText("[N° RCS Demandeur]", demandeur.UserCompany != null && demandeur.UserCompany.Company != null ? demandeur.UserCompany.Company.RCS : "RCS Inconnu");
                document.ReplaceText("[N° RCS Défendeur]", defendeur.UserCompany != null && defendeur.UserCompany.Company != null ? defendeur.UserCompany.Company.RCS : "RCS Inconnu");
                document.ReplaceText("[Demandeur]", demandeur.User.DisplayName);
                document.ReplaceText("[Défendeur]", defendeur.User.DisplayName);
                document.ReplaceText("[Arbitre]", conflict.Arbiter.DisplayName);
                document.ReplaceText("[Date]", DateTime.Now.ToShortDateString());
            }

            return(stream);
        }
Ejemplo n.º 5
0
        public EmptyResult SaveRecord(string url, int conflictId, int eventId)
        {
            //url = LZString.LZString.decompressFromUTF16(url);
            var stream = new MemoryStream();
            var sr     = new StreamWriter(stream);

            sr.Write(url);
            sr.Flush();

            stream.Seek(0, SeekOrigin.Begin);

            var retMs = new MemoryStream(GetBytes(url));
            //using (var retMs = new MemoryStream())
            //using (var ms = new MemoryStream(GetBytes(url)))
            //using (var rdr = new WaveFileReader(ms))
            //using (var wtr = new LameMP3FileWriter(retMs, rdr.WaveFormat, 128))
            //{
            //    rdr.CopyTo(wtr);
            //    retMs.Seek(0, SeekOrigin.Begin);

            var name = Guid.NewGuid().ToString().Replace("-", "") + ".wav";

            var blob = AzureFileHelper.AddFile(conflictId, stream, name);

            BLLConflicts.AddFile(new Common.ProofFile()
            {
                Description = "", IdConflict = conflictId, Name = "Enregistrement audio", FilePath = blob.Uri.AbsoluteUri
            }, eventId);
            //}
            sr.Close();
            return(new EmptyResult());
        }
Ejemplo n.º 6
0
        public ActionResult PreSentence(int conflictId)
        {
            var conflict  = BLLConflicts.GetConflictForArbitration(conflictId);
            var demandeur = conflict.UsersInConflicts.First(c => c.IdUser == conflict.IdCreationUser);

            if (demandeur.IsLawyer != null && demandeur.IsLawyer.Value)
            {
                demandeur = conflict.UsersInConflicts.First(c => c.IdLawyer == conflict.IdCreationUser);
            }
            var defendeur = conflict.UsersInConflicts.First(c => (c.IsLawyer == null || !c.IsLawyer.Value) && c.IdUser != demandeur.IdUser);

            if (demandeur.UserCompany == null || demandeur.UserCompany.Company == null ||
                defendeur.UserCompany == null || defendeur.UserCompany.Company == null)
            {
                TempData["Error"] = "Vous devez renseigner les informations d'entreprises de chaque parties avant de pouvoir générer la pré-sentence";
                return(RedirectToAction("Conflict", "Viewer", new { conflictId = conflictId }));
            }

            var file      = DocGenerator.GeneratePreSentenceReport(conflict);
            var azureFile = AzureFileHelper.AddFile(conflictId, file.FileStream, file.FileName);

            return(View("WritePreSentence", new WritePreSentenceModel()
            {
                Conflict = conflict, Url = azureFile.Uri.AbsoluteUri
            }));
        }
Ejemplo n.º 7
0
        public async Task <ActionResult> Register(RegisterViewModel model, string returnUrl)
        {
            if (ModelState.IsValid)
            {
                var user = new ApplicationUser {
                    UserName = model.Email, Email = model.Email, CreateDate = DateTime.Now, FirstName = model.FirstName, LastName = model.LastName
                };
                var result = await UserManager.CreateAsync(user, model.Password);

                if (result.Succeeded)
                {
                    UserManager.AddToRole(user.Id, "User");
                    if (!String.IsNullOrWhiteSpace(Request.QueryString.Get("i")))
                    {
                        BLLUsers.AutoConfirmUser(user.Id);
                        var invit    = Guid.Parse(Request.QueryString.Get("i"));
                        var invitObj = BLLInvitations.GetInvitation(invit);
                        BLLConflicts.AddUserInConflictFromInvitation(user.Email, invit, user.Id);
                        await SignInManager.SignInAsync(user, isPersistent : false, rememberBrowser : false);

                        OpenFireConnector.Connector connector = new OpenFireConnector.Connector("http://openfire-444e60hk.cloudapp.net:9090/", "admin", "SF211084agantio");
                        connector.CreateUser(new OpenFireConnector.user()
                        {
                            password = user.Email, username = user.FirstName.Replace(" ", ".").ToLower() + "." + user.LastName.Replace(" ", ".").ToLower(), email = user.Email
                        });

                        return(RedirectToAction("Identification", "Conflict", new { conflictId = invitObj.IdConflict, idUser = user.Id }));
                    }
                    else
                    {
                        BLLUsers.AutoConfirmUser(user.Id);
                        await SignInManager.SignInAsync(user, isPersistent : false, rememberBrowser : false);

                        if (!String.IsNullOrWhiteSpace(returnUrl))
                        {
                            return(Redirect(returnUrl));
                        }
                        else
                        {
                            return(RedirectToAction("Index", "Home"));
                        }

                        // string code = await UserManager.GenerateEmailConfirmationTokenAsync(user.Id);
                        // var callbackUrl = Url.Action("ConfirmEmail", "Account", new { userId = user.Id, code = code }, protocol: Request.Url.Scheme);
                        // Guid guid = Guid.NewGuid();
                        // FastArbitreEmails.ConfirmAccount(model.Email, model.FirstName + " " + model.LastName, callbackUrl, Request.UrlReferrer.DnsSafeHost + Url.Action("Index", "Email", new { id = guid.ToString() }), guid);
                        //// await UserManager.SendEmailAsync(user.Id, "Confirm your account", "Please confirm your account by clicking <a href=\"" + callbackUrl + "\">here</a>");

                        // return View("ShouldConfirmEmail");
                    }

                    // Send an email with this link
                }
                AddErrors(result);
            }

            // If we got this far, something failed, redisplay form

            return(View(model));
        }
Ejemplo n.º 8
0
        public ActionResult ValidateAcceptance(int conflictId, bool noconflict, bool legitimate, HttpPostedFileBase FileClause)
        {
            BLLArbiter.AcceptConflict(conflictId, User.Identity.GetId(), noconflict, legitimate);

            var legalDoc = BLLLegalDocuments.GetLastDocumentForType(conflictId, (int)LegalDocumentTypeEnum.MissionAct);

            var et = BLLConflicts.AddEvent(new Event()
            {
                DateBegin   = legalDoc != null && legalDoc.CreateDate != null ? legalDoc.CreateDate.Value : DateTime.Now,
                Description = "Acte de mission désignant l arbitre",
                IdConflict  = conflictId,
                Name        = "Acte de mission",
                Type        = (int)EventTypeEnum.OfficialDocuments,
                IdUser      = User.Identity.GetId()
            });

            BLLConflicts.AddFile(new ProofFile()
            {
                Description = "Acte de mission désignant l arbitre",
                FilePath    = legalDoc.Url,
                FileType    = (int)FileTypeEnum.PDF,
                IdConflict  = conflictId,
                Name        = "Acte de mission",
                UploadDate  = DateTime.Now,
            }, et.Id);

            var evt = BLLConflicts.AddEvent(new Event()
            {
                DateBegin   = DateTime.Now,
                Description = "L'arbitre " + User.Identity.FirstName() + " " + User.Identity.LastName() + " a accepté de prendre en charge votre dossier. Il a par ailleurs déclaré n'avoir aucun conflit d'intérêt dans votre dossier et être en mesure de le prendre en charge.",
                IdConflict  = conflictId,
                Name        = "Déclaration d'acceptation et d'indépendance de l'arbitre",
                Type        = (int)EventTypeEnum.OfficialDocuments,
                IdUser      = User.Identity.GetId()
            });

            var azureFile = AzureFileHelper.AddFile(conflictId, FileClause);

            BLLConflicts.AddFile(new ProofFile()
            {
                Description = "Déclaration d'acceptation et d'indépendance de l'arbitre",
                FilePath    = azureFile.Uri.AbsoluteUri,
                FileType    = (int)FileTypeEnum.PDF,
                IdConflict  = conflictId,
                Name        = "Déclaration d'acceptation et d'indépendance de l'arbitre",
                UploadDate  = DateTime.Now,
            }, evt.Id);



            var csh = new ConflictStateHistoric()
            {
                IdConflict        = conflictId,
                ConflictStateId   = (int)ConflictState.ArbitrationStarted,
                ConflictStateName = MetadataHelper.GetEnumDisplayNAme((ConflictState)ConflictState.ArbitrationStarted),
            };

            BLLConflicts.AddConflictStateHistoric(csh);
            return(RedirectToAction("Conflict", "Viewer", new { conflictId = conflictId }));
        }
Ejemplo n.º 9
0
        public ActionResult Quotation(int conflictId)
        {
            var conflict = BLLConflicts.GetConflict(conflictId);

            conflict.State = (int)ConflictState.Quotation;
            BLLConflicts.UpdateConflict(conflict);
            return(RedirectToAction("Conflict", "Viewer", new { conflictId = conflictId }));
        }
Ejemplo n.º 10
0
        public ActionResult UpdateSituation(int conflictId, int situation)
        {
            int totalPages = 0;

            BLLConflicts.UpdateConflictState(conflictId, situation);
            var conflicts = BLLConflicts.SearchConflicts(null, null, Enum.GetName(typeof(ConflictState), (ConflictState)situation), 0, 10, out totalPages);

            return(RedirectToAction("CaseList", new { id = conflictId }));
        }
Ejemplo n.º 11
0
        // GET: Arbiter
        public ActionResult Centre()
        {
            var model = new CentreModel();

            model.ConflictsToAssigned = BLLConflicts.SearchConflicts(Common.ConflictState.ArbitrationReady);
            model.ConflictsAssigned   = BLLConflicts.SearchConflicts(Common.ConflictState.ArbiterAssigned);
            model.ArbitrationStarted  = BLLConflicts.SearchConflicts(Common.ConflictState.ArbitrationStarted, true);
            return(View(model));
        }
Ejemplo n.º 12
0
        //public ContentResult Index()
        //{
        //    var file = DocGenerator.GenerateBodaccReport("414819409");

        //    return new ContentResult() { Content = file, ContentType = "text/html" };
        //}

        public ContentResult ConflictTest()
        {
            var conflicts = BLLConflicts.GetConflictsWithInvitations();

            return(new ContentResult()
            {
                Content = JsonConvert.SerializeObject(conflicts), ContentType = "application/json"
            });
        }
Ejemplo n.º 13
0
        public ActionResult CaseList(int?id, string text, string situation, int nbPage = 0)
        {
            int totalPages = 0;
            var conflicts  = BLLConflicts.SearchConflicts(id, text, situation, nbPage, 10, out totalPages);

            return(View(new CaseListModel()
            {
                Conflicts = conflicts, Page = nbPage, TotalPages = totalPages, id = id, text = text, situation = situation
            }));
        }
Ejemplo n.º 14
0
        public ContentResult GenerateAcceptanceReport(int conflictId)
        {
            var file      = DocGenerator.GenerateAcceptanceDeclaration(BLLConflicts.GetConflict(conflictId), User.Identity.FirstName() + " " + User.Identity.LastName());
            var azureFile = AzureFileHelper.AddFile(conflictId, file.FileStream, file.FileName);

            return(new ContentResult()
            {
                Content = azureFile.Uri.AbsoluteUri
            });
        }
Ejemplo n.º 15
0
        public ActionResult AskArbitrationValidation(int conflictId, Company company)
        {
            var conflict = BLLConflicts.GetConflictForUser(conflictId, User.Identity.GetId());


            var com = BLLUsers.AddOrUpdateCompany(company);

            BLLUsers.UpdateUserMainCompany(com.Id, User.Identity.GetId());

            var uic = conflict.UsersInConflicts.Where(c => c.IdUser == User.Identity.GetId()).FirstOrDefault();

            uic.HasAcceptedArbitration = true;
            BLLConflicts.UpdateUserInConflict(uic);

            conflict = BLLConflicts.GetFullConflict(conflictId);
            if (conflict.UsersInConflicts.All(c => c.HasAcceptedArbitration != null && c.HasAcceptedArbitration.Value) ||
                conflict.HasArbitralClause && conflict.UsersInConflicts.Any(c => c.HasAcceptedArbitration != null && c.HasAcceptedArbitration.Value) &&
                conflict.PaymentState == (int)PaymentStateEnum.Complete)
            {
                conflict.State = (int)ConflictState.ArbitrationReady;
                BLLConflicts.UpdateConflict(conflict);

                foreach (var item in conflict.UsersInConflicts)
                {
                    var hasPayed = false;
                    if (!hasPayed && (item.HasAcceptedArbitration == null || !item.HasAcceptedArbitration.Value))
                    {
                        Guid guid = Guid.NewGuid();
                        FastArbitreEmails.ArbitrationAsked(item.User.Email, conflict.Id,
                                                           Request.UrlReferrer.DnsSafeHost + Url.Action("AskArbitration", "Viewer", new { conflictId = conflict.Id }),
                                                           Request.UrlReferrer.DnsSafeHost + Url.Action("Index", "Email", new { id = guid.ToString() }), guid);
                        hasPayed = true;
                    }
                    else
                    {
                        Guid guid = Guid.NewGuid();
                        FastArbitreEmails.ArbitrationSentToCentre(item.User.Email, conflict.Id,
                                                                  Request.UrlReferrer.DnsSafeHost + Url.Action("AskArbitration", "Viewer", new { conflictId = conflict.Id }),
                                                                  Request.UrlReferrer.DnsSafeHost + Url.Action("Index", "Email", new { id = guid.ToString() }), guid);
                    }
                }
            }
            else
            {
                foreach (var item in conflict.UsersInConflicts.Where(c => c.HasAcceptedArbitration == null || !c.HasAcceptedArbitration.Value))
                {
                    Guid guid = Guid.NewGuid();
                    FastArbitreEmails.ArbitrationAsked(item.User.Email, conflict.Id,
                                                       Request.UrlReferrer.DnsSafeHost + Url.Action("AskArbitration", "Viewer", new { conflictId = conflict.Id }),
                                                       Request.UrlReferrer.DnsSafeHost + Url.Action("Index", "Email", new { id = guid.ToString() }), guid);
                }
            }
            return(RedirectToAction("Conflict", new { conflictId = conflictId }));
        }
Ejemplo n.º 16
0
        public ActionResult Sentence(int conflictId)
        {
            var conflict  = BLLConflicts.GetConflictForArbitration(conflictId);
            var file      = DocGenerator.GenerateSentenceReport(conflict);
            var azureFile = AzureFileHelper.AddFile(conflictId, file.FileStream, file.FileName);

            return(View("WriteSentence", new WritePreSentenceModel()
            {
                Conflict = conflict, Url = azureFile.Uri.AbsoluteUri
            }));
        }
Ejemplo n.º 17
0
        public ActionResult ProcedureClosure(int id, int conflictId)
        {
            var conflict  = BLLConflicts.GetConflictForArbitration(conflictId);
            var debate    = BLLDebates.GetDebate(id);
            var file      = DocGenerator.GenerateOrdonnanceProcedure(conflict, debate);
            var azureFile = AzureFileHelper.AddFile(conflictId, file.FileStream, file.FileName);

            return(View("ProcedureClosure", new ProcedureClosureModel()
            {
                Conflict = conflict, Debat = debate, DocumentUrl = azureFile.Uri.AbsoluteUri
            }));
        }
Ejemplo n.º 18
0
        public ActionResult MailDebateAdd(int debatId, string mailBody)
        {
            var debate = BLLDebates.GetDebate(debatId);

            if (String.IsNullOrWhiteSpace(mailBody) && Request.Files["FileUpload"] != null && Request.Files["FileUpload"].ContentLength > 0)
            {
                HttpPostedFileBase hpf = Request.Files["FileUpload"] as HttpPostedFileBase;

                var blockBlob = AzureFileHelper.AddFile(debate.Event.IdConflict, hpf);

                var f = new ProofFile();
                f.FilePath   = blockBlob.Uri.AbsoluteUri;
                f.IdConflict = debate.Event.IdConflict;
                f.Name       = blockBlob.Name;

                var file       = BLLConflicts.AddFile(f);
                var mailDebate = BLLDebates.AddMailDebate(new MailDebate()
                {
                    IdDebate   = debatId,
                    Body       = "<a href='" + file.FilePath + "'>" + file.Name + "</a>",
                    CreateDate = DateTime.Now,
                    CreatedBy  = User.Identity.GetId(),
                    IdFile     = file.Id
                });

                foreach (var item in BLLDebates.GetUsersForDebate(debatId))
                {
                    Guid guid = Guid.NewGuid();
                    FastArbitreEmails.YouHaveMail(item, debate, Url.Action("MailDebate", "Arbitre", new
                    {
                        debatId = debate.Id
                    },
                                                                           this.Request.Url.Scheme) + "#mail_" + mailDebate.Id,
                                                  Request.UrlReferrer.DnsSafeHost + Url.Action("Index", "Email", new { id = guid.ToString() }), guid);
                }
            }
            else
            {
                var mailDebate = BLLDebates.AddMailDebate(new MailDebate()
                {
                    IdDebate = debatId, Body = mailBody, CreateDate = DateTime.Now, CreatedBy = User.Identity.GetId()
                });

                foreach (var item in BLLDebates.GetUsersForDebate(debatId))
                {
                    Guid guid = Guid.NewGuid();
                    FastArbitreEmails.YouHaveMail(item, debate,
                                                  Url.Action("MailDebate", "Arbitre", new { debatId = debate.Id }, this.Request.Url.Scheme) + "#mail_" + mailDebate.Id,
                                                  Request.UrlReferrer.DnsSafeHost + Url.Action("Index", "Email", new { id = guid.ToString() }), guid);
                }
            }
            return(RedirectToAction("MailDebate", new { debatId = debatId }));
        }
Ejemplo n.º 19
0
        public async Task <ActionResult> Login(LoginViewModel model, string returnUrl)
        {
            if (!ModelState.IsValid)
            {
                return(View(model));
            }
            // find user by username first
            var user = UserManager.FindByEmail(model.Email);

            if (user == null)
            {
                ModelState.AddModelError("", "Nom d'utilisateur ou mot de passe erroné, veuillez ressayer.");
                return(View(model));
            }

            if (await UserManager.IsLockedOutAsync(user.Id))
            {
                ModelState.AddModelError("", string.Format("Quelqu'un a tenté de se connecter à votre compte sans succès. Afin d'empêcher les personnes malveillantes de trouver votre mot de passe en testant un maximum de combinaison (technique dite 'bruteforce'), votre compte est maintenant bloqué pour {0} minutes.", ConfigurationManager.AppSettings["DefaultAccountLockoutTimeSpan"].ToString()));
                return(View(model));
            }

            // This doesn't count login failures towards account lockout
            // To enable password failures to trigger account lockout, change to shouldLockout: true
            var result = await SignInManager.PasswordSignInAsync(model.Email, model.Password, model.RememberMe, shouldLockout : true);

            switch (result)
            {
            case SignInStatus.Success:
                if (returnUrl != null)
                {
                    if ((returnUrl.Contains("userId") || returnUrl.Contains("?i=")))
                    {
                        returnUrl = returnUrl.Replace("userId", user.Id);
                        var invitation = HttpUtility.ParseQueryString(returnUrl)[0];
                        BLLConflicts.AddUserInConflictFromInvitation(user.Email, Guid.Parse(invitation), user.Id);
                    }
                    return(Redirect(returnUrl));
                }
                return(RedirectToAction("Profil"));

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

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

            case SignInStatus.Failure:
            default:
                ModelState.AddModelError("", "Nom d'utilisateur ou mot de passe erroné, veuillez ressayer.");
                return(View(model));
            }
        }
Ejemplo n.º 20
0
        public ActionResult AskForVisio(int conflictId, string reason)
        {
            var  conflict = BLLConflicts.GetConflictForArbitration(conflictId);
            Guid guid     = Guid.NewGuid();

            FastArbitreEmails.VisioAsked(conflict.Arbiter.Email, User.Identity.FirstName() + " " + User.Identity.LastName(), conflictId, reason,
                                         Request.UrlReferrer.DnsSafeHost + Url.Action("Conflict", "Viewer", new { conflictId = conflictId }), Request.UrlReferrer.DnsSafeHost + Url.Action("RefuseVisio", new { conflictId = conflictId }),
                                         Request.UrlReferrer.DnsSafeHost + Url.Action("Index", "Email", new { id = guid.ToString() }), guid);

            TempData["info"] = "Votre message vient d'être envoyé a l'arbitre. Celui vous proposera rapidement des dates s'il accepte le motif de votre visio conférence.";

            return(RedirectToAction("Conflict", new { conflictId = conflictId }));
        }
Ejemplo n.º 21
0
        public ActionResult ResendInvitation(string id)
        {
            var invit    = BLLInvitations.GetInvitation(Guid.Parse(id));
            var conflict = BLLConflicts.GetConflict(invit.IdConflict);
            var guid     = Guid.NewGuid();
            var url      = Url.Action("Conflict", "Viewer", new { conflictId = invit.IdConflict });

            FastArbitreEmails.InvitationToJoinConflict(invit, conflict,
                                                       String.Format("{0}?i={1}", Request.Url.Authority.ToLower() + url, invit.Id),
                                                       conflict.CreatedBy.DisplayName,
                                                       Url.Action("Index", "Email", new { id = guid.ToString() }), guid);
            return(View());
        }
Ejemplo n.º 22
0
        public ActionResult PaymentDone()
        {
            var conflictId = Request.Cookies["conflictId"].Value;
            int confId     = 0;

            if (int.TryParse(conflictId, out confId))
            {
                return(View("PaymentDone", BLLConflicts.GetConflict(confId)));
            }
            else
            {
                return(RedirectToAction("Index", "Home"));
            }
        }
Ejemplo n.º 23
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);
        }
Ejemplo n.º 24
0
        public ActionResult Refuse(int conflictId, string text)
        {
            var conflict = BLLConflicts.GetFullConflict(conflictId);

            conflict.State = (int)ConflictState.RefusedByPlateform;
            BLLConflicts.UpdateConflict(conflict);

            foreach (var item in conflict.UsersInConflicts)
            {
                Guid guid = Guid.NewGuid();

                FastArbitreEmails.CaseRefused(item.User.Email, text, Request.UrlReferrer.DnsSafeHost + Url.Action("Index", "Email", new { id = guid.ToString() }), guid);
            }
            return(RedirectToAction("Centre"));
        }
Ejemplo n.º 25
0
        public static void VisioNotProgrammable(string to, string confTitle, int conflictId, string url, string emailUrl, Guid guid)
        {
            var replacements = new Dictionary <string, string>();

            var conflict = BLLConflicts.GetConflict(conflictId);

            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("|*URL*|", url);

            MailSender.SendMessage(to, "[FastArbitre] Impossible de fixer une date", MailSender.GetHtmlAndReplaceData("~/Emails/Visio.NoDate.html", replacements), guid);
        }
Ejemplo n.º 26
0
        public ActionResult AskArbitration(int conflictId)
        {
            AskArbitrationViewModel model = new AskArbitrationViewModel();

            model.Conflict = BLLConflicts.GetConflictForArbitration(conflictId);
            model.User     = BLLUsers.GetMyProfil(User.Identity.GetId());
            if (model.Conflict.UsersInConflicts.First(c => c.IdUser == model.User.Id).IdUserCompany != null)
            {
                model.Company = BLLCompanies.GetCompany(model.Conflict.UsersInConflicts.First(c => c.IdUser == model.User.Id).IdUserCompany.Value);
            }
            if (model.Company == null)
            {
                model.Company = new Company();
            }
            return(View(model));
        }
Ejemplo n.º 27
0
 public ContentResult AddNewEvent(Event e)
 {
     if (e.Id != 0)
     {
         return(new ContentResult()
         {
             Content = JsonHelper.GetJsonString(BLLConflicts.UpdateEvent(e)), ContentType = "application/json"
         });
     }
     e.IdUser = User.Identity.GetId();
     e.Type   = (int)EventTypeEnum.Event;
     return(new ContentResult()
     {
         Content = JsonHelper.GetJsonString(BLLConflicts.AddEvent(e)), ContentType = "application/json"
     });
 }
Ejemplo n.º 28
0
        public static Stream GenerateIndependencyAndAcceptanceAct(int conflictId)
        {
            Conflict conflict = BLLConflicts.GetConflictForArbitration(conflictId);

            var stream = File.OpenWrite(HttpContext.Current.Server.MapPath("~/Templates/C2. Déclaration d'acceptation et d'indépendance_V1.docx"));

            using (DocX document = DocX.Load(stream))
            {
                document.ReplaceText("[N° du Litige]", conflict.Id.ToString());
                document.ReplaceText("[Demandeur]", conflict.CreatedBy.DisplayName);
                document.ReplaceText("[Défendeur]", conflict.UsersInConflicts.First(c => c.IdUser != conflict.IdCreationUser).User.DisplayName);
                document.ReplaceText("[Arbitre]", conflict.Arbiter.DisplayName);
                document.ReplaceText("[Date]", DateTime.Now.ToShortDateString());
            }

            return(stream);
        }
Ejemplo n.º 29
0
        public ActionResult UpdateState(int conflictId, int newStateId, bool hasCountdown, int countdown)
        {
            var csh = new ConflictStateHistoric()
            {
                IdConflict        = conflictId,
                ConflictStateId   = newStateId,
                ConflictStateName = MetadataHelper.GetEnumDisplayNAme((ConflictState)newStateId),
            };

            if (hasCountdown)
            {
                csh.CountDown = countdown;
            }
            BLLConflicts.AddConflictStateHistoric(csh);
            BLLConflicts.UpdateConflictState(conflictId, newStateId);
            return(RedirectToAction("Conflict", new { conflictId = conflictId }));
        }
Ejemplo n.º 30
0
        public ActionResult RefuseAssignation(int conflictId, string text, string whereFrom)
        {
            var conflict = BLLConflicts.GetConflict(conflictId);

            conflict.State = (int)ConflictState.ArbitrationReady;
            BLLConflicts.UpdateConflict(conflict);
            Guid guid = Guid.NewGuid();

            FastArbitreEmails.ArbitreRefuseAssignation(text, conflictId, User.Identity.FirstName() + " " + User.Identity.LastName(), Url.Action("Index", "Email", new { id = guid.ToString() }, this.Request.Url.Scheme), guid);
            if (whereFrom == "Centre")
            {
                return(RedirectToAction("Centre"));
            }
            else
            {
                return(RedirectToAction("Detail", new { id = User.Identity.GetId() }));
            }
        }