/// <summary> /// 实现IOccupationBLL接口 /// </summary> /// <param name="occupationClass">需要保存的职位类型</param> /// <returns>返回是否成功的布尔值</returns> public bool SaveOccupationClass(OccupationClass occupationClass) { //throw new System.NotImplementedException(); IOccupationClassDAL dAL = new OccupationClassDAL(); //先检查有没有该职位类型,如果有,则更新记录,如果没有,则添加 if (dAL.QueryById(occupationClass.Id) != null) { if (dAL.Update(occupationClass) > 0) { return(true); } else { return(false); } } else { if (dAL.Add(occupationClass) > 0) { return(true); } else { return(false); } } }
/// <summary> /// 实现IOccupationBLL接口 /// </summary> /// <returns>返回所有职位类别,List类型</returns> public List <OccupationClass> GetAllOccupationClass() { //throw new NotImplementedException(); IOccupationClassDAL dAL = new OccupationClassDAL(); return(dAL.Query()); }
/// <summary> /// 实现IOccupationBLL接口 /// </summary> /// <param name="id">主键id</param> /// <returns>返回id对应的职位类型</returns> public OccupationClass GetOccupationClassById(int id) { //throw new NotImplementedException(); IOccupationClassDAL dAL = new OccupationClassDAL(); return(dAL.QueryById(id)); }
/// <summary> /// 实现IOccupationBLL接口,通过id删除职位类型 /// </summary> /// <param name="id">主键id</param> /// <returns>返回是否成功的布尔值</returns> public bool DeleteOccupationClassById(int id) { //throw new System.NotImplementedException(); IOccupationClassDAL dAL = new OccupationClassDAL(); if (dAL.Remove(id) > 0) { return(true); } else { return(false); } }