/// <summary> /// 给消息通知中某个接收者发送完毕时的处理 /// </summary> /// <param name="receiver">接收者</param> /// <param name="code">发送结果状态码</param> /// <param name="text">如果发送时发生异常,该文本传入异常信息</param> /// <returns>如果发送结果表明发送成功,返回true,否则返回false(短信的发送是否成功,还得延迟一段时间查询后才能获知)</returns> public bool AfterSendDo(NotificationReceiver receiver, string code, string text) { //查询发送结果状态码对象 NotificationCodeDef codeDef = GetCodeDef(this._session, GetCategory(this._session, this.CatID).Type, code); //记录一条发送日志 NotificationLog ntflog = new NotificationLog(); ntflog.NotifyID = this.NotifyID; ntflog.ReceiverID = receiver.ReceiverID; ntflog.ResultCode = code; if (codeDef != null && codeDef.IsSuccess) { ntflog.ErrorText = text; } else { ntflog.ErrorText = codeDef == null ? text : codeDef.Text + text; } ntflog.LogTime = DateTime.Now; ntflog.Create(this._session); //接收者状态更新 //TODO: 等待查询短信发送状态之后再做这个处理 if (codeDef != null && codeDef.IsSuccess) { receiver.ResultStatus = NotificationResultStatus.AllSuccess; } else { receiver.ResultStatus = NotificationResultStatus.AllError; } receiver.FinishTime = DateTime.Now; receiver.Update(this._session, "ResultStatus", "FinishTime"); return(codeDef != null && codeDef.IsSuccess); }
/// <summary> /// ����Ϣ֪ͨ��ij�������߷������ʱ�Ĵ��� /// </summary> /// <param name="receiver">������</param> /// <param name="code">���ͽ��״̬��</param> /// <param name="text">�������ʱ�����쳣�����ı������쳣��Ϣ</param> /// <returns>������ͽ���������ͳɹ�������true������false�����ŵķ����Ƿ�ɹ��������ӳ�һ��ʱ���ѯ����ܻ�֪��</returns> public bool AfterSendDo(NotificationReceiver receiver, string code, string text) { //��ѯ���ͽ��״̬����� NotificationCodeDef codeDef = GetCodeDef(this._session, GetCategory(this._session, this.CatID).Type, code); //��¼һ��������־ NotificationLog ntflog = new NotificationLog(); ntflog.NotifyID = this.NotifyID; ntflog.ReceiverID = receiver.ReceiverID; ntflog.ResultCode = code; if (codeDef != null && codeDef.IsSuccess) ntflog.ErrorText = text; else ntflog.ErrorText = codeDef == null ? text : codeDef.Text + text; ntflog.LogTime = DateTime.Now; ntflog.Create(this._session); //������״̬���� //TODO: �ȴ���ѯ���ŷ���״̬֮������������� if (codeDef!=null && codeDef.IsSuccess) receiver.ResultStatus = NotificationResultStatus.AllSuccess; else receiver.ResultStatus = NotificationResultStatus.AllError; receiver.FinishTime = DateTime.Now; receiver.Update(this._session, "ResultStatus", "FinishTime"); return codeDef != null && codeDef.IsSuccess; }