Esempio n. 1
0
        /// <summary>
        /// 删除知识库
        /// </summary>
        public bool DeleteKnow(long artId, long userId)
        {
            var timeNow       = Tools.Date.DateHelper.ToUniversalTimeStamp(DateTime.Now);
            var skatDal       = new sdk_kb_article_ticket_dal();
            var skacDal       = new sdk_kb_article_comment_dal();
            var thisArt       = _dal.FindNoDeleteById(artId);
            var thisArtTicket = skatDal.GetArtTicket(artId);
            var thisArtComm   = skacDal.GetCommByArt(artId);

            if (thisArtComm != null && thisArtComm.Count > 0)
            {
                thisArtComm.ForEach(_ => {
                    skacDal.SoftDelete(_, userId);
                    OperLogBLL.OperLogDelete <sdk_kb_article_comment>(_, _.id, userId, OPER_LOG_OBJ_CATE.SDK_KONWLEDGE_COMMENT, "删除知识库评论");
                });
            }
            if (thisArtTicket != null && thisArtTicket.Count > 0)
            {
                thisArtTicket.ForEach(_ => {
                    skatDal.SoftDelete(_, userId);
                    OperLogBLL.OperLogDelete <sdk_kb_article_ticket>(_, _.id, userId, OPER_LOG_OBJ_CATE.SDK_KONWLEDGE_TICKET, "删除知识库关联工单");
                });
            }
            if (thisArt != null)
            {
                _dal.SoftDelete(thisArt, userId);
                OperLogBLL.OperLogDelete <sdk_kb_article>(thisArt, thisArt.id, userId, OPER_LOG_OBJ_CATE.SDK_KONWLEDGE, "删除知识库");
            }

            return(true);
        }
Esempio n. 2
0
        /// <summary>
        /// 知识库关联工单相关管理
        /// </summary>
        public void KnowTicketManage(long artId, string ticketIds, long userId)
        {
            var oldArt = _dal.FindNoDeleteById(artId);

            if (oldArt == null)
            {
                return;
            }
            var stDal       = new sdk_task_dal();
            var skatDal     = new sdk_kb_article_ticket_dal();
            var oldTickList = skatDal.GetArtTicket(artId);
            var timeNow     = Tools.Date.DateHelper.ToUniversalTimeStamp(DateTime.Now);

            if (oldTickList != null && oldTickList.Count > 0)
            {
                if (!string.IsNullOrEmpty(ticketIds))
                {
                    var ticketArr = ticketIds.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries);
                    foreach (var ticketId in ticketArr)
                    {
                        var thisTicket = stDal.FindNoDeleteById(long.Parse(ticketId));
                        if (thisTicket == null)
                        {
                            continue;
                        }
                        var artTicket = oldTickList.FirstOrDefault(_ => _.kb_article_id == artId && _.task_id.ToString() == ticketId);
                        if (artTicket != null)
                        {
                            oldTickList.Remove(artTicket);
                        }
                        else
                        {
                            artTicket = new sdk_kb_article_ticket()
                            {
                                id             = skatDal.GetNextIdCom(),
                                create_time    = timeNow,
                                create_user_id = userId,
                                update_time    = timeNow,
                                update_user_id = userId,
                                kb_article_id  = artId,
                                task_id        = thisTicket.id,
                                task_no        = thisTicket.no,
                            };
                            skatDal.Insert(artTicket);
                            OperLogBLL.OperLogAdd <sdk_kb_article_ticket>(artTicket, artTicket.id, userId, OPER_LOG_OBJ_CATE.SDK_KONWLEDGE_TICKET, "新增知识库关联工单");
                        }
                    }
                }
                oldTickList.ForEach(_ => {
                    skatDal.SoftDelete(_, userId);
                    OperLogBLL.OperLogDelete <sdk_kb_article_ticket>(_, _.id, userId, OPER_LOG_OBJ_CATE.SDK_KONWLEDGE_TICKET, "删除知识库关联工单");
                });
            }
            else
            {
                if (!string.IsNullOrEmpty(ticketIds))
                {
                    var ticketArr = ticketIds.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries);
                    foreach (var ticketId in ticketArr)
                    {
                        var thisTicket = stDal.FindNoDeleteById(long.Parse(ticketId));
                        if (thisTicket == null)
                        {
                            continue;
                        }
                        var artTicket = new sdk_kb_article_ticket()
                        {
                            id             = skatDal.GetNextIdCom(),
                            create_time    = timeNow,
                            create_user_id = userId,
                            update_time    = timeNow,
                            update_user_id = userId,
                            kb_article_id  = artId,
                            task_id        = thisTicket.id,
                            task_no        = thisTicket.no,
                        };
                        skatDal.Insert(artTicket);
                        OperLogBLL.OperLogAdd <sdk_kb_article_ticket>(artTicket, artTicket.id, userId, OPER_LOG_OBJ_CATE.SDK_KONWLEDGE_TICKET, "新增知识库关联工单");
                    }
                }
            }
        }