Example #1
0
        /// <summary>
        /// 删除知识库目录
        /// </summary>
        public bool DeleteKnowMenu(long cateId, long userId, ref string failReason)
        {
            var dgDal = new d_general_dal();
            var cate  = dgDal.FindNoDeleteById(cateId);

            if (cate == null)
            {
                return(true);
            }
            if (cate.parent_id == null)
            {
                failReason = "根目录不可删除";
                return(false);
            }
            var gBll = new GeneralBLL();

            ChangeArtCate(cateId, userId, (int)cate.parent_id);
            //var subMenu = dgDal.GetGeneralByParentId(cateId);
            //if (subMenu != null && subMenu.Count > 0)
            //    subMenu.ForEach(_ => {
            //        _.parent_id = cate.parent_id;
            //        gBll.EditGeneral(_,userId);
            //    });
            //var subArt = _dal.GetArtByCate(cateId);
            //if(subArt!=null&& subArt.Count > 0)
            //    subArt.ForEach(_=> {
            //        _.kb_category_id = (int)cate.parent_id;
            //        UpdateKnow(_,userId);
            //    });
            dgDal.SoftDelete(cate, userId);
            OperLogBLL.OperLogAdd <d_general>(cate, cate.id, userId, OPER_LOG_OBJ_CATE.General_Code, "删除知识库目录");
            return(true);
        }
Example #2
0
        /// <summary>
        /// 编辑知识库目录
        /// </summary>
        public bool EditKnowMenu(long cateId, string name, int parentId, long userId, ref string failReason)
        {
            var dgDal = new d_general_dal();

            if (string.IsNullOrEmpty(name))
            {
                failReason = "为获取到相关名称";
                return(false);
            }
            var cate = dgDal.FindNoDeleteById(cateId);

            if (cate == null)
            {
                failReason = "该目录已经删除";
                return(false);
            }
            var isCanAdd = true;
            var subList  = dgDal.GetGeneralByParentId(parentId);

            if (subList != null && subList.Count > 0)
            {
                if (subList.Any(_ => name.Equals(_.name) && _.id != cateId))
                {
                    isCanAdd = false;
                }
            }
            if (!isCanAdd)
            {
                failReason = "同一级目录,名称不能相同!";
                return(false);
            }
            cate.name           = name;
            cate.parent_id      = parentId;
            cate.update_time    = Tools.Date.DateHelper.ToUniversalTimeStamp(DateTime.Now);
            cate.update_user_id = userId;
            var oldCate = dgDal.FindNoDeleteById(cateId);

            dgDal.Update(cate);
            OperLogBLL.OperLogUpdate <d_general>(cate, oldCate, cate.id, userId, OPER_LOG_OBJ_CATE.General_Code, "编辑知识库目录");
            return(true);
        }
Example #3
0
        /// <summary>
        /// 根据ID 集合获取相应的服务信息
        /// </summary>
        public void GetServicesByIds(HttpContext context)
        {
            var serviceIds = context.Request.QueryString["ids"];

            if (!string.IsNullOrEmpty(serviceIds))
            {
                var serList = new ivt_service_dal().GetServiceList($" and id in({serviceIds})");
                if (serList != null && serList.Count > 0)
                {
                    List <ServiceDto> serDtoList = new List <ServiceDto>();
                    var accBll = new CompanyBLL();
                    var dDal   = new d_general_dal();
                    var dccDal = new d_cost_code_dal();
                    serList.ForEach(_ => {
                        var thisDto = new ServiceDto()
                        {
                            id             = _.id,
                            name           = _.name,
                            description    = _.description,
                            unit_cost      = (_.unit_cost ?? 0),
                            unit_price     = (_.unit_price ?? 0),
                            cost_code_id   = _.cost_code_id,
                            period_type_id = _.period_type_id,
                            vendor_id      = _.vendor_account_id,
                        };
                        if (_.vendor_account_id != null)
                        {
                            var thisVendor = accBll.GetCompany((long)_.vendor_account_id);
                            if (thisVendor != null)
                            {
                                thisDto.vendor_name = thisVendor.name;
                            }
                        }
                        if (_.period_type_id != null)
                        {
                            var thisType = dDal.FindNoDeleteById((long)_.period_type_id);
                            if (thisType != null)
                            {
                                thisDto.period_type_name = thisType.name;
                            }
                        }
                        var thisCode = dccDal.FindNoDeleteById(_.cost_code_id);
                        if (thisCode != null)
                        {
                            thisDto.cost_code_name = thisCode.name;
                        }
                        serDtoList.Add(thisDto);
                    });

                    context.Response.Write(new EMT.Tools.Serialize().SerializeJson(serDtoList));
                }
            }
        }