Пример #1
0
        public bool insertChucVu(Entities.tblChucVu cv)
        {
            bool   check = false;
            string sql   = "sp_tblChucVu_Insert";

            try
            {
                con = ds.getConnect();
                cmd = new SqlCommand(sql, con);
                con.Open();
                cmd.CommandType = CommandType.StoredProcedure;
                cmd.CommandText = sql;
                cmd.Connection  = con;
                cmd.Parameters.Add("@maChucVu", SqlDbType.NVarChar).Value  = cv.Machucvu;
                cmd.Parameters.Add("@tenChucVu", SqlDbType.NVarChar).Value = cv.Tenchucvu;
                cmd.ExecuteNonQuery();
                check = true;
            }
            catch (Exception ex)
            {
                ex.ToString();
            }
            finally
            {
                cmd.Dispose();
                con.Close();
            }
            return(check);
        }
Пример #2
0
        public bool deleteChucVu(Entities.tblChucVu cv)
        {
            bool   check = false;
            string sql   = "sp_tblChucVu_Delete";

            try
            {
                con = ds.getConnect();
                cmd = new SqlCommand(sql, con);
                con.Open();
                cmd.CommandType = CommandType.StoredProcedure;
                cmd.Parameters.Add("@id", SqlDbType.Int).Value = cv.Id;
                cmd.ExecuteNonQuery();
                check = true;
            }
            catch (Exception ex)
            {
                ex.ToString();
            }
            finally
            {
                cmd.Dispose();
                con.Close();
            }
            return(check);
        }
Пример #3
0
 private void btnSave_Click(object sender, EventArgs e)
 {
     if (int.TryParse(lblID.Text, out _ID))
     {
     }
     if (CheckObject())
     {
         Entities.tblChucVu kh = new Entities.tblChucVu();
         kh.Id        = _ID;
         kh.Machucvu  = txtMaChucVu.Text;
         kh.Tenchucvu = txtTenChucVu.Text;
         if (flag == "add")
         {
             bool check = bllChucVu.insertChucVu(kh);
             if (check)
             {
                 MessageBox.Show("Thêm thành công.", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information);
             }
             ReLoad();
         }
         else if (flag == "update")
         {
             bool check = bllChucVu.updateChucVu(kh);
             if (check)
             {
                 MessageBox.Show("Cập nhật thành công.", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information);
             }
             ReLoad();
         }
         else if (flag == "delete")
         {
             bool check = bllChucVu.deleteChucVu(kh);
             if (check)
             {
                 MessageBox.Show("Xóa thành công.", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information);
             }
             ReLoad();
         }
         ReLoad();
         dgvChucVu_SelectionChanged(sender, e);
     }
 }
Пример #4
0
 public bool deleteChucVu(Entities.tblChucVu kh)
 {
     return(dal.deleteChucVu(kh));
 }
Пример #5
0
 public bool updateChucVu(Entities.tblChucVu kh)
 {
     return(dal.updateChucVu(kh));
 }
Пример #6
0
 public bool insertChucVu(Entities.tblChucVu kh)
 {
     return(dal.insertChucVu(kh));
 }