Пример #1
0
 public int SendMailLog_Insert(SendMailLog obj)
 {
     using (VideosAccess access = new VideosAccess())
     {
         return(access.SendMailLog_Insert(obj));
     }
 }
Пример #2
0
 public int SendMailLog_UpdateById(SendMailLog obj)
 {
     using (VideosAccess access = new VideosAccess())
     {
         return(access.SendMailLog_UpdateById(obj));
     }
 }
Пример #3
0
        public List <SendMailLog> SendMailLog_SelectPage(string cloumns, int pageIndex, int pageSize, string orderBy, string where, out int rowCount)
        {
            DbCommand dbCmd = db.GetStoredProcCommand("Proc_SendMailLog_SelectPage");

            db.AddOutParameter(dbCmd, "@rowCount", DbType.Int32, 4);
            db.AddInParameter(dbCmd, "@cloumns", DbType.String, cloumns);
            db.AddInParameter(dbCmd, "@pageIndex", DbType.Int32, pageIndex);
            db.AddInParameter(dbCmd, "@pageSize", DbType.Int32, pageSize);
            db.AddInParameter(dbCmd, "@orderBy", DbType.String, orderBy);
            db.AddInParameter(dbCmd, "@where", DbType.String, where);
            List <SendMailLog> list = new List <SendMailLog>();

            try
            {
                using (IDataReader reader = db.ExecuteReader(dbCmd))
                {
                    while (reader.Read())
                    {
                        SendMailLog obj = Obj2Model <SendMailLog>(reader);

                        list.Add(obj);
                    }
                    reader.NextResult();
                }
                rowCount = (int)dbCmd.Parameters["@rowCount"].Value;
                return(list);
            }
            catch (Exception e)
            {
                throw new Exception(e.Message);
            }
        }
Пример #4
0
        public static int SendMailLog_UpdateById(SendMailLog obj)
        {
            IVideosService channel = Entity.CreateChannel <IVideosService>(SiteEnum.SiteService.VideoService);
            var            result  = channel.SendMailLog_UpdateById(obj);

            (channel as IDisposable).Dispose();
            return(result);
        }
Пример #5
0
        public int SendMailLog_UpdateById(SendMailLog obj)
        {
            DbCommand dbCmd = db.GetStoredProcCommand("Proc_SendMailLog_UpdateById");

            db.AddInParameter(dbCmd, "@Id", DbType.Int32, obj.Id);
            db.AddInParameter(dbCmd, "@Email", DbType.String, obj.Email);
            db.AddInParameter(dbCmd, "@Title", DbType.String, obj.Title);
            db.AddInParameter(dbCmd, "@SendTime", DbType.String, obj.SendTime);
            db.AddInParameter(dbCmd, "@SendContent", DbType.String, obj.SendContent);
            db.AddInParameter(dbCmd, "@IsSuccess", DbType.Boolean, obj.IsSuccess);
            db.AddInParameter(dbCmd, "@Remark", DbType.String, obj.Remark);
            db.AddInParameter(dbCmd, "@CreateTime", DbType.String, obj.CreateTime);
            try
            {
                int returnValue = db.ExecuteNonQuery(dbCmd);
                return(returnValue);
            }
            catch (Exception e)
            {
                throw new Exception(e.Message);
            }
        }
Пример #6
0
        public ActionResult ReSendMail(int id)
        {
            SendMailLog sInfo = VideoServiceClass.SendMailLog_SelectById(id);

            SentMail.SentMail sm = new SentMail.SentMail();
            sm.Init("*****@*****.**", "账号激活", sInfo.Email, sInfo.SendContent, true);
            string error;
            sm.SentNetMail(out error);

            sInfo.Remark = error;
            sInfo.SendTime = DateTime.Now;

            int result = VideoServiceClass.SendMailLog_UpdateById(sInfo);

            if (result > 0)
            {
                return Json(new { success = true, errors = new { text = "删除成功" } });
            }
            else
            {
                return Json(new { success = false, errors = new { text = "删除失败" } });
            }
        }
Пример #7
0
        public SendMailLog SendMailLog_SelectById(int Id)
        {
            DbCommand dbCmd = db.GetStoredProcCommand("Proc_SendMailLog_SelectById");

            db.AddInParameter(dbCmd, "@Id", DbType.Int32, Id);
            SendMailLog obj = null;

            try
            {
                using (IDataReader reader = db.ExecuteReader(dbCmd))
                {
                    while (reader.Read())
                    {
                        obj = Obj2Model <SendMailLog>(reader);
                    }
                }
                return(obj);
            }
            catch (Exception e)
            {
                throw new Exception(e.Message);
            }
        }
Пример #8
0
        /// <summary>
        /// Sends the mail.
        /// </summary>
        /// <param name="engine">The engine.</param>
        /// <param name="workItems">The work items.</param>
        public void SendMail(EPiMailEngine engine, JobWorkItems workItems, bool isTestSend)
        {
            if (_log.IsDebugEnabled())
            {
                _log.Debug("Starting send process. Testmode: " + isTestSend.ToString());
            }

            // First we verify the environment
            if (VerifyEnvironment(engine) == false)
            {
                return;
            }

            // Collection of recipients from job
            if (workItems == null)
            {
                throw new NullReferenceException("workItems cannot be null when sending newsletter");
            }

            if (workItems.Items.Count == 0)
            {
                ShowError("No recipients defined. Please add email addresses to textbox above Test Send button.");
                return;
            }

            // Need default values
            // 1. Use MailSender property
            // 2. Use EPsSendMailFromAddress from web.config
            // 3. Construct newsletter@<sitename>
            string fromAddress = MailFrom;

            // 1. Use MailSubject property
            // 2. Use EPsSendMailSubject from web.config
            // 3. Use "Newsletter" as default
            string subject = MailSubject;

            if (isTestSend)
            {
                subject += TEST_SUBJECT_POSTFIX;
            }

            if (_log.IsDebugEnabled())
            {
                _log.Debug(string.Format("Start sending newsletter based on WorkItems. Subject: '{0}', From: '{1}', Count '{2}', Test Mode: '{3}'",
                                         subject, fromAddress, workItems.Items.Count.ToString(), isTestSend.ToString()));
            }

            // Send the message
            string sendStatus;
            // We set testsend as false in the method below, as the test sending UI has changed, but the
            // logic in the engine interpret this as not sending anything. Test here means change the
            // email subject
            SendMailLog log = engine.SendNewsletter(subject, fromAddress, CurrentPage.ContentLink, workItems, false);

            sendStatus = log.GetClearTextLogString(true);

            lblSendResult.Text    = sendStatus;
            pnlSendResult.Visible = true;

            if (_log.IsDebugEnabled())
            {
                _log.Debug("Send process finished. Testmode: " + isTestSend.ToString());
            }
        }