private void SendEmail_ConfirmDocument_Updated(ConfirmDocument confirmDoc)
        {
            List <LCStatusRecord> statusRecords = IndentRepository.GetAllConfirmDocumentStatusRecords(confirmDoc.ID).ToList();
            string subject = "LC #" + confirmDoc.ID + " " + (statusRecords.Count() == 1 ? "created" : "updated");

            //IEnumerable<User> users = MembershipService.GetUsersInRole("Finance User");
            IEnumerable <User> users = MembershipService.GetAllUserOfEmailTemplate("ConfirmDocument", "Initial");

            foreach (User u in users.Where(f => !string.IsNullOrWhiteSpace(f.Email)))
            {
                var viewBag = new { User = u, StatusRecords = statusRecords };
                var message = new RazorMailMessage("ConfirmDocument/Initial", confirmDoc, viewBag).Render();
                SendEmail(u.Email, subject, message);
            }
        }
Example #2
0
        private void SendEmail_IndentUpdate(Indent indent)
        {
            List<IndentStatusRecord> statusRecords = IndentRepository.GetIndentStatusRecords(indent.ID).ToList();

            string subject = "Indent no " + indent.IndentNo + " has been " + (statusRecords.Count() == 1 ? "created" : "updated");

            //IEnumerable<User> users = MembershipService.GetUsersInRole("Indent Manager");
            IEnumerable<User> users = MembershipService.GetAllUserOfEmailTemplate("Indent", "Initial");
            foreach (User u in users.Where(m => m.Email != null))
            {
                var viewBag = new { User = u, StatusRecords = statusRecords };
                var message = new RazorMailMessage("Indent/Initial", indent, viewBag).Render();
                SendEmail(u.Email, subject, message);
            }
        }
Example #3
0
        // created
        // updated
        // manager -> general manager
        private void SendEmail_ConsolidateUpdated(Consolidate consolidate)
        {
            List <ConsolidateStatusRecord> statusRecords = IndentRepository.GetConsolidateStatusRecords(consolidate.ID).ToList();

            string subject = statusRecords.Count() == 1
                                 ? "New consolidate (id :" + consolidate.ID + ")"
                                 : "Consolidate updated (id: " + consolidate.ID + ")";

            //IEnumerable<User> users = MembershipService.GetUsersInRole("General Manager");
            IEnumerable <User> users = MembershipService.GetAllUserOfEmailTemplate("Consolidate", "Initial");

            foreach (User u in users.Where(g => !string.IsNullOrWhiteSpace(g.Email)))
            {
                var viewBag = new { User = u, StatusRecords = statusRecords };
                var message = new RazorMailMessage("Consolidate/Initial", consolidate, viewBag).Render();
                SendEmail(u.Email, subject, message);
            }
        }