예제 #1
0
        private void btnLogin_Click(object sender, EventArgs e)
        {
            //非空验证
            if (txtUserName.Text == "")
            {
                HintMessageBox.Warning_hint("请输入账户姓名!!");
                return;
            }
            else if (txtPwd.Text == "")
            {
                HintMessageBox.Warning_hint("请输入账户密码!!");
                return;
            }
            //sql语句
            string sql = string.Format("select COUNT(*) from admin_info where admin_name = '{0}' and admin_pwd = '{1}'", txtUserName.Text.Trim(), txtPwd.Text.Trim());

            if (db.ExecuteScalar(sql) == null)
            {
                return;
            }
            if ((int)db.ExecuteScalar(sql) > 0)
            {
                HintMessageBox.Information_hint("登录成功!!");
                FrmAdmin admin = new FrmAdmin();
                admin.Show(); //显示后台管理主窗体
                this.Hide();  //隐藏登录窗体
            }
            else
            {
                HintMessageBox.Information_hint("用户名或密码错误!!");
            }
        }
예제 #2
0
        private void btnAdd_Click(object sender, EventArgs e)
        {
            //非空验证
            if (txtName.Text == "" || Convert.ToInt32(cmbSingerType.SelectedValue) == -1)
            {
                HintMessageBox.Warning_hint("请填写完整带*项的信息!!");
                return;
            }
            //获取性别
            string sex;

            if (rdoMale.Checked == true)
            {
                sex = rdoMale.Text;
            }
            else if (rdoFemale.Checked == true)
            {
                sex = rdoFemale.Text;
            }
            else
            {
                sex = rdoCom.Text;
            }
            //获取用户输入的值
            string name       = txtName.Text.Trim();                                           //获取歌手姓名
            int    singerType = Convert.ToInt32(cmbSingerType.SelectedValue);                  //歌手类型

            photoPath = photoPath == "" ? System.IO.Path.GetFullPath(ofd.FileName): photoPath; //歌手写真的路径
            string describe = txtDescribe.Text.Trim();                                         //歌手简介
            //sql语句
            string sql = string.Empty;

            switch (btnAdd.Text.Trim())
            {
            case "添加":
                //执行数据库插入操作的sql语句
                sql = string.Format("insert singer_info values('{0}','{1}','{2}','{3}','{4}')", name, singerType, sex, photoPath, describe);
                break;

            case "修改":
                sql = string.Format("update dbo.singer_info set singer_name = '{0}',singertype_id = '{1}',singer_sex = '{2}',singer_photo_url = '{3}',singer_Describe = '{4}' where singer_id = '{5}'", name, singerType, sex, photoPath, describe, singer_id);
                break;
            }
            if (db.ExecuteNonQuery(sql) > 0)
            {
                HintMessageBox.Information_hint(btnAdd.Text.Trim() + "歌手信息成功!!");
            }
            else
            {
                HintMessageBox.Warning_hint(btnAdd.Text.Trim() + "失败!!");
            }
        }
예제 #3
0
 private void tsmiDelete_Click(object sender, EventArgs e)
 {
     if (new MyKTV_.DBHelper().ExecuteNonQuery(string.Format("delete song_info where song_id = '{0}'", dgvSongList.SelectedCells[0].Value)) > 0)
     {
         HintMessageBox.Information_hint("删除成功!!");
         dv = new MyKTV_.DBHelper().GetDataView("select s_i.song_id,song_name,songtype_name,song_url,song_play_count from dbo.song_info s_i inner join dbo.song_type s_t on(s_i.songtype_id=s_t.songtype_id)");
         dgvSongList.DataSource = dv;
     }
     else
     {
         HintMessageBox.Information_hint("删除失败!!");
     }
 }
예제 #4
0
        private void tsmiChange_Click(object sender, EventArgs e)
        {
            if (dgvSongList.SelectedCells == null)
            {
                HintMessageBox.Information_hint("请选择歌曲");
                return;
            }
            FrmEditSong frmEditSong = new FrmEditSong();

            frmEditSong.song_id = Convert.ToInt32(dgvSongList.SelectedCells[0].Value);
            frmEditSong.ShowDialog();
            dv = new MyKTV_.DBHelper().GetDataView("select s_i.song_id,song_name,songtype_name,song_url,song_play_count from dbo.song_info s_i inner join dbo.song_type s_t on(s_i.songtype_id=s_t.songtype_id)");
        }
예제 #5
0
        private void tsmiChange_Click(object sender, EventArgs e)
        {
            //获取选中歌手的主键
            if (dgvSingerList.SelectedCells[0] == null)
            {
                HintMessageBox.Warning_hint("请选择歌手!!");
                return;
            }
            FrmEditSinger frmEditSinger = new FrmEditSinger();

            frmEditSinger.singer_id = Convert.ToInt32(dgvSingerList.SelectedCells[0].Value);
            frmEditSinger.ShowDialog();
            GetDataView();//刷新数据
        }
예제 #6
0
        private void tsmiDelect_Click(object sender, EventArgs e)
        {
            if (dgvSingerList.SelectedCells[0] == null)
            {
                HintMessageBox.Warning_hint("请选择歌手!!");
                return;
            }
            int singer_id = Convert.ToInt32(dgvSingerList.SelectedCells[0].Value);

            if (MessageBox.Show("确定删除姓名为" + dgvSingerList.SelectedCells[1].Value + "的歌手吗?") == DialogResult.OK)
            {
                if (new MyKTV_.DBHelper().ExecuteNonQuery("DELETE singer_info where singer_id = '" + dgvSingerList.SelectedCells[0].Value + "'") > 0)
                {
                    HintMessageBox.Information_hint("删除成功!!");
                    GetDataView();//刷新数据
                }
                else
                {
                    HintMessageBox.Information_hint("删除失败!!");
                }
            }
        }
예제 #7
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            //非空验证
            if (txtSongName.Text == "" || txtPinYin.Text == "" || Convert.ToInt32(cmbSongType.SelectedValue) == -1 || txtSongFileName.Text == "")
            {
                HintMessageBox.Information_hint("请填写完整带 * 的项!!");
                return;
            }
            //获取用户输入的值
            string songName     = txtSongName.Text;
            string pinYin       = txtPinYin.Text;
            string songFileName = txtSongFileName.Text;
            int    singer       = Convert.ToInt32(db.ExecuteScalar(string.Format("select singer_id from dbo.singer_info where singer_Name = '{0}'", txtSinger.Text)));
            int    songtype     = Convert.ToInt32(cmbSongType.SelectedValue);
            int    wordNum      = Convert.ToInt32(nudWordCount.Value);
            string sql          = "";

            switch (btnSave.Text)
            {
            case "保存":
                sql = string.Format("insert dbo.song_info values('{0}','{1}','{2}','{3}','{4}','{5}','{6}')", songName, pinYin, wordNum, songtype, singer, songFileName, 0);
                break;

            case "保存修改":
                sql = string.Format("UPDATE [MyKTV].[dbo].[song_info]  SET [song_name] = '{0}',[song_ab] ='{1}',[song_word_count] = '{2}',[songtype_id] = '{3}',[singer_id] = '{4}',[song_url] = '{5}' WHERE song_id='{6}'", songName, pinYin, wordNum, songtype, singer, songFileName, song_id);
                break;
            }
            if (db.ExecuteNonQuery(sql) > 0)
            {
                HintMessageBox.Information_hint(btnSave.Text + "歌曲成功!!");
            }
            else
            {
                HintMessageBox.Warning_hint(btnSave.Text + "歌曲失败!!");
            }
        }