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

行业应用

开发平台:

Visual C++

  1. using System;
  2. using System.Collections.Generic;
  3. using System.ComponentModel;
  4. using System.Data;
  5. using System.Data.SqlClient;
  6. using System.Drawing;
  7. using System.Text;
  8. using System.Windows.Forms;
  9. namespace KTVAdmin.GeQuGuanLi
  10. {
  11.     public partial class FrmGeQu : Form
  12.     {
  13.         public FrmGeQu()
  14.         {
  15.             InitializeComponent();
  16.         }
  17.         public int RID = 0;
  18.         public int SID = 0;
  19.         private void FrmGeQu_Load(object sender, EventArgs e)
  20.         {
  21.             DataSet dsRName = new DataSet();
  22.             dsRName = KTVData.KTVDB.SelectGeShou("", "");
  23.             cmbRName.DisplayMember = "歌手姓名";
  24.             cmbRName.ValueMember = "歌手编号";
  25.             cmbRName.DataSource = dsRName.Tables[0];
  26.             txtCiShu.Enabled = true;
  27.             if (SID != 0)
  28.             {
  29.                 label7.Text = "歌曲信息修改";
  30.                 this.Text = "歌曲信息修改";
  31.                 DataSet ds=new DataSet();
  32.                 ds=KTVData.KTVDB.SelectOneGeQu(SID);
  33.                 if (ds.Tables[0].Rows.Count > 0)
  34.                 {
  35.                     cmbRName.Text = ds.Tables[0].Rows[0]["歌手"].ToString();
  36.                     cmbYuYan.Text = ds.Tables[0].Rows[0]["语言"].ToString();
  37.                     cmbZiMu.Text = ds.Tables[0].Rows[0]["首字母"].ToString();
  38.                     cmbClass.Text = ds.Tables[0].Rows[0]["类型"].ToString();
  39.                     txtSName.Text = ds.Tables[0].Rows[0]["歌曲名称"].ToString();
  40.                     txtWiZhi.Text = ds.Tables[0].Rows[0]["存放位置"].ToString();
  41.                     RID = int.Parse(ds.Tables[0].Rows[0]["歌手编号"].ToString());
  42.                     txtCiShu.Text = ds.Tables[0].Rows[0]["点击次数"].ToString();
  43.                 }
  44.             }
  45.         }
  46.         private void btnLiuLan_Click(object sender, EventArgs e)
  47.         {
  48.             openFileDialog1.ShowDialog();
  49.             txtWiZhi.Text = openFileDialog1.FileName;
  50.         }
  51.         private void btnOk_Click(object sender, EventArgs e)
  52.         {
  53.             if (cmbClass.Text.Trim() == "--请选择--" || cmbClass.Text.Trim() == "")
  54.             {
  55.                 MessageBox.Show("请选择歌曲类型!!", "系统提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
  56.                 return;
  57.             }
  58.             if (cmbZiMu.Text.Trim() == "--请选择--" || cmbZiMu.Text.Trim() == "")
  59.             {
  60.                 MessageBox.Show("请选择歌曲的首字母!!", "系统提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
  61.                 return;
  62.             }
  63.             if (cmbYuYan.Text.Trim() == "--请选择--" || cmbYuYan.Text.Trim() == "")
  64.             {
  65.                 MessageBox.Show("请选择歌曲语言!!", "系统提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
  66.                 return;
  67.             }
  68.             if (cmbRName.Text.Trim() == "--请选择--" || cmbRName.Text.Trim()=="")
  69.             {
  70.                 MessageBox.Show("请选择歌手!!", "系统提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
  71.                 return;
  72.             }
  73.             int CiShu = 0;
  74.             try
  75.             {
  76.                 CiShu = int.Parse(txtCiShu.Text.Trim());
  77.             }
  78.             catch
  79.             {
  80.                 CiShu = 0;
  81.             }
  82.             try
  83.             {
  84.                 RID = int.Parse(cmbRName.SelectedValue.ToString());
  85.             }
  86.             catch
  87.             {
  88.             }
  89.            
  90.             if (KTVData.KTVDB.AdminGeQu(SID, txtSName.Text.Trim(), cmbYuYan.Text.Trim(), cmbClass.Text.Trim(), RID, cmbZiMu.Text.Trim(), CiShu, txtWiZhi.Text.Trim()))
  91.             {
  92.                 MessageBox.Show("歌曲信息更新成功!!", "系统提示", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
  93.                 if (SID != 0)
  94.                 {
  95.                     this.DialogResult = DialogResult.Yes;
  96.                     this.Close();
  97.                 }
  98.                 
  99.             }
  100.             else
  101.             {
  102.                 MessageBox.Show("歌曲信息更新失败,您可以重新选择,再更新!!", "系统提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
  103.                 
  104.             }
  105.         }
  106.         private void cmbRName_SelectedIndexChanged(object sender, EventArgs e)
  107.         {
  108.             try
  109.             {
  110.                 RID = int.Parse(cmbRName.SelectedValue.ToString());
  111.             }
  112.             catch
  113.             {
  114.             }
  115.         }
  116.         private void btnExit_Click(object sender, EventArgs e)
  117.         {
  118.             if (SID != 0)
  119.             {
  120.                 this.DialogResult = DialogResult.No;
  121.                 this.Close();
  122.             }
  123.             else
  124.             {
  125.                 this.Close();
  126.             }
  127.         }
  128.     }
  129. }