FrmGeQuAdmin.cs
资源名称:KTV.rar [点击查看]
上传用户:fzwcsgshou
上传日期:2022-07-30
资源大小:28414k
文件大小:4k
源码类别:
行业应用
开发平台:
Visual C++
- using System;
- using System.Collections.Generic;
- using System.ComponentModel;
- using System.Data;
- using System.Drawing;
- using System.Text;
- using System.Windows.Forms;
- namespace KTVAdmin.GeQuGuanLi
- {
- public partial class FrmGeQuAdmin : Form
- {
- public FrmGeQuAdmin()
- {
- InitializeComponent();
- }
- private int SID = 0;
- private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)
- {
- }
- private void FrmGeQuAdmin_Load(object sender, EventArgs e)
- {
- DataSet ds = new DataSet();
- ds = KTVData.KTVDB.SelectClassName("");
- dataGridView1.DataSource = ds.Tables[0];
- if (dataGridView1.RowCount < 1)
- {
- MessageBox.Show("现在还没有任何歌曲信息!", "系统提示", MessageBoxButtons.OK,
- MessageBoxIcon.Asterisk);
- }
- else
- {
- try
- {
- SID = int.Parse(dataGridView1.CurrentRow.Cells["歌曲编号"].Value.ToString());
- }
- catch
- {
- }
- }
- }
- private void btnSel_Click(object sender, EventArgs e)
- {
- SelectGeQuInfo();
- }
- public void SelectGeQuInfo()
- {
- DataSet ds = new DataSet();
- ds = KTVData.KTVDB.SelectGeQu(txtRName.Text.Trim(),
- txtSName.Text.Trim(), cmbClass.Text.Trim(), cmbYuYan.Text.Trim());
- dataGridView1.DataSource = ds.Tables[0];
- if (dataGridView1.RowCount < 1)
- {
- MessageBox.Show("现在还此条件的歌曲信息!", "系统提示", MessageBoxButtons.OK,
- MessageBoxIcon.Asterisk);
- }
- else
- {
- try
- {
- SID = int.Parse(dataGridView1.CurrentRow.Cells["歌曲编号"].Value.ToString());
- }
- catch
- {
- }
- }
- }
- private void dataGridView1_CellContentClick(object sender, DataGridViewCellEventArgs e)
- {
- try
- {
- SID = int.Parse(dataGridView1.CurrentRow.Cells["歌曲编号"].Value.ToString());
- }
- catch
- {
- }
- }
- private void btnUpdate_Click(object sender, EventArgs e)
- {
- if(SID==0)
- {
- MessageBox.Show("请先选择有效的歌曲信息!", "系统提示", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
- return;
- }
- FrmGeQu FrmGeQu1 = new FrmGeQu();
- FrmGeQu1.SID = SID;
- if (FrmGeQu1.ShowDialog(this) == DialogResult.Yes)
- {
- SelectGeQuInfo();
- }
- }
- private void btnDel_Click(object sender, EventArgs e)
- {
- if (SID == 0)
- {
- MessageBox.Show("请先选择有效的歌曲信息!", "系统提示", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
- return;
- }
- if (MessageBox.Show("你确定要删除歌曲 “" + dataGridView1.CurrentRow.Cells["歌曲名称"].Value.ToString() +
- "” 的信息吗?", "系统提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No)
- {
- MessageBox.Show("你取消了删除!", "系统提示", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
- return;
- }
- if (KTVData.KTVDB.DelGeQu(SID)>0)
- {
- MessageBox.Show("歌曲信息删除成功!", "系统提示", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
- SelectGeQuInfo();
- }
- else
- {
- MessageBox.Show("歌曲信息删除失败,您可以重新选择再删除!", "系统提示", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
- }
- }
- private void dataGridView1_CellClick(object sender, DataGridViewCellEventArgs e)
- {
- try
- {
- SID = int.Parse(dataGridView1.CurrentRow.Cells["歌曲编号"].Value.ToString());
- }
- catch
- {
- }
- }
- private void btnExit_Click(object sender, EventArgs e)
- {
- this.Close();
- }
- }
- }