コード例 #1
0
        private string BuildBodyMailForQuotaNotification(Pbck1Dto pbck1Data, string webRootUrl, QUOTA_MONITORING dataMonitoring)
        {
            var bodyMail = new StringBuilder();
            var supplier = dataMonitoring.SUPPLIER_WERKS;

            bodyMail.Append("<table><tr><td>PBCK1 Number </td><td>: " + pbck1Data.Pbck1Number + "</td></tr>");
            bodyMail.Append("<tr><td>NPPBKC Destination </td><td>: " + dataMonitoring.NPPBKC_ID + "</td></tr>");



            bodyMail.Append("<tr><td>Plant & NPPBKC Supplier </td><td>: " + supplier + " - " +
                            dataMonitoring.SUPPLIER_NPPBKC_ID + "</td></tr>");

            //bodyMail.Append("<tr><td>Total Qty Approved </td><td>: " +
            //                ConvertHelper.ConvertDecimalToStringMoneyFormat(pbck1Data.QtyApproved) + " " + pbck1Data.RequestQtyUomName + "</td></tr>");
            //bodyMail.Append("<tr><td>Total Quota Qty Used </td><td>: " +
            //                ConvertHelper.ConvertDecimalToStringMoneyFormat(quotaDetail.QtyCk5) + " " + pbck1Data.RequestQtyUomName + "</td></tr>");
            //bodyMail.Append("<tr><td>Total Quota Qty Remain </td><td>: " +
            //                ConvertHelper.ConvertDecimalToStringMoneyFormat(quotaDetail.RemainQuota) + " " + pbck1Data.RequestQtyUomName + "</td></tr>");

            string userName = "";

            var creator = _pbck1BLL.GetPbck1Creator(pbck1Data.Pbck1Id);

            userName = creator.LAST_NAME + ", " + creator.FIRST_NAME;



            bodyMail.Append("<tr><td>Creator</td><td> : " + userName + "</td></tr>");

            var poa = _pbck1BLL.GetPbck1POA(pbck1Data.Pbck1Id);

            userName = poa.LAST_NAME + ", " + poa.FIRST_NAME;
            bodyMail.Append("<tr><td>POA Approver</td><td> : " + userName + "</td></tr>");



            bodyMail.Append("<tr colspan='2'><td><i>To VIEW, Please click this <a href='" + webRootUrl + "/PBCK1/QuotaMonitoring/" + dataMonitoring.MONITORING_ID + "'><u>link</u></a> to view detailed information</i></td></tr>");



            bodyMail.Append("</table>");
            bodyMail.AppendLine();
            bodyMail.Append("<br />Regards,<br />");

            return(bodyMail.ToString());
        }
コード例 #2
0
        private MailNotification ProcessEmailQuotaNotification(QUOTA_MONITORING data, out Pbck1Dto pbck1Data, List <string> goodTypeList)
        {
            var bodyMail = new StringBuilder();
            var rc       = new MailNotification();



            var toUserIdList       = data.QUOTA_MONITORING_DETAIL.Where(x => x.ROLE_ID != (int)Core.Enums.UserRole.Controller).Select(x => x.USER).ToList();
            var ccControllerIdList = data.QUOTA_MONITORING_DETAIL.Where(x => x.ROLE_ID == (int)Core.Enums.UserRole.Controller).Select(x => x.USER).ToList();

            var webRootUrl = ConfigurationManager.AppSettings["WebRootUrl"];

            if (data.EX_GROUP_TYPE == (int)Core.Enums.ExGoodsType.HasilTembakau)
            {
                pbck1Data =
                    _pbck1BLL.GetPbck1CompletedDocumentByPlantAndSubmissionDate(data.SUPPLIER_WERKS,
                                                                                data.SUPPLIER_NPPBKC_ID,
                                                                                DateTime.Now, data.NPPBKC_ID, goodTypeList).LastOrDefault();
            }
            else
            {
                pbck1Data =
                    _pbck1BLL.GetPbck1CompletedDocumentByExternalAndSubmissionDate(data.SUPPLIER_WERKS,
                                                                                   data.SUPPLIER_NPPBKC_ID,
                                                                                   DateTime.Now, data.NPPBKC_ID, goodTypeList).LastOrDefault();
            }


            rc.Subject = "PBCK-1  Quota is currently below " + data.WARNING_LEVEL + "% of Approved Qty.";
            bodyMail.Append("Dear Team,<br />");

            bodyMail.Append("Kindly be informed, " + rc.Subject + ". <br />");

            bodyMail.Append(BuildBodyMailForQuotaNotification(pbck1Data, webRootUrl, data));

            rc.To.AddRange(toUserIdList.Select(x => x.EMAIL).ToList());

            rc.Body = bodyMail.ToString();
            foreach (var controller in ccControllerIdList)
            {
                rc.IsCCExist = true;
                rc.CC.Add(controller.EMAIL);
            }

            return(rc);
        }