// ajax请求发送文字内容,创建一个条目 // chat.aspx?action=send&data=xxx&room=xxx&text=xxx&style=xxx&name=xxx void DoSendText(LoginState loginstate) { int nRet = 0; SendResultInfo result_info = new SendResultInfo(); string strDate = this.Request["date"]; if (strDate != DateTimeUtil.DateTimeToString8(DateTime.Now)) { result_info.ErrorString = "不允许发送到非今天的文件中"; result_info.ResultValue = -1; goto END_SEND; } string strRoom = this.Request.Form["room"]; string strText = this.Request.Form["text"]; string strStyle = this.Request.Form["style"]; string strUserName = this.Request.Form["name"]; string strUserID = sessioninfo.UserID; string strDisplayName = ""; string strIP = ""; if (loginstate == LoginState.NotLogin || loginstate == LoginState.Public) { strUserID = "(访客)" + strUserName; strIP = this.Request.UserHostAddress.ToString(); } else if (loginstate == LoginState.Reader) { if (sessioninfo.ReaderInfo != null && string.IsNullOrEmpty(sessioninfo.ReaderInfo.DisplayName) == false) { strDisplayName = sessioninfo.ReaderInfo.DisplayName; } } nRet = app.CreateChatItem( MergeRights(sessioninfo.RightsOrigin, sessioninfo.SsoRights), strRoom, strUserID, strDisplayName, strIP, strText, strStyle, sessioninfo.PostedFileInfo != null ? sessioninfo.PostedFileInfo.FileName : "", // null, // this.FileUpload1.PostedFile, sessioninfo.PhotoUrl, out string strError); result_info.ErrorString = strError; result_info.ResultValue = nRet; DeleteTempFile(); END_SEND: this.Response.Write(GetResultString(result_info)); this.Response.End(); }
// ajax请求发送文字内容,创建一个条目 // chat.aspx?action=send&data=xxx&room=xxx&text=xxx&style=xxx&name=xxx void DoSendText(LoginState loginstate) { string strError = ""; int nRet = 0; SendResultInfo result_info = new SendResultInfo(); string strDate = this.Request["date"]; if (strDate != DateTimeUtil.DateTimeToString8(DateTime.Now)) { result_info.ErrorString = "不允许发送到非今天的文件中"; result_info.ResultValue = -1; goto END_SEND; } string strRoom = this.Request.Form["room"]; string strText = this.Request.Form["text"]; string strStyle = this.Request.Form["style"]; string strUserName = this.Request.Form["name"]; string strUserID = sessioninfo.UserID; string strDisplayName = ""; string strIP = ""; if (loginstate == LoginState.NotLogin || loginstate == LoginState.Public) { strUserID = "(访客)" + strUserName; strIP = this.Request.UserHostAddress.ToString(); } else if (loginstate == LoginState.Reader) { if (sessioninfo.ReaderInfo != null && string.IsNullOrEmpty(sessioninfo.ReaderInfo.DisplayName) == false) strDisplayName = sessioninfo.ReaderInfo.DisplayName; } nRet = app.CreateChatItem( MergeRights(sessioninfo.RightsOrigin, sessioninfo.SsoRights), strRoom, strUserID, strDisplayName, strIP, strText, strStyle, sessioninfo.PostedFileInfo != null ? sessioninfo.PostedFileInfo.FileName : "", // null, // this.FileUpload1.PostedFile, sessioninfo.PhotoUrl, out strError); result_info.ErrorString = strError; result_info.ResultValue = nRet; DeleteTempFile(); END_SEND: this.Response.Write(GetResultString(result_info)); this.Response.End(); }