public bool Insert(CTNV_DTO kh)
        {
            try
            {
                con.Open();

                string SQL = "Insert into CTNV values(N'"
                             + kh.ChucVu + "')";
                SqlCommand cmd = new SqlCommand(SQL, con);
                if (cmd.ExecuteNonQuery() > 0)
                {
                    return(true);
                }
            }

            catch (Exception e)
            { }

            finally
            {
                con.Close();
            }

            return(false);
        }
Beispiel #2
0
        private void btnThemCV_Click(object sender, EventArgs e)
        {
            CTNV_DTO kh_DTO = new CTNV_DTO(txtTenChucVu.Text);

            if (ctnv_BUS.Insert(kh_DTO))
            {
                MessageBox.Show("Thêm thành công!");
                LoadChucVu();
            }
            else
            {
                MessageBox.Show("Thêm thất bại!");
            }
        }
Beispiel #3
0
 private void btnSuaCV_Click(object sender, EventArgs e)
 {
     if (txtIDChucVu.Text != "")
     {
         CTNV_DTO kh_DTO = new CTNV_DTO(int.Parse(txtIDChucVu.Text), txtTenChucVu.Text);
         if (ctnv_BUS.Update(kh_DTO))
         {
             MessageBox.Show("Sửa thành công!");
             LoadChucVu();
         }
         else
         {
             MessageBox.Show("Sửa thất bại!");
         }
     }
     else
     {
         MessageBox.Show("Vui lòng chọn dữ liệu!");
     }
 }
        public bool Update(CTNV_DTO kh)
        {
            try
            {
                con.Open();

                string     SQL = string.Format("UPDATE CTNV SET  Chuc =N'" + kh.ChucVu + "' WHERE IDPHANQUYEN = '" + kh.IDPhanQuyen + "'");
                SqlCommand cmd = new SqlCommand(SQL, con);
                if (cmd.ExecuteNonQuery() > 0)
                {
                    return(true);
                }
            }

            catch (Exception e)
            { }

            finally
            {
                con.Close();
            }

            return(false);
        }
Beispiel #5
0
 public bool Update(CTNV_DTO ctnv)
 {
     return(ctnv_dal.Update(ctnv));
 }
Beispiel #6
0
 public bool Insert(CTNV_DTO ctnv)
 {
     return(ctnv_dal.Insert(ctnv));
 }