Exemple #1
0
        public static int Delete(int nodeId)
        {
            if (nodeId == 0)
            {
                return(3);
            }
            NodeInfo cacheNodeById = GetCacheNodeById(nodeId);

            if (cacheNodeById.IsNull)
            {
                return(2);
            }
            DeleteNodeRelationByNodeId(nodeId);
            DeleteInArrChild(cacheNodeById.ArrChildId);
            if (cacheNodeById.ParentId > 0)
            {
                NodeInfo nodeInfo = GetCacheNodeById(cacheNodeById.ParentId);
                nodeInfo.Child--;
                nodeInfo.ArrChildId = nodeInfo.ArrChildId.Replace("," + cacheNodeById.ArrChildId, "");
                Update(nodeInfo);
            }
            PatchNodes();
            ContentManage.DeleteByNodeId(cacheNodeById.ArrChildId, -4);
            DeleteNodeFolder(cacheNodeById);
            RemoveCacheAllNodeInfo();
            return(1);
        }
 public static bool Add(CommentInfo commentInfo)
 {
     commentInfo.CommentId = MaxCommentId() + 1;
     if (dal.Add(commentInfo))
     {
         ContentManage.UpdateCommentAuditedAndUnaudited(commentInfo.GeneralId);
         return(true);
     }
     return(false);
 }
        public static bool SetStatus(int commentId, bool status)
        {
            CommentInfo commentInfo = dal.GetCommentInfo(commentId);

            if (!commentInfo.IsNull && dal.SetStatus(commentId, status))
            {
                ContentManage.UpdateCommentAuditedAndUnaudited(commentInfo.GeneralId);
                return(true);
            }
            return(false);
        }
        public static bool Delete(int commentId)
        {
            CommentInfo commentInfo = dal.GetCommentInfo(commentId);

            if (dal.Delete(commentId))
            {
                ContentManage.UpdateCommentAuditedAndUnaudited(commentInfo.GeneralId);
                CommentPKZone.DeleteByCommentId(commentId);
                return(true);
            }
            return(false);
        }
Exemple #5
0
        public static bool BatchUpdate(ContentChargeInfo contentChargeInfo, string itemId, Dictionary <string, bool> checkItem, int batchType)
        {
            if (!DataValidator.IsValidId(itemId))
            {
                return(false);
            }
            if (!checkItem.ContainsValue(true))
            {
                return(false);
            }
            StringBuilder sb        = new StringBuilder();
            int           generalId = 0;

            if (batchType == 1)
            {
                foreach (CommonModelInfo info in ContentManage.GetCommonModelInfoList(itemId))
                {
                    if (!dal.Exists(info.GeneralId))
                    {
                        contentChargeInfo.GeneralId = info.GeneralId;
                        dal.Add(contentChargeInfo);
                    }
                    else
                    {
                        StringHelper.AppendString(sb, info.GeneralId.ToString());
                    }
                }
            }
            else
            {
                foreach (string str in itemId.Split(new char[] { ',' }))
                {
                    generalId = DataConverter.CLng(str);
                    if (generalId != 0)
                    {
                        if (!dal.Exists(generalId))
                        {
                            contentChargeInfo.GeneralId = generalId;
                            dal.Add(contentChargeInfo);
                        }
                        else
                        {
                            StringHelper.AppendString(sb, str);
                        }
                    }
                }
            }
            if (sb.Length > 0)
            {
                return(dal.BatchUpdate(contentChargeInfo, sb.ToString(), checkItem));
            }
            return(true);
        }
        public static bool DeleteByUserName(int commentId)
        {
            string      userName    = PEContext.Current.User.UserName;
            CommentInfo commentInfo = dal.GetCommentInfo(commentId);

            if (((!commentInfo.IsNull && (commentInfo.UserName == userName)) && !commentInfo.Status) && dal.Delete(commentId, userName))
            {
                ContentManage.UpdateCommentAuditedAndUnaudited(commentInfo.GeneralId);
                CommentPKZone.DeleteByCommentId(commentId);
                return(true);
            }
            return(false);
        }
Exemple #7
0
        public static int NodesUnite(int nodeId, int targetNodeId)
        {
            if (nodeId <= 0)
            {
                return(1);
            }
            if (targetNodeId <= 0)
            {
                return(2);
            }
            if (nodeId == targetNodeId)
            {
                return(3);
            }
            NodeInfo nodeById = GetNodeById(targetNodeId);

            if (nodeById.IsNull)
            {
                return(4);
            }
            if (nodeById.Child > 0)
            {
                return(5);
            }
            if (nodeById.NodeType != NodeType.Container)
            {
                return(6);
            }
            NodeInfo cacheNodeById = GetCacheNodeById(nodeId);

            if (cacheNodeById.IsNull)
            {
                return(7);
            }
            if (StringHelper.FoundCharInArr(cacheNodeById.ArrChildId, targetNodeId.ToString()))
            {
                return(8);
            }
            ContentManage.UpdateNodeId(targetNodeId, cacheNodeById.ArrChildId);
            Delete(cacheNodeById.NodeId);
            RemoveCacheAllNodeInfo();
            return(0);
        }
        public ChargeManage()
        {
            int generalId = DataConverter.CLng(HttpContext.Current.Request["id"]);

            this.m_UserInfo          = PEContext.Current.User.UserInfo;
            this.m_CommonModelInfo   = ContentManage.GetCommonModelInfoById(generalId);
            this.m_ModelInfo         = ModelManager.GetModelInfoById(this.m_CommonModelInfo.ModelId);
            this.m_NodeInfo          = Nodes.GetCacheNodeById(this.m_CommonModelInfo.NodeId);
            this.m_contentChargeInfo = ContentCharge.GetContentChargeInfoById(this.m_CommonModelInfo.GeneralId);
            this.m_UserTrueIP        = HttpContext.Current.Request.ServerVariables["HTTP_X_FORWARDED_FOR"];
            if (string.IsNullOrEmpty(this.m_UserTrueIP))
            {
                this.m_UserTrueIP = HttpContext.Current.Request.ServerVariables["REMOTE_ADDR"];
            }
            this.m_UserTrueIP       = DataSecurity.FilterBadChar(this.m_UserTrueIP);
            this.m_Pay              = HttpContext.Current.Request["Pay"];
            this.m_errMsg_NoLogin   = this.m_errMsg_NoLogin.Replace("{$InstallDir}", SiteConfig.SiteInfo.VirtualPath);
            this.m_errMsg_NoLogin   = this.m_errMsg_NoLogin.Replace("{$ItemName}", this.m_ModelInfo.ItemName);
            this.m_errMsg_NoLogin   = this.m_errMsg_NoLogin.Replace("{$ReturnUrl}", DataSecurity.HtmlEncode(HttpContext.Current.Request.RawUrl).Replace("&", "%26"));
            this.m_errMsg_OutTime   = this.m_errMsg_OutTime.Replace("{$ItemName}", this.m_ModelInfo.ItemName);
            this.m_errMsg_NeedPoint = this.m_errMsg_NeedPoint.Replace("{$ItemName}", this.m_ModelInfo.ItemName);
            this.m_errMsg_NeedPoint = this.m_errMsg_NeedPoint.Replace("{$InfoPoint}", this.m_contentChargeInfo.InfoPoint.ToString());
            this.m_errMsg_NeedPoint = this.m_errMsg_NeedPoint.Replace("{$NeedPoint}", this.m_contentChargeInfo.InfoPoint.ToString());
            this.m_errMsg_NeedPoint = this.m_errMsg_NeedPoint.Replace("{$NowPoint}", this.m_UserInfo.UserPoint.ToString());
            this.m_errMsg_NeedPoint = this.m_errMsg_NeedPoint.Replace("{$PointName}", SiteConfig.UserConfig.PointName);
            this.m_errMsg_NeedPoint = this.m_errMsg_NeedPoint.Replace("{$PointUnit}", SiteConfig.UserConfig.PointUnit);
            this.m_errMsg_UsePoint  = this.m_errMsg_UsePoint.Replace("{$ItemName}", this.m_ModelInfo.ItemName);
            this.m_errMsg_UsePoint  = this.m_errMsg_UsePoint.Replace("{$InfoPoint}", this.m_contentChargeInfo.InfoPoint.ToString());
            this.m_errMsg_UsePoint  = this.m_errMsg_UsePoint.Replace("{$NowPoint}", this.m_UserInfo.UserPoint.ToString());
            this.m_errMsg_UsePoint  = this.m_errMsg_UsePoint.Replace("{$FinalPoint}", (this.m_UserInfo.UserPoint - this.m_contentChargeInfo.InfoPoint).ToString());
            if (HttpContext.Current.Request.RawUrl.Contains("?"))
            {
                this.m_errMsg_UsePoint = this.m_errMsg_UsePoint.Replace("{$url}", HttpContext.Current.Request.RawUrl + "&Pay=yes");
            }
            else
            {
                this.m_errMsg_UsePoint = this.m_errMsg_UsePoint.Replace("{$url}", HttpContext.Current.Request.RawUrl + "?Pay=yes");
            }
            this.m_errMsg_UsePoint = this.m_errMsg_UsePoint.Replace("{$InstallDir}", SiteConfig.SiteInfo.VirtualPath);
            this.m_errMsg_UsePoint = this.m_errMsg_UsePoint.Replace("{$PointName}", SiteConfig.UserConfig.PointName);
            this.m_errMsg_UsePoint = this.m_errMsg_UsePoint.Replace("{$PointUnit}", SiteConfig.UserConfig.PointUnit);
        }