public bool SendMail(CandidateExamBookingDetail candidateExamBookingDetail)
        {
            try
            {
                string message = "";
                //Here we will save data to the database
                DateTime bookedDate = Convert.ToDateTime(candidateExamBookingDetail.BookedDate);
                string   slotname   = db.ExamSlots.Where(s => s.SlotId == candidateExamBookingDetail.SlotId).FirstOrDefault().SlotName;

                string ToEmail = db.CandidateDetails.Where(c => c.CandidateId == candidateExamBookingDetail.CandidateId).FirstOrDefault().Email;
                //check username available
                byte[]    bytes = null;
                MailModel mm    = new Models.MailModel();
                mm.To      = ToEmail;
                mm.From    = "*****@*****.**";
                mm.Body    = "Dear " + candidateExamBookingDetail.CandidateDetail.FirstName + ", <br /> <br />Thank you for booking exam with TADE. <br /><br />Your exam has been booked on " + bookedDate.ToString("dd/MM/yyyy") + " at " + slotname + ".<br /><br /><u>To attend the exam:</u><br /><br />Please read the registration confirmation email for exam details.<br /><br />  Kind Regards <br /> TADE Admin Team";
                mm.Subject = "TADE exam booking confirmation";
                message    = "Exam booking confirmation";
                SendMailBLL sm = new SendMailBLL();
                sm.SendMail(mm, bytes);
                return(true);
            }
            catch (Exception ex)
            {
                return(false);
            }
        }
Exemplo n.º 2
0
        protected override EmptyResponseData ProcessRequest(DTO.Base.APIRequest <ApplyForBuyUnitRP> pRequest)
        {
            var rd   = new EmptyResponseData();
            var para = pRequest.Parameters;

            var     loggingSessionInfo = new SessionManager().CurrentUserLoginInfo;
            var     bllAPCommon        = new APCommonBLL(loggingSessionInfo);
            DataSet dsCustomer         = bllAPCommon.GetCustomerInfo(loggingSessionInfo.ClientID);

            if (dsCustomer.Tables.Count > 0 && dsCustomer.Tables[0].Rows.Count > 0)
            {
                string      strSupportType = "30";
                string      strSubject     = "商户购买门店申请";
                string      strBody        = "申请时间:" + DateTime.Now.ToShortDateString() + "<br/>商户名称:" + dsCustomer.Tables[0].Rows[0]["customer_name"] + "<br/>产品套餐:集客宝" + "<br/>申请人名称:" + loggingSessionInfo.CurrentUser.User_Name + "<br/>购买数量:" + para.ByeUnitCount.ToString();
                SendMailBLL bllSendMail    = new SendMailBLL();
                bllSendMail.SendMail(loggingSessionInfo, strSubject, strBody, strSupportType);

                T_UnitNumApplyOrderBLL    bll    = new T_UnitNumApplyOrderBLL(loggingSessionInfo);
                T_UnitNumApplyOrderEntity entity = new T_UnitNumApplyOrderEntity();
                entity.ApplyUnitNum         = para.ByeUnitCount;
                entity.ApplyUnitsPrice      = para.ApplyUnitsPrice;
                entity.UnitNumLimitConfigId = new Guid(bllAPCommon.GetSysUnitNumLimitConfigId());
                entity.CustomerId           = loggingSessionInfo.ClientID;
                bll.Create(entity);
            }
            return(rd);
        }
Exemplo n.º 3
0
        protected override EmptyResponseData ProcessRequest(DTO.Base.APIRequest <EmptyRequestParameter> pRequest)
        {
            var     rd = new EmptyResponseData();
            var     loggingSessionInfo = new SessionManager().CurrentUserLoginInfo;
            var     bllAPCommon        = new APCommonBLL(loggingSessionInfo);
            DataSet dsCustomer         = bllAPCommon.GetCustomerInfo(loggingSessionInfo.ClientID);

            if (dsCustomer.Tables.Count > 0 && dsCustomer.Tables[0].Rows.Count > 0)
            {
                string      strSupportType = "40";
                string      strSubject     = "商户权限升级申请";
                string      strBody        = "申请时间:" + DateTime.Now.ToShortDateString() + "<br/>商户名称:" + dsCustomer.Tables[0].Rows[0]["customer_name"] + "<br/>产品套餐:集客宝" + "<br/>申请人名称:" + loggingSessionInfo.CurrentUser.User_Name;
                SendMailBLL bllSendMail    = new SendMailBLL();
                bllSendMail.SendMail(loggingSessionInfo, strSubject, strBody, strSupportType);
            }
            return(rd);
        }
Exemplo n.º 4
0
        public bool SendMail(CandidateDetail candidateDetail)
        {
            string message = "";

            //Here we will save data to the database

            //check username available
            byte[]    bytes = null;
            MailModel mm    = new Models.MailModel();

            mm.To      = candidateDetail.Email;
            mm.From    = "*****@*****.**";
            mm.Body    = "Dear " + candidateDetail.FirstName + ", " + MailBody(candidateDetail.ExamId.ToString());
            mm.Subject = "TADE registration confirmation";
            message    = "Confirmation";
            SendMailBLL sm = new SendMailBLL();

            sm.SendMail(mm, bytes);
            return(true);
        }
        public bool SendMail(DrivingTestResult dr)
        {
            string message = "";

            //Here we will save data to the database

            //check username available

            if (dr.Email != null)
            {
                using (StringWriter sw = new StringWriter())
                {
                    using (HtmlTextWriter hw = new HtmlTextWriter(sw))
                    {
                        StringBuilder sb = new StringBuilder();
                        sb.Append("<h1 style='text - align: center; '>TADE EXAM RESULT</h1><p>&nbsp; &nbsp; &nbsp; &nbsp;</p>");
                        sb.Append("<table style='width: 100 % '><tbody><tr><td colspan='2'><h2>APPLICANT DETAILS</h2></td></tr><tr><td>1. FIRST NAME:</td><td>");
                        sb.Append(dr.FirstName);
                        sb.Append("</td></tr><tr><td>2. MIDDLE NAME:</td><td>");
                        sb.Append(dr.MiddleName);

                        sb.Append("</td></tr><tr><td>3. LAST NAME:</td><td>");
                        sb.Append(dr.LastName);

                        sb.Append("</td></tr><tr><td>4. DATE OF BIRTH</td><td>");
                        sb.Append(dr.DateOfBirth);
                        sb.Append("</td></tr><tr><td>5. DRIVING LICENCE No.</td><td>");
                        sb.Append(dr.DrivingLicense);

                        sb.Append("</td></tr><tr><td>6. ADDRESS</td><td>");
                        sb.Append(dr.Address);
                        sb.Append(" </td></tr><tr><td colspan='2'><h2>EXAM DETAILS</h2></td></tr><tr><td>7. REGISTRATION No.</td><td>");
                        sb.Append(dr.ExamId);
                        sb.Append("</td></tr><tr><td>8. IP ADDRESS OF COMPUTER TEST ATTENDED</td><td>");
                        sb.Append(dr.IPAddress);

                        sb.Append("</td></tr><tr><td>9. EXAMINER ID</td><td>");
                        sb.Append("&nbsp;");
                        sb.Append("</td></tr><tr><td>10. TIME OF EXAM</td><td>");
                        sb.Append("&nbsp;");

                        sb.Append("</td></tr><tr><td>11. DURATION OF EXAM</td><td>");
                        sb.Append("&nbsp;");
                        sb.Append(" </td></tr><tr><td>12. EXAM GRADE</td><td>");
                        sb.Append(dr.Grade);

                        sb.Append("</td></tr><tr><td>13. EXAM RESULT VALID TILL</td><td>");
                        sb.Append("&nbsp;");
                        sb.Append(" </td></tr><tr><td>14. COMMENTS</td><td>");
                        sb.Append(dr.Explanation);
                        sb.Append("</td></tr></tbody></table>");


                        StringReader sr         = new StringReader(sb.ToString());
                        Document     pdfDoc     = new Document(PageSize.A4, 10f, 10f, 10f, 0f);
                        HTMLWorker   htmlparser = new HTMLWorker(pdfDoc);
                        using (MemoryStream memoryStream = new MemoryStream())
                        {
                            PdfWriter writer = PdfWriter.GetInstance(pdfDoc, memoryStream);
                            pdfDoc.Open();
                            htmlparser.Parse(sr);
                            pdfDoc.Close();
                            byte[] bytes = memoryStream.ToArray();
                            memoryStream.Close();
                            string thesavePath = Server.MapPath("~/CandidateExamResults") + "\\" + dr.ExamId.ToString() + ".pdf";
                            System.IO.File.WriteAllBytes(thesavePath, bytes);
                            MailModel mm = new Models.MailModel();
                            mm.To      = dr.Email;
                            mm.From    = "*****@*****.**";
                            mm.Body    = "Dear " + dr.FirstName + ", <br /> <br />Congratulations! You have successfully completed TADE exam. Please find attached certificate for future reference. <br /><br /> Kind Regards <br /> TADE Admin Team";
                            mm.Subject = "TADE exam result";
                            message    = "Success";
                            SendMailBLL sm = new SendMailBLL();
                            sm.SendMail(mm, bytes);
                        }
                    }
                }
            }
            else
            {
                message = "Failed!";
            }
            return(true);
        }