/// <summary> /// Sends a message to a user /// </summary> /// <param name="WebMemberID">The member posting the message</param> /// <param name="ToMemberID">The receiver of the message</param> /// <param name="Message">The text content fo the message</param> /// <returns>Returns a chat object</returns> public static Next2Friends.Data.Chat SendMessageDB(int MemberIDFrom, int MemberIDTo, string FromNickName, string Message) { Next2Friends.Data.Chat m = new Next2Friends.Data.Chat(); m.ChatWebID = GetGUID(); m.DTCreated = DateTime.Now; m.Delivered = false; m.MemberIDFrom = MemberIDFrom; m.MemberIDTo = MemberIDTo; m.Message = Message; m.Save(); return(m); }
/// <summary> /// Takes an prepopulated IDataReader and creates an array of Chats /// </summary> public static List<Chat> PopulateObject(IDataReader dr) { ColumnFieldList list = new ColumnFieldList(dr); List<Chat> arr = new List<Chat>(); Chat obj; while (dr.Read()) { obj = new Chat(); if (list.IsColumnPresent("ChatID")) { obj._chatID = (int)dr["ChatID"]; } if (list.IsColumnPresent("ChatWebID")) { obj._chatWebID = (string)dr["ChatWebID"]; } if (list.IsColumnPresent("MemberIDFrom")) { obj._memberIDFrom = (int)dr["MemberIDFrom"]; } if (list.IsColumnPresent("MemberIDTo")) { obj._memberIDTo = (int)dr["MemberIDTo"]; } if (list.IsColumnPresent("Message")) { obj._message = (string)dr["Message"]; } if (list.IsColumnPresent("Delivered")) { obj._delivered = (bool)dr["Delivered"]; } if (list.IsColumnPresent("Fakey")) { obj._fakey = (string)dr["Fakey"]; } if (list.IsColumnPresent("DTCreated")) { obj._dTCreated = (DateTime)dr["DTCreated"]; } arr.Add(obj); } dr.Close(); return arr; }
/// <summary> /// Sends a message to a user /// </summary> /// <param name="WebMemberID">The member posting the message</param> /// <param name="ToMemberID">The receiver of the message</param> /// <param name="Message">The text content fo the message</param> /// <returns>Returns a chat object</returns> public static Next2Friends.Data.Chat SendMessageDB(int MemberIDFrom, int MemberIDTo, string FromNickName, string Message) { Next2Friends.Data.Chat m = new Next2Friends.Data.Chat(); m.ChatWebID = GetGUID(); m.DTCreated = DateTime.Now; m.Delivered = false; m.MemberIDFrom = MemberIDFrom; m.MemberIDTo = MemberIDTo; m.Message = Message; m.Save(); return m; }