FrmGeShouAdmin.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.GeShouGuanLi
- {
- public partial class FrmGeShouAdmin : Form
- {
- public FrmGeShouAdmin()
- {
- InitializeComponent();
- }
- private int RID = 0;
- private void FrmGeShouAdmin_Load(object sender, EventArgs e)
- {
- DataSet ds = new DataSet();
- ds = KTVData.KTVDB.SelectGeShou("", "");
- dataGridView1.DataSource = ds.Tables[0];
- }
- private void btnExit_Click(object sender, EventArgs e)
- {
- this.Close();
- }
- private void btnSelect_Click(object sender, EventArgs e)
- {
- SelectGeShou();
- }
- public void SelectGeShou()
- {
- DataSet ds = new DataSet();
- if (txtName.Text.Trim() != "")
- {
- ds = KTVData.KTVDB.SelectGeShouName(txtName.Text.Trim());
- }
- else
- {
- ds = KTVData.KTVDB.SelectGeShou(cmbSex.Text.Trim(), cmbDiQu.Text.Trim());
- }
- if (ds.Tables[0].Rows.Count < 1)
- {
- MessageBox.Show("没有此信息的歌手,请重新选择!", "系统提示", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
- }
- else
- {
- dataGridView1.DataSource = ds.Tables[0];
- }
- }
- private void dataGridView1_CellClick(object sender, DataGridViewCellEventArgs e)
- {
- if (dataGridView1.RowCount > 0)
- {
- RID=int.Parse(dataGridView1.CurrentRow.Cells["歌手编号"].Value.ToString());
- }
- }
- private void btnUpdate_Click(object sender, EventArgs e)
- {
- if (RID == 0)
- {
- MessageBox.Show("请先选择有效的歌手信息!", "系统提示", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
- return;
- }
- FrmGeShouAdd FrmGeShouAdd1 = new FrmGeShouAdd();
- FrmGeShouAdd1.RID = RID;
- if (FrmGeShouAdd1.ShowDialog(this) == DialogResult.Yes)
- {
- SelectGeShou();
- }
- }
- private void btnDel_Click(object sender, EventArgs e)
- {
- if (RID == 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.SelectGeShouDeGe(RID).Tables[0].Rows.Count > 0)
- {
- if(MessageBox.Show("KTV系统中还有此歌手的歌,如果将起删除,将会把他的歌的信息一并删除,你还是确定删除吗?", "系统提示",
- MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No)
- return;
- }
- if (KTVData.KTVDB.DelGeShou(RID)>0)
- {
- MessageBox.Show("歌手信息删除成功!", "系统提示", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
- SelectGeShou();
- }
- else
- {
- MessageBox.Show("歌手信息删除失败,您可以重新选择再删除!", "系统提示", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
- }
- }
- }
- }