Exemplo n.º 1
0
        public ActionResult Reject(RejectViewModel model)
        {
            var report = _reportLogic.GetById(model.Id);

            report.PPKComment += "<br /><b>Komentar Admin</b>";
            report.PPKComment += model.StaffComment;
            report.Status      = Constant.ReportStatus.ONPROCESS;
            report.ClosedDate  = null;
            _reportLogic.Edit(report);


            try
            {
                var ppk = _ppkLogic.GetById(report.PPKId.Value);

                if (ppk != null)
                {
                    if (ppk.PIC != null)
                    {
                        var msg = new MailMessage();
                        msg.To.Add(new MailAddress(ppk.PIC.Email));
                        msg.Subject = "LAPOR-BRANTAS Rejected Report";
                        msg.Body    = model.StaffComment;
                        msg.From    = new MailAddress("*****@*****.**");

                        using (var client = new SmtpClient()
                        {
                            Host = "relay-hosting.secureserver.net", Port = 25, EnableSsl = false, UseDefaultCredentials = false
                        })
                        {
                            client.Send(msg);
                        }
                    }
                }
            }
            catch (Exception ex)
            {
            }

            return(RedirectToAction("Index"));
        }
Exemplo n.º 2
0
        public void ReportLogic_EditReport_SuccessfullDone()
        {
            Mock <IReportDAO> mockDAO = new Mock <IReportDAO>();

            mockDAO.Setup(t => t.Edit(It.IsAny <Report>())).Verifiable();

            ReportLogic logic         = new ReportLogic(mockDAO.Object, Mock.Of <IUserDAO>(), Mock.Of <ICustomLogger>());
            Report      correctReport = ReportProvider.GetCorrectInternsReport();

            logic.Edit(correctReport);

            mockDAO.VerifyAll();
        }