Ejemplo n.º 1
0
 private void button3_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_KKSL CTKKSL = new CT_KKSL();
         CTKKSL.SOPSL = txtSOPSL.Text;
         if (bllCT_KKSL.DeleteCT_KKSL(CTKKSL))
         {
             ShowAllCT_KKSL();
         }
         else
         {
             MessageBox.Show("Lỗi", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Error);
         }
     }
 }
Ejemplo n.º 2
0
        public bool DeleteCT_KKSL(CT_KKSL CTKKSL)
        {
            string        sql = "DELETE CHITIET_PHIEUKKSL WHERE SOPSL = @SOPSL ";
            SqlConnection con = dc.getConnect();

            try
            {
                cmd = new SqlCommand(sql, con);
                con.Open();
                cmd.Parameters.Add("@SOPSL", SqlDbType.NChar).Value = CTKKSL.SOPSL;
                cmd.ExecuteNonQuery();
                con.Close();
            }
            catch (Exception e)
            {
                return(false);
            }
            return(true);
        }
Ejemplo n.º 3
0
        private void button2_Click(object sender, EventArgs e)
        {
            CT_KKSL CTKKSL = new CT_KKSL();

            CTKKSL.SOPSL        = txtSOPSL.Text;
            CTKKSL.MAHH         = txtMAHH.Text;
            CTKKSL.PHUONGTHUCKK = txtPHUONGTHUCKK.Text;
            CTKKSL.SOLUONGCT    = int.Parse(txtSOLUONGCT.Text);
            CTKKSL.SOLUONGTT    = int.Parse(txtSOLUONGTT.Text);
            CTKKSL.GHICHU       = txtGHICHU.Text;


            if (bllCT_KKSL.UpdateCT_KKSL(CTKKSL))
            {
                ShowAllCT_KKSL();
            }
            else
            {
                MessageBox.Show("Lỗi", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Ejemplo n.º 4
0
        public bool UpdateCT_KKSL(CT_KKSL CTKKSL)
        {
            string        sql = "UPDATE CHITIET_PHIEUKKSL SET SOPSL = @SOPSL, MAHH = @MAHH, PHUONGTHUCKK = @PHUONGTHUCKK, SOLUONGCT = @SOLUONGCT, SOLUONGTT = @SOLUONGTT, GHICHU = @GHICHU WHERE SOPSL = @SOPSL ";
            SqlConnection con = dc.getConnect();

            try
            {
                cmd = new SqlCommand(sql, con);
                con.Open();
                cmd.Parameters.Add("@SOPSL", SqlDbType.NChar).Value           = CTKKSL.SOPSL;
                cmd.Parameters.Add("@MAHH", SqlDbType.NChar).Value            = CTKKSL.MAHH;
                cmd.Parameters.Add("@PHUONGTHUCKK", SqlDbType.NVarChar).Value = CTKKSL.PHUONGTHUCKK;
                cmd.Parameters.Add("@SOLUONGCT", SqlDbType.Int).Value         = CTKKSL.SOLUONGCT;
                cmd.Parameters.Add("@SOLUONGTT", SqlDbType.Int).Value         = CTKKSL.SOLUONGTT;
                cmd.Parameters.Add("@GHICHU", SqlDbType.NVarChar).Value       = CTKKSL.GHICHU;
                cmd.ExecuteNonQuery();
                con.Close();
            }
            catch (Exception e)
            {
                return(false);
            }
            return(true);
        }
Ejemplo n.º 5
0
        public bool InsertCT_KKSL(CT_KKSL CTKKSL)
        {
            string        sql = "INSERT INTO CHITIET_PHIEUKKSL( SOPSL, MAHH, PHUONGTHUCKK, SOLUONGCT, SOLUONGTT, GHICHU) VALUES(@SOPSL, @MAHH, @PHUONGTHUCKK, @SOLUONGCT, @SOLUONGTT, @GHICHU) ";
            SqlConnection con = dc.getConnect();

            try
            {
                cmd = new SqlCommand(sql, con);
                con.Open();
                cmd.Parameters.Add("@SOPSL", SqlDbType.NChar).Value           = CTKKSL.SOPSL;
                cmd.Parameters.Add("@MAHH", SqlDbType.NChar).Value            = CTKKSL.MAHH;
                cmd.Parameters.Add("@PHUONGTHUCKK", SqlDbType.NVarChar).Value = CTKKSL.PHUONGTHUCKK;
                cmd.Parameters.Add("@SOLUONGCT", SqlDbType.Int).Value         = CTKKSL.SOLUONGCT;
                cmd.Parameters.Add("@SOLUONGTT", SqlDbType.Int).Value         = CTKKSL.SOLUONGTT;
                cmd.Parameters.Add("@GHICHU", SqlDbType.NVarChar).Value       = CTKKSL.GHICHU;
                cmd.ExecuteNonQuery();
                con.Close();
            }
            catch (Exception e)
            {
                return(false);
            }
            return(true);
        }
Ejemplo n.º 6
0
 public bool DeleteCT_KKSL(CT_KKSL CTKKSL)
 {
     return(dalCT_KKSL.DeleteCT_KKSL(CTKKSL));
 }
Ejemplo n.º 7
0
 public bool UpdateCT_KKSL(CT_KKSL CTKKSL)
 {
     return(dalCT_KKSL.UpdateCT_KKSL(CTKKSL));
 }
Ejemplo n.º 8
0
 public bool InsertCT_KKSL(CT_KKSL CTKKSL)
 {
     return(dalCT_KKSL.InsertCT_KKSL(CTKKSL));
 }