Example #1
0
        /// <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);
                }
            }
        }
Example #2
0
        /// <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));
        }