예제 #1
0
파일: AddSach.cs 프로젝트: NTPac/lms
        private void button4_Click(object sender, EventArgs e)
        {
            string x  = "";
            string tl = "";

            if (ckbHD.Checked == true)
            {
                tl = tl + "hanh dong, ";
                x  = x + " hanhdong = 'True',";
            }
            else
            {
                x = x + " hanhdong = 'False',";
            }
            if (ckbNL.Checked == true)
            {
                tl = tl + "nguoi lon, ";
                x  = x + " nguoilon = 'True',";
            }
            else
            {
                x = x + "nguoilon = 'False',";
            }
            if (ckbPL.Checked == true)
            {
                tl = tl + "phieu lieu, ";
                x  = x + " phieuluu = 'True',";
            }
            else
            {
                x = x + " phieuluu 'False',";
            }
            if (ckbHH.Checked == true)
            {
                tl = tl + "hai huoc, ";
                x  = x + " haihuoc =  'True',";
            }
            else
            {
                x = x + " haihuoc = 'False',";
            }
            if (ckbDrama.Checked == true)
            {
                tl = tl + "drama, ";
                x  = x + " drama = 'True',";
            }
            else
            {
                x = x + " drama = 'False',";
            }
            if (ckbFan.Checked == true)
            {
                tl = tl + "fantasy, ";
                x  = x + " fantasy = 'True',";
            }
            else
            {
                x = x + " fantasy = 'False',";
            }
            if (ckbLS.Checked == true)
            {
                tl = tl + "lich su, ";
                x  = x + " lichsu = 'True',";
            }
            else
            {
                x = x + " lichsu = 'False',";
            }
            if (ckbCG.Checked == true)
            {
                tl = tl + "con gai, ";
                x  = x + " congai ='True',";
            }
            else
            {
                x = x + " congai = 'False',";
            }
            if (ckbCT.Checked == true)
            {
                tl = tl + "contrai, ";
                x  = x + " contrai = 'True',";
            }
            else
            {
                x = x + " contrai = 'False',";
            }
            if (ckbKDi.Checked == true)
            {
                tl = tl + "kinh di, ";
                x  = x + " kinhdi = 'True',";
            }
            else
            {
                x = x + " kinhdi = 'False',";
            }
            if (ckbTra.Checked == true)
            {
                tl = tl + "tragedy, ";
                x  = x + " tragedy = 'True',";
            }
            else
            {
                x = x + " tragedy = 'False',";
            }
            if (ckbBiAn.Checked == true)
            {
                tl = tl + "bi an, ";
                x  = x + " bian = 'True',";
            }
            else
            {
                x = x + " bian = 'False',";
            }
            if (ckbTrinhT.Checked == true)
            {
                tl = tl + "trinh tham, ";
                x  = x + " trinhtham = 'True',";
            }
            else
            {
                x = x + " trinhtham = 'False',";
            }
            if (ckbGGan.Checked == true)
            {
                tl = tl + "giat gan, ";
                x  = x + " giatgan = 'True',";
            }
            else
            {
                x = x + " giatgan = 'False',";
            }
            if (ckbLM.Checked == true)
            {
                tl = tl + "lang man, ";
                x  = x + " lanman = 'True',";
            }
            else
            {
                x = x + " lanman = 'False',";
            }
            if (ckbLN.Checked == true)
            {
                tl = tl + "lightnovel, ";
                x  = x + " lightnovel = 'True',";
            }
            else
            {
                x = x + " lightnovel = 'False',";
            }
            if (ckbHT.Checked == true)
            {
                tl = tl + "hoc thuat, ";
                x  = x + " sachht = 'True',";
            }
            else
            {
                x = x + " sachht = 'False'";
            }

            if (sach.UpdData(textBox5.Text, tl, textBox4.Text, textBox1.Text, textBox2.Text, txbAnh.Text, textBox7.Text, textBox8.Text, textBox6.Text, textBox9.Text, ids))
            {
                if (sach.UpdDatatl(x, ids))
                {
                    MessageBox.Show("Sua thanh cong!", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
                else
                {
                    MessageBox.Show("Vui long nhap day du cac muc co danh dau *!", "Lỗi", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
        }