//增加群组成员 public int addChatRoomMember(Model.Chatroom chatroom) { string sql = "insert into [chatroom_member] ([chatroom_id],[time],[u_id]) values (@CId,@Time,@LeaderId)"; List <SqlParameter> parameters = new List <SqlParameter>(); SqlParameter CId = new SqlParameter("@CId", SqlDbType.Int); SqlParameter Time = new SqlParameter("@Time", SqlDbType.DateTime); SqlParameter LeaderId = new SqlParameter("@LeaderId", SqlDbType.Int); Time.Value = chatroom.Time; parameters.Add(Time); LeaderId.Value = chatroom.LeaderId; parameters.Add(LeaderId); CId.Value = chatroom.CId; parameters.Add(CId); int result = SqlDbHelper.ExecuteNoQuery(sql, CommandType.Text, parameters); return(result); }
public int addChatRoom(Model.Chatroom chatroom) { string sql = "insert into [chatroom] ([name],[time],[limit_num],[leader_id]) values (@Name,@Time,@LimitNum,@LeaderId)"; List <SqlParameter> parameters = new List <SqlParameter>(); SqlParameter Name = new SqlParameter("@Name", SqlDbType.VarChar, 50); SqlParameter Time = new SqlParameter("@Time", SqlDbType.DateTime); SqlParameter LimitNum = new SqlParameter("@LimitNum", SqlDbType.Int); SqlParameter LeaderId = new SqlParameter("@LeaderId", SqlDbType.Int); Name.Value = chatroom.Name; parameters.Add(Name); Time.Value = chatroom.Time; parameters.Add(Time); LimitNum.Value = chatroom.LimitNum; parameters.Add(LimitNum); LeaderId.Value = chatroom.LeaderId; parameters.Add(LeaderId); int result = SqlDbHelper.ExecuteNoQuery(sql, CommandType.Text, parameters); setPort();//设置端口号 return(result); }
public string addChatRoom(Model.Chatroom chatroom, string key)//添加群 { string msg = null; if (this.isExist(key)) { msg = "当前群已经存在,请换个名字!"; return(msg); } else { int result = chatRoomMemberDal.addChatRoom(chatroom); if (result == 1) { msg = null; return(msg); } else { msg = "错误!"; return(msg); } } }