public Faculty faculty() { Faculty khoa = new Faculty(); khoa.ID = txtMaKhoa.Text; khoa.Name = txtKhoa.Text; return khoa; }
public bool Delete(Faculty khoa) { try { SqlParameter[] sqlParams = new SqlParameter[]{ new SqlParameter("@MaKhoa", khoa.ID) }; return DBConnection.Instance.ExecuteQuery("Faculty_Delete", sqlParams, CommandType.StoredProcedure); } catch (Exception ex) { return false; } }
public bool Edit(Faculty khoa, string MaTruongKhoa) { try { SqlParameter[] sqlParams = new SqlParameter[]{ new SqlParameter("@MaKhoa", khoa.ID), new SqlParameter("@TenKhoa", khoa.Name), new SqlParameter("@MaTruongKhoa", MaTruongKhoa) }; return DBConnection.Instance.ExecuteQuery("Faculty_Update", sqlParams, CommandType.StoredProcedure); } catch (Exception ex) { return false; } }
public List<Faculty> GetList() { try { List<Faculty> faculties = new List<Faculty>(); DataTable dt = facultyDAL.GetAll(); for(int i=0;i<dt.Rows.Count;i++) { Faculty faculty = new Faculty(); faculty.ID = dt.Rows[i][0].ToString(); faculty.Name = dt.Rows[i][1].ToString(); faculties.Add(faculty); } return faculties; } catch(Exception ex) { throw ex; } }