Example #1
0
        public void updateReorderItemGF(ReorderItem ri)
        {
            reorderItem r = ctx.reorderItems.FirstOrDefault(o => o.reorderId == ri.ReorderItemId);
            r.status = ri.Status;
            r.rejectReason = ri.RejectReason;
            ctx.SaveChanges();

            if (ri.Status == "Rejected")
            {
                UserFacade userFacade = new UserFacade();
                user us = userFacade.getUser_Lingna(ri.UserId);

                string subject = "Purchase reorder Rejected";

                string bodyStart = "<HTML>"
                              + "<HEAD>"
                              + "</HEAD>"
                              + "<BODY>"
                              + "<BR/>"
                              + "<P>Dear ";

                string body = ",</P><BR/><P>The purchase reorder you submitted with ID : " + ri.ReorderItemId + ", has been rejected.</P>"
                    + "<BR/><P>Reject Reason : " + ri.RejectReason + "</P>";

                body = body
                    + "<BR/>"
                    + "<P>From,</P>"
                    + "<P>SSIS.</P>"
                    + "</BODY>"
                    + "</HTML>";

                NotifyUserController notifyUserController = new NotifyUserController();
                notifyUserController.sendEmail(us.email, subject, bodyStart + us.name + body);
            }
        }
Example #2
0
        public void updateDiscrepancyStatusGF(Discrepancy dis)
        {
            discrepancy d = ctx.discrepancies.FirstOrDefault( o => o.discrepancyId == dis.DiscrepancyId);
            d.status = dis.Status;
            d.rejectReason = dis.RejectReason;
            d.approveDate = dis.ApproveDate;
            ctx.SaveChanges();

            if (dis.Status == "Rejected")
            {
                UserFacade userFacade = new UserFacade();
                user us = userFacade.getUser_Lingna(dis.UserId);

                string subject = "Discrepency Rejected";

                string bodyStart = "<HTML>"
                              + "<HEAD>"
                              + "</HEAD>"
                              + "<BODY>"
                              + "<BR/>"
                              + "<P>Dear ";

                string body = ",</P><BR/><P>The discrepency you submitted with ID : " + dis.DiscrepancyId + ", has been rejected.</P>"
                    + "<BR/><P>Reject Reason : " + dis.RejectReason + "</P>";

                body = body
                    + "<BR/>"
                    + "<P>From,</P>"
                    + "<P>SSIS.</P>"
                    + "</BODY>"
                    + "</HTML>";

                NotifyUserController notifyUserController = new NotifyUserController();
                notifyUserController.sendEmail(us.email, subject, bodyStart + us.name + body);
            }
        }