⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 contentmanage.cs

📁 动易SiteFactory&#8482 网上商店系统1.0源代码
💻 CS
📖 第 1 页 / 共 3 页
字号:
                Users.Update(usersByUserName);
            }
        }

        public static string RebuildArr(string idArray)
        {
            StringBuilder builder = new StringBuilder();
            string[] strArray = idArray.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries);
            for (int i = 0; i < strArray.Length; i++)
            {
                bool flag = true;
                for (int j = 0; j < i; j++)
                {
                    if (strArray[i] == strArray[j])
                    {
                        flag = false;
                        break;
                    }
                }
                if (flag)
                {
                    builder.Append(strArray[i]);
                    builder.Append(",");
                }
            }
            return builder.ToString().TrimEnd(new char[] { ',' });
        }

        public static bool RecycleAll(string nodeIds)
        {
            if (!DataValidator.IsValidId(nodeIds))
            {
                return false;
            }
            return dal.RecycleAll(nodeIds);
        }

        public static DataTable SavePemotePic(DataTable dtContent, NodeInfo nodeInfo, string content)
        {
            string str = VirtualPathUtility.AppendTrailingSlash(SiteConfig.SiteOption.UploadDir);
            string str2 = dtContent.Rows[0][content].ToString();
            string str3 = dtContent.Rows[0]["DefaultPicUrl"].ToString();
            StringBuilder builder = new StringBuilder();
            builder.Append(dtContent.Rows[0]["UploadFiles"].ToString());
            str2 = PathReplaceLable(str2);
            WebClient client = new WebClient();
            MatchCollection matchs = new Regex(@"((http|https|ftp|rtsp|mms):(\/\/|\\\\){1}([\w\-]+[.]){1,}(net|com|cn|org|cc|tv|[0-9]{1,3})(([^.])+[.]{1}(gif|jpg|jpeg|jpe|bmp|png)))", RegexOptions.IgnoreCase).Matches(str2);
            if (matchs.Count > 0)
            {
                HttpContext.Current.Response.Write("字段" + content + ":总共有 <span style='color:blue'><b>" + matchs.Count.ToString() + " </b></span>张远程图片, 请等待不要刷新!<br/>");
            }
            int num = 0;
            foreach (Match match in matchs)
            {
                num++;
                string path = match.Groups[1].Value;
                try
                {
                    string str5 = DataSecurity.MakeFileRndName();
                    string str6 = Path.GetExtension(path).ToLower();
                    string str7 = PowerEasy.Contents.Nodes.UploadPathParse(nodeInfo, str5 + str6).Replace("//", "/");
                    StringBuilder builder2 = new StringBuilder();
                    builder2.Append(FileSystemObject.CreateFileFolder(str + str7, HttpContext.Current));
                    builder2.Append(str5 + str6);
                    string str8 = str7 + str5 + str6;
                    client.DownloadFile(path, builder2.ToString());
                    str2 = str2.Replace(path, "{PE.SiteConfig.ApplicationPath/}{PE.SiteConfig.uploaddir/}/" + str8);
                    if (builder.Length > 0)
                    {
                        builder.Append("|" + str8);
                    }
                    else
                    {
                        builder.Append(str8);
                    }
                    if (string.IsNullOrEmpty(str3))
                    {
                        str3 = str8;
                    }
                    HttpContext.Current.Response.Write("保存远程图片第 <span style='color:blue'><b>" + num + " </b></span> 张成功。<br/>");
                }
                catch (WebException)
                {
                    HttpContext.Current.Response.Write("获取保存远程图片第 <b>" + num + " </b> 张失败。<br/>");
                }
                client.Dispose();
                HttpContext.Current.Response.Flush();
            }
            str2 = str2.Replace(SiteConfig.SiteOption.UploadDir, "{PE.SiteConfig.uploaddir/}");
            if (SiteConfig.SiteInfo.VirtualPath.CompareTo("/") != 0)
            {
                str2 = str2.Replace(SiteConfig.SiteInfo.VirtualPath, "{PE.SiteConfig.ApplicationPath/}");
            }
            dtContent.Rows[0][content] = str2;
            dtContent.Rows[0]["DefaultPicUrl"] = str3;
            dtContent.Rows[0]["UploadFiles"] = builder.ToString();
            return dtContent;
        }

        private static void SavePresentExp(string generalIds, int status)
        {
            foreach (CommonModelInfo info in dal.GetCommonInfoListByGeneralId(generalIds))
            {
                PresentExp(info, status);
            }
        }

        public static string ToFieldType(string fieldValue, FieldType fieldtype, int type)
        {
            string str = "";
            Dictionary<FieldType, string> dictionary = SiteCache.Get("CK_Content_Dictionary_ConvertFieldType") as Dictionary<FieldType, string>;
            if (dictionary == null)
            {
                dictionary = new Dictionary<FieldType, string>();
                dictionary.Add(FieldType.TextType, "ToHtml");
                dictionary.Add(FieldType.MultipleTextType, "ToHtml");
                dictionary.Add(FieldType.MultipleHtmlTextType, "Original");
                dictionary.Add(FieldType.ListBoxType, "ToHtml");
                dictionary.Add(FieldType.NumberType, "Original");
                dictionary.Add(FieldType.MoneyType, "Original");
                dictionary.Add(FieldType.DateTimeType, "Original");
                dictionary.Add(FieldType.LookType, "ToHtml");
                dictionary.Add(FieldType.LinkType, "ToHtml");
                dictionary.Add(FieldType.BoolType, "ConvertBool");
                dictionary.Add(FieldType.CountType, "ToHtml");
                dictionary.Add(FieldType.PictureType, "ToHtml");
                dictionary.Add(FieldType.FileType, "ToHtml");
                dictionary.Add(FieldType.MultiplePhotoType, "ToHtml");
                dictionary.Add(FieldType.ColorType, "ToHtml");
                dictionary.Add(FieldType.NodeType, "Original");
                dictionary.Add(FieldType.TemplateType, "Original");
                dictionary.Add(FieldType.InfoType, "Original");
                dictionary.Add(FieldType.SpecialType, "Original");
                dictionary.Add(FieldType.AuthorType, "ToHtml");
                dictionary.Add(FieldType.SourceType, "ToHtml");
                dictionary.Add(FieldType.KeywordType, "ToHtml");
                dictionary.Add(FieldType.OperatingType, "ToHtml");
                dictionary.Add(FieldType.SkinType, "Original");
                dictionary.Add(FieldType.StatusType, "Original");
                dictionary.Add(FieldType.Producer, "ToHtml");
                dictionary.Add(FieldType.Trademark, "ToHtml");
                dictionary.Add(FieldType.ContentType, "Original");
                dictionary.Add(FieldType.TitleType, "ToHtml");
                dictionary.Add(FieldType.DownServerType, "ToHtml");
                SiteCache.Insert("CK_Content_Dictionary_ConvertFieldType", dictionary);
            }
            string str2 = dictionary[fieldtype];
            if (str2 == null)
            {
                return str;
            }
            if (!(str2 == "ToHtml"))
            {
                if (str2 != "ConvertBool")
                {
                    if (str2 != "Original")
                    {
                        return str;
                    }
                    return fieldValue;
                }
            }
            else
            {
                return ToHtml(fieldValue, type);
            }
            if (string.Compare(fieldValue, "true", true) == 0)
            {
                return "1";
            }
            return "0";
        }

        private static string ToHtml(string fieldValue, int type)
        {
            if (type == 0)
            {
                return DataSecurity.HtmlEncode(fieldValue);
            }
            return DataSecurity.HtmlDecode(fieldValue);
        }

        public static bool Update(int generalId, DataTable contentData)
        {
            return dal.Update(generalId, FieldValueHtmlEncode(contentData));
        }

        public static int UpdateBrowseTimes(int generalId)
        {
            return dal.UpdateBrowseTimes(generalId);
        }

        public static bool UpdateByUser(int generalId, DataTable contentData)
        {
            string userName = PEContext.Current.User.UserName;
            return dal.UpdateByUser(generalId, FieldValueHtmlEncode(contentData), userName);
        }

        public static bool UpdateCommentAuditedAndUnaudited(int generalId)
        {
            return dal.UpdateCommentAuditedAndUnaudited(generalId);
        }

        public static bool UpdateCreateTime(int generalId, DateTime? createTime)
        {
            return dal.UpdateCreateTime(generalId, createTime);
        }

        public static void UpdateDataSet(DataSet ds, int modeId)
        {
            IList<FieldInfo> fieldListByModelId = ModelManager.GetFieldListByModelId(modeId);
            DataTable contentData = new DataTable();
            contentData.Columns.Add("FieldName");
            contentData.Columns.Add("FieldValue");
            contentData.Columns.Add("FieldType");
            contentData.Columns.Add("FieldLevel");
            foreach (DataRow row2 in ds.Tables[0].Rows)
            {
                int generalId = DataConverter.CLng(row2["GeneralID"]);
                foreach (DataColumn column in ds.Tables[0].Columns)
                {
                    if ((((((string.Compare(column.ColumnName, "GeneralID", true) == 0) || (string.Compare(column.ColumnName, "ModelId", true) == 0)) || ((string.Compare(column.ColumnName, "ItemId", true) == 0) || (string.Compare(column.ColumnName, "TableName", true) == 0))) || (((string.Compare(column.ColumnName, "Inputer", true) == 0) || (string.Compare(column.ColumnName, "LinkType", true) == 0)) || ((string.Compare(column.ColumnName, "CreateTime", true) == 0) || (string.Compare(column.ColumnName, "CommentAudited", true) == 0)))) || ((((string.Compare(column.ColumnName, "CommentUnAudited", true) == 0) || (string.Compare(column.ColumnName, "SigninType", true) == 0)) || ((string.Compare(column.ColumnName, "InputTime", true) == 0) || (string.Compare(column.ColumnName, "PassedTime", true) == 0))) || (((string.Compare(column.ColumnName, "Editor", true) == 0) || (string.Compare(column.ColumnName, "LastHitTime", true) == 0)) || ((string.Compare(column.ColumnName, "ID", true) == 0) || (string.Compare(column.ColumnName, "DefaultPicUrl", true) == 0))))) || (string.Compare(column.ColumnName, "UploadFiles", true) == 0))
                    {
                        continue;
                    }
                    DataRow row = contentData.NewRow();
                    row["FieldName"] = column.ColumnName;
                    row["FieldValue"] = row2[column.ColumnName].ToString();
                    FieldInfo fieldInfoByName = GetFieldInfoByName(fieldListByModelId, column.ColumnName);
                    if (fieldInfoByName.IsNull)
                    {
                        throw new CustomException("ID为" + modeId.ToString() + "的模型中没有找到对应的字段" + column.ColumnName + "!");
                    }
                    row["FieldType"] = fieldInfoByName.FieldType;
                    row["FieldLevel"] = fieldInfoByName.FieldLevel;
                    contentData.Rows.Add(row);
                }
                if (generalId > 0)
                {
                    dal.Update(generalId, contentData);
                    contentData.Rows.Clear();
                }
            }
        }

        public static bool UpdateField(int id, string table, string fieldName, DataTable dtContent)
        {
            return dal.UpdateField(id, DataSecurity.FilterBadChar(table), DataSecurity.FilterBadChar(fieldName), dtContent);
        }

        public static bool UpdateHits(int generalId, int hits, int dayhits, int weekhits, int monthhits, DateTime lasthittime)
        {
            return dal.UpdateHits(generalId, hits, dayhits, weekhits, monthhits, lasthittime);
        }

        public static void UpdateNodeId(int nodeId, string sourceNodeIds)
        {
            dal.UpdateNodeId(nodeId, sourceNodeIds);
        }

        public static bool UpdateStatus(int generalId, int status)
        {
            string editor = string.Empty;
            if (status == 0x63)
            {
                editor = PEContext.Current.Admin.AdminName;
            }
            return dal.UpdateStatus(generalId, status, editor);
        }

        public static bool UpdateStatus(string generalIds, int status)
        {
            if (!DataValidator.IsValidId(generalIds))
            {
                return false;
            }
            string editor = string.Empty;
            if (status == 0x63)
            {
                editor = PEContext.Current.Admin.AdminName;
            }
            SavePresentExp(generalIds, status);
            return dal.UpdateStatus(generalIds, status, editor);
        }

        public static bool UpdateStatusByUserName(string generalIds, int status)
        {
            if (!DataValidator.IsValidId(generalIds))
            {
                return false;
            }
            string editor = string.Empty;
            if (status == 0x63)
            {
                editor = PEContext.Current.Admin.AdminName;
            }
            SavePresentExp(generalIds, status);
            return dal.UpdateStatusByUser(generalIds, status, editor, PEContext.Current.User.UserName);
        }
    }
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -