Example #1
0
        /// <summary>
        /// 实现IOrgBLL接口
        /// </summary>
        /// <param name="secondOrg">需要保存的SecondOrg</param>
        /// <returns>返回是否保存成功的布尔值</returns>
        public bool SaveSecondOrg(SecondOrg secondOrg)
        {
            //throw new System.NotImplementedException();

            ISecondOrgDAL dAL = new SecondOrgDAL();

            //先检查有没有该SecondOrg,如果有,则更新,没有则添加
            if (dAL.QueryById(secondOrg.Id) != null)
            {
                if (dAL.Update(secondOrg) > 0)
                {
                    return(true);
                }
                else
                {
                    return(false);
                }
            }
            else
            {
                if (dAL.Add(secondOrg) > 0)
                {
                    return(true);
                }
                else
                {
                    return(false);
                }
            }
        }
Example #2
0
        /// <summary>
        /// 实现IOrgBLL接口
        /// </summary>
        /// <returns>返回所有2级机构</returns>
        public List <SecondOrg> GetAllSecondOrg()
        {
            //throw new NotImplementedException();

            ISecondOrgDAL dAL = new SecondOrgDAL();

            return(dAL.Query());
        }
Example #3
0
        /// <summary>
        /// 实现IOrgBLL接口
        /// </summary>
        /// <param name="id">主键id</param>
        /// <returns>返回对应id的2级机构</returns>
        public SecondOrg GetSecondOrgById(int id)
        {
            //throw new NotImplementedException();

            ISecondOrgDAL dAL = new SecondOrgDAL();

            return(dAL.QueryById(id));
        }
Example #4
0
        /// <summary>
        /// 实现IOrgBLL接口
        /// </summary>
        /// <param name="id">1级机构的id</param>
        /// <returns>返回所欲parentId为传入id的2级机构</returns>
        public List <SecondOrg> GetSecondOrgByFirstOrgId(int id)
        {
            //throw new System.NotImplementedException();

            ISecondOrgDAL dAL = new SecondOrgDAL();

            return(dAL.QueryByParentOrgId(id));
        }
Example #5
0
        public bool DeleteSecondOrgById(int id)
        {
            //throw new System.NotImplementedException();

            ISecondOrgDAL dAL = new SecondOrgDAL();

            if (dAL.Remove(id) > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }