Example #1
0
        public List <Venurooms> GetAllVenurooms(string userID)
        {
            List <Venurooms> listMod   = new List <Venurooms>();
            MySqlConnection  con       = new MySqlConnection(DbCon.connectionString);
            string           sqlInsert = "SELECT venurooms.id,venurooms.venuid,venurooms.roomname,venurooms.size,venurooms.active,venus.venuname FROM venurooms INNER JOIN venus ON venurooms.venuid = venus.id WHERE venurooms.active = 1";
            MySqlDataReader  dr        = null;
            MySqlCommand     cmd;

            con.Open();
            cmd = new MySqlCommand(sqlInsert, con);
            dr  = cmd.ExecuteReader();

            while (dr.Read()) //iterate through the records in the result dataset
            {
                Venurooms Mod = new Venurooms();
                Mod.ID        = dr.GetInt32(0);
                Mod.VenuId    = dr.GetInt32(1);
                Mod.RoomName  = dr.GetString(2);
                Mod.Size      = dr.GetInt32(3);
                Mod.Active    = dr.GetInt32(4);
                Mod.xVenuName = dr.GetString(5);
                listMod.Add(Mod);
            }


            con.Close();
            return(listMod);
        }
Example #2
0
        public bool UpdateVenurooms(Venurooms vr, string userID)
        {
            bool            result    = false;
            MySqlConnection con       = new MySqlConnection(DbCon.connectionString);
            string          sqlInsert = "UPDATE `venurooms` SET `venuid`=@venuid,`roomname`=@roomname,`size`=@size WHERE id = @id";

            con.Open();
            MySqlCommand cmd = new MySqlCommand(sqlInsert, con);

            cmd.Parameters.AddWithValue("@venuid", vr.VenuId);
            cmd.Parameters.AddWithValue("@roomname", vr.RoomName);
            cmd.Parameters.AddWithValue("@size", vr.Size);

            if (cmd.ExecuteNonQuery() > 0)
            {
                result = true;
            }
            con.Close();
            return(result);
        }
Example #3
0
        public bool AddVenurooms(Venurooms vr, string userID)
        {
            bool            result    = false;
            MySqlConnection con       = new MySqlConnection(DbCon.connectionString);
            string          sqlInsert = "INSERT INTO `venurooms`(`venuid`, `roomname`, `size`) VALUES (@venuid,@roomname,@size)";

            con.Open();
            MySqlCommand cmd = new MySqlCommand(sqlInsert, con);

            cmd.Parameters.AddWithValue("@venuid", vr.VenuId);
            cmd.Parameters.AddWithValue("@roomname", vr.RoomName);
            cmd.Parameters.AddWithValue("@size", vr.Size);

            if (cmd.ExecuteNonQuery() > 0)
            {
                result = true;
            }
            con.Close();
            return(result);
        }