예제 #1
0
        public async Task <ActionResult <EmailList> > PostEmailList(EmailList emailList)
        {
            _context.EmailLists.Add(emailList);
            await _context.SaveChangesAsync();

            return(CreatedAtAction("GetEmailList", new { id = emailList.Id }, emailList));
        }
예제 #2
0
        public async Task <IActionResult> PutEmailList(int id, EmailList emailList)
        {
            if (id != emailList.Id)
            {
                return(BadRequest());
            }

            _context.Entry(emailList).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!EmailListExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(NoContent());
        }
예제 #3
0
        public IActionResult NewsletterRegistration()
        {
            //Code needed for adding emails to the email list
            EmailList el = new EmailList();

            el.EmailListID = Guid.NewGuid().GetHashCode();
            el.Email       = HttpContext.Request.Form["newsletterRegister"].ToString();
            if (el.Email.ToString().IndexOf("@") != -1 && el.Email.ToString().IndexOf(".") != -1 &&
                !el.Email.Equals("") && el.Email.ToString().IndexOf(";") == -1 &&
                el.Email.ToString().IndexOf("(") == -1 && el.Email.ToString().IndexOf(")") == -1 &&
                el.Email.ToString().IndexOf(",") == -1 && el.Email.ToString().IndexOf("'") == -1 &&
                el.Email.ToString().IndexOf(":") == -1)
            {
                foreach (var email in _context.EmailList)
                {
                    if (el.Email.ToString().Equals(email.Email))
                    {
                        HttpContext.Session.SetString(NewsletterResult, "Subscription failed, email is already subscribed");
                        return(RedirectToAction("Index"));
                    }
                }
                el.SaveDetails();
                HttpContext.Session.SetString(NewsletterResult, "Subscription Successful");
                return(RedirectToAction("Index"));
            }
            else
            {
                HttpContext.Session.SetString(NewsletterResult, "Subscription failed, please ensure your email is correct");
                return(RedirectToAction("Index"));
            }
        }
예제 #4
0
        public async Task <IActionResult> ResendEmail([FromQuery] string e)
        {
            IActionResult result;

            if (!string.IsNullOrEmpty(e))
            {
                EmailList emailListItem = await _emailListRepository.GetEntityByEmailAsync(e);

                if (emailListItem != null && await SendEmailMessage(this.HttpContext, emailListItem.Id, e))
                {
                    result = Json(new { Status = "Success", Email = e, Message = "Email send successful." });
                }
                else if (emailListItem == null)
                {
                    result = Json(new { Status = "Failure", Email = e, Message = "Unable to find email in database." });
                }
                else
                {
                    result = Json(new { Status = "Failure", Email = e, Message = "Failure to send email message." });
                }
            }
            else
            {
                result = Json(new { Status = "Failure", Email = e, Message = "Query string was empty, no email provided." });
            }

            return(result);
        }
예제 #5
0
        public void testList010()
        {
            EmailList el = new EmailList();

            // Using the generic "Wrap" API so that we can use this
            // test against any internationalized version of the ADK
            Email email1 = new Email(EmailType.Wrap("foo"), "*****@*****.**");
            Email email2 = new Email(EmailType.Wrap("foo"), "*****@*****.**");

            el.Add(email1);
            Assert.AreEqual(1, el.ChildCount, "Should have 1 email");

            el.Add(email2);
            Assert.AreEqual(2, el.ChildCount, "Should have 2 emails");

            Email[] children = el.ToArray();
            Assert.AreEqual(2, children.Length, "Should have 2 array elements");

            el.RemoveChild(email2);
            Assert.AreEqual(1, el.ChildCount, "Should have 1 email");

            el.RemoveChild(email1);
            Assert.AreEqual(0, el.ChildCount, "Should have 0 emails");

            children = el.ToArray();
            Assert.AreEqual(0, children.Length, "Should have 0 array elements");
        }
예제 #6
0
 private void ExecuteNewCommand()
 {
     new EmailView().Show();
     Messenger.Default.Send(new NotificationMessageAction <EmailItem>(null, item => {
         EmailList.Add(item);
     }), "email");
 }
예제 #7
0
        public void testList010()
        {
            EmailList el = new EmailList();

            // Using the generic "Wrap" API so that we can use this
            // test against any internationalized version of the ADK
            Email email1 = new Email(EmailType.Wrap("foo"), "*****@*****.**");
            Email email2 = new Email(EmailType.Wrap("foo"), "*****@*****.**");

            el.Add(email1);
            Assert.AreEqual(1, el.ChildCount, "Should have 1 email");

            el.Add(email2);
            Assert.AreEqual(2, el.ChildCount, "Should have 2 emails");

            Email[] children = el.ToArray();
            Assert.AreEqual(2, children.Length, "Should have 2 array elements");

            el.RemoveChild(email2);
            Assert.AreEqual(1, el.ChildCount, "Should have 1 email");

            el.RemoveChild(email1);
            Assert.AreEqual(0, el.ChildCount, "Should have 0 emails");

            children = el.ToArray();
            Assert.AreEqual(0, children.Length, "Should have 0 array elements");
        }
예제 #8
0
        /// <summary>
        /// 添加记录
        /// </summary>
        /// <param name="emailList">实体类</param>
        /// <param name="delCache">添加成功后清理的CACHE key,支持正则</param>
        /// <param name="dbkey">存在数据库连接池中的连接key,为空时使用ConnString连接</param>
        /// <returns>添加是否成功</returns>
        public static bool Insert(EmailList emailList, string dbkey = "", string[] delCache = null)
        {
            int obj = new SQL().Database(dbkey).Insert(EmailList._)
                      .ValueP(EmailList._EmailAddress, emailList.EmailAddress)
                      .ValueP(EmailList._NickName, emailList.NickName)
                      .ValueP(EmailList._LastSendStatus, emailList.LastSendStatus)
                      .ValueP(EmailList._LastSendError, emailList.LastSendError)
                      .ValueP(EmailList._LastSendTime, emailList.LastSendTime)
                      .ValueP(EmailList._LastSendSmtp, emailList.LastSendSmtp)
                      .ValueP(EmailList._SendCount, emailList.SendCount)
                      .ValueP(EmailList._CreateTime, emailList.CreateTime)
                      .ValueP(EmailList._ex0, emailList.ex0)
                      .ValueP(EmailList._ex1, emailList.ex1)
                      .ValueP(EmailList._ex2, emailList.ex2)
                      .ValueP(EmailList._ex3, emailList.ex3)
                      .ValueP(EmailList._ex4, emailList.ex4)
                      .ValueP(EmailList._ex5, emailList.ex5)
                      .ValueP(EmailList._ex6, emailList.ex6)
                      .ValueP(EmailList._ex7, emailList.ex7)
                      .ValueP(EmailList._ex8, emailList.ex8)
                      .ToExec();

            if (delCache.IsNull())
            {
                return(obj == 1);
            }
            Cache2.Remove("TH.Mailer.EmailListCache_", delCache);
            return(obj == 1);
        }
예제 #9
0
 public void Add()
 {
     using (EmailListDbContext db = new EmailListDbContext())
     {
         try
         {
             EmailList emaillist = new EmailList()
             {
                 List_Name = listname,
                 List_Dtls = listdetails,
                 Eml_Id    = emailid,
                 Emlist_Id = emaillistid,
                 U_Id      = userid
             };
             db.EmailLists.Add(emaillist);
             db.SaveChangesAsync();
             ProecessSuccess?.Invoke(null, null);
         }
         catch (Exception ex)
         {
             ProcessFailDelegate Failed = ProcessFail;
             Failed?.Invoke("Failed" + Environment.NewLine + ex.ToString());
         }
     }
 }
예제 #10
0
 public void Update()
 {
     using (EmailListDbContext db = new EmailListDbContext())
     {
         EmailList emaillist = db.EmailLists.Where(x => x.U_Id == userid && x.Emlist_Id == emaillistid).FirstOrDefault();
         try
         {
             if (listname != emaillist.List_Name)
             {
                 emaillist.List_Name = listname;
             }
             else if (listdetails != emaillist.List_Dtls)
             {
                 emaillist.List_Dtls = listdetails;
             }
             else if (emailid != emaillist.Eml_Id)
             {
                 emaillist.Eml_Id = emailid;
             }
             db.SaveChanges();
             ProecessSuccess?.Invoke(null, null);
         }
         catch (Exception ex)
         {
             ProcessFailDelegate Failed = ProcessFail;
             Failed?.Invoke("Failed" + Environment.NewLine + ex.ToString());
         }
     }
 }
예제 #11
0
 protected void CheckedOut(object sender, CheckedOutEventArgs e)
 {
     // MAILING LIST SIGNUP
     if (EmailListsPanel.Visible && EmailLists.Items.Count > 0)
     {
         string            email      = string.IsNullOrEmpty(AbleContext.Current.User.Email) ? AbleContext.Current.User.PrimaryAddress.Email : AbleContext.Current.User.Email;
         int               listIndex  = 0;
         IList <EmailList> emailLists = GetPublicEmailLists();
         if (emailLists != null && emailLists.Count > 0)
         {
             foreach (ListViewDataItem item in EmailLists.Items)
             {
                 EmailList list     = emailLists[listIndex];
                 CheckBox  selected = (CheckBox)item.FindControl("Selected");
                 if (selected != null)
                 {
                     if (selected.Checked)
                     {
                         list.ProcessSignupRequest(email);
                     }
                     else
                     {
                         list.RemoveMember(email);
                     }
                 }
                 else
                 {
                     list.RemoveMember(email);
                 }
                 listIndex++;
             }
         }
     }
 }
        public void Send(IUserProfile userProfile, string baseUrl, Guid?websiteId)
        {
            int num;

            baseUrl = baseUrl.TrimEnd(new char[] { '/' });
            SiteContext.AllowForAdmin();
            bool    flag           = userProfile is AdminUserProfile;
            string  str            = (flag ? AdminUserNameHelper.AddPrefix(userProfile.UserName) : userProfile.UserName);
            dynamic expandoObjects = new ExpandoObject();

            expandoObjects.UserName      = userProfile.GetDisplayName();
            expandoObjects.UserEmail     = userProfile.UserName;
            expandoObjects.ActivationUrl = string.Concat(baseUrl, this.AuthenticationService.GeneratePasswordResetUrl(str, false));
            dynamic obj = expandoObjects;

            num = (flag ? this.ConsoleSecuritySettings.EmailedPasswordLinkValidForDays : this.StorefrontSecuritySettings.EmailedPasswordLinkValidForDays);
            obj.ActivationUrlExpirationInDays = num;
            expandoObjects.ContentBaseUrl     = baseUrl;
            string    str1           = string.Concat((flag ? "Admin" : "Website"), "_AccountActivation");
            EmailList orCreateByName = this.UnitOfWork.GetTypedRepository <IEmailListRepository>().GetOrCreateByName(str1, "Insite Commerce Account Activation", "");

            this.EmailService.SendEmailList(orCreateByName.Id, userProfile.Email, expandoObjects, string.Empty, this.UnitOfWork, websiteId);
            if (userProfile.ActivationStatus == UserActivationStatus.EmailNotSent.ToString())
            {
                userProfile.ActivationStatus = UserActivationStatus.EmailSent.ToString();
            }
            userProfile.LastActivationEmailSentOn = new DateTimeOffset?(DateTimeProvider.Current.Now);
            this.UnitOfWork.Save();
        }
        protected void SendOrderCancellationEmail(IUnitOfWork unitOfWork, CustomerOrder cart)
        {
            dynamic expandoObjects = new ExpandoObject();

            this.PopulateOrderEmailModel(expandoObjects, cart, unitOfWork);
            EmailList     orCreateByName = unitOfWork.GetTypedRepository <IEmailListRepository>().GetOrCreateByName("OrderCancellation", "Order Cancellation");
            List <string> list           = BuildEmailValues(cart.Id, unitOfWork).Split(new char[] { ',' }).ToList <string>();
            EmailList     emailList      = unitOfWork.GetRepository <EmailList>().GetTable().Expand((EmailList x) => x.EmailTemplate).FirstOrDefault((EmailList x) => x.Id == orCreateByName.Id);

            if (emailList != null)
            {
                SendEmailParameter sendEmailParameter = new SendEmailParameter();
                CustomSettings     customSettings     = new CustomSettings();
                string             htmlTemplate       = GetHtmlTemplate(emailList);
                sendEmailParameter.Body = this.EmailService.Value.ParseTemplate(htmlTemplate, expandoObjects);
                string defaultEmailAddress = customSettings.DefaultEmailAddress;
                string approverEmail       = SiteContext.Current.IsUserInRole("Administrator") ? SiteContext.Current.UserProfileDto.Email : !string.IsNullOrEmpty(cart.ApproverUserProfile.Email) ? cart.ApproverUserProfile.Email : defaultEmailAddress;// BUSA-625 : To Add Reject Button to order Approve page. If Admin rejects the order, then Admin email's address should be in From address.
                sendEmailParameter.Subject            = emailList.Subject;
                sendEmailParameter.ToAddresses        = list;
                sendEmailParameter.FromAddress        = approverEmail;
                sendEmailParameter.ReplyToAddresses   = new List <string>();
                sendEmailParameter.ExtendedProperties = new NameValueCollection();
                this.EmailService.Value.SendEmail(sendEmailParameter, unitOfWork);
            }
        }
예제 #14
0
 public ActionResult ForgotPassword(string email)
 {
     if (String.IsNullOrEmpty(email))
     {
         ModelState.AddModelError("", "Bạn chưa nhập email.");
         return View();
     }
     var user = UserService.GetByEmail(email);
     if (user == null)
     {
         ModelState.AddModelError("", "Email bạn nhập sai định dạng hoặc không có trong hệ thống.");
         return View();
     }
     user.Password = "******";
     long stt = UserService.Save(user);
     //    Kiểm tra status  + Hàm gởi mail ở đây.
     if (stt > 0)
     {
         EmailList _email = new EmailList();
         _email.Email = email;
         _email.TitleExt = "Camerashop - Phục hồi mật khẩu";
         _email.BodyExt = "Mật khẩu mới của bạn là: 123456, vui lòng thay đổi mật khẩu sau khi đăng nhập";
         MvcApplication.EmailQueue.Add(_email);
     }
     return View();
 }
예제 #15
0
        public ActionResult SaveOrEdit(EmailList emaillist)
        {
            if (ModelState.IsValid)
            {
                if (emaillist.Id == 0)
                {
                    EmailListRepository.Add(emaillist);
                }
                else
                {
                    EmailListRepository.Edit(emaillist);
                }
                EmailListRepository.Save();

                if (IsSuperAdmin)
                {
                    return(RedirectToAction("Index", new { storeId = emaillist.StoreId }));
                }
                else
                {
                    return(RedirectToAction("Index"));
                }
            }
            return(View(emaillist));
        }
        private void chkTrustees_CheckedChanged(object sender, EventArgs e)
        {
            if (dgCustomers.Rows.Count > 0)
            {
                foreach (DataGridViewRow dvr in dgCustomers.Rows)
                {
                    EmailList dataRow  = dvr.DataBoundItem as EmailList;
                    Customer  customer = customers.SingleOrDefault(c => c.accNumber == dataRow.AccNumber);


                    if (customer != null && customer.IsTrustee)
                    {
                        if (chkTrustees.Checked == false)
                        {
                            dvr.Cells[3].Value = false;
                        }
                        else
                        {
                            dvr.Cells[3].Value = customer.IsTrustee;
                        }
                    }
                    else
                    {
                        dvr.Cells[3].Value = false;
                    }
                }
            }
        }
        public IHttpActionResult PutEmailList(int id, EmailList emailList)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != emailList.EmailListID)
            {
                return(BadRequest());
            }

            db.Entry(emailList).State = EntityState.Modified;

            try
            {
                db.SaveChanges();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!EmailListExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(StatusCode(HttpStatusCode.NoContent));
        }
예제 #18
0
        public ActionResult DeleteConfirmed(int id)
        {
            EmailList emaillist = EmailListRepository.GetSingle(id);

            if (emaillist == null)
            {
                return(HttpNotFound());
            }
            try
            {
                EmailListRepository.Delete(emaillist);
                EmailListRepository.Save();

                if (IsSuperAdmin)
                {
                    return(RedirectToAction("Index", new { storeId = emaillist.StoreId }));
                }
                else
                {
                    return(RedirectToAction("Index"));
                }
            }
            catch (Exception ex)
            {
                Logger.Error(ex, "Unable to delete:" + emaillist, ex);
                ModelState.AddModelError("", "Unable to save changes. Try again, and if the problem persists see your system administrator.");
            }

            return(View(emaillist));
        }
예제 #19
0
        public async Task <EmailListResponseModel> AddEmailList(EmailList еmailListAdd, EmailListRequestModel requestEmailList)
        {
            using (DbContextTransaction transaction = db.Database.BeginTransaction())
            {
                еmailListAdd.EmailListName = requestEmailList.EmailListName;

                if (requestEmailList.Contacts != null)
                {
                    еmailListAdd.Contacts.Clear();
                    foreach (Guid guid in requestEmailList.Contacts)
                    {
                        var contacts = await db.Contacts.FirstOrDefaultAsync(x => x.GuID == guid);

                        if (contacts != null)
                        {
                            еmailListAdd.Contacts.Add(contacts);
                        }
                    }
                }
                try
                {
                    db.EmailLists.AddOrUpdate(еmailListAdd);
                    await db.SaveChangesAsync();

                    transaction.Commit();
                }
                catch
                {
                    transaction.Rollback();
                    throw;
                }
                return(factory.CreateEmailResponseModel(еmailListAdd));
            }
        }
예제 #20
0
        public async Task <EmailListResponseModel> RemoveAtEmailList(EmailList еmailListForAddOrUpdate, List <Guid> guidList)
        {
            using (DbContextTransaction transaction = db.Database.BeginTransaction())
            {
                //еmailListForAddOrUpdate.EmailListName = guidList.EmailListName;
                if (guidList.Count != 0)
                {
                    foreach (Guid guid in guidList)
                    {
                        var contacts = await db.Contacts.FirstOrDefaultAsync(x => x.GuID == guid);

                        if (contacts != null)
                        {
                            еmailListForAddOrUpdate.Contacts.Remove(contacts);
                        }
                    }
                }
                try
                {
                    await db.SaveChangesAsync();

                    transaction.Commit();
                }
                catch
                {
                    transaction.Rollback();
                    throw;
                }

                return(factory.CreateEmailResponseModel(еmailListForAddOrUpdate));
            }
        }
예제 #21
0
        // Adds new mail into the JSON file so it appears in the inbox.
        public static void AddMail(string src, string dst, string dt, string sbjt, string bdy)
        {
            string domain = "";//init

            if (BootOptions.enableNetworking == true)
            {
                //break up parts of the sender's email
                if (src.Contains("@"))
                {
                    string[] breakUpEmail = src.Split('@');
                    domain = breakUpEmail[1]; //grab domain after the @ symbol
                }
                //If the email source hasn't been blocked on the firewall
                if (Class_Firewall.blockedDomains.Contains(domain) == false)
                {
                    EmailStruct newMail = new EmailStruct
                    {
                        // Creates a new email with the passed in values.
                        Source      = src,
                        Destination = dst,
                        Date        = dt,
                        Subject     = sbjt,
                        Body        = bdy
                    };

                    //Then we add the new email to the inbox.
                    EmailList.Add(newMail);
                    Desktop_BKEND.Notification("You've got mail!");
                }
            }
        }
예제 #22
0
        public void testSetChildren()
        {
            StudentPersonal sp     = ObjectCreator.CreateStudentPersonal();
            Email           email1 = new Email(EmailType.PRIMARY, "*****@*****.**");
            Email           email2 = new Email(EmailType.ALT1, "*****@*****.**");

            sp.EmailList = new EmailList();
            sp.EmailList.SetChildren(CommonDTD.EMAIL, new Email[] { email1, email2 });

            EmailList studentEmails = sp.EmailList;

            Assert.AreEqual(2, studentEmails.ChildCount, "Should be two emails");

            studentEmails.SetChildren(CommonDTD.EMAIL, new Email[0]);
            studentEmails = sp.EmailList;
            Assert.AreEqual(0, studentEmails.ChildCount, "Should be zero emails after setting empty array");

            studentEmails.SetChildren(CommonDTD.EMAIL, new Email[] { email1, email2 });
            studentEmails = sp.EmailList;
            Assert.AreEqual(2, studentEmails.ChildCount, "Should be two emails");

            studentEmails.SetChildren(CommonDTD.EMAIL, null);
            studentEmails = sp.EmailList;
            Assert.AreEqual(0, studentEmails.ChildCount, "Should be zero emails after setting null");
        }
예제 #23
0
        protected void Page_Load(object sender, EventArgs e)
        {
            _EmailListId = AlwaysConvert.ToInt(Request.QueryString["EmailListId"]);
            _EmailList   = EmailListDataSource.Load(_EmailListId);
            if (_EmailList == null)
            {
                Response.Redirect("Default.aspx");
            }
            if (!Page.IsPostBack)
            {
                Caption.Text = string.Format(Caption.Text, _EmailList.Name);
                EmailListUsersCaption.Text = string.Format(EmailListUsersCaption.Text, _EmailList.Name);
                SearchUsersGrid.Visible    = false;
                if (Request.UrlReferrer.AbsolutePath.EndsWith("ManageList.aspx"))
                {
                    FinishLink.NavigateUrl = "ManageList.aspx?EmailListId=" + _EmailListId;
                }
            }

            AlphabetRepeater.DataSource = GetAlphabetDS();
            AlphabetRepeater.DataBind();
            AbleCommerce.Code.PageHelper.SetDefaultButton(SearchEmail, SearchButton.ClientID);
            IList <Group> storeGroups = GroupDataSource.LoadAll();

            SearchGroup.DataSource     = storeGroups;
            SearchGroup.DataTextField  = "Name";
            SearchGroup.DataValueField = "GroupId";
            SearchGroup.DataBind();
        }
예제 #24
0
        public async Task <IActionResult> ValidateEmail([FromQuery] string e, [FromQuery] string v)
        {
            _logger.LogDebug($"{GetType().Name}.{nameof(ValidateEmail)}-Get method called...");

            IActionResult result = View();

            if (!string.IsNullOrEmpty(e) && !string.IsNullOrEmpty(v))
            {
                EmailList emailItem = await _emailListRepository.GetEntityByEmailAsync(e);

                if (emailItem != null &&
                    emailItem.Email.Equals(e, StringComparison.InvariantCultureIgnoreCase) &&
                    emailItem.Id.ToString().Equals(v, StringComparison.InvariantCultureIgnoreCase))
                {
                    emailItem.IsValidated = true;
                    _emailListRepository.Update(emailItem);
                    _unitOfWork.Save();

                    this.HttpContext.Session.Set("Email", Encoding.UTF8.GetBytes(emailItem.Email));

                    result = Redirect($"/Home/ThankYou");
                }
            }
            else if (!string.IsNullOrEmpty(e))
            {
                if (!string.IsNullOrEmpty(e))
                {
                    EmailList emailItem = _emailListRepository.GetEntityByEmail(e);
                    this.HttpContext.Session.Set("Email", Encoding.UTF8.GetBytes(emailItem.Email));
                }
            }

            return(result);
        }
예제 #25
0
        public void testList020()
        {
            EmailList el = new EmailList();

            // Using the generic "Wrap" API so that we can use this
            // test against any internationalized version of the ADK
            Email email1 = new Email( EmailType.Wrap( "asdfasdf" ), "*****@*****.**" );
            Email email2 = new Email( EmailType.Wrap( "Primary" ), "*****@*****.**" );

            el.Add(email1);
            Assert.AreEqual(1, el.ChildCount, "Should have 1 email");

            el.Add(email2);
            Assert.AreEqual(2, el.ChildCount, "Should have 2 emails");

            Email email3 = new Email();
            email3.Type = "Alternate1";
            el.Add(email3);
            Assert.AreEqual(3, el.ChildCount, "Should have 3 emails");

            Email primary = el[EmailType.PRIMARY];
            Assert.IsNotNull( primary );

            primary = el["Primary"];
            Assert.IsNotNull(primary);

            Email secondary = el[EmailType.ALT1];
            Assert.IsNotNull(secondary);

            secondary = el["Alternate1"];
            Assert.IsNotNull(secondary);
        }
예제 #26
0
        void CreateThunderbirdContactItem(string name, EmailList emails)
        {
            int emailCount = emails.Count;

            ThunderbirdEmail[] sortedEmails = new ThunderbirdEmail[emailCount];

            int i = 0;

            foreach (string key in emails.Keys)
            {
                sortedEmails [i] = new ThunderbirdEmail(key, emails [key]);
                i++;
            }
            Array.Sort(sortedEmails, (x, y) => (int)(y.popularity - x.popularity));

            ContactItem contact = ContactItem.Create(name);

            for (i = 0; i < emailCount; i++)
            {
                string detail = THUNDERBIRD_EMAIL + "." + i;
                contact [detail] = sortedEmails [i].email;
            }

            if (!contacts.ContainsKey(name.ToLower()))
            {
                contacts.Add(name.ToLower(), contact);
            }
        }
예제 #27
0
 /// <summary>
 /// 处理邮件标题和内容
 /// </summary>
 /// <param name="text"></param>
 /// <param name="e"></param>
 /// <returns></returns>
 private string processText(string text, EmailList e)
 {
     return(Jammer(text.Replace("{EmailAddress}", e.EmailAddress).Replace("{Email}", e.EmailAddress).Replace("{email}", e.EmailAddress)
                   .Replace("{NickName}", e.NickName).Replace("{Name}", e.NickName).Replace("{name}", e.NickName)
                   .Replace("{ex0}", e.ex0).Replace("{ex1}", e.ex1).Replace("{ex2}", e.ex2).Replace("{ex3}", e.ex3).Replace("{ex4}", e.ex4)
                   .Replace("{ex5}", e.ex5).Replace("{ex6}", e.ex6).Replace("{ex7}", e.ex7).Replace("{ex8}", e.ex8)));
 }
예제 #28
0
 protected override void TimeUp()
 {
     Singular.Emails.SingularMail.AddEmailFooterImage += AddEmailFooterImage;
     try
     {
         EmailList EmailList = Singular.Emails.EmailList.GetEmailList(false);
         if (EmailList.Count > 0)
         {
             var mailList = new List <Singular.Emails.SingularMailSettings.MailCredential>();
             mailList.Add(DefaultMailCredential());
             EmailList.SendEmails(mailList);
             if (EmailList.FailedCount > 0)
             {
                 WriteProgress("Sent " + EmailList.SentCount + " Emails, " + EmailList.FailedCount + " Failed to Send");
             }
             EmailList.Save();
         }
     }
     catch (Exception ex)
     {
         WriteProgress("Error Sending Emails: (" + ex.Source + ") " + ex.Message + " | " + ex.StackTrace);
         throw;
     }
     finally
     {
         Singular.Emails.SingularMail.AddEmailFooterImage -= AddEmailFooterImage;
     }
 }
예제 #29
0
        public async Task <IActionResult> Edit(int id, [Bind("ID,Name,Email, ContactType")] EmailList emailList)
        {
            if (id != emailList.ID)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(emailList);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!EmailListExists(emailList.ID))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(emailList));
        }
예제 #30
0
        //BUSA - 489 - end

        protected virtual EmailList GetOrCreateEmailList(string name, string defaultSubject)
        {
            IRepository <EmailList> repository = this.UnitOfWork.GetRepository <EmailList>();
            EmailList inserted = repository.GetTable().Expand <EmailList, ContentManager>((Expression <Func <EmailList, ContentManager> >)(o => o.EmailTemplate.ContentManager)).FirstOrDefault <EmailList>((Expression <Func <EmailList, bool> >)(o => o.Name == name));

            if (inserted == null)
            {
                inserted = new EmailList()
                {
                    Name          = name,
                    Subject       = defaultSubject,
                    EmailTemplate = new EmailTemplate()
                    {
                        Name           = name,
                        ContentManager = new ContentManager()
                        {
                            Name = "EmailTemplate"
                        }
                    }
                };
                repository.Insert(inserted);
                this.UnitOfWork.Save();
            }
            return(inserted);
        }
        protected void Page_PreRender(object sender, EventArgs e)
        {
            if (_EmailListId == 0)
            {
                this.Visible = false;
                return;
            }

            EmailList emailList = EmailListDataSource.Load(_EmailListId);

            if (emailList == null)
            {
                this.Visible = false;
                return;
            }

            CaptionLabel.Text = this.Caption;
            if (!AbleContext.Current.User.IsAnonymous && !String.IsNullOrEmpty(AbleContext.Current.User.Email))
            {
                UserEmail.Text = AbleContext.Current.User.Email;
            }

            InstructionsText.Text = string.Format(InstructionsText.Text, emailList.Name);
            this.Visible          = true;
        }
예제 #32
0
        public async Task <bool> AddNewEmailList(RequestEmailList model)
        {
            using (var transaction = _database.Database.BeginTransaction())
            {
                try
                {
                    var original = new EmailList();
                    AutoMapper.Mapper.Map(model, original);
                    if (!ReferenceEquals(model.Guids, null))
                    {
                        foreach (Guid modelGuid in model.Guids)
                        {
                            original.Contacts.Add(await _database.Contacts.FirstOrDefaultAsync(p => p.GuID == modelGuid));
                        }
                    }
                    _database.EmailLists.Add(original);
                    await _database.SaveChangesAsync();

                    transaction.Commit();
                    return(true);
                }
                catch
                {
                    transaction.Rollback();
                    throw;
                }
            }
        }
예제 #33
0
        private void btnAdd_Click(object sender, EventArgs e)
        {
            if (txtName.Text.Trim().Length == 0)
            {
                MessageBox.Show("请输入收件人名称");
                txtName.Select();
                return;
            }

            if (txtEmailAddress.Text.Trim().Length == 0)
            {
                MessageBox.Show("请输入邮件地址");
                txtEmailAddress.Select();
                return;
            }
            EmailList model = new EmailList();

            model.Remark       = txtName.Text.Trim();
            model.EmailAddress = txtEmailAddress.Text.Trim();
            model.CreateDate   = DateTime.Now.ToString();
            int intFlag = dal.Add(model);

            if (intFlag > 0)
            {
                MessageBox.Show("添加成功");
                this.DialogResult = DialogResult.OK;
            }
            else
            {
                MessageBox.Show("添加失败");
            }
        }
예제 #34
0
        private void inportEmailList()
        {
            int totals = 0; int success = 0;
            WriteLog("");
            WriteLog("正在读取数据.....");
            IList<string> data = FileDirectory.FileRead(fileName, FileDirectory.FileEncoding(fileName));
            totals = data.Count;
            WriteLog("读取到:" + totals + " 行记录!");

            WriteLog("正在导入数据.....");
            int index = 1;
            foreach (string str in data) {
                string[] list = str.Split(',');
                string email = list[0].Trim();
                if (!email.IsEmail()) {
                    WriteLog("第" + index.ToString() + "行Email地址格式不正确:" + str);
                } else {
                    if (EmailListHelper.IsExistByID(email)) {
                        WriteLog("第" + index.ToString() + "行数据已存在:" + str);
                    } else {
                        EmailList info = new EmailList();
                        info.EmailAddress = email;
                        info.NickName = email.Split('@')[0];
                        if (list.Length == 10) {
                            info.ex0 = list[1];
                            info.ex1 = list[2];
                            info.ex2 = list[3];
                            info.ex3 = list[4];
                            info.ex4 = list[5];
                            info.ex5 = list[6];
                            info.ex6 = list[7];
                            info.ex7 = list[8];
                            info.ex8 = list[9];
                        }
                        info.CreateTime = DateTime.Now.ToDateTime().ToDateTime();
                        EmailListHelper.Insert(info);
                        success++;
                    }
                }
                index++;
            }
            EmailListHelper.ClearCacheAll();
            WriteLog("导入Email列表完成:共 {0} 条记录,成功 {1} 条记录,失败 {2} 条记录!".FormatWith(totals, success, totals - success));
        }
예제 #35
0
        public static List<EmailList> MailChimpResponseToEmailList(EmailListResponse response)
        {
            var lists = new List<EmailList>();
            foreach (var list in response.lists)
            {
                var emailList = new EmailList();
                emailList.Id = list.id;
                emailList.Name = list.name;
                emailList.NotifyOnSubscribe = list.notify_on_subscribe;
                emailList.NotifyOnUnsubscribe = list.notify_on_unsubscribe;
                emailList.DateCreated = list.date_created;
                emailList.ListRating = list.list_rating;
                emailList.EmailType = Convert.ToBoolean(list.email_type_option);
                emailList.Visibility = list.visibility;
                emailList.Contact = new Contact
                {
                    Address1 = list.contact.address1,
                    Address2 = list.contact.address2,
                    City = list.contact.city,
                    Company = list.contact.company,
                    Country = list.contact.country,
                    Phone = list.contact.phone,
                    State = list.contact.state,
                    Zip = list.contact.zip
                };
                emailList.CampaignDefaults = new CampaignDefaults
                {
                    FromEmail = list.campaign_defaults.from_email,
                    FromName = list.campaign_defaults.from_name,
                    Language = list.campaign_defaults.language
                };
                emailList.Stats = new EmailListStats
                {
                    AvgSubRate = list.stats.avg_sub_rate,
                    AvgUnsubRate = list.stats.avg_unsub_rate,
                    CampaignCount = list.stats.campaign_count,
                    CampaignLastSent = list.stats.campaign_last_sent
                };

                lists.Add(emailList);
            }
            return lists;
        }
예제 #36
0
        public void testList020()
        {
            EmailList el = new EmailList();

            // Using the generic "Wrap" API so that we can use this
            // test against any internationalized version of the ADK
            Email email1 = new Email(EmailType.Wrap("foo"), "*****@*****.**");
            Email email2 = new Email(EmailType.Wrap("foo"), "*****@*****.**");

            el.Add(email1);
            el.Add(email2);

            Assert.IsNotNull(email1.Parent, "Parent should not be null");
            Assert.IsNotNull(email2.Parent, "Parent should not be null");

            el.Clear();
            Assert.AreEqual(0, el.ChildCount, "Should have 0 emails");
            Assert.IsNull(email1.Parent, "Parent should be null");
            Assert.IsNull(email2.Parent, "Parent should be null");
        }
예제 #37
0
        public void testList030()
        {
            EmailList el = new EmailList();

            // Using the generic "Wrap" API so that we can use this
            // test against any internationalized version of the ADK
            Email email1 = new Email(EmailType.Wrap("foo"), "*****@*****.**");
            Email email2 = new Email(EmailType.Wrap("bar"), "*****@*****.**");

            el.Add(email1);
            el.Add(email2);

            // test the iterator
            int count = 0;
            foreach (Email e in el)
            {
                Assert.IsNotNull(e, "Email should not be null");
                Assert.AreEqual(24, e.TextValue.Length, "Should have email address");
                count++;
            }

            Assert.AreEqual(2, count, "Should have iterated 2 emails");
        }
예제 #38
0
        private void button1_Click(object sender, EventArgs e)
        {
            if (string.IsNullOrEmpty(this.txtEmailAddress.Text)) {
                MessageBox.Show("发送的Email不能为空", "系统提示");
                return;
            }

            DialogResult = System.Windows.Forms.DialogResult.OK;

            EmailList info = new EmailList();

            info.EmailAddress = this.txtEmailAddress.Text;
            info.NickName = this.txtNickName.Text;
            if (info.NickName.IsNullEmpty()) info.NickName = info.EmailAddress.Split('@')[0];
            info.ex0 = this.txtex0.Text;
            info.ex1 = this.txtex1.Text;
            info.ex2 = this.txtex2.Text;
            info.ex3 = this.txtex3.Text;
            info.ex4 = this.txtex4.Text;
            info.ex5 = this.txtex5.Text;
            info.ex6 = this.txtex6.Text;
            info.ex7 = this.txtex7.Text;
            info.ex8 = this.txtex8.Text;
            info.LastSendError = txtError.Text;
            //info.LastSendStatus = this.checkBoxStatus.Checked ? 0 : 1;

            if (!email.IsNullEmpty() || EmailListHelper.IsExistByID(info.EmailAddress)) {
                EmailListHelper.Update(info);
            } else {
                info.CreateTime = DateTime.Now.ToDateTime().ToDateTime();
                EmailListHelper.Insert(info);
            }
            EmailListHelper.ClearCacheAll();

            MessageBox.Show("保存数据成功!", " 系统提示");
            this.Close();
        }
예제 #39
0
 /// <summary>
 /// ��Ӽ�¼
 /// </summary>
 /// <param name="emailList">ʵ����</param>
 /// <returns>����Ƿ�ɹ�</returns>
 public static bool Insert(EmailList emailList, string dbkey)
 {
     return Insert(emailList, dbkey, null);
 }
예제 #40
0
 /// <summary>
 /// �޸ļ�¼
 /// </summary>
 /// <param name="emailList">ʵ����</param>
 /// <returns>�޸��Ƿ�ɹ�</returns>
 public static bool Update(EmailList emailList, string dbkey)
 {
     return Update(emailList, dbkey, null, null);
 }
예제 #41
0
 /// <summary>
 /// �޸Ķ�����¼
 /// </summary>
 /// <param name="emailAddressList">���͵�Email�б���á�,���ŷָ�</param>
 /// <param name="emailList">ʵ����</param>
 /// <param name="where">�޸�ʱ����������ͳһ��ǰ��Ҫ�����ӷ���and��or�ȵȣ�</param>
 /// <param name="delCache">�޸ijɹ��������CACHE key��֧������</param>
 /// <param name="dbkey">�������ݿ����ӳ��е�����key��Ϊ��ʱʹ��ConnString����</param>
 /// <returns>�޸��Ƿ�ɹ�</returns>
 public static bool UpdateByIDList(IEnumerable<string> emailAddressList,  EmailList emailList, string dbkey = "", Where where = null, string[] delCache = null)
 {
     int value = new SQL().Database(dbkey).Update(EmailList._)
         .SetP(EmailList._NickName, emailList.NickName)
         .SetP(EmailList._LastSendStatus, emailList.LastSendStatus)
         .SetP(EmailList._LastSendError, emailList.LastSendError)
         .SetP(EmailList._LastSendTime, emailList.LastSendTime)
         .SetP(EmailList._LastSendSmtp, emailList.LastSendSmtp)
         .SetP(EmailList._SendCount, emailList.SendCount)
         .SetP(EmailList._CreateTime, emailList.CreateTime)
         .SetP(EmailList._ex0, emailList.ex0)
         .SetP(EmailList._ex1, emailList.ex1)
         .SetP(EmailList._ex2, emailList.ex2)
         .SetP(EmailList._ex3, emailList.ex3)
         .SetP(EmailList._ex4, emailList.ex4)
         .SetP(EmailList._ex5, emailList.ex5)
         .SetP(EmailList._ex6, emailList.ex6)
         .SetP(EmailList._ex7, emailList.ex7)
         .SetP(EmailList._ex8, emailList.ex8)
         .Where(new Where()
             .And(EmailList._EmailAddress, "(" + emailAddressList .Join(",") + ")", Operator.In)
         ).Where(where).ToExec();
     if (value <= 0) return false;
     if (delCache.IsNull()) return true;
     Cache2.Remove("TH.Mailer.EmailListCache_", delCache);
     return true;
 }
예제 #42
0
 /// <summary>
 /// �޸Ķ�����¼
 /// </summary>
 /// <param name="emailAddressList">���͵�Email�б���á�,���ŷָ�</param>
 /// <param name="emailList">ʵ����</param>
 /// <returns>�޸��Ƿ�ɹ�</returns>
 public static bool UpdateByIDList(IEnumerable<string> emailAddressList,  EmailList emailList, string dbkey)
 {
     return UpdateByIDList(emailAddressList,  emailList, dbkey, null, null);
 }
예제 #43
0
 /// <summary>
 /// 处理邮件标题和内容
 /// </summary>
 /// <param name="text"></param>
 /// <param name="e"></param>
 /// <returns></returns>
 private string processText(string text, EmailList e)
 {
     return Jammer(text.Replace("{EmailAddress}", e.EmailAddress).Replace("{Email}", e.EmailAddress).Replace("{email}", e.EmailAddress)
         .Replace("{NickName}", e.NickName).Replace("{Name}", e.NickName).Replace("{name}", e.NickName)
         .Replace("{ex0}", e.ex0).Replace("{ex1}", e.ex1).Replace("{ex2}", e.ex2).Replace("{ex3}", e.ex3).Replace("{ex4}", e.ex4)
         .Replace("{ex5}", e.ex5).Replace("{ex6}", e.ex6).Replace("{ex7}", e.ex7).Replace("{ex8}", e.ex8));
 }
예제 #44
0
        private int SendEmails(int sends = 0)
        {
            int sendIndex = 0; //当前发送的邮件索引
            int ips = 0; //记录发送多少邮件后更换IP
            int smtps = 0; int smtps2 = 0; int smtpIndex = 0; //记录发送多少邮件后更换SMTP、smtp发送失败次数、当前使用的smtp索引

            EmailListHelper.ClearCacheAll();
            Where where = new Where().And("LastSendStatus", 0, Operator.Equal);
            emailList = EmailListHelper.SelectListByAll(null, where).Where(e => e.LastSendError.IndexOf("Mailbox not found") == -1).ToList();
            if (emailList.Count == 0) return 0; //0正常发送结束

            //循环发送所有email
            foreach (EmailList e in emailList) {
                sendIndex++;
                if (exit) { clear(); WriteLog("已停止发送邮件!"); thread.Abort(); return -1; } //-1停止发送邮件

                string name = smtpInfo.UserName;
                if (name.IndexOf("@") != -1) name = name.Split('@')[0]; //显示发件人

                int index = smtpInfo.SmtpServer.IndexOf(".");
                string smtpDomail = smtpInfo.SmtpServer.Substring(index + 1);
                string emailAddress = name + "@" + smtpDomail; //显示发件人EMAIL

                if (!template.ShowName.IsNullEmpty()) name = template.ShowName;  //显示模版里设置的发件人

                bool success = false; string msg = string.Empty;
                if (emailAddress.Trim().ToLower() == e.EmailAddress.Trim().ToLower()) success = true; //不允许自己发给自己

                if (!success) {
                    success = email.ClearTo()
                        .From(name, emailAddress)
                        .Subject(processText(template.Subject, e))
                        .Body(processText(template.Body, e))
                        .To(t => t.Add(e.NickName.IfNullOrEmpty(e.EmailAddress.Split('@')[0]), e.EmailAddress))
                        .Send();
                    msg = processError(email.ErrorMessage);
                    if (sendSetting.SendInterval > 0) Thread.Sleep(sendSetting.SendInterval.Value); //暂停时间
                }

                WriteLog("<" + e.NickName + ">" + e.EmailAddress + (success ? " 发送成功!" : " 发送出错:" + msg));

                //最后一次发送情况
                EmailList emailInfo = new EmailList();
                emailInfo.EmailAddress = e.EmailAddress;
                emailInfo.LastSendStatus = success ? 1 : (sendSetting.SendRetryCount == e.SendCount + 1 ? 2 : 0);
                emailInfo.LastSendTime = DateTime.Now;
                emailInfo.LastSendSmtp = smtpInfo.SmtpServer + "|" + smtpInfo.UserName;
                emailInfo.LastSendError = msg;
                emailInfo.SendCount = e.SendCount + 1;
                EmailListHelper.Update(emailInfo);

                ips++;
                if (sendSetting.IPInterval > 0 && ips >= sendSetting.IPInterval) { //换IP
                    ips = 0;
                    WriteLog("正在更换IP.....");
                    string ip = NetHelper.ChangeIP(sendSetting.ConnectType.Value, uiMsg, uiDone);
                    if (ip.IsNullEmpty()) { WriteLog(sendSetting.MaxRetryCount + "次更换IP失败!"); return 1; } //1更换IP失败结束
                    WriteLog("更换IP:" + ip);
                }

                smtps++;
                if (!success) smtps2++;
                if (sendSetting.SmtpInterval > 0 && smtps >= sendSetting.SmtpInterval && smtpList.Count > 1) { //换SMTP
                    UpdateSmtpListSendCount(smtpIndex, sendSetting.SmtpInterval.Value, smtps2); //更新smtp发送次数

                    smtps = 0; smtps2 = 0;
                    smtpIndex++;
                    if (smtpIndex + 1 > smtpList.Count) smtpIndex = 0; //如果所有smtp发送完,将重新循环更换
                    smtpInfo = smtpList[smtpIndex]; //更换下一个smtp
                    WriteLog("更换SMTP:" + smtpInfo.SmtpServer + "|" + smtpInfo.UserName);
                    email.Host(smtpInfo.SmtpServer)
                        .Ssl(smtpInfo.SSL.Value)
                        .Port(smtpInfo.SmtpPort.Value)
                        .Credentials(smtpInfo.UserName, smtpInfo.SPassword);
                }
            };

            if (smtps > 0) UpdateSmtpListSendCount(smtpIndex, smtps, smtps2); //更新smtp发送次数
            WriteLog("第" + (sends + 1) + "轮发送完成!");
            return SendEmails(sends + 1);
        }
예제 #45
0
        /// <summary>
        /// Initialize window.
        /// </summary>
        public override void _initializeComponents()
        {
            // Server Name + URL + Periodicity window
            Frame f = new Frame();
            f.Label = Director.Properties.Resources.ServerSettings;
            f.Padding = 10;

            // Create VBOX
            VBox ServerSettings = new VBox();

            // Prepare text box
            ServerSettings.PackStart(new Label()
            {
                Text = Director.Properties.Resources.ServerName
            });
            ServerName = new TextEntry();
            ServerName.Changed += ServerName_Changed;
            ServerSettings.PackStart(ServerName);

            // Add invalid server name
            ServerSettings.PackStart(InvalidServerName);

            // Server URL
            ServerSettings.PackStart(new Label()
            {
                Text = Director.Properties.Resources.ServerURL
            });
            ServerURL = new TextEntry();
            ServerURL.Changed += ServerURL_Changed;
            ServerSettings.PackStart(ServerURL);

            // Invalid URL
            ServerSettings.PackStart(InvalidServerURL);

            // Frequency settings
            ServerSettings.PackStart(new Label()
            {
                Text = Director.Properties.Resources.RunningPeriodicity
            });
            FrequencyRunning = new ComboBox();
            FrequencyHelper.FillComboBox(FrequencyRunning);
            ServerSettings.PackStart(FrequencyRunning);
            FrequencyRunning.SelectedIndex = 0;
            FrequencyRunning.SelectionChanged += FrequencyRunning_SelectionChanged;

            // Add Frame to server settings
            f.Content = ServerSettings;
            PackStart(f);

            // Authorization
            AuthRequired = new CheckBox(Director.Properties.Resources.Authorization);
            AuthRequired.MarginLeft = 10;
            PackStart(AuthRequired);

            // Create Authentication Frame
            Authentication = new Frame()
            {
                Label = Director.Properties.Resources.AuthorizationSettings,
                Padding = 10
            };

            // Login and Password fields
            VBox AuthBox = new VBox();

            AuthBox.PackStart(new Label()
            {
                Text = Director.Properties.Resources.Username
            });
            AuthUserName = new TextEntry();
            AuthUserName.Changed += AuthUserName_Changed;
            AuthBox.PackStart(AuthUserName);

            AuthBox.PackStart(new Label()
            {
                Text = Director.Properties.Resources.Password
            });
            AuthUserPassword = new PasswordEntry();
            AuthUserPassword.Changed += AuthUserPassword_Changed;
            AuthBox.PackStart(AuthUserPassword);

            // Authentication content
            Authentication.Content = AuthBox;
            PackStart(Authentication);

            // Change value
            AuthRequired.Toggled += AuthRequired_Toggled;

            // Email settings
            Frame EmailFrame = new Frame()
            {
                Label = Director.Properties.Resources.EmailNotifications,
                Padding = 10,
                MinHeight = 180
            };

            // Create EmailList widget
            EmailWidget = new EmailList();
            EmailFrame.Content = EmailWidget;
            PackStart(EmailFrame, expand: true, fill: true);
        }
예제 #46
0
 /// <summary>
 /// ��Ӽ�¼
 /// </summary>
 /// <param name="emailList">ʵ����</param>
 /// <param name="delCache">��ӳɹ��������CACHE key��֧������</param>
 /// <param name="dbkey">�������ݿ����ӳ��е�����key��Ϊ��ʱʹ��ConnString����</param>
 /// <returns>����Ƿ�ɹ�</returns>
 public static bool Insert(EmailList emailList, string dbkey = "", string[] delCache = null)
 {
     int obj = new SQL().Database(dbkey).Insert(EmailList._)
         .ValueP(EmailList._EmailAddress, emailList.EmailAddress)
         .ValueP(EmailList._NickName, emailList.NickName)
         .ValueP(EmailList._LastSendStatus, emailList.LastSendStatus)
         .ValueP(EmailList._LastSendError, emailList.LastSendError)
         .ValueP(EmailList._LastSendTime, emailList.LastSendTime)
         .ValueP(EmailList._LastSendSmtp, emailList.LastSendSmtp)
         .ValueP(EmailList._SendCount, emailList.SendCount)
         .ValueP(EmailList._CreateTime, emailList.CreateTime)
         .ValueP(EmailList._ex0, emailList.ex0)
         .ValueP(EmailList._ex1, emailList.ex1)
         .ValueP(EmailList._ex2, emailList.ex2)
         .ValueP(EmailList._ex3, emailList.ex3)
         .ValueP(EmailList._ex4, emailList.ex4)
         .ValueP(EmailList._ex5, emailList.ex5)
         .ValueP(EmailList._ex6, emailList.ex6)
         .ValueP(EmailList._ex7, emailList.ex7)
         .ValueP(EmailList._ex8, emailList.ex8)
         .ToExec();
     if (delCache.IsNull()) return obj == 1;
     Cache2.Remove("TH.Mailer.EmailListCache_", delCache);
     return obj == 1;
 }
예제 #47
0
    /// <summary>
    /// ดึงรายชื่ออีเมล์ในฐานข้อมูล EmailList โดยคืนค่าเป็น List<EmailList>
    /// </summary>
    /// <param name="EmailListName">ชื่ออ้างอิงข้อมูลเมล์ในฐานข้อมูล</param>
    /// <returns>List ของคลาส EmailList</returns>
    /// <example>
    /// clsMail clsMail = new clsMail();
    /// List<clsMail.EmailList> emailLists=new List<clsMail.EmailList>();
    /// emailLists = clsMail.GetEmailList("DoctorScheduleTo");
    /// </example>
    public List<EmailList> GetEmailList(string EmailListName)
    {
        #region Variable
        clsSQL clsSQL = new clsSQL();
        StringBuilder strSQL = new StringBuilder();
        DataTable dt = new DataTable();
        List<EmailList> emailLists = new List<EmailList>();
        #endregion
        #region DataBuilder
        #region SQL Query
        strSQL.Append("SELECT ");
        strSQL.Append("EMail,");
        strSQL.Append("EMailAliasName ");
        strSQL.Append("FROM ");
        strSQL.Append("EmailList ");
        strSQL.Append("WHERE ");
        strSQL.Append("Active='1' ");
        strSQL.Append("AND Name="+parameterChar+"Name");
        #endregion
        dt = clsSQL.Bind(strSQL.ToString(),new string[,]{{parameterChar+"Name",EmailListName}}, dbType, cs);
        if (dt != null && dt.Rows.Count > 0)
        {
            for (int i = 0; i < dt.Rows.Count; i++)
            {
                EmailList emailList = new EmailList();
                emailList.EmailAddress = dt.Rows[i]["EMail"].ToString();
                emailList.EmailAliasName = (dt.Rows[i]["EMailAliasName"] != DBNull.Value ? dt.Rows[i]["EMailAliasName"].ToString() : "");

                emailLists.Add(emailList);
            }
        }
        #endregion

        return emailLists;
    }
예제 #48
0
        public ActionResult RegisterEmail(string email)
        {
            if (String.IsNullOrEmpty(email))
            {
                return Content("Email không được rỗng");
            }
            var check = EmailListService.GetOneByLINQ(c => c.Email.Equals(email));
            if (check != null)
            {
                return Content("Email này đã tồn tại trong hệ thống của chúng tôi");
            }
            EmailList _email = new EmailList()
            {
                Email = email

            };
            if (EmailListService.Save(_email) > 0)
            {
                return Content("Bạn đã đăng ký email thành công");
            }
            return Content("Lỗi, vui lòng thử lại");
        }