public AddAlertResult AddSoundAlert(AccessControl AccessInformation, SoundAlert AlertInformation) { AddAlertResult Result = new AddAlertResult(); string estr = ""; bool ret = true; string strServer = ""; string strUser = ""; while (ret) { ret = GetAccessControlInformation(AccessInformation); if (!ret) { estr = keytext[ErrorInfo.AccessControlError.ToString()]; } strServer = "localhost"; strUser = "******"; if (AccessInformation.LimitServer) { strServer = AccessInformation.SVDBServer; } if (AccessInformation.LimitUser) { strUser = AccessInformation.UserID; } if (IsAlertNameExist(AccessInformation, AlertInformation.BaseInfo.Name)) { ret = false; estr = keytext[ErrorInfo.AlertNameError.ToString()]; break; } //script���� break; } string strAlertIndex = ""; while (ret) { strAlertIndex = GenerateAlertIndex(AccessInformation); AlertInformation.BaseInfo.ID = strAlertIndex; //���ݴ洢���� ret = SetIniBaseAlertInfo(AccessInformation, AlertInformation.BaseInfo, estr); if (!ret) { break; } //email���� if (this.iniFile == null) { this.iniFile = new IniFileDaoImpl(); } this.iniFile.WriteIniFileString("alert.ini", strAlertIndex, "Server", AlertInformation.ServerName); this.iniFile.WriteIniFileString("alert.ini", strAlertIndex, "LoginName", AlertInformation.LoginName); this.iniFile.WriteIniFileString("alert.ini", strAlertIndex, "LoginPwd", AlertInformation.LoginPassword); if (queue == null) { this.queue = new QueueDaoImpl(); } //send message to service bool meseagebool = this.queue.PushStringMessage("SiteView70-Alert", "IniChange", "alert.ini," + strAlertIndex + ",ADD"); if (!meseagebool) { estr = keytext[ErrorInfo.PushMessageError.ToString()]; } break; } Result.ErrorInformation = estr; Result.AddAlertOK = ret; Result.AlertIndex = strAlertIndex; return Result; }
/// <summary> /// SMS ���� /// </summary> /// <param name="AccessInformation"></param> /// <param name="AlertInformation"></param> /// <returns></returns> public AddAlertResult AddSMSAlert(AccessControl AccessInformation, SMSAlert AlertInformation) { AddAlertResult Result = new AddAlertResult(); string estr = ""; bool ret = true; string strServer = ""; string strUser = ""; while (ret) { ret = GetAccessControlInformation(AccessInformation); if (!ret) { estr = keytext[ErrorInfo.AccessControlError.ToString()]; } strServer = "localhost"; strUser = "******"; if (AccessInformation.LimitServer) { strServer = AccessInformation.SVDBServer; } if (AccessInformation.LimitUser) { strUser = AccessInformation.UserID; } if (IsAlertNameExist(AccessInformation, AlertInformation.BaseInfo.Name)) { ret = false; estr = keytext[ErrorInfo.AlertNameError.ToString()]; break; } //sms���� if (string.IsNullOrEmpty(AlertInformation.SmsNumber)) { ret = false; break; } if (!string.IsNullOrEmpty(AlertInformation.UpgradeTimes)) { if (!IsAlphaNumber(AlertInformation.UpgradeTimes)) { ret = false; estr = keytext[ErrorInfo.UpgradeTimesError.ToString()]; break; } } if (!string.IsNullOrEmpty(AlertInformation.StopTimes)) { if (!IsAlphaNumber(AlertInformation.StopTimes)) { ret = false; estr = keytext[ErrorInfo.StopTimesError.ToString()]; break; } } break; } string strAlertIndex = ""; while (ret) { strAlertIndex = GenerateAlertIndex(AccessInformation); AlertInformation.BaseInfo.ID = strAlertIndex; //���ݴ洢���� ret = SetIniBaseAlertInfo(AccessInformation, AlertInformation.BaseInfo, estr); if (!ret) { break; } //email���� if (this.iniFile == null) { this.iniFile = new IniFileDaoImpl(); } this.iniFile.WriteIniFileString("alert.ini", strAlertIndex, "SmsNumber", AlertInformation.SmsNumber); this.iniFile.WriteIniFileString("alert.ini", strAlertIndex, "OtherNumber", AlertInformation.OtherNumber); this.iniFile.WriteIniFileString("alert.ini", strAlertIndex, "SmsSendMode", AlertInformation.SendMode); this.iniFile.WriteIniFileString("alert.ini", strAlertIndex, "SmsTemplate", AlertInformation.SMSTemplate); this.iniFile.WriteIniFileString("alert.ini", strAlertIndex, "WatchSheet", AlertInformation.WatchSheet); this.iniFile.WriteIniFileString("alert.ini", strAlertIndex, "Upgrade", AlertInformation.UpgradeTimes); this.iniFile.WriteIniFileString("alert.ini", strAlertIndex, "UpgradeTo", AlertInformation.ReceiverAddress); this.iniFile.WriteIniFileString("alert.ini", strAlertIndex, "Stop", AlertInformation.StopTimes); if (queue == null) { this.queue = new QueueDaoImpl(); } //send message to service bool meseagebool = this.queue.PushStringMessage("SiteView70-Alert", "IniChange", "alert.ini," + strAlertIndex + ",ADD"); if (!meseagebool) { estr = keytext[ErrorInfo.PushMessageError.ToString()]; } break; } Result.ErrorInformation = estr; Result.AddAlertOK = ret; Result.AlertIndex = strAlertIndex; return Result; }