示例#1
0
 private void btnXOA_Click(object sender, EventArgs e)
 {
     if (MessageBox.Show("Bạn có chắc chắn muốn xóa?", "Thông báo", MessageBoxButtons.YesNo, MessageBoxIcon.Warning) == DialogResult.Yes)
     {
         CT_KKCL CTKKCL = new CT_KKCL();
         CTKKCL.SOPCL = txtSOPCL.Text;
         if (bllCT_KKCL.DeleteCT_KKCL(CTKKCL))
         {
             ShowAllCT_KKCL();
         }
         else
         {
             MessageBox.Show("Lỗi", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Error);
         }
     }
 }
        public bool DeleteCT_KKCL(CT_KKCL CTKKCL)
        {
            string        sql = "DELETE CHITIET_PHIEUKKCL WHERE SOPCL = @SOPCL ";
            SqlConnection con = dc.getConnect();

            try
            {
                cmd = new SqlCommand(sql, con);
                con.Open();
                cmd.Parameters.Add("@SOPCL", SqlDbType.NChar).Value = CTKKCL.SOPCL;
                cmd.ExecuteNonQuery();
                con.Close();
            }
            catch (Exception e)
            {
                return(false);
            }
            return(true);
        }
示例#3
0
        private void btnSUA_Click(object sender, EventArgs e)
        {
            CT_KKCL CTKKCL = new CT_KKCL();

            CTKKCL.SOPCL       = txtSOPCL.Text;
            CTKKCL.MAHH        = txtMAHH.Text;
            CTKKCL.SOLUONGSPKT = int.Parse(txtSOLUONGSPKT.Text);
            CTKKCL.SOLUONGSPL  = int.Parse(txtSOLUONGSPL.Text);
            CTKKCL.SOLUONGSPHH = int.Parse(txtSOLUONGSPHH.Text);
            CTKKCL.GHICHU      = txtGHICHU.Text;


            if (bllCT_KKCL.UpdateCT_KKCL(CTKKCL))
            {
                ShowAllCT_KKCL();
            }
            else
            {
                MessageBox.Show("Lỗi", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
        public bool UpdateCT_KKCL(CT_KKCL CTKKCL)
        {
            string        sql = "UPDATE CHITIET_PHIEUKKCL SET SOPCL = @SOPCL, MAHH = @MAHH, SOLUONGSPKT = @SOLUONGSPKT, SOLUONGSPL = @SOLUONGSPL, SOLUONGSPHH = @SOLUONGSPHH, GHICHU = @GHICHU WHERE SOPCL = @SOPCL ";
            SqlConnection con = dc.getConnect();

            try
            {
                cmd = new SqlCommand(sql, con);
                con.Open();
                cmd.Parameters.Add("@SOPCL", SqlDbType.NChar).Value     = CTKKCL.SOPCL;
                cmd.Parameters.Add("@MAHH", SqlDbType.NChar).Value      = CTKKCL.MAHH;
                cmd.Parameters.Add("@SOLUONGSPKT", SqlDbType.Int).Value = CTKKCL.SOLUONGSPKT;
                cmd.Parameters.Add("@SOLUONGSPL", SqlDbType.Int).Value  = CTKKCL.SOLUONGSPL;
                cmd.Parameters.Add("@SOLUONGSPHH", SqlDbType.Int).Value = CTKKCL.SOLUONGSPHH;
                cmd.Parameters.Add("@GHICHU", SqlDbType.NVarChar).Value = CTKKCL.GHICHU;
                cmd.ExecuteNonQuery();
                con.Close();
            }
            catch (Exception e)
            {
                return(false);
            }
            return(true);
        }
        public bool InsertCT_KKCL(CT_KKCL CTKKCL)
        {
            string        sql = "INSERT INTO CHITIET_PHIEUKKCL( SOPCL, MAHH, SOLUONGSPKT, SOLUONGSPL, SOLUONGSPHH, GHICHU) VALUES(@SOPCL, @MAHH, @SOLUONGSPKT, @SOLUONGSPL, @SOLUONGSPHH, @GHICHU) ";
            SqlConnection con = dc.getConnect();

            try
            {
                cmd = new SqlCommand(sql, con);
                con.Open();
                cmd.Parameters.Add("@SOPCL", SqlDbType.NChar).Value     = CTKKCL.SOPCL;
                cmd.Parameters.Add("@MAHH", SqlDbType.NChar).Value      = CTKKCL.MAHH;
                cmd.Parameters.Add("@SOLUONGSPKT", SqlDbType.Int).Value = CTKKCL.SOLUONGSPKT;
                cmd.Parameters.Add("@SOLUONGSPL", SqlDbType.Int).Value  = CTKKCL.SOLUONGSPL;
                cmd.Parameters.Add("@SOLUONGSPHH", SqlDbType.Int).Value = CTKKCL.SOLUONGSPHH;
                cmd.Parameters.Add("@GHICHU", SqlDbType.NVarChar).Value = CTKKCL.GHICHU;
                cmd.ExecuteNonQuery();
                con.Close();
            }
            catch (Exception e)
            {
                return(false);
            }
            return(true);
        }
示例#6
0
 public bool DeleteCT_KKCL(CT_KKCL CTKKCL)
 {
     return(dalCT_KKCL.DeleteCT_KKCL(CTKKCL));
 }
示例#7
0
 public bool UpdateCT_KKCL(CT_KKCL CTKKCL)
 {
     return(dalCT_KKCL.UpdateCT_KKCL(CTKKCL));
 }
示例#8
0
 public bool InsertCT_KKCL(CT_KKCL CTKKCL)
 {
     return(dalCT_KKCL.InsertCT_KKCL(CTKKCL));
 }