コード例 #1
0
        private void btnGhi_Click(object sender, EventArgs e)
        {
            n         = new Nghe();
            nBus      = new NgheBUS();
            n.MaNghe  = txtMaNghe.Text;
            n.TenNghe = txtTenNghe.Text;
            int kq = nBus.Insert(n);

            nBus.hienThi(dataNghe, txtMaNghe, lblDongDL);
        }
コード例 #2
0
ファイル: DAL.cs プロジェクト: haidangaten/1A
        //Hàm trả về danh sách nghề khi biết tên nghề, tìm gần đúng
        public DataTable NgheDS_TenNghe(Nghe n)
        {
            SqlDataAdapter adap = new SqlDataAdapter("NgheDS_TenNghe", KetNoiCSDL._conn);

            adap.SelectCommand.CommandType = CommandType.StoredProcedure;
            adap.SelectCommand.Parameters.Add("@TenNghe", SqlDbType.NVarChar).Value = n.TenNghe;
            DataTable ds = new DataTable();

            adap.Fill(ds);
            return(ds);
        }
コード例 #3
0
ファイル: DAL.cs プロジェクト: haidangaten/1A
        //Hàm thêm 1 nghề mới, trả về 1 nếu thêm thành công, ngược lại trả về 0
        public int ngheThem(Nghe n)
        {
            SqlConnection dbConn = new SqlConnection(KetNoiCSDL.strConn);

            dbConn.Open();
            SqlCommand dbCmd = new SqlCommand("Nghe_Them", dbConn);

            dbCmd.CommandType = CommandType.StoredProcedure;
            dbCmd.Parameters.Add("@TenNghe", SqlDbType.NVarChar).Value = n.TenNghe;
            dbCmd.Parameters.Add("@kq", SqlDbType.Int).Direction       = ParameterDirection.Output;
            dbCmd.ExecuteNonQuery();
            return((int)dbCmd.Parameters["@kq"].Value);
        }
コード例 #4
0
ファイル: DAL.cs プロジェクト: haidangaten/1A
        public int Insert(Nghe n)
        {
            if (kt == false)
            {
                return(0);
            }
            KetNoiCSDL._conn = new SqlConnection(KetNoiCSDL.strConn);
            SqlCommand cmd = new SqlCommand("Nghe_Them", KetNoiCSDL._conn);

            KetNoiCSDL._conn.Open();
            cmd.CommandType = CommandType.StoredProcedure;
            cmd.Parameters.Add("@TenNghe", SqlDbType.NVarChar).Value = n.TenNghe;
            cmd.Parameters.Add("@kq", SqlDbType.Int).Direction       = ParameterDirection.Output;
            cmd.ExecuteNonQuery();
            return((int)cmd.Parameters["@kq"].Value);
        }
コード例 #5
0
 // private string _error;
 public int Insert(Nghe n)
 {
     nDAL = new NgheDAL();
     if (n.TenNghe != "")
     {
         int kq = nDAL.Insert(n);
         //Nếu hợp lệ thêm thông tin mới
         if (kq == 0)
         {
             MessageBox.Show("Không thể thêm thông tin này. Vui lòng kiểm tra lại!", "Hệ thống quản lý thư viện - Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Error);
             return(0);
         }
         else
         {
             return(1);
         }
     }
     else
     {
         MessageBox.Show("Phải nhập tên nghề. Vui lòng kiểm tra lại!", "Thông báo");
         return(0);
     }
 }
コード例 #6
0
 public async Task <int> UpdateFileNghe(Nghe c)
 {
     return(await _ngheService.UpdateNghe(c));
 }
コード例 #7
0
 public async Task <int> AddFileNghe(Nghe d)
 {
     return(await _ngheService.Add(d));
 }