FrmGeQuAdmin.cs
上传用户:fzwcsgshou
上传日期:2022-07-30
资源大小:28414k
文件大小:4k
源码类别:

行业应用

开发平台:

Visual C++

  1. using System;
  2. using System.Collections.Generic;
  3. using System.ComponentModel;
  4. using System.Data;
  5. using System.Drawing;
  6. using System.Text;
  7. using System.Windows.Forms;
  8. namespace KTVAdmin.GeQuGuanLi
  9. {
  10.     public partial class FrmGeQuAdmin : Form
  11.     {
  12.         public FrmGeQuAdmin()
  13.         {
  14.             InitializeComponent();
  15.         }
  16.         private int SID = 0;
  17.         private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)
  18.         {
  19.         }
  20.         private void FrmGeQuAdmin_Load(object sender, EventArgs e)
  21.         {
  22.             DataSet ds = new DataSet();
  23.             ds = KTVData.KTVDB.SelectClassName("");
  24.             dataGridView1.DataSource = ds.Tables[0];
  25.             if (dataGridView1.RowCount < 1)
  26.             {
  27.                 MessageBox.Show("现在还没有任何歌曲信息!", "系统提示", MessageBoxButtons.OK,
  28.                      MessageBoxIcon.Asterisk);
  29.             }
  30.             else
  31.             {
  32.                 try
  33.                 {
  34.                     SID = int.Parse(dataGridView1.CurrentRow.Cells["歌曲编号"].Value.ToString());
  35.                 }
  36.                 catch
  37.                 {
  38.                 }
  39.             }
  40.         }
  41.         private void btnSel_Click(object sender, EventArgs e)
  42.         {
  43.             SelectGeQuInfo();
  44.         }
  45.         public void SelectGeQuInfo()
  46.         {
  47.             DataSet ds = new DataSet();
  48.             ds = KTVData.KTVDB.SelectGeQu(txtRName.Text.Trim(),
  49.                 txtSName.Text.Trim(), cmbClass.Text.Trim(), cmbYuYan.Text.Trim());
  50.             dataGridView1.DataSource = ds.Tables[0];
  51.             if (dataGridView1.RowCount < 1)
  52.             {
  53.                 MessageBox.Show("现在还此条件的歌曲信息!", "系统提示", MessageBoxButtons.OK,
  54.                      MessageBoxIcon.Asterisk);
  55.             }
  56.             else
  57.             {
  58.                 try
  59.                 {
  60.                     SID = int.Parse(dataGridView1.CurrentRow.Cells["歌曲编号"].Value.ToString());
  61.                 }
  62.                 catch
  63.                 {
  64.                 }
  65.             }
  66.         }
  67.         private void dataGridView1_CellContentClick(object sender, DataGridViewCellEventArgs e)
  68.         {
  69.             try
  70.             {
  71.                 SID = int.Parse(dataGridView1.CurrentRow.Cells["歌曲编号"].Value.ToString());
  72.             }
  73.             catch
  74.             {
  75.             }
  76.         }
  77.         private void btnUpdate_Click(object sender, EventArgs e)
  78.         {
  79.             if(SID==0)
  80.             {
  81.                 MessageBox.Show("请先选择有效的歌曲信息!", "系统提示", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
  82.                 return;
  83.             }
  84.             FrmGeQu FrmGeQu1 = new FrmGeQu();
  85.             FrmGeQu1.SID = SID;
  86.             if (FrmGeQu1.ShowDialog(this) == DialogResult.Yes)
  87.             {
  88.                 SelectGeQuInfo();
  89.             }
  90.             
  91.         }
  92.         private void btnDel_Click(object sender, EventArgs e)
  93.         {
  94.             if (SID == 0)
  95.             {
  96.                 MessageBox.Show("请先选择有效的歌曲信息!", "系统提示", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
  97.                 return;
  98.             }
  99.             if (MessageBox.Show("你确定要删除歌曲 “" + dataGridView1.CurrentRow.Cells["歌曲名称"].Value.ToString() +
  100.                 "” 的信息吗?", "系统提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No)
  101.             {
  102.                 MessageBox.Show("你取消了删除!", "系统提示", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
  103.                 return;
  104.             }
  105.             if (KTVData.KTVDB.DelGeQu(SID)>0)
  106.             {
  107.                 MessageBox.Show("歌曲信息删除成功!", "系统提示", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
  108.                 SelectGeQuInfo();
  109.             }
  110.             else
  111.             {
  112.                 MessageBox.Show("歌曲信息删除失败,您可以重新选择再删除!", "系统提示", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
  113.             }
  114.         }
  115.         private void dataGridView1_CellClick(object sender, DataGridViewCellEventArgs e)
  116.         {
  117.             try
  118.             {
  119.                 SID = int.Parse(dataGridView1.CurrentRow.Cells["歌曲编号"].Value.ToString());
  120.             }
  121.             catch
  122.             {
  123.             }
  124.         }
  125.         private void btnExit_Click(object sender, EventArgs e)
  126.         {
  127.             this.Close();
  128.         }
  129.     }
  130. }