/// <summary> /// /// </summary> /// <param name="AccessInformation"></param> /// <param name="AlertInformation"></param> /// <returns></returns> public UpdateAlertResult UpdateEmailAlert(AccessControl AccessInformation, EmailAlert AlertInformation,bool checkname) { UpdateAlertResult Result = new UpdateAlertResult(); 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 (checkname) { if (IsAlertNameExist(AccessInformation, AlertInformation.BaseInfo.Name)) { ret = false; estr = keytext[ErrorInfo.AlertNameError.ToString()]; break; } } //email���� //if (string.IsNullOrEmpty(AlertInformation.EmailAddresss)) //{ // ret = false; // estr = keytext[ErrorInfo.EmailAddresssError.ToString()]; // break; //} //if (!string.IsNullOrEmpty(AlertInformation.EmailAddresss)) //{ // if (!CheckEmail(AlertInformation.OtherAddress)) // { // ret = false; // estr = keytext[ErrorInfo.EmailAddresssError.ToString()]; // break; // } //} if (!string.IsNullOrEmpty(AlertInformation.UpgradeTimes)) { if (!IsAlphaNumber(AlertInformation.UpgradeTimes)) { ret = false; estr = keytext[ErrorInfo.AlertTimesError.ToString()]; break; } } if (!string.IsNullOrEmpty(AlertInformation.StopTimes)) { if (!IsAlphaNumber(AlertInformation.StopTimes)) { ret = false; estr = keytext[ErrorInfo.AlertTimesError.ToString()]; break; } } break; } string strAlertIndex = ""; while (ret) { strAlertIndex = AlertInformation.BaseInfo.ID; //���ݴ洢���� ret = SetIniBaseAlertInfo(AccessInformation, AlertInformation.BaseInfo, estr); if (!ret) { break; } //email���� if (this.iniFile == null) { this.iniFile = new IniFileDaoImpl(); } this.iniFile.WriteIniFileString("alert.ini", strAlertIndex, "EmailAdress", AlertInformation.EmailAddresss); this.iniFile.WriteIniFileString("alert.ini", strAlertIndex, "OtherAdress", AlertInformation.OtherAddress); this.iniFile.WriteIniFileString("alert.ini", strAlertIndex, "EmailTemplate", AlertInformation.EmailTemplate); 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 + ",EDIT"); if (!meseagebool) { estr = keytext[ErrorInfo.PushMessageError.ToString()]; } break; } Result.ErrorInformation = estr; Result.UpdateAlertOK = ret; return Result; }
/// <summary> /// /// </summary> /// <param name="AccessInformation"></param> /// <param name="AlertInformation"></param> /// <returns></returns> public UpdateAlertResult UpdateSoundAlert(AccessControl AccessInformation, SoundAlert AlertInformation,bool checkname) { UpdateAlertResult Result = new UpdateAlertResult(); 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 (checkname) { if (IsAlertNameExist(AccessInformation, AlertInformation.BaseInfo.Name)) { ret = false; estr = keytext[ErrorInfo.AlertNameError.ToString()]; break; } } //script���� break; } string strAlertIndex = ""; while (ret) { strAlertIndex = AlertInformation.BaseInfo.ID; //���ݴ洢���� 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 + ",EDIT"); if (!meseagebool) { estr = keytext[ErrorInfo.PushMessageError.ToString()]; } break; } Result.ErrorInformation = estr; Result.UpdateAlertOK = ret; return Result; }