Beispiel #1
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 && !string.IsNullOrEmpty(this.txtMemberNames.Text.Trim()))
     {
         string   text  = this.txtMemberNames.Text.Trim().Replace("\r\n", "\n");
         string[] array = text.Replace("\n", "*").Split(new char[]
         {
             '*'
         });
         for (int i = 0; i < array.Length; i++)
         {
             Member member = this.GetMember(array[i]);
             if (member != null)
             {
                 list.Add(new MessageBoxInfo
                 {
                     Accepter = array[i],
                     Sernder  = "admin",
                     Title    = this.MessageTitle,
                     Content  = this.Content
                 });
             }
         }
         if (list.Count <= 0)
         {
             this.ShowMsg("没有要发送的对象", false);
             return;
         }
         NoticeHelper.SendMessageToMember(list);
         //Messages.Messenger.SendXinGe(array, this.Content, this.MessageTitle, 3, 10, 0);
         this.ShowMsg(string.Format("成功给{0}个用户发送了消息.", list.Count), true);
     }
     if (this.rdoRank.Checked)
     {
         System.Collections.Generic.IList <Member> list2 = new System.Collections.Generic.List <Member>();
         list2 = NoticeHelper.GetMembersByRank(this.rankList.SelectedValue);
         List <string> users = new List <string>();
         foreach (Member current in list2)
         {
             list.Add(new MessageBoxInfo
             {
                 Accepter = current.Username,
                 Sernder  = "admin",
                 Title    = this.MessageTitle,
                 Content  = this.Content
             });
             users.Add(current.Username);
         }
         if (list.Count > 0)
         {
             NoticeHelper.SendMessageToMember(list);
             this.ShowMsg(string.Format("成功给{0}个用户发送了消息.", list.Count), true);
             //Messages.Messenger.SendXinGe(users.ToArray(), this.Content, this.MessageTitle, 3, 10, 0);
             return;
         }
         this.ShowMsg("没有要发送的对象", false);
     }
 }
Beispiel #2
0
        private void btnSendToRank_Click(object sender, EventArgs e)
        {
            IList <MessageBoxInfo> list = new List <MessageBoxInfo>();

            if (this.rdoName.Checked && !string.IsNullOrEmpty(this.txtMemberNames.Text.Trim()))
            {
                string   text  = this.txtMemberNames.Text.Trim().Replace("\r\n", "\n");
                string[] array = text.Replace("\n", "*").Split('*');
                for (int i = 0; i < array.Length; i++)
                {
                    MemberInfo memberInfo = MemberProcessor.FindMemberByUsername(array[i]);
                    if (memberInfo != null)
                    {
                        MessageBoxInfo messageBoxInfo = new MessageBoxInfo();
                        messageBoxInfo.Accepter = array[i];
                        messageBoxInfo.Sernder  = "admin";
                        messageBoxInfo.Title    = this.MessageTitle;
                        messageBoxInfo.Content  = this.Content;
                        list.Add(messageBoxInfo);
                    }
                }
                if (list.Count > 0)
                {
                    NoticeHelper.SendMessageToMember(list);
                    this.ShowMsg($"成功给{list.Count}个用户发送了消息.", true, "SendMessageSelectUser.aspx");
                }
                else
                {
                    this.ShowMsg("没有要发送的对象", true, "SendMessageSelectUser.aspx");
                }
            }
            if (this.rdoRank.Checked)
            {
                IList <string> membersByRank = NoticeHelper.GetMembersByRank(this.rankList.SelectedValue);
                foreach (string item in membersByRank)
                {
                    MessageBoxInfo messageBoxInfo2 = new MessageBoxInfo();
                    messageBoxInfo2.Accepter = item;
                    messageBoxInfo2.Sernder  = "admin";
                    messageBoxInfo2.Title    = this.MessageTitle;
                    messageBoxInfo2.Content  = this.Content;
                    list.Add(messageBoxInfo2);
                }
                if (list.Count > 0)
                {
                    NoticeHelper.SendMessageToMember(list);
                    this.ShowMsg($"成功给{list.Count}个用户发送了消息.", true, "SendMessageSelectUser.aspx");
                }
                else
                {
                    this.ShowMsg("没有要发送的对象", true, "SendMessageSelectUser.aspx");
                }
            }
        }
        private void btnSendToRank_Click(object sender, EventArgs e)
        {
            IList <MessageBoxInfo> messageBoxInfos = new List <MessageBoxInfo>();

            if (this.rdoName.Checked && !string.IsNullOrEmpty(this.txtMemberNames.Text.Trim()))
            {
                string[] strArray = this.txtMemberNames.Text.Trim().Replace("\r\n", "\n").Replace("\n", "*").Split(new char[] { '*' });
                for (int i = 0; i < strArray.Length; i++)
                {
                    if (this.GetMember(strArray[i]) != null)
                    {
                        MessageBoxInfo item = new MessageBoxInfo();
                        item.Accepter = strArray[i];
                        item.Sernder  = "admin";
                        item.Title    = this.MessageTitle;
                        item.Content  = this.Content;
                        messageBoxInfos.Add(item);
                    }
                }
                if (messageBoxInfos.Count <= 0)
                {
                    this.ShowMsg("没有要发送的对象", false);
                    return;
                }
                NoticeHelper.SendMessageToMember(messageBoxInfos);
                this.ShowMsg(string.Format("成功给{0}个用户发送了消息.", messageBoxInfos.Count), true);
            }
            if (this.rdoRank.Checked)
            {
                IList <Member> list2 = new List <Member>();
                foreach (Member member2 in NoticeHelper.GetMembersByRank(this.rankList.SelectedValue))
                {
                    MessageBoxInfo info2 = new MessageBoxInfo();
                    info2.Accepter = member2.Username;
                    info2.Sernder  = "admin";
                    info2.Title    = this.MessageTitle;
                    info2.Content  = this.Content;
                    messageBoxInfos.Add(info2);
                }
                if (messageBoxInfos.Count > 0)
                {
                    NoticeHelper.SendMessageToMember(messageBoxInfos);
                    this.ShowMsg(string.Format("成功给{0}个用户发送了消息.", messageBoxInfos.Count), true);
                }
                else
                {
                    this.ShowMsg("没有要发送的对象", false);
                }
            }
        }