/// <summary> /// 得到一个对象实体 /// </summary> public AndroidMvcServer.Model.Tb_MeetingRoom DataRowToModel(DataRow row) { AndroidMvcServer.Model.Tb_MeetingRoom model = new AndroidMvcServer.Model.Tb_MeetingRoom(); if (row != null) { if (row["RoomId"] != null && row["RoomId"].ToString() != "") { model.RoomId = int.Parse(row["RoomId"].ToString()); } if (row["RoomName"] != null) { model.RoomName = row["RoomName"].ToString(); } if (row["RoomAddr"] != null) { model.RoomAddr = row["RoomAddr"].ToString(); } if (row["RoomCapacity"] != null && row["RoomCapacity"].ToString() != "") { model.RoomCapacity = int.Parse(row["RoomCapacity"].ToString()); } if (row["RoomDesc"] != null) { model.RoomDesc = row["RoomDesc"].ToString(); } if (row["CompId"] != null) { model.CompId = row["CompId"].ToString(); } if (row["Phone"] != null) { model.Phone = row["Phone"].ToString(); } if (row["Equipments"] != null) { model.Equipments = row["Equipments"].ToString(); } } return model; }
/// <summary> /// 得到一个对象实体 /// </summary> public AndroidMvcServer.Model.Tb_MeetingRoom GetModel(int RoomId) { StringBuilder strSql = new StringBuilder(); strSql.Append("select RoomId,RoomName,RoomAddr,RoomCapacity,RoomDesc,CompId,Phone,Equipments from tb_meetingroom "); strSql.Append(" where RoomId=@RoomId "); MySqlParameter[] parameters = { new MySqlParameter("@RoomId", MySqlDbType.Int32,11) }; parameters[0].Value = RoomId; AndroidMvcServer.Model.Tb_MeetingRoom model = new AndroidMvcServer.Model.Tb_MeetingRoom(); DataSet ds = DbHelperMySQL.Query(strSql.ToString(), parameters); if (ds.Tables[0].Rows.Count > 0) { return DataRowToModel(ds.Tables[0].Rows[0]); } else { return null; } }