// TODO: 需要增加一个功能,把显示名转化为条码号 // 校验收件人是否存在 // parameters: // return: // -1 error // 0 not exist // 1 exist public int DoVerifyRecipient( RmsChannelCollection channels, string strRecipient, out string strError) { strError = ""; if (this.VerifyAccount == null) { // text-level: 内部错误 strError = "MessageCenter 尚未挂接 VerifyRecipient 事件,无法校验收件人的存在与否。"; return(-1); } VerifyAccountEventArgs e = new VerifyAccountEventArgs(); e.Name = strRecipient; e.Channels = channels; this.VerifyAccount(this, e); if (e.Error == true) { strError = e.ErrorInfo; return(-1); } if (e.Exist == false) { if (String.IsNullOrEmpty(e.ErrorInfo) == true) { // text-level: 用户提示 strError = string.Format(this.GetString("收件人s不存在"), // "收件人 '{0}' 不存在。" strRecipient); // "收件人 '" + strRecipient + "' 不存在。"; return(0); } strError = e.ErrorInfo; return(0); } return(1); }
// TODO: 需要增加一个功能,把显示名转化为条码号 // 校验收件人是否存在 // parameters: // return: // -1 error // 0 not exist // 1 exist public int DoVerifyRecipient( RmsChannelCollection channels, string strRecipient, out string strError) { strError = ""; if (this.VerifyAccount == null) { // text-level: 内部错误 strError = "MessageCenter 尚未挂接 VerifyRecipient 事件,无法校验收件人的存在与否。"; return -1; } VerifyAccountEventArgs e = new VerifyAccountEventArgs(); e.Name = strRecipient; e.Channels = channels; this.VerifyAccount(this, e); if (e.Error == true) { strError = e.ErrorInfo; return -1; } if (e.Exist == false) { if (String.IsNullOrEmpty(e.ErrorInfo) == true) { // text-level: 用户提示 strError = string.Format(this.GetString("收件人s不存在"), // "收件人 '{0}' 不存在。" strRecipient); // "收件人 '" + strRecipient + "' 不存在。"; return 0; } strError = e.ErrorInfo; return 0; } return 1; }
void MessageCenter_VerifyAccount(object sender, VerifyAccountEventArgs e) { string strError = ""; if (e.Name == "public") { e.Exist = false; e.Error = true; e.ErrorInfo = "系统禁止对 public 用户发消息。"; return; } RmsChannel channel = e.Channels.GetChannel(this.WsUrl); if (channel == null) { e.Exist = false; e.Error = true; e.ErrorInfo = "get channel error"; return; } // 检查读者账号是否存在 // return: // -1 error // 0 不存在 // 1 存在 // >1 多于一个 int nRet = VerifyReaderAccount(channel, // e.Channels, e.Name, out strError); if (nRet == -1 || nRet > 1) { e.Exist = false; e.Error = true; e.ErrorInfo = strError; return; } if (nRet == 1) { e.Exist = true; return; } // 检查工作人员账号 Account account = null; /* if (e.Name == "public") { }*/ // 从library.xml文件定义 获得一个帐户的信息 // return: // -1 error // 0 not found // 1 found nRet = this.GetAccount(e.Name, out account, out strError); if (nRet == -1) { e.Exist = false; e.Error = true; e.ErrorInfo = strError; return; } if (nRet == 0) { e.Exist = false; e.Error = false; e.ErrorInfo = "用户名 '" + e.Name + "' 不存在。"; return; } e.Exist = true; }