小学生之KTV项目文档(bdqn) 指导老师:yuanyuming

第一步:创建数据库连接方法和打开方法和关闭方法!

 1  public class DBHelper
 2     {
 3        private  string str = "server=.;database=MyKtv;uid=sa";
 4        private SqlConnection _conection;
 5
 6        public SqlConnection Conection
 7        {
 8            get
 9            {
10                if (_conection==null)
11                {
12                    _conection = new SqlConnection(str);
13                }
14                return _conection;
15            }
16        }
17        /// <summary>
18        /// 打开方法
19        /// </summary>
20        public void OpenConnection()
21        {
22            if (Conection.State == ConnectionState.Closed)
23            {
24                Conection.Open();
25            } if (Conection.State == ConnectionState.Broken)
26            {
27                Conection.Close();
28                Conection.Open();
29            }
30        }
31        /// <summary>
32        /// 关闭方法`
33        /// </summary>
34        public void CloseConnection()
35        {
36            if (Conection.State == ConnectionState.Open && Conection.State == ConnectionState.Broken)
37            {
38                Conection.Close();
39            }
40
41        }

第二步:歌曲首页

歌曲首页:用到了窗体之间的转换和读取路径表中的图片路径放到filepath上

 1 public partial class FormMain : Form
 2     {
 3         DBHelper db = new DBHelper();
 4         public FormMain()
 5         {
 6             InitializeComponent();
 7         }
 8         private void Form1_Load(object sender, EventArgs e)
 9         {
10             //读取路径表中的图片路径放到filepath上
11             string sql = "select resource_path from resource_path where resource_id=1";
12             SqlCommand cmd = new SqlCommand(sql,db.Conection);
13             db.OpenConnection();
14             KtvUtil.FilePath = cmd.ExecuteScalar().ToString();
15             db.CloseConnection();
16         }
17
18         private void pictureBox1_Click(object sender, EventArgs e)
19         {
20             //打开明星点歌窗体
21             FrmSinger frmSinger = new FrmSinger();
22             frmSinger.Show();
23         }
24
25         private void toolStripButton4_Click(object sender, EventArgs e)
26         {
27             this.Close();
28         }
29
30         private void pictureBox4_Click(object sender, EventArgs e)
31         {
32             //打开拼音点歌窗体
33             FrmOrderBySongName fobsn = new FrmOrderBySongName();
34             fobsn.ShowDialog();
35         }

第三步:歌星点歌

歌星点歌:用到了3个ListView之间的跳转,

  1 public partial class FrmSinger : Form
  2     {
  3         DBHelper db = new DBHelper();
  4         public string SingerType = "组合";
  5         public int SingerId = 0;
  6
  7         public FrmSinger()
  8         {
  9             InitializeComponent();
 10         }
 11
 12         private void panel1_Paint(object sender, PaintEventArgs e)
 13         {
 14
 15         }
 16         /// <summary>
 17         /// 点击歌手类型后加载相应的信息
 18         /// </summary>
 19         public void ShowSingerDiQu()
 20         {
 21              if (lvtype.SelectedItems[0]!=null)
 22             {
 23                 lvtype.Visible = false;
 24                 lvSinger.Visible = true;
 25                 lvSinger.Location = lvtype.Location;
 26
 27
 28                 this.SingerType = Convert.ToString(lvtype.SelectedItems[0].Tag);
 29             }
 30             string sql = "select singertype_name,singertype_id from singer_type";
 31             SqlCommand cmd = new SqlCommand(sql,db.Conection);
 32             SqlDataReader sdr;
 33             try
 34             {
 35                 db.OpenConnection();
 36                 sdr = cmd.ExecuteReader();
 37                 lvtype.Items.Clear();
 38                 if (sdr.HasRows)
 39                 {
 40                     int result = 0;
 41                     while (sdr.Read())
 42                     {
 43                         ListViewItem lvitem = new ListViewItem();
 44                         string typename = Convert.ToString(sdr["singertype_name"]);
 45                         int typeid = Convert.ToInt32(sdr["singertype_id"]);
 46                         lvitem.Text = typename;
 47                         lvitem.Tag = typeid;
 48                         lvitem.ImageIndex = result;
 49                         lvSinger.Items.Add(lvitem);
 50                         result++;
 51                     }
 52                     sdr.Close();
 53                 }
 54             }
 55             catch (Exception ex)
 56             {
 57                 MessageBox.Show("第二个系统报错" + ex.Message);
 58             }
 59             finally
 60             {
 61                 db.CloseConnection();
 62             }
 63         }
 64
 65         private void listView2_SelectedIndexChanged(object sender, EventArgs e)
 66         {
 67
 68         }
 69
 70         private void FrmOrderBySinger_Load(object sender, EventArgs e)
 71         {
 72             this.lvSinger.Visible = false;
 73             this.lvContry.Visible=false;
 74         }
 75
 76         private void listView1_Click(object sender, EventArgs e)
 77         {
 78              ShowSingerDiQu();
 79         }
 80         /// <summary>
 81         /// 读取对应地区的歌手名称
 82         /// </summary>
 83         public void ShowSingerName()
 84         {
 85             if (lvSinger.SelectedItems[0]!=null)
 86             {
 87                 lvSinger.Visible = false;
 88                 lvContry.Visible = true;
 89                 lvContry.Location = lvtype.Location;
 90                 SingerId = Convert.ToInt32(lvSinger.SelectedItems[0].Tag);
 91                 StringBuilder sb = new StringBuilder();
 92                 string sum = SingerType;
 93                 if (sum!="组合")
 94                 {
 95                     sum = SingerType == "女歌手" ? "男" : "女";
 96                 }
 97                 string sql = string.Format("select singer_name,singer_photo_url,singer_id from singer_info where singertype_id=‘{0}‘ and singer_sex=‘{1}‘", SingerId,sum);
 98                 SqlCommand cmd = new SqlCommand(sql, db.Conection);
 99                 try
100                 {
101                     db.OpenConnection();
102                     SqlDataReader read = cmd.ExecuteReader();
103                     if (read.HasRows)
104                     {
105                         //歌手头像索引
106                         int imageindex = 0;
107                         //清空图片集合
108                         imageName.Images.Clear();
109                         //清空listview列表集合
110                         lvContry.Items.Clear();
111                         if (read.HasRows)
112                         {
113                             while (read.Read())
114                             {
115                                 //图片的地址
116                                 string path = KtvUtil.FilePath + @"" + Convert.ToString(read["singer_photo_url"]);
117                                 imageName.Images.Add(Image.FromFile(path));
118                                 ListViewItem lvitem = new ListViewItem();
119                                 string typename = Convert.ToString(read["singer_name"]);
120                                 int typeid = Convert.ToInt32(read["singer_id"]);
121                                 lvitem.Text = typename;
122                                 lvitem.Tag = typeid;
123                                 lvitem.ImageIndex = imageindex;
124                                 lvContry.Items.Add(lvitem);
125                                 imageindex++;
126                             }
127                             read.Close();
128                         }
129                     }
130
131                 }
132                 catch (Exception ex)
133                 {
134                     MessageBox.Show("第三个系统报错!" + ex.Message);
135                 }
136                 finally
137                 {
138                     db.CloseConnection();
139                 }
140             }
141
142         }
143         private void lvName_Click(object sender, EventArgs e)
144         {
145             ShowList();
146         }
147
148         private void listView2_Click(object sender, EventArgs e)
149         {
150             ShowSingerName();
151         }
152
153         private void listView1_ChangeUICues(object sender, UICuesEventArgs e)
154         {
155
156         }
157         /// <summary>
158         /// 打开第三层ListView
159         /// </summary>
160         public void ShowList()
161         {
162             //定义一个StringBuilder对象
163             StringBuilder sb = new StringBuilder();
164             //sql语句
165             string sql = string.Format("select song_id,song_name,singer_name=‘{0}‘,song_url from song_info where singer_id={1}",lvContry.SelectedItems[0].Text,Convert.ToInt32(lvContry.SelectedItems[0].Tag));
166             //定义歌曲列表窗体的对象
167             FrmSongList sl=new FrmSongList();
168            //把sql语句传到第三个窗体上
169             sl.Sql=sql;
170             sl.ShowDialog();
171             this.Close();
172         }
173
174         private void toolStripButton4_Click(object sender, EventArgs e)
175         {
176             this.Close();
177         }
178
179         private void toolStripButton1_Click(object sender, EventArgs e)
180         {
181             if (lvSinger.Visible)
182             {
183                 lvSinger.Visible = false;
184                 lvContry.Visible = true;
185             }
186             else if (lvContry.Visible)
187             {
188                 lvContry.Visible = false;
189                 lvtype.Visible = true;
190             }
191             else if (lvtype.Visible)
192             {
193                 FormMain dd = new FormMain();
194                 dd.Show();
195                 this.Close();
196             }
197         }

第四步:歌曲列表

双击DateGrilView选中的一行,提示:

歌曲列表:实现点击一下歌曲列表中的一行信息就到以点里面

 1 public partial class FrmSongList : Form
 2     {
 3         DBHelper db = new DBHelper();
 4         DataSet ds = new DataSet();
 5
 6         private string sql = "";
 7         //歌曲的查询语句
 8         public string Sql
 9         {
10             get { return sql; }
11             set { sql = value; }
12         }
13         public FrmSongList()
14         {
15             InitializeComponent();
16         }
17
18         private void dataGridView1_CellContentClick(object sender, DataGridViewCellEventArgs e)
19         {
20             //第一步判断datagridView有没有选中的行
21             //第二步从实例化SongList类
22             //第三步调取歌曲song类的字段进行赋值(从datagridview中的列赋值);
23             //第四部把从datagridview中获取到的数据添加到播放类里的数组中
24             if (this.dataGridView1.SelectedRows[0]!=null)
25             {
26                 SongList song = new SongList();
27                 song.SongName1 = this.dataGridView1.SelectedRows[0].Cells[1].Value.ToString();
28                 song.SongUl1 = this.dataGridView1.SelectedRows[0].Cells[3].Value.ToString();
29                 PalyList.AddSong(song);
30             }
31
32         }
33
34         private void FrmSongList_Load(object sender, EventArgs e)
35         {
36             SqlDataAdapter sda = new SqlDataAdapter(sql,db.Conection);
37             sda.Fill(ds,"songinfo");
38             dataGridView1.DataSource = ds.Tables["songinfo"];
39         }
40
41         private void toolStripButton4_Click(object sender, EventArgs e)
42         {
43             this.Close();
44         }
45
46         private void toolStripButton6_Click(object sender, EventArgs e)
47         {
48             FrmSong frm = new FrmSong();
49             frm.ShowDialog();
50         }

第五步:已点歌曲

已点歌曲:进入了就是已播放状态一次往下添加都是未播放,如果到了下面的播放状态就还得改变成已播放

 1   private void FrmOrderedSongList_Load(object sender, EventArgs e)
 2         {
 3             //遍历播放类里面的数组
 4             foreach (SongList item in PalyList.song)
 5             {
 6
 7                 if (item!=null)
 8                 {
 9                     ListViewItem lvitem = new ListViewItem(item.SongName1);
10                     string type = item.PlaySong == PalySongState.unplayed ? "未播放" : "已播放";
11                     lvitem.SubItems.Add(type);
12                     this.listView1.Items.Add(lvitem);
13                 }
14
15             }
16         }
17
18         private void toolStripButton1_Click(object sender, EventArgs e)
19         {
20             FrmSinger dd = new FrmSinger();
21             dd.Show();
22         }

第六步:拼音点歌

  1     public partial class FrmSpeall : Form
  2     {
  3         private DBOpetion db = new DBOpetion();
  4         private SqlDataAdapter adapter = null;
  5         private DataSet ds = new DataSet();
  6         public FrmSpeall()
  7         {
  8             InitializeComponent();
  9         }
 10         [DllImportAttribute("user32.dll")]
 11         private static extern bool AnimateWindow(IntPtr hwnd, int dwTime, int dwFlags);
 12         private void FrmSpeall_Load(object sender, EventArgs e)
 13         {
 14             AnimateWindow(this.Handle, 300, FrmMain.AW_SLIDE + FrmMain.AW_VER_POSITIVE);
 15         //动态效果可以取消注释
 16             //for (int i = 97; i < 123; i++)
 17             //{
 18             //    for (int j = 0; j < 4; j++)
 19             //    {
 20             //        Label label = new Label();
 21             //        label.BackColor = Color.Yellow;
 22             //        label.Font=new System.Drawing.Font("宋体",14.25F,System.Drawing.FontStyle.Regular,
 23             //            System.Drawing.GraphicsUnit.Point,((byte)(134)));
 24             //        label.AutoSize = false;
 25             //        label.Size = new System.Drawing.Size(50, 25);
 26             //        label.Text = ((char)i).ToString();
 27             //        label.TextAlign = ContentAlignment.MiddleCenter;
 28             //        label.Location = new Point(60 + (i * 90), 60 + (j * 60));
 29             //        label.Parent = panel1;
 30             //    }
 31             //}
 32             ////for (int i = 97; i < 123; i++)
 33             ////{
 34             ////    Console.WriteLine((char)i);
 35             ////}
 36         }
 37
 38         private void pictureBox1_Click(object sender, EventArgs e)
 39         {
 40             this.textBox1.Text = this.textBox1.Text + "a";
 41         }
 42
 43         private void pictureBox2_Click(object sender, EventArgs e)
 44         {
 45             this.textBox1.Text = this.textBox1.Text + "b";
 46         }
 47
 48         private void pictureBox3_Click(object sender, EventArgs e)
 49         {
 50             this.textBox1.Text = this.textBox1.Text + "c";
 51         }
 52
 53         private void pictureBox4_Click(object sender, EventArgs e)
 54         {
 55             this.textBox1.Text = this.textBox1.Text + "d";
 56         }
 57
 58         private void pictureBox5_Click(object sender, EventArgs e)
 59         {
 60             this.textBox1.Text = this.textBox1.Text + "e";
 61         }
 62
 63         private void pictureBox6_Click(object sender, EventArgs e)
 64         {
 65             this.textBox1.Text = this.textBox1.Text + "f";
 66         }
 67
 68         private void pictureBox7_Click(object sender, EventArgs e)
 69         {
 70             this.textBox1.Text = this.textBox1.Text + "g";
 71         }
 72
 73         private void pictureBox8_Click(object sender, EventArgs e)
 74         {
 75             this.textBox1.Text = this.textBox1.Text + "h";
 76         }
 77
 78         private void pictureBox9_Click(object sender, EventArgs e)
 79         {
 80             this.textBox1.Text = this.textBox1.Text + "i";
 81         }
 82
 83         private void pictureBox10_Click(object sender, EventArgs e)
 84         {
 85             this.textBox1.Text = this.textBox1.Text + "j";
 86         }
 87
 88         private void pictureBox11_Click(object sender, EventArgs e)
 89         {
 90             this.textBox1.Text = this.textBox1.Text + "k";
 91         }
 92
 93         private void pictureBox12_Click(object sender, EventArgs e)
 94         {
 95             this.textBox1.Text = this.textBox1.Text + "l";
 96         }
 97
 98         private void pictureBox13_Click(object sender, EventArgs e)
 99         {
100             this.textBox1.Text = this.textBox1.Text + "m";
101         }
102
103         private void pictureBox14_Click(object sender, EventArgs e)
104         {
105             this.textBox1.Text = this.textBox1.Text + "n";
106         }
107
108         private void pictureBox15_Click(object sender, EventArgs e)
109         {
110             this.textBox1.Text = this.textBox1.Text + "o";
111         }
112
113         private void pictureBox16_Click(object sender, EventArgs e)
114         {
115             this.textBox1.Text = this.textBox1.Text + "p";
116         }
117
118         private void pictureBox17_Click(object sender, EventArgs e)
119         {
120             this.textBox1.Text = this.textBox1.Text + "q";
121         }
122
123         private void pictureBox18_Click(object sender, EventArgs e)
124         {
125             this.textBox1.Text = this.textBox1.Text + "r";
126         }
127
128         private void pictureBox19_Click(object sender, EventArgs e)
129         {
130             this.textBox1.Text = this.textBox1.Text + "s";
131         }
132
133         private void pictureBox20_Click(object sender, EventArgs e)
134         {
135             this.textBox1.Text = this.textBox1.Text + "t";
136         }
137
138         private void pictureBox21_Click(object sender, EventArgs e)
139         {
140             this.textBox1.Text = this.textBox1.Text + "u";
141         }
142
143         private void pictureBox22_Click(object sender, EventArgs e)
144         {
145             this.textBox1.Text = this.textBox1.Text + "v";
146         }
147
148         private void pictureBox23_Click(object sender, EventArgs e)
149         {
150             this.textBox1.Text = this.textBox1.Text + "w";
151         }
152
153         private void pictureBox24_Click(object sender, EventArgs e)
154         {
155             this.textBox1.Text = this.textBox1.Text + "x";
156         }
157
158         private void pictureBox25_Click(object sender, EventArgs e)
159         {
160             this.textBox1.Text = this.textBox1.Text + "y";
161         }
162
163         private void pictureBox26_Click(object sender, EventArgs e)
164         {
165             this.textBox1.Text = this.textBox1.Text + "z";
166         }
167         private void button1_Click(object sender, EventArgs e)
168         {
169             string text = this.textBox1.Text;
170             int index = text.Length - 1;
171             if (index >= 0)
172             {
173                 textBox1.Text = text.Remove(index);
174             }
175         }
176         /// <summary>
177         /// 按拼音查找歌曲
178         /// </summary>
179         private void SeleSong()
180         {
181             string sql =string.Format("select song_id,song_name,song_url,singer_name from song_info,singer_info" +
182 " where song_info.singer_id=singer_info.singer_id and song_ab like ‘%{0}%‘",this.textBox1.Text);
183             adapter = new SqlDataAdapter(sql, db.Conntion);
184             if (ds.Tables["song_info"]!=null)
185             {
186                 ds.Tables.Clear();
187             }
188             adapter.Fill(ds, "song_info");
189             this.dataGridView1.DataSource = ds.Tables["song_info"];
190         }
191         private void textBox1_TextChanged(object sender, EventArgs e)
192         {
193             if (this.textBox1.Text !=string.Empty)
194             {
195                 SeleSong();
196                 this.dataGridView1.AutoGenerateColumns = false;
197             }
198             else
199             {
200                 this.dataGridView1.DataSource = null;
201             }
202
203         }
204
205         private void FrmSpeall_FormClosing(object sender, FormClosingEventArgs e)
206         {
207             AnimateWindow(this.Handle, 300, FrmMain.AW_SLIDE + FrmMain.AW_VER_POSITIVE);
208         }
209
210         private void dataGridView1_DoubleClick(object sender, EventArgs e)
211         {
212             if (this.dataGridView1.SelectedRows[0] != null)
213             {
214                 Song song = new Song();
215                 song.SongName = this.dataGridView1.SelectedRows[0].Cells[3].Value.ToString();
216                 song.SongPath = this.dataGridView1.SelectedRows[0].Cells[2].Value.ToString();
217                 ListSong.AddSong(song);
218                 MessageBox.Show("添加成功,请在已点歌曲中查看!!!");
219                 this.Close();
220             }
221         }

第七部:金榜排行

 1    DataSet sb = new DataSet();
 2         SqlDataAdapter adapter = new SqlDataAdapter();
 3         public FrmOrderWordText()
 4         {
 5             InitializeComponent();
 6         }
 7
 8         private void FrmOrderWordText_Load(object sender, EventArgs e)
 9         {
10             DBHelper dd = new DBHelper();
11             string sql = string.Format("select song_name,singer_name,song_play_count from song_info,singer_info where song_info.singer_id=singer_info.singer_id order by song_play_count desc");
12             adapter.SelectCommand = new SqlCommand(sql, dd.Conection);
13             adapter.Fill(sb, "song_info");
14             DataTable table = sb.Tables["song_info"];
15
16             foreach (DataRow row in table.Rows)
17             {
18                 ListViewItem list = new ListViewItem(row[0].ToString());
19                 string [] item={row[1].ToString(),row[2].ToString()};
20                 list.SubItems.AddRange(item);
21                 listView1.Items.Add(list);
22             }
23         }
24
25         private void toolStripButton1_Click(object sender, EventArgs e)
26         {
27             this.Close();
28         }
29
30         private void toolStripButton5_Click(object sender, EventArgs e)
31         {
32             FrmSong song = new FrmSong();
33             song.Show();
34         }
35
36         private void toolStripButton6_Click(object sender, EventArgs e)
37         {
38             if (MessageBox.Show("确定要切歌吗?", "提示", MessageBoxButtons.OKCancel, MessageBoxIcon.Warning) == DialogResult.OK)
39             {
40                 PalyList.CutSong(-1);
41             }
42         }
43
44         private void toolStripButton7_Click(object sender, EventArgs e)
45         {
46             //PalyList.PlayAgain();
47
48             FormMain dd = new FormMain();
49             dd.palySong();
50         }
51
52         private void toolStripButton2_Click(object sender, EventArgs e)
53         {
54             FormMain dd = new FormMain();
55             dd.Show();
56             this.Close();
57         }

第八步:字数点歌

  1  DBHelper db = new DBHelper();
  2         SqlDataAdapter sda = new SqlDataAdapter();
  3         DataSet ds = new DataSet();
  4         public FrmOrderByWordCount()
  5         {
  6             InitializeComponent();
  7         }
  8         /// <summary>
  9         /// 打开主界面
 10         /// </summary>
 11         /// <param name="sender"></param>
 12         /// <param name="e"></param>
 13         private void toolStripButton2_Click(object sender, EventArgs e)
 14         {
 15             FormMain f = new FormMain();
 16             f.Show();
 17         }
 18         /// <summary>
 19         /// 重唱歌曲
 20         /// </summary>
 21         /// <param name="sender"></param>
 22         /// <param name="e"></param>
 23         private void toolStripButton7_Click(object sender, EventArgs e)
 24         {
 25
 26             FormMain dd = new FormMain();
 27             dd.palySong();
 28             //PalyList.PlayAgain();
 29         }
 30         /// <summary>
 31         /// 切歌
 32         /// </summary>
 33         /// <param name="sender"></param>
 34         /// <param name="e"></param>
 35         private void toolStripButton6_Click(object sender, EventArgs e)
 36         {
 37             if (MessageBox.Show("确定要切歌吗?", "提示", MessageBoxButtons.OKCancel, MessageBoxIcon.Warning) == DialogResult.OK)
 38             {
 39                 PalyList.CutSong(-1);
 40             }
 41         }
 42         /// <summary>
 43         /// 已点歌曲
 44         /// </summary>
 45         /// <param name="sender"></param>
 46         /// <param name="e"></param>
 47         private void toolStripButton5_Click(object sender, EventArgs e)
 48         {
 49             FrmSong frmList = new FrmSong();
 50             frmList.Show();
 51         }
 52         /// <summary>
 53         /// 返回
 54         /// </summary>
 55         /// <param name="sender"></param>
 56         /// <param name="e"></param>
 57         private void toolStripButton1_Click(object sender, EventArgs e)
 58         {
 59             this.Close();
 60
 61         }
 62
 63         public void FrmOrderByWordCount_Load(object sender, EventArgs e)
 64         {
 65             string sql2 = "select resource_path from resource_path where resource_id=2";
 66             SqlCommand cmd2 = new SqlCommand(sql2, db.Conection);
 67             db.OpenConnection();
 68             KtvUtil.SongPath = cmd2.ExecuteScalar().ToString();
 69             db.CloseConnection();
 70             for (int i = 1; i <= 4; i++)
 71             {
 72                 for (int j = 1; j<= 3; j++)
 73                 {
 74                     Label label = new Label();
 75                     label.Text = "" + i + "";
 76                     if (j==2)
 77                     {
 78                         label.Text = "" + (i + 4) + "";
 79                     }
 80                     else if (j==3)
 81                     {
 82                         label.Text = "" + (i + 8) + "";
 83                     }
 84                     label.Size = new Size(60, 30);
 85                     label.TextAlign = ContentAlignment.MiddleCenter;
 86                     label.Font = new System.Drawing.Font("华文彩云", 10);
 87                     label.BackColor = Color.Pink;
 88                     label.Click += label_Click;
 89                     label.Location = new Point(40 + 120 * j, 40 + 80 * i);
 90                     this.Controls.Add(label);
 91                 }
 92
 93             }
 94         }
 95         void label_Click(object sender, EventArgs e)
 96         {
 97             DBHelper dd = new DBHelper();
 98             DataSet ds = new DataSet();
 99             Label label = (Label)sender;
100             string sql = string.Format("select song_name,song_url,singer_name from song_info,singer_info" +
101                 " where song_info.singer_id=singer_info.singer_id and song_word_count={0}", Convert.ToInt32(label.Text));
102             SqlDataAdapter da = new SqlDataAdapter(sql, dd.Conection);
103             da.Fill(ds, "song_info");
104             dataGridView1.DataSource = ds.Tables["song_info"];
105             this.dataGridView1.Visible = true;
106
107
108         }
109
110         private void dataGridView1_CellContentClick(object sender, DataGridViewCellEventArgs e)
111         {
112             string songname = this.dataGridView1.SelectedRows[0].Cells["clnSongName"].Value.ToString();
113             DBHelper db = new DBHelper();
114             db.OpenConnection();
115             string sql = string.Format("SELECT song_name,singer_name,song_url,song_photo_url FROM dbo.song_info,dbo.singer_info  where dbo.singer_info.singer_id=dbo.song_info.singer_id and song_name=‘{0}‘", songname);
116             SqlCommand cmd = new SqlCommand(sql, db.Conection);
117
118             SqlDataReader read = cmd.ExecuteReader();
119             if (read.Read())
120             {
121                 SongList song = new SongList();
122                 song.SongName1 = read["song_name"].ToString();
123                 song.SongUl1 = read["song_url"].ToString();
124                 PalyList.AddSong(song);
125             }
126             read.Close();
127         }
128
129     }

第九步:类型点歌

  1  /// <summary>
  2         /// 切歌方法
  3         /// </summary>
  4         /// <param name="sender"></param>
  5         /// <param name="e"></param>
  6         private void toolStripButton6_Click(object sender, EventArgs e)
  7         {
  8             if (MessageBox.Show("确定要切歌吗?", "提示", MessageBoxButtons.OKCancel, MessageBoxIcon.Warning) == DialogResult.OK)
  9             {
 10                 PalyList.CutSong(-1);
 11             }
 12         }
 13
 14         private void FrmOrderBySongType_Load(object sender, EventArgs e)
 15         {
 16             LoadListView();
 17         }
 18
 19
 20         private void LoadListView()
 21         {
 22             DBHelper db = new DBHelper();
 23             string sql = "select songtype_id,songtype_name,songtype_URL from song_type";
 24             SqlCommand cmd = new SqlCommand(sql, db.Conection);
 25
 26             try
 27             {
 28                 db.OpenConnection();
 29                 SqlDataReader reader = cmd.ExecuteReader();
 30
 31                 if (reader.HasRows)
 32                 {
 33                     int index = 0;
 34                     while (reader.Read())
 35                     {
 36                         ListViewItem item = new ListViewItem();
 37                         item.Text = reader[1].ToString();
 38                         item.Tag = reader[0].ToString();
 39                         this.imageList1.Images.Add(Image.FromFile(@"E:\KTV前台管理\KTV前台管理\SingerTypeIamge\" + reader[2].ToString()));
 40                         item.ImageIndex = index;
 41                         this.listView1.Items.Add(item);
 42                         index++;
 43                     }
 44                 }
 45                 reader.Close();
 46             }
 47             catch (Exception ex)
 48             {
 49                 MessageBox.Show(ex.Message);
 50             }
 51             finally
 52             {
 53                 db.CloseConnection();
 54             }
 55         }
 56         /// <summary>
 57         /// 查找到该类型的歌手的歌曲
 58         /// </summary>
 59         private void DoubleClickSong()
 60         {
 61             if (this.listView1.SelectedItems[0] != null)
 62             {
 63                 string sql = string.Format("select song_id,song_name,song_url,singer_name from song_info,singer_info" +
 64                " where song_info.singer_id=singer_info.singer_id and song_info.songtype_id={0}", Convert.ToInt32(this.listView1.SelectedItems[0].Tag));
 65                 FrmSongList fs = new FrmSongList();
 66                 fs.Sql = sql;
 67                 fs.Show();
 68             }
 69         }
 70
 71         private void toolStripButton1_Click(object sender, EventArgs e)
 72         {
 73
 74             this.Close();
 75         }
 76
 77         private void toolStripButton5_Click(object sender, EventArgs e)
 78         {
 79             FrmSong song = new FrmSong();
 80             song.Show();
 81         }
 82
 83         private void listView1_Click(object sender, EventArgs e)
 84         {
 85             listView1.ToString();
 86         }
 87
 88         private void listView1_DoubleClick(object sender, EventArgs e)
 89         {
 90             DoubleClickSong();
 91         }
 92
 93         private void toolStripButton2_Click(object sender, EventArgs e)
 94         {
 95             FormMain dd = new FormMain();
 96             dd.Show();
 97             this.Close();
 98         }
 99
100         private void toolStripButton7_Click(object sender, EventArgs e)
101         {
102
103             FormMain dd = new FormMain();
104             dd.palySong();
105         }

2015-07-31

时间: 2024-10-09 09:05:48

小学生之KTV项目文档(bdqn) 指导老师:yuanyuming的相关文章

最专业逻辑图和最专业项目文档制作实战讲解

1个小时彻底学会改变运维人员不被待见的本领 提高运维人员逼格和软实力-专业逻辑图和项目文档制作实战 逻辑图和项目文档制作是运维人员最核心的软实力! 逻辑图和项目文档制作老男孩教育对学员的硬性能力要求(一出手就要专业规范). 购买后请给力评价,评价后,联系飞雪帮你拉入,有讲课作者为你答疑解惑! linux运维画图文档排版专业交流群 手把手带你快速做[最专业]的项目文档实战 http://edu.51cto.com/course/course_id-4992.html 手把手带你快速画[最专业]的逻

使用 Github Pages 发布你的项目文档

导读 你可能比较熟悉如何用 Github Pages 来分享你的工作,又或许你看过一堂教你建立你的第一个 Github Pages 网站的教程.近期 Github Pages 的改进使得从不同的数据源来发布您的网站更加的方便,其中的来源之一就是你的仓库的 /docs 目录. 文档的质量是一个软件项目健康发展的标志.对于开源项目来说,维护一个可靠而不出错的知识库.详细说明所有的细节是至关重要的.精心策划的文档可以让增加项目的亲切感,提供一步步的指导并促进各种方式的合作可以推动开源软件开发的协作进程

maven 学习---生成基于Maven的项目文档站点

在Maven中,可以使用“mvn site”,为您的项目信息生成文档站点. mvn site 生成的网站是在项目的“target/site”文件夹中. mvn site 示例 请参见通过“mvn site”命令生成的文件列表. 文档页面的样本如下. 想知道自己开发的项目的信息可以试试. 标签:Maven    项目    文档    站点 本站文章除注明转载外,均为本站原创或编译欢迎任何形式的转载,但请务必注明出处,尊重他人劳动共创优秀实例教程转载请注明:文章转载自:http://www.yii

项目可行性研究报告---团队开发项目文档

FloatyFish游戏可行性研究报告 1.引言 1.1编写目的 通过查询相关的资料,初步拟定本项目实现方法,之处在开发过程中会遇到的问题以及解决方案,对项目的可行性有一个分析,本报告撰写完毕后交由组长查看. 1.2项目背景 1.2.1 项目名称:FloatyFish 1.2.2 用户:无聊人群 1.2.3 说明:目前一款flappy bird手机游戏非常盛行,但是这款游戏尚无PC版,导致有的人用电脑学习之余想放松一下只能借助手机,但现在智能机电池都不耐用,那么通过编写一款类似于flappy b

Atitit. 项目文档目录大纲 总集合 &#160;v2

Atitit. 项目文档目录大纲 总集合  v2 -----Atitti.原有项目源码的架构,框架,配置与环境说明 v3 q511 -----Atitit.开发环境 与 工具 以及技术框架 以及 注意事项 v2 .docx 我们推荐的开发理念与工具与技术 -----现有数据库表说明.docx ------功能表v2 q55 - 副本.xlsx 主要对客户需求进行了解析,结构化,归纳整理 -------训练系统需求具体内容  最新版 (1).doc(客户原始需求最新版) ------Atitti.

命令行创建项目文档目录结构

命令行创建项目文档目录结构 [email protected] 2016年1月21日11:10:59 文档化有助于减轻记忆压力,有利于在互联网时代顺畅分享建议用Cmd MarkDown打开,DOS脚本有语法高亮. 缘起 之前整理所有项目文档的时候,发现项目结构与内容不协调: 纯文档项目,采用的商业项目管理目录,很多目录都是空的: 纯代码项目,采用商业项目管理目录,文档多是空的: 繁复的项目目录,会令人望而生畏,不利于文档化: 冗余的目录,很难快速找到所需文档资料 更好的方式,是用数据库管理文档并

Maven生成项目文档

Maven项目可以通过maven-site-plugin插件生成项目文档,无论什么项目都可以生成. 执行命令: mvn site 生成完成的输出目录在${basedir}/target/site文件夹,直接点击index.html查看即可. 原理解释: Maven 使用一个名为Doxia的文档处理引擎来创建文档,它能将多种格式的源码读取成一种通用的文档模型.要为你的项目撰写文档,你可以将内容写成下面几种常用的,可被 Doxia 转化的格式. 格式名 描述 参考 Apt 纯文本文档格式 http:

【新闻发布系统】项目文档

[新闻发布系统]项目文档 一.项目需求 1.具体功能 *修改新闻主题 *删除新闻主题 *首页显示固定主题的新闻标题(左侧的"国内新闻""国际新闻") *首页按主题动态显示新闻 2.技能点 *使用集合类存取对象 *使用SQL语言操作数据表 *使用JDBC操作数据库(连接数据库和关闭资源,对数据库表进行增删改查的操作) *能够编写jsp页面 *使用jsp处理请求(表单请求/URL请求) *使用jsp的内置对象实现访问控制(使用session保存用户信息/能够从sessi

【项目文档】网页钓鱼URL过滤系统总结报告

本博客系作者原创,欢迎转载,转载请注明出处http://www.cnblogs.com/windcarp/ 课题内容和要求 "钓鱼"是一种网络欺诈行为,指不法分子利用各种手段,仿冒真实网站的URL地址以及页面内容,或利用真实网站服务器程序上的漏洞在站点的某些网页中插入危险的HTML代码,以此来骗取用户银行或信用卡账号.密码等私人资料.网络钓鱼不仅给网民带来经济损失,更阻碍着互联网更深的发展.防御网络钓鱼是当前形势的需要.本题是实现一个简单的钓鱼URL过滤系统,基本功能主要有: 1.黑名