Exemplo n.º 1
0
        /// <summary>
        /// 发送手机消息
        /// </summary>
        /// <param name="tel">手机号</param>
        /// <param name="doc">手机内容</param>
        public static void SendSMS(string tel, string doc)
        {
            // 如果不启用消息机制.
            if (BP.WF.Glo.IsEnableSysMessage == false)
            {
                return;
            }

            SMS sms = new SMS();

            sms.MyPK        = DBAccess.GenerGUID();
            sms.HisMsgSta   = MsgSta.UnRun;
            sms.MsgAccepter = tel;
            sms.Title       = doc;
            sms.Sender      = BP.Web.WebUser.No;
            sms.RDT         = BP.DA.DataType.CurrentDataTime;

            sms.MsgType = 1;  // 0 邮件 1,短信。

            try
            {
                sms.Insert();
            }
            catch
            {
                sms.CheckPhysicsTable();
                sms.Insert();
            }
        }
Exemplo n.º 2
0
        /// <summary>
        /// 发送邮件消息
        /// </summary>
        /// <param name="email">邮件地址</param>
        /// <param name="mailTitle">邮件标题</param>
        /// <param name="mailDoc">发送内容</param>
        /// <param name="msgFlag">标志</param>
        public static void SendEmail(string email, string mailTitle, string mailDoc, string msgFlag)
        {
            // 如果不启用消息机制.
            if (BP.WF.Glo.IsEnableSysMessage == false)
            {
                return;
            }

            SMS sms = new SMS();

            sms.CheckPhysicsTable();

            sms.MyPK      = DBAccess.GenerGUID();
            sms.HisMsgSta = MsgSta.UnRun;

            sms.MsgAccepter = email;
            sms.Title       = mailTitle;
            sms.Doc         = mailDoc;

            sms.Sender = BP.Web.WebUser.No;
            sms.RDT    = BP.DA.DataType.CurrentDataTime;

            sms.MsgFlag = msgFlag; // 消息标志.
            sms.Insert();
        }
Exemplo n.º 3
0
        void btn_Click(object sender, EventArgs e)
        {
            BP.Sys.SMS msg = new BP.Sys.SMS();
            msg.Title  = this.Pub1.GetTextBoxByID("TB_Title").Text;
            msg.Doc    = this.Pub1.GetTextBoxByID("TB_Doc").Text;
            msg.Sender = WebUser.No;
            msg.RDT    = DataType.CurrentDataTime;

            string acces = this.Pub1.GetTextBoxByID("TB_Emps").Text.Trim();

            if (acces.Length == 0)
            {
                throw new Exception("请输入或者选择接受人.");
            }

            if (msg.Title.Length == 0)
            {
                throw new Exception("请输入标题.");
            }

            acces = acces.Replace(";", ",");
            acces = acces.Replace(";;", ",");
            acces = acces.Replace(" ", ",");
            acces = acces.Replace(",,", ",");

            string[] strs = acces.Split(',');
            foreach (string str in strs)
            {
                if (str == null || str == "")
                {
                    continue;
                }

                msg.MsgAccepter = str;
                msg.MyPK        = DBAccess.GenerOID().ToString();
                msg.Insert();
            }

            BP.DA.Paras ps = new BP.DA.Paras();
            ps.Add("Sender", WebUser.No);
            ps.Add("Receivers", msg.MsgAccepter);
            ps.Add("Title", msg.Title);
            ps.Add("Context", msg.Doc);
            try
            {
                DBAccess.RunSP("CCstaff", ps);
            }
            catch (Exception ex)
            {
                this.ToMsgPage("发送消息出现错误:" + ex.Message);
                return;
            }
            this.ToMsgPage("您的信息已经成功的发送到:" + acces);
        }