Example #1
0
        /// <summary>
        /// Send email to selected consumers event
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btSendSelectedConsumers_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            if (selectedList != null && selectedList.Items.Count > 0)
            {
                var query = (from s1 in selectedList.Items
                             where s1.email != null && s1.email != string.Empty
                             select s1).ToList();

                if (query.Count < selectedList.Items.Count)
                {
                    XtraMessageBox.Show("一个或多个用户未指定邮箱地址");
                }
                if (query.Count > 0)
                {
                    List <Alading.Entity.Consumer> list1 = new List <Alading.Entity.Consumer>();
                    list1.AddRange(query);
                    EmailToConsumer emailToConsumer = new EmailToConsumer();
                    emailToConsumer.Receivers = list1;
                    emailToConsumer.ShowDialog();
                }
            }
            else
            {
                XtraMessageBox.Show("未指定要发送邮件的客户");
            }
        }
Example #2
0
        /// <summary>
        /// Send email to all consumers event
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btSendToAll_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            var list1 = loadStrategy.LoadAllConsumers();

            if (list1 != null && list1.Count > 0)
            {
                var query = (from s1 in list1
                             where s1.email != null && s1.email != string.Empty
                             select s1).ToList();

                if (query.Count < list1.Count)
                {
                    XtraMessageBox.Show("一个或多个用户未指定邮箱地址");
                }
                if (query.Count > 0)
                {
                    List <Alading.Entity.Consumer> list2 = new List <Alading.Entity.Consumer>();
                    list2.AddRange(query);
                    try
                    {
                        EmailToConsumer emailToConsumer = new EmailToConsumer();
                        emailToConsumer.Receivers = list2;
                        emailToConsumer.ShowDialog();
                    }
                    catch (Exception)
                    {
                        //throw;
                    }
                }
            }
            else
            {
                XtraMessageBox.Show("未指定要发送邮件的客户");
            }
        }
Example #3
0
 /// <summary>
 /// Send email to selected consumer event
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void btSendMail_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
 {
     if (selectedConsumer != null)
     {
         if (!string.IsNullOrEmpty(selectedConsumer.email))
         {
             List <Alading.Entity.Consumer> list1 = new List <Alading.Entity.Consumer>();
             list1.Add(selectedConsumer);
             EmailToConsumer emailToConsumer = new EmailToConsumer();
             emailToConsumer.Receivers = list1;
             emailToConsumer.ShowDialog();
         }
         else
         {
             XtraMessageBox.Show("未指定所选客户的邮箱地址");
         }
     }
 }