当前位置: 首页>>代码示例>>C#>>正文


C# DataAccessLayer.SendMessage方法代码示例

本文整理汇总了C#中DataAccessLayer.SendMessage方法的典型用法代码示例。如果您正苦于以下问题:C# DataAccessLayer.SendMessage方法的具体用法?C# DataAccessLayer.SendMessage怎么用?C# DataAccessLayer.SendMessage使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在DataAccessLayer的用法示例。


在下文中一共展示了DataAccessLayer.SendMessage方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: AlarmChecker

        static void AlarmChecker(Ram_Info ws1)
        {
            try
            {

                if (AlarmCount > ws1.AlarmValue && AlarmStatus == 0)
                {

                    try
                    {
                        AlarmFormatter(ws1);
                    }
                    catch (Exception ex)
                    {

                        LogUtil.WriteLog(LogLevel.ERROR, ex.Message + " " + ex.StackTrace + Environment.NewLine + "**** " + "Date:" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"));
                    }

                    if (ws1.isFtpUploadEnable)
                    {
                        FTPHandler ftpUploader = new FTPHandler();
                        ftpUploader.Upload(ws1.AlarmFilePath, ws1.FtpFileName);
                    }

                    if (ws1.isMailSendEnable)
                    {
                        string[] mailingList1 = ws1.ReceiverList.Split('#');
                        foreach (string mailAdress in mailingList1)
                        {
                            Mailer cs = new Mailer();
                            cs.EmailSubject = String.Format(ws1.ClubName + "/" + ws1.Name, ws1.ClubName);
                            cs.EmailBody = "Server-IP: " + ws1.ServerIpAddress + "\n" + "Project Name:  " + ws1.ClubName + "\n" + ws1.MessageStopped + "%" + ws1.AlarmPercentage + "\n" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
                            cs.IsHtmlMail = false;
                            cs.EmailTo = mailAdress;
                            cs.SmtpServerPort = SMTP_PORT;
                            cs.SenderEmailAddress = SMTP_USER;
                            cs.SenderEmailPassword = SMTP_PASS;
                            cs.EnableSsl = true;
                            cs.SmtpServerName = SMTP_HOST;
                            Mailer.SendSingleEmail(cs);
                            cs = null;

                        }

                    }

                    if (ws1.isSmsSendEnable)
                    {

                        try
                        {

                            string[] arrSmsList = ws1.SmsList.Split('#');
                            foreach (string Msisdn in arrSmsList)
                            {
                                DataAccessLayer _objDataAccessLayer = new DataAccessLayer();
                                _objDataAccessLayer.SendMessage(ws1.ServiceCode, Msisdn, String.Format("{0} - {1}", ws1.ClubName, ws1.MessageStopped + "\n" + "Server-IP: " + ws1.ServerIpAddress + "\n" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")));
                            }
                        }
                        catch (Exception exSms)
                        {
                            LogUtil.WriteLog(LogLevel.ERROR, exSms.Message + " " + exSms.StackTrace + Environment.NewLine + "**** " + "Date:" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"));
                        }
                    }
                    AlarmStatus = 1;

                }

                else if (AlarmCount == 0 && AlarmStatus == 1)
                {

                    AlarmStatus = 0;
                    AlarmCount = 0;

                    try
                    {
                        AlarmFormatter(ws1);
                    }
                    catch (Exception ex)
                    {

                        LogUtil.WriteLog(LogLevel.ERROR, ex.Message + " " + ex.StackTrace + Environment.NewLine + "**** " + "Date:" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"));
                    }

                    if (ws1.isFtpUploadEnable)
                    {
                        FTPHandler ftpUploader = new FTPHandler();
                        ftpUploader.Upload(ws1.AlarmFilePath, ws1.FtpFileName);
                    }

                    if (ws1.isSmsSendEnable)
                    {

                        try
                        {

                            string[] arrSmsList = ws1.SmsList.Split('#');
                            foreach (string Msisdn in arrSmsList)
                            {
                                DataAccessLayer _objDataAccessLayer = new DataAccessLayer();
//.........这里部分代码省略.........
开发者ID:cagatayes85,项目名称:WIN_S_RAM_CHECK,代码行数:101,代码来源:AlarmChecker.cs


注:本文中的DataAccessLayer.SendMessage方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。