Esempio n. 1
0
        public static void SendMessageToDistributors(string productId, int type)
        {
            string         format   = "";
            string         str2     = "";
            string         str3     = "";
            string         str4     = "";
            int            sumcount = 0;
            string         productNameByProductIds = "";
            IList <string> userIdByProductId       = new List <string>();

            switch (type)
            {
            case 1:
            {
                productNameByProductIds = ProductHelper.GetProductNameByProductIds(productId, out sumcount);
                userIdByProductId       = ProductHelper.GetUserIdByProductId(productId.ToString());
                format = "供应商下架了{0}个商品";
                str2   = "尊敬的各位分销商,供应商已下架了{0}个商品,如下:";
                break;
            }

            case 2:
            {
                productNameByProductIds = ProductHelper.GetProductNameByProductIds(productId, out sumcount);
                userIdByProductId       = ProductHelper.GetUserIdByProductId(productId.ToString());
                format = "供应商入库了{0}个商品";
                str2   = "尊敬的各位分销商,供应商已入库了{0}个商品,如下:";
                break;
            }

            case 3:
            {
                productNameByProductIds = ProductHelper.GetProductNameByProductIds(productId, out sumcount);
                userIdByProductId       = ProductHelper.GetUserIdByProductId(productId.ToString());
                format = "供应商删除了{0}个商品";
                str2   = "尊敬的各位分销商,供应商已删除了{0}个商品,如下:";
                break;
            }

            case 4:
            {
                str3 = productId.Split(new char[] { '|' })[1].ToString();
                str4 = productId.Split(new char[] { '|' })[2].ToString();
                productNameByProductIds = ProductHelper.GetProductNamesByLineId(Convert.ToInt32(productId.Split(new char[] { '|' })[0].ToString()), out sumcount);
                userIdByProductId       = ProductHelper.GetUserIdByLineId(Convert.ToInt32(productId.Split(new char[] { '|' })[0].ToString()));
                format = "供应商转移了{0}个商品";
                str2   = "尊敬的各位分销商,供应商已将整个产品线" + str3 + "的商品转移移至产品线" + str4 + "目录下,共{0}个,如下:";
                break;
            }

            case 5:
            {
                productNameByProductIds = ProductHelper.GetProductNameByProductIds(productId, out sumcount);
                userIdByProductId       = ProductHelper.GetUserIdByProductId(productId.ToString());
                format = "供应商取消了{0}个商品的铺货状态";
                str2   = "尊敬的各位分销商,供应商已取消了{0}个商品的铺货,如下:";
                break;
            }

            default:
            {
                str4 = productId.Split(new char[] { '|' })[1].ToString();
                productNameByProductIds = ProductHelper.GetProductNameByProductIds(productId.Split(new char[] { '|' })[0].ToString(), out sumcount);
                userIdByProductId       = ProductHelper.GetUserIdByProductId(productId.Split(new char[] { '|' })[0].ToString());
                format = "供应商转移了{0}个商品至产品线" + str4;
                str2   = "尊敬的各位分销商,供应商已转移了{0}个商品至产品线" + str4 + ",如下:";
                break;
            }
            }
            if (sumcount > 0)
            {
                IList <Distributor>        distributorsByNames = new List <Distributor>();
                IList <SendMessageInfo>    sendMessageList     = new List <SendMessageInfo>();
                IList <ReceiveMessageInfo> receiveMessageList  = new List <ReceiveMessageInfo>();
                IList <int> userids = new List <int>();
                foreach (string str6 in userIdByProductId)
                {
                    userids.Add(Convert.ToInt32(str6));
                }
                if (userids.Count > 0)
                {
                    distributorsByNames = NoticeHelper.GetDistributorsByNames(userids);
                }
                foreach (Distributor distributor in distributorsByNames)
                {
                    SendMessageInfo    item  = new SendMessageInfo();
                    ReceiveMessageInfo info2 = new ReceiveMessageInfo();
                    item.Addressee      = info2.Addressee = distributor.Username;
                    item.Addresser      = info2.Addresser = "admin";
                    item.Title          = info2.Title = string.Format(format, sumcount);
                    item.PublishContent = info2.PublishContent = string.Format(str2, sumcount) + productNameByProductIds;
                    sendMessageList.Add(item);
                    receiveMessageList.Add(info2);
                }
                if (sendMessageList.Count > 0)
                {
                    NoticeHelper.SendMessage(sendMessageList, receiveMessageList);
                }
            }
        }
        private void btnSendToRank_Click(object sender, EventArgs e)
        {
            IList <Distributor>        list               = new List <Distributor>();
            IList <SendMessageInfo>    sendMessageList    = new List <SendMessageInfo>();
            IList <ReceiveMessageInfo> receiveMessageList = new List <ReceiveMessageInfo>();

            if (rdoName.Checked)
            {
                if (string.IsNullOrEmpty(txtDistributorNames.Text.Trim()))
                {
                    ShowMsg("请输入您要发送的用户", false);
                    return;
                }
                IList <string> names    = new List <string>();
                string[]       strArray = txtDistributorNames.Text.Trim().Replace("\r\n", "\n").Replace("\n", "*").Split(new char[] { '*' });
                for (int i = 0; i < strArray.Length; i++)
                {
                    if (IsMembers(strArray[i]))
                    {
                        names.Add(strArray[i]);
                    }
                }
                foreach (Distributor distributor in NoticeHelper.GetDistributorsByNames(names))
                {
                    SendMessageInfo    item  = new SendMessageInfo();
                    ReceiveMessageInfo info2 = new ReceiveMessageInfo();
                    item.Addressee      = info2.Addressee = distributor.Username;
                    item.Addresser      = info2.Addresser = "admin";
                    item.Title          = info2.Title = MessageTitle;
                    item.PublishContent = info2.PublishContent = Content;
                    sendMessageList.Add(item);
                    receiveMessageList.Add(info2);
                    if (chkIsSendEmail.Checked)
                    {
                        string str;
                        Messenger.SendMail(MessageTitle, Content, distributor.Email, HiContext.Current.SiteSettings, out str);
                    }
                }
                if (sendMessageList.Count <= 0)
                {
                    ShowMsg("没有要发送的对象", false);
                    return;
                }
                NoticeHelper.SendMessage(sendMessageList, receiveMessageList);
                ShowMsg(string.Format("成功给{0}个用户发送了消息.", sendMessageList.Count), true);
            }
            if (rdoRank.Checked)
            {
                foreach (Distributor distributor2 in NoticeHelper.GetDistributorsByRank(rankList.SelectedValue))
                {
                    SendMessageInfo    info3 = new SendMessageInfo();
                    ReceiveMessageInfo info4 = new ReceiveMessageInfo();
                    info3.Addressee      = info4.Addressee = distributor2.Username;
                    info3.Addresser      = info4.Addresser = "admin";
                    info3.Title          = info4.Title = MessageTitle;
                    info3.PublishContent = info4.PublishContent = Content;
                    sendMessageList.Add(info3);
                    receiveMessageList.Add(info4);
                    if (chkIsSendEmail.Checked)
                    {
                        string str2;
                        Messenger.SendMail(MessageTitle, Content, distributor2.Email, HiContext.Current.SiteSettings, out str2);
                    }
                }
                if (sendMessageList.Count > 0)
                {
                    NoticeHelper.SendMessage(sendMessageList, receiveMessageList);
                    ShowMsg(string.Format("成功给{0}个用户发送了消息.", sendMessageList.Count), true);
                }
                else
                {
                    ShowMsg("没有要发送的对象", false);
                }
            }
        }
        private void btnSendToRank_Click(object sender, EventArgs e)
        {
            IList <Member>             list               = new List <Member>();
            IList <SendMessageInfo>    sendMessageList    = new List <SendMessageInfo>();
            IList <ReceiveMessageInfo> receiveMessageList = new List <ReceiveMessageInfo>();

            if (this.rdoName.Checked)
            {
                if (string.IsNullOrEmpty(this.txtMemberNames.Text.Trim()))
                {
                    this.ShowMsg("请输入您要发送的用户", false);
                    return;
                }
                IList <string> names    = new List <string>();
                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.IsMembers(strArray[i]))
                    {
                        names.Add(strArray[i]);
                    }
                }
                foreach (Member member in SubsitePromoteHelper.GetMemdersByNames(names))
                {
                    SendMessageInfo    item  = new SendMessageInfo();
                    ReceiveMessageInfo info2 = new ReceiveMessageInfo();
                    item.Addressee      = info2.Addressee = member.Username;
                    item.Addresser      = info2.Addresser = HiContext.Current.User.Username;
                    item.Title          = info2.Title = this.MessageTitle;
                    item.PublishContent = info2.PublishContent = this.Content;
                    sendMessageList.Add(item);
                    receiveMessageList.Add(info2);
                }
                if (sendMessageList.Count <= 0)
                {
                    this.ShowMsg("没有要发送的对象", false);
                    return;
                }
                SubsiteCommentsHelper.SendMessage(sendMessageList, receiveMessageList);
                this.ShowMsg(string.Format("成功给{0}个用户发送了消息.", sendMessageList.Count), true);
            }
            if (this.rdoRank.Checked)
            {
                foreach (Member member2 in SubsitePromoteHelper.GetMembersByRank(this.rankList.SelectedValue))
                {
                    SendMessageInfo    info3 = new SendMessageInfo();
                    ReceiveMessageInfo info4 = new ReceiveMessageInfo();
                    info3.Addressee      = info4.Addressee = member2.Username;
                    info3.Addresser      = info4.Addresser = HiContext.Current.User.Username;
                    info3.Title          = info4.Title = this.MessageTitle;
                    info3.PublishContent = info4.PublishContent = this.Content;
                    sendMessageList.Add(info3);
                    receiveMessageList.Add(info4);
                }
                if (sendMessageList.Count > 0)
                {
                    SubsiteCommentsHelper.SendMessage(sendMessageList, receiveMessageList);
                    this.ShowMsg(string.Format("成功给{0}个用户发送了消息.", sendMessageList.Count), true);
                }
                else
                {
                    this.ShowMsg("没有要发送的对象", false);
                }
            }
        }
 public abstract bool InsertReceiveMessageToAdmin(ReceiveMessageInfo receiveMessage);
Esempio n. 5
0
 public static bool InsertSendMessageToAdmin(SendMessageInfo message, ReceiveMessageInfo receiveMessage)
 {
     return(SubsiteCommentsProvider.Instance().InsertSendMessageToAdmin(message) && SubsiteCommentsProvider.Instance().InsertReceiveMessageToAdmin(receiveMessage));
 }
Esempio n. 6
0
 public static void Update(ReceiveMessageInfo entity)
 {
     dal.Update(entity);
 }
Esempio n. 7
0
 public static int Add(ReceiveMessageInfo entity)
 {
     return(dal.Add(entity));
 }
Esempio n. 8
0
 public static void UpdateReceiveMessage(ReceiveMessageInfo receiveMessage)
 {
     dal.UpdateReceiveMessage(receiveMessage);
 }
Esempio n. 9
0
 public static int AddReceiveMessage(ReceiveMessageInfo receiveMessage)
 {
     receiveMessage.ID = dal.AddReceiveMessage(receiveMessage);
     return(receiveMessage.ID);
 }