示例#1
0
 private void btthem_Click(object sender, EventArgs e)
 {
     diaphim.openConnection();
     if (name.Text != string.Empty)
     {
         tl.insertTHELOAI(name.Text);
         MessageBox.Show("Thêm thành công", "Thêm Thể Loại", MessageBoxButtons.OK, MessageBoxIcon.Information);
         dataGridView1.DataSource = tl.getTHELOAI();
     }
 }
示例#2
0
        public void updateNGUOIDUNG(string username, string type, string password, string tel, string email, int NID)
        {
            DATABASE diaphim = new DATABASE();

            diaphim.openConnection();
            SqlParameter[] parameters = new SqlParameter[6];

            parameters[0]       = new SqlParameter("@USERNAME", SqlDbType.VarChar, 20);
            parameters[0].Value = username;

            parameters[1]       = new SqlParameter("@TYPE", SqlDbType.VarChar, 100);
            parameters[1].Value = type;

            parameters[2]       = new SqlParameter("@PASS", SqlDbType.VarChar, 20);
            parameters[2].Value = password;

            parameters[3]       = new SqlParameter("@TEL", SqlDbType.VarChar, 20);
            parameters[3].Value = tel;

            parameters[4]       = new SqlParameter("@EMAIL", SqlDbType.VarChar, 20);
            parameters[4].Value = email;

            parameters[5]       = new SqlParameter("@ID", SqlDbType.Int);
            parameters[5].Value = NID;

            diaphim.setData("spr_update_NGUOIDUNG", parameters);
            diaphim.closeConnection();
        }
示例#3
0
        public void insertSANPHAM(int cid, string tenphim, string linkphim, byte[] image, int thoiluong, string namsanxuat, string daodien)
        {
            DATABASE diaphim = new DATABASE();

            diaphim.openConnection();
            SqlParameter[] parameters = new SqlParameter[7];

            parameters[0]       = new SqlParameter("@T_ID", SqlDbType.Int);
            parameters[0].Value = cid;

            parameters[1]       = new SqlParameter("@TENPHIM", SqlDbType.VarChar, 50);
            parameters[1].Value = tenphim;

            parameters[2]       = new SqlParameter("@THOILUONG", SqlDbType.Int);
            parameters[2].Value = thoiluong;

            parameters[3]       = new SqlParameter("@LINKPHIM", SqlDbType.VarChar);
            parameters[3].Value = linkphim;

            parameters[4]       = new SqlParameter("@NAMSANXUAT", SqlDbType.VarChar, 10);
            parameters[4].Value = namsanxuat;

            parameters[5]       = new SqlParameter("@DAODIEN", SqlDbType.VarChar, 20);
            parameters[5].Value = daodien;

            parameters[6]       = new SqlParameter("@HINHANH", SqlDbType.Image);
            parameters[6].Value = image;

            diaphim.setData("spr_insert_SANPHAM", parameters);
            diaphim.closeConnection();
        }
示例#4
0
        public void deleteNGUOIDUNG(int userId)
        {
            DATABASE diaphim = new DATABASE();

            diaphim.openConnection();
            SqlParameter[] parameters = new SqlParameter[1];

            parameters[0]       = new SqlParameter("@NID", SqlDbType.Int);
            parameters[0].Value = userId;

            diaphim.setData("spr_delete_NGUOIDUNG", parameters);
            diaphim.closeConnection();
        }
示例#5
0
        public void insertTHELOAI(string name)
        {
            DATABASE diaphim = new DATABASE();

            diaphim.openConnection();
            SqlParameter[] parameters = new SqlParameter[1];

            parameters[0]       = new SqlParameter("@NAME", SqlDbType.VarChar);
            parameters[0].Value = name;

            diaphim.setData("spr_insert_THELOAI", parameters);
            diaphim.closeConnection();
        }
 private void butten_Click(object sender, EventArgs e)
 {
     if (tbtheloai.Text != string.Empty)
     {
         diaphim.openConnection();
         tl.insertTHELOAI(tbtheloai.Text);
         MessageBox.Show("Thêm thành công", "Thêm thể loại", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
     else
     {
         MessageBox.Show("Thông tin chưa đầy đủ");
     }
 }
示例#7
0
        public void deleteTHELOAI(int S_id)
        {
            DATABASE  diaphim = new DATABASE();
            DataTable table   = new DataTable();

            SqlParameter[] parameters = new SqlParameter[1];

            parameters[0]       = new SqlParameter("@cid", SqlDbType.Int);
            parameters[0].Value = S_id;

            diaphim.openConnection();
            diaphim.setData("spr_delete_THELOAI", parameters);
            diaphim.closeConnection();
        }
示例#8
0
        public void deleteSANPHAM(int s_id)
        {
            DATABASE diaphim = new DATABASE();

            diaphim.openConnection();
            SqlParameter[] parameters = new SqlParameter[1];

            parameters[0]       = new SqlParameter("@SID", SqlDbType.Int);
            parameters[0].Value = s_id;


            diaphim.setData("spr_delete_SANPHAM", parameters);
            diaphim.closeConnection();
        }
示例#9
0
        public void updateTHELOAI(int cid, string name)
        {
            DATABASE diaphim = new DATABASE();

            diaphim.openConnection();
            SqlParameter[] parameters = new SqlParameter[2];

            parameters[0]       = new SqlParameter("@T_ID", SqlDbType.Int);
            parameters[0].Value = cid;

            parameters[1]       = new SqlParameter("@NAME", SqlDbType.VarChar);
            parameters[1].Value = name;

            diaphim.setData("spr_update_THELOAI", parameters);
            diaphim.closeConnection();
        }