/// <summary> /// 创建短消息 /// </summary> /// <param name="privatemessageinfo">短消息内容</param> /// <param name="savetosentbox">设置短消息是否在发件箱保留(0为不保留, 1为保留)</param> /// <returns>短消息在数据库中的pmid</returns> public static int CreatePrivateMessage(PrivateMessageInfo privatemessageinfo, int savetosentbox) { return SAS.Data.DataProvider.PrivateMessages.CreatePrivateMessage(privatemessageinfo, savetosentbox); }
/// <summary> /// 创建短消息 /// </summary> /// <param name="privatemessageinfo">短消息内容</param> /// <param name="savetosentbox">设置短消息是否在发件箱保留(0为不保留, 1为保留)</param> /// <returns>短消息在数据库中的pmid</returns> public static int CreatePrivateMessage(PrivateMessageInfo privatemessageinfo, int savetosentbox) { return DatabaseProvider.GetInstance().CreatePrivateMessage(privatemessageinfo, savetosentbox); }
/// <summary> /// 创建短消息 /// </summary> /// <param name="__privatemessageinfo">短消息内容</param> /// <param name="savetosentbox">设置短消息是否在发件箱保留(0为不保留, 1为保留)</param> /// <returns>短消息在数据库中的pmid</returns> public int CreatePrivateMessage(PrivateMessageInfo privateMessageInfo, int saveToSentBox) { DbParameter[] parms = { DbHelper.MakeInParam("@pmid",(DbType)SqlDbType.Int,4,privateMessageInfo.Pmid), DbHelper.MakeInParam("@msgfrom",(DbType)SqlDbType.NVarChar,20,privateMessageInfo.Msgfrom), DbHelper.MakeInParam("@msgfromid",(DbType)SqlDbType.Int,4,privateMessageInfo.Msgfromid), DbHelper.MakeInParam("@msgto",(DbType)SqlDbType.NVarChar,20,privateMessageInfo.Msgto), DbHelper.MakeInParam("@msgtoid",(DbType)SqlDbType.Int,4,privateMessageInfo.Msgtoid), DbHelper.MakeInParam("@folder",(DbType)SqlDbType.SmallInt,2,privateMessageInfo.Folder), DbHelper.MakeInParam("@new",(DbType)SqlDbType.Int,4,privateMessageInfo.New), DbHelper.MakeInParam("@subject",(DbType)SqlDbType.NVarChar,80,privateMessageInfo.Subject), DbHelper.MakeInParam("@postdatetime",(DbType)SqlDbType.DateTime,8,DateTime.Parse(privateMessageInfo.Postdatetime)), DbHelper.MakeInParam("@message",(DbType)SqlDbType.NText,0,privateMessageInfo.Message), DbHelper.MakeInParam("@savetosentbox",(DbType)SqlDbType.Int,4,saveToSentBox) }; return TypeConverter.ObjectToInt( DbHelper.ExecuteScalar(CommandType.StoredProcedure, string.Format("{0}createpm", BaseConfigs.GetTablePrefix), parms), -1); }
/// <summary> /// 加载单个短消息对象 /// </summary> /// <param name="reader"></param> /// <returns></returns> private static PrivateMessageInfo LoadSinglePrivateMessage(IDataReader reader) { PrivateMessageInfo info = new PrivateMessageInfo(); info.Pmid = TypeConverter.StrToInt(reader["pmid"].ToString()); info.Msgfrom = reader["msgfrom"].ToString(); info.Msgfromid = TypeConverter.StrToInt(reader["msgfromid"].ToString()); info.Msgto = reader["msgto"].ToString(); info.Msgtoid = TypeConverter.StrToInt(reader["msgtoid"].ToString()); info.Folder = TypeConverter.StrToInt(reader["folder"].ToString()); info.New = TypeConverter.StrToInt(reader["new"].ToString()); info.Subject = reader["subject"].ToString(); info.Postdatetime = reader["postdatetime"].ToString(); info.Message = reader["message"].ToString(); return info; }