Beispiel #1
0
        private void btnsitecontent_Click(object sender, System.EventArgs e)
        {
            System.Collections.Generic.IList <MessageBoxInfo> list = new System.Collections.Generic.List <MessageBoxInfo>();
            string text = this.txtsitecontent.Value.Trim();

            if (string.IsNullOrEmpty(text) || text.Equals("输入发送内容……"))
            {
                this.ShowMsg("请输入要发送的内容信息", false);
                return;
            }
            string title = text;

            if (text.Length > 10)
            {
                title = text.Substring(0, 10) + "……";
            }
            foreach (System.Web.UI.WebControls.GridViewRow gridViewRow in this.grdDistributorList.Rows)
            {
                System.Web.UI.WebControls.CheckBox checkBox = (System.Web.UI.WebControls.CheckBox)gridViewRow.FindControl("checkboxCol");
                if (checkBox.Checked)
                {
                    string text2 = "";
                    foreach (object current in gridViewRow.Controls[1].Controls)
                    {
                        if (!(current is System.Web.UI.WebControls.Literal))
                        {
                            if (!(current is System.Web.UI.DataBoundLiteralControl))
                            {
                                continue;
                            }
                            text2 = ((System.Web.UI.DataBoundLiteralControl)current).Text.Trim();
                        }
                        else
                        {
                            text2 = ((System.Web.UI.WebControls.Literal)current).Text.Trim();
                        }
                        break;
                    }
                    if (this.IsMembers(text2))
                    {
                        list.Add(new MessageBoxInfo
                        {
                            Sernder  = "Admin",
                            Accepter = text2,
                            Title    = title,
                            Content  = text
                        });
                    }
                }
            }
            if (list.Count > 0)
            {
                NoticeHelper.SendMessageToDistributor(list);
                this.ShowMsg(string.Format("成功给{0}个分销商发送了消息.", list.Count), true);
                return;
            }
            this.ShowMsg("没有要发送的对象", false);
        }
Beispiel #2
0
        private void btnsitecontent_Click(object sender, EventArgs e)
        {
            IList <MessageBoxInfo> messageBoxInfos = new List <MessageBoxInfo>();
            string str = this.txtsitecontent.Value.Trim();

            if (string.IsNullOrEmpty(str) || str.Equals("输入发送内容……"))
            {
                this.ShowMsg("请输入要发送的内容信息", false);
            }
            else
            {
                string str2 = str;
                if (str.Length > 10)
                {
                    str2 = str.Substring(0, 10) + "……";
                }
                foreach (GridViewRow row in this.grdDistributorList.Rows)
                {
                    CheckBox box = (CheckBox)row.FindControl("checkboxCol");
                    if (box.Checked)
                    {
                        string name = "";
                        foreach (object obj2 in row.Controls[1].Controls)
                        {
                            if (obj2 is Literal)
                            {
                                name = ((Literal)obj2).Text.Trim();
                                break;
                            }
                            if (obj2 is DataBoundLiteralControl)
                            {
                                name = ((DataBoundLiteralControl)obj2).Text.Trim();
                                break;
                            }
                        }
                        if (this.IsMembers(name))
                        {
                            MessageBoxInfo item = new MessageBoxInfo();
                            item.Sernder  = "Admin";
                            item.Accepter = name;
                            item.Title    = str2;
                            item.Content  = str;
                            messageBoxInfos.Add(item);
                        }
                    }
                }
                if (messageBoxInfos.Count > 0)
                {
                    NoticeHelper.SendMessageToDistributor(messageBoxInfos);
                    this.ShowMsg(string.Format("成功给{0}个分销商发送了消息.", messageBoxInfos.Count), true);
                }
                else
                {
                    this.ShowMsg("没有要发送的对象", false);
                }
            }
        }
 protected void btnReplyReplyReceivedMessages_Click(object sender, System.EventArgs e)
 {
     if (NoticeHelper.SendMessageToDistributor(new System.Collections.Generic.List <MessageBoxInfo>
     {
         new MessageBoxInfo
         {
             Accepter = (string)this.ViewState["Sernder"],
             Sernder = "admin",
             Title = this.txtTitle.Text.Trim(),
             Content = this.txtContes.Text.Trim()
         }
     }) > 0)
     {
         this.CloseWindow();
         return;
     }
     this.ShowMsg("回复分销商的站内信失败.", false);
 }
        protected void btnReplyReplyReceivedMessages_Click(object sender, EventArgs e)
        {
            IList <MessageBoxInfo> messageBoxInfos = new List <MessageBoxInfo>();
            MessageBoxInfo         item            = new MessageBoxInfo();

            item.Accepter = (string)this.ViewState["Sernder"];
            item.Sernder  = "admin";
            item.Title    = this.txtTitle.Text.Trim();
            item.Content  = this.txtContes.Text.Trim();
            messageBoxInfos.Add(item);
            if (NoticeHelper.SendMessageToDistributor(messageBoxInfos) > 0)
            {
                this.CloseWindow();
            }
            else
            {
                this.ShowMsg("回复分销商的站内信失败.", false);
            }
        }
Beispiel #5
0
        private void btnSendToRank_Click(object sender, EventArgs e)
        {
            IList <MessageBoxInfo> messageBoxInfos = new List <MessageBoxInfo>();

            if (this.rdoName.Checked)
            {
                if (string.IsNullOrEmpty(this.txtDistributorNames.Text.Trim()))
                {
                    this.ShowMsg("请输入您要发送的用户", false);
                    return;
                }
                string[] strArray = this.txtDistributorNames.Text.Trim().Replace("\r\n", "\n").Replace("\n", "*").Split(new char[] { '*' });
                for (int i = 0; i < strArray.Length; i++)
                {
                    Distributor distributor = this.GetDistributor(strArray[i]);
                    if (distributor != null)
                    {
                        MessageBoxInfo item = new MessageBoxInfo();
                        item.Accepter = strArray[i];
                        item.Sernder  = "admin";
                        item.Title    = this.MessageTitle;
                        item.Content  = this.Content;
                        messageBoxInfos.Add(item);
                        if (this.chkIsSendEmail.Checked && Regex.IsMatch(distributor.Email, @"([a-zA-Z\.0-9_-])+@([a-zA-Z0-9_-])+((\.[a-zA-Z0-9_-]{2,4}){1,2})"))
                        {
                            string str2;
                            Messenger.SendMail(this.MessageTitle, this.Content, distributor.Email, HiContext.Current.SiteSettings, out str2);
                        }
                    }
                }
                if (messageBoxInfos.Count <= 0)
                {
                    this.ShowMsg("没有要发送的对象", false);
                    return;
                }
                NoticeHelper.SendMessageToDistributor(messageBoxInfos);
                this.ShowMsg(string.Format("成功给{0}个用户发送了消息.", messageBoxInfos.Count), true);
            }
            if (this.rdoRank.Checked)
            {
                IList <Distributor> list2 = new List <Distributor>();
                foreach (Distributor distributor2 in NoticeHelper.GetDistributorsByRank(this.rankList.SelectedValue))
                {
                    MessageBoxInfo info2 = new MessageBoxInfo();
                    info2.Accepter = distributor2.Username;
                    info2.Sernder  = "admin";
                    info2.Title    = this.MessageTitle;
                    info2.Content  = this.Content;
                    messageBoxInfos.Add(info2);
                    if (this.chkIsSendEmail.Checked && Regex.IsMatch(distributor2.Email, @"([a-zA-Z\.0-9_-])+@([a-zA-Z0-9_-])+((\.[a-zA-Z0-9_-]{2,4}){1,2})"))
                    {
                        string str3;
                        Messenger.SendMail(this.MessageTitle, this.Content, distributor2.Email, HiContext.Current.SiteSettings, out str3);
                    }
                }
                if (messageBoxInfos.Count > 0)
                {
                    NoticeHelper.SendMessageToDistributor(messageBoxInfos);
                    this.ShowMsg(string.Format("成功给{0}个用户发送了消息.", messageBoxInfos.Count), true);
                }
                else
                {
                    this.ShowMsg("没有要发送的对象", false);
                }
            }
        }
Beispiel #6
0
 private void btnSendToRank_Click(object sender, System.EventArgs e)
 {
     System.Collections.Generic.IList <MessageBoxInfo> list = new System.Collections.Generic.List <MessageBoxInfo>();
     if (this.rdoName.Checked)
     {
         if (string.IsNullOrEmpty(this.txtDistributorNames.Text.Trim()))
         {
             this.ShowMsg("请输入您要发送的用户", false);
             return;
         }
         string   text  = this.txtDistributorNames.Text.Trim().Replace("\r\n", "\n");
         string[] array = text.Replace("\n", "*").Split(new char[]
         {
             '*'
         });
         for (int i = 0; i < array.Length; i++)
         {
             Hidistro.Membership.Context.Distributor distributor = this.GetDistributor(array[i]);
             if (distributor != null)
             {
                 list.Add(new MessageBoxInfo
                 {
                     Accepter = array[i],
                     Sernder  = "admin",
                     Title    = this.MessageTitle,
                     Content  = this.Content
                 });
                 if (this.chkIsSendEmail.Checked && System.Text.RegularExpressions.Regex.IsMatch(distributor.Email, "([a-zA-Z\\.0-9_-])+@([a-zA-Z0-9_-])+((\\.[a-zA-Z0-9_-]{2,4}){1,2})"))
                 {
                     string text2;
                     Messenger.SendMail(this.MessageTitle, this.Content, distributor.Email, Hidistro.Membership.Context.HiContext.Current.SiteSettings, out text2);
                 }
             }
         }
         if (list.Count <= 0)
         {
             this.ShowMsg("没有要发送的对象", false);
             return;
         }
         NoticeHelper.SendMessageToDistributor(list);
         this.ShowMsg(string.Format("成功给{0}个用户发送了消息.", list.Count), true);
     }
     if (this.rdoRank.Checked)
     {
         System.Collections.Generic.IList <Hidistro.Membership.Context.Distributor> list2 = new System.Collections.Generic.List <Hidistro.Membership.Context.Distributor>();
         list2 = NoticeHelper.GetDistributorsByRank(this.rankList.SelectedValue);
         foreach (Hidistro.Membership.Context.Distributor current in list2)
         {
             list.Add(new MessageBoxInfo
             {
                 Accepter = current.Username,
                 Sernder  = "admin",
                 Title    = this.MessageTitle,
                 Content  = this.Content
             });
             if (this.chkIsSendEmail.Checked && System.Text.RegularExpressions.Regex.IsMatch(current.Email, "([a-zA-Z\\.0-9_-])+@([a-zA-Z0-9_-])+((\\.[a-zA-Z0-9_-]{2,4}){1,2})"))
             {
                 string text3;
                 Messenger.SendMail(this.MessageTitle, this.Content, current.Email, Hidistro.Membership.Context.HiContext.Current.SiteSettings, out text3);
             }
         }
         if (list.Count > 0)
         {
             NoticeHelper.SendMessageToDistributor(list);
             this.ShowMsg(string.Format("成功给{0}个用户发送了消息.", list.Count), true);
             return;
         }
         this.ShowMsg("没有要发送的对象", false);
     }
 }