public static string GetLoadingAreasParameters(EAreaLoadingType loadingType, NameValueCollection additional) { return(TranslateUtils.NameValueCollectionToString(new NameValueCollection { { "loadingType", EAreaLoadingTypeUtils.GetValue(loadingType) }, { "additional", TranslateUtils.EncryptStringBySecretKey(TranslateUtils.NameValueCollectionToString(additional)) } })); }
public static string GetSiteTemplateUnZipParameters(string fileName, string userKeyPrefix) { return(TranslateUtils.NameValueCollectionToString(new NameValueCollection { { "fileName", fileName }, { "userKeyPrefix", userKeyPrefix } })); }
public static string GetPluginDownloadParameters(string downloadUrl, string userKeyPrefix) { return(TranslateUtils.NameValueCollectionToString(new NameValueCollection { { "downloadUrl", TranslateUtils.EncryptStringBySecretKey(downloadUrl) }, { "userKeyPrefix", userKeyPrefix } })); }
public override string ToString() { if (_extendedAttributes != null && _extendedAttributes.Count > 0) { return(TranslateUtils.NameValueCollectionToString(_extendedAttributes)); } return(string.Empty); }
public static string GetGatherFileParameters(int publishmentSystemId, string gatherRuleNameCollection, string userKeyPrefix) { return(TranslateUtils.NameValueCollectionToString(new NameValueCollection { { "publishmentSystemID", publishmentSystemId.ToString() }, { "gatherRuleNameCollection", gatherRuleNameCollection }, { "userKeyPrefix", userKeyPrefix }, })); }
public static string GetBackupParameters(int siteId, string backupType, string userKeyPrefix) { return(TranslateUtils.NameValueCollectionToString(new NameValueCollection { { "siteID", siteId.ToString() }, { "backupType", backupType }, { "userKeyPrefix", userKeyPrefix } })); }
public static string GetGetLoadingChannelsParameters(int siteId, ELoadingType loadingType, NameValueCollection additional) { return(TranslateUtils.NameValueCollectionToString(new NameValueCollection { { "siteID", siteId.ToString() }, { "loadingType", ELoadingTypeUtils.GetValue(loadingType) }, { "additional", TranslateUtils.EncryptStringBySecretKey(TranslateUtils.NameValueCollectionToString(additional)) } })); }
public void SaveTableNameCache(NameValueCollection nameValueCollection) { if (nameValueCollection != null && nameValueCollection.Count > 0) { var cacheKey = GetTableNameNameValueCollectionDbCacheKey(); var cacheValue = TranslateUtils.NameValueCollectionToString(nameValueCollection); CacheDbUtils.RemoveAndInsert(cacheKey, cacheValue); } }
public static string GetSiteTemplateDownloadParameters(string downloadUrl, string directoryName, string userKeyPrefix) { return(TranslateUtils.NameValueCollectionToString(new NameValueCollection { { "downloadUrl", TranslateUtils.EncryptStringBySecretKey(downloadUrl) }, { "directoryName", directoryName }, { "userKeyPrefix", userKeyPrefix }, })); }
public static string GetLoadingGovPublicCategoriesParameters(int publishmentSystemId, string classCode, EGovPublicCategoryLoadingType loadingType, NameValueCollection additional) { return(TranslateUtils.NameValueCollectionToString(new NameValueCollection { { "publishmentSystemID", publishmentSystemId.ToString() }, { "classCode", classCode }, { "loadingType", EGovPublicCategoryLoadingTypeUtils.GetValue(loadingType) }, { "additional", TranslateUtils.EncryptStringBySecretKey(TranslateUtils.NameValueCollectionToString(additional)) } })); }
//将数据保存至数据库前执行 public void BeforeExecuteNonQuery() { var attributes = new NameValueCollection(Attributes); foreach (var attributeName in GetDefaultAttributesNames()) { attributes.Remove(attributeName.ToLower()); } SettingsXml = TranslateUtils.NameValueCollectionToString(attributes); }
public static string GetCreateSiteParameters(int siteId, bool isImportContents, bool isImportTableStyles, string siteTemplateDir, string onlineTemplateName, string userKeyPrefix) { return(TranslateUtils.NameValueCollectionToString(new NameValueCollection { { "siteId", siteId.ToString() }, { "isImportContents", isImportContents.ToString() }, { "isImportTableStyles", isImportTableStyles.ToString() }, { "siteTemplateDir", siteTemplateDir }, { "onlineTemplateName", onlineTemplateName }, { "userKeyPrefix", userKeyPrefix } })); }
public int Insert(TableMatchInfo tableMatchInfo) { const string sqlString = "INSERT INTO siteserver_TableMatch (ConnectionString, TableName, ConnectionStringToMatch, TableNameToMatch, ColumnsMap) VALUES (@ConnectionString, @TableName, @ConnectionStringToMatch, @TableNameToMatch, @ColumnsMap)"; var insertParms = new IDataParameter[] { GetParameter(ParmConnectionString, DataType.VarChar, 200, tableMatchInfo.ConnectionString), GetParameter(ParmTableName, DataType.VarChar, 200, tableMatchInfo.TableName), GetParameter(ParmConnectionStringToMatch, DataType.VarChar, 200, tableMatchInfo.ConnectionStringToMatch), GetParameter(ParmTableNameToMatch, DataType.VarChar, 200, tableMatchInfo.TableNameToMatch), GetParameter(ParmColumnsMap, DataType.Text, TranslateUtils.NameValueCollectionToString(tableMatchInfo.ColumnsMap)) }; return(ExecuteNonQueryAndReturnId(TableName, nameof(TableMatchInfo.Id), sqlString, insertParms)); }
public static string GetCreatePublishmentSystemParameters(int publishmentSystemId, bool isUseSiteTemplate, bool isImportContents, bool isImportTableStyles, string siteTemplateDir, bool isUseTables, string userKeyPrefix, bool isTop, string returnUrl) { return(TranslateUtils.NameValueCollectionToString(new NameValueCollection { { "publishmentSystemID", publishmentSystemId.ToString() }, { "isUseSiteTemplate", isUseSiteTemplate.ToString() }, { "isImportContents", isImportContents.ToString() }, { "isImportTableStyles", isImportTableStyles.ToString() }, { "siteTemplateDir", siteTemplateDir }, { "isUseTables", isUseTables.ToString() }, { "userKeyPrefix", userKeyPrefix }, { "isTop", isTop.ToString() }, { "returnUrl", StringUtils.ValueToUrl(returnUrl) } })); }
public static string GetRecoveryParameters(int siteId, bool isDeleteChannels, bool isDeleteTemplates, bool isDeleteFiles, bool isZip, string path, bool isOverride, bool isUseTable, string userKeyPrefix) { return(TranslateUtils.NameValueCollectionToString(new NameValueCollection { { "siteID", siteId.ToString() }, { "isDeleteChannels", isDeleteChannels.ToString() }, { "isDeleteTemplates", isDeleteTemplates.ToString() }, { "isDeleteFiles", isDeleteFiles.ToString() }, { "isZip", isZip.ToString() }, { "path", path }, { "isOverride", isOverride.ToString() }, { "isUseTable", isUseTable.ToString() }, { "userKeyPrefix", userKeyPrefix } })); }
public void Update(TableMatchInfo tableMatchInfo) { var updateParms = new IDataParameter[] { GetParameter(ParmConnectionString, DataType.VarChar, 200, tableMatchInfo.ConnectionString), GetParameter(ParmTableName, DataType.VarChar, 200, tableMatchInfo.TableName), GetParameter(ParmConnectionStringToMatch, DataType.VarChar, 200, tableMatchInfo.ConnectionStringToMatch), GetParameter(ParmTableNameToMatch, DataType.VarChar, 200, tableMatchInfo.TableNameToMatch), GetParameter(ParmColumnsMap, DataType.Text, TranslateUtils.NameValueCollectionToString(tableMatchInfo.ColumnsMap)), GetParameter(ParmId, DataType.Integer, tableMatchInfo.Id) }; using (var conn = GetConnection()) { conn.Open(); ExecuteNonQuery(conn, SqlUpdateTableMatch, updateParms); } }
public int Insert(TableMatchInfo tableMatchInfo) { int tableMatchId; var sqlString = "INSERT INTO bairong_TableMatch (ConnectionString, TableName, ConnectionStringToMatch, TableNameToMatch, ColumnsMap) VALUES (@ConnectionString, @TableName, @ConnectionStringToMatch, @TableNameToMatch, @ColumnsMap)"; var insertParms = new IDataParameter[] { GetParameter(ParmConnectionString, EDataType.VarChar, 200, tableMatchInfo.ConnectionString), GetParameter(ParmTableName, EDataType.VarChar, 200, tableMatchInfo.TableName), GetParameter(ParmConnectionStringToMatch, EDataType.VarChar, 200, tableMatchInfo.ConnectionStringToMatch), GetParameter(ParmTableNameToMatch, EDataType.VarChar, 200, tableMatchInfo.TableNameToMatch), GetParameter(ParmColumnsMap, EDataType.NText, TranslateUtils.NameValueCollectionToString(tableMatchInfo.ColumnsMap)) }; using (var conn = GetConnection()) { conn.Open(); using (var trans = conn.BeginTransaction()) { try { tableMatchId = ExecuteNonQueryAndReturnId(trans, sqlString, insertParms); trans.Commit(); } catch { trans.Rollback(); throw; } } } return(tableMatchId); }
public bool Validate_InsertGatherRule(out string errorMessage) { try { var isNeedAdd = false; if (_isEdit) { if (_theGatherRuleName != GatherRuleName.Text) { isNeedAdd = true; DataProvider.GatherDatabaseRuleDao.Delete(_theGatherRuleName, PublishmentSystemId); } else { var gatherFileRuleInfo = DataProvider.GatherFileRuleDao.GetGatherFileRuleInfo(_theGatherRuleName, PublishmentSystemId); gatherFileRuleInfo.GatherUrl = GatherUrl.Text; gatherFileRuleInfo.Charset = ECharsetUtils.GetEnumType(Charset.SelectedValue); gatherFileRuleInfo.IsToFile = TranslateUtils.ToBool(IsToFile.SelectedValue); gatherFileRuleInfo.FilePath = FilePath.Text; gatherFileRuleInfo.IsSaveRelatedFiles = TranslateUtils.ToBool(IsSaveRelatedFiles.SelectedValue); gatherFileRuleInfo.IsRemoveScripts = TranslateUtils.ToBool(IsRemoveScripts.SelectedValue); gatherFileRuleInfo.StyleDirectoryPath = StyleDirectoryPath.Text; gatherFileRuleInfo.ScriptDirectoryPath = ScriptDirectoryPath.Text; gatherFileRuleInfo.ImageDirectoryPath = ImageDirectoryPath.Text; if (NodeIDDropDownList.SelectedValue != null) { gatherFileRuleInfo.NodeId = int.Parse(NodeIDDropDownList.SelectedValue); } gatherFileRuleInfo.IsSaveImage = TranslateUtils.ToBool(IsSaveImage.SelectedValue); gatherFileRuleInfo.IsChecked = TranslateUtils.ToBool(IsChecked.SelectedValue); gatherFileRuleInfo.IsAutoCreate = TranslateUtils.ToBool(IsAutoCreate.SelectedValue); gatherFileRuleInfo.ContentExclude = ContentExclude.Text; var htmlClearArrayList = new ArrayList(); foreach (ListItem item in ContentHtmlClearCollection.Items) { if (item.Selected) { htmlClearArrayList.Add(item.Value); } } gatherFileRuleInfo.ContentHtmlClearCollection = TranslateUtils.ObjectCollectionToString(htmlClearArrayList); var htmlClearTagArrayList = new ArrayList(); foreach (ListItem item in ContentHtmlClearTagCollection.Items) { if (item.Selected) { htmlClearTagArrayList.Add(item.Value); } } gatherFileRuleInfo.ContentHtmlClearTagCollection = TranslateUtils.ObjectCollectionToString(htmlClearTagArrayList); gatherFileRuleInfo.ContentTitleStart = ContentTitleStart.Text; gatherFileRuleInfo.ContentTitleEnd = ContentTitleEnd.Text; gatherFileRuleInfo.ContentContentStart = ContentContentStart.Text; gatherFileRuleInfo.ContentContentEnd = ContentContentEnd.Text; var valueArrayList = ControlUtils.GetSelectedListControlValueArrayList(ContentAttributes); gatherFileRuleInfo.ContentAttributes = TranslateUtils.ObjectCollectionToString(valueArrayList); var attributesXML = new NameValueCollection(); for (var i = 0; i < valueArrayList.Count; i++) { var attributeName = valueArrayList[i] as string; foreach (RepeaterItem item in ContentAttributesRepeater.Items) { if (item.ItemIndex == i) { var contentStart = (TextBox)item.FindControl("ContentStart"); var contentEnd = (TextBox)item.FindControl("ContentEnd"); attributesXML[attributeName + "_ContentStart"] = StringUtils.ValueToUrl(contentStart.Text); attributesXML[attributeName + "_ContentEnd"] = StringUtils.ValueToUrl(contentEnd.Text); } } } gatherFileRuleInfo.ContentAttributesXml = TranslateUtils.NameValueCollectionToString(attributesXML); DataProvider.GatherFileRuleDao.Update(gatherFileRuleInfo); } } else { isNeedAdd = true; } if (isNeedAdd) { var gatherFileRuleInfo = new GatherFileRuleInfo(); gatherFileRuleInfo.GatherRuleName = GatherRuleName.Text; gatherFileRuleInfo.PublishmentSystemId = PublishmentSystemId; if (NodeIDDropDownList.SelectedValue != null) { gatherFileRuleInfo.NodeId = int.Parse(NodeIDDropDownList.SelectedValue); } gatherFileRuleInfo.GatherUrl = GatherUrl.Text; gatherFileRuleInfo.Charset = ECharsetUtils.GetEnumType(Charset.SelectedValue); gatherFileRuleInfo.IsToFile = TranslateUtils.ToBool(IsToFile.SelectedValue); gatherFileRuleInfo.FilePath = FilePath.Text; gatherFileRuleInfo.IsSaveRelatedFiles = TranslateUtils.ToBool(IsSaveRelatedFiles.SelectedValue); gatherFileRuleInfo.IsRemoveScripts = TranslateUtils.ToBool(IsRemoveScripts.SelectedValue); gatherFileRuleInfo.StyleDirectoryPath = StyleDirectoryPath.Text; gatherFileRuleInfo.ScriptDirectoryPath = ScriptDirectoryPath.Text; gatherFileRuleInfo.ImageDirectoryPath = ImageDirectoryPath.Text; if (NodeIDDropDownList.SelectedValue != null) { gatherFileRuleInfo.NodeId = int.Parse(NodeIDDropDownList.SelectedValue); } gatherFileRuleInfo.IsSaveImage = TranslateUtils.ToBool(IsSaveImage.SelectedValue); gatherFileRuleInfo.IsChecked = TranslateUtils.ToBool(IsChecked.SelectedValue); gatherFileRuleInfo.IsAutoCreate = TranslateUtils.ToBool(IsAutoCreate.SelectedValue); gatherFileRuleInfo.ContentExclude = ContentExclude.Text; var htmlClearArrayList = new ArrayList(); foreach (ListItem item in ContentHtmlClearCollection.Items) { if (item.Selected) { htmlClearArrayList.Add(item.Value); } } gatherFileRuleInfo.ContentHtmlClearCollection = TranslateUtils.ObjectCollectionToString(htmlClearArrayList); var htmlClearTagArrayList = new ArrayList(); foreach (ListItem item in ContentHtmlClearTagCollection.Items) { if (item.Selected) { htmlClearTagArrayList.Add(item.Value); } } gatherFileRuleInfo.ContentHtmlClearTagCollection = TranslateUtils.ObjectCollectionToString(htmlClearTagArrayList); gatherFileRuleInfo.LastGatherDate = DateUtils.SqlMinValue; gatherFileRuleInfo.ContentTitleStart = ContentTitleStart.Text; gatherFileRuleInfo.ContentTitleEnd = ContentTitleEnd.Text; gatherFileRuleInfo.ContentContentStart = ContentContentStart.Text; gatherFileRuleInfo.ContentContentEnd = ContentContentEnd.Text; var valueArrayList = ControlUtils.GetSelectedListControlValueArrayList(ContentAttributes); gatherFileRuleInfo.ContentAttributes = TranslateUtils.ObjectCollectionToString(valueArrayList); var attributesXML = new NameValueCollection(); for (var i = 0; i < valueArrayList.Count; i++) { var attributeName = valueArrayList[i] as string; foreach (RepeaterItem item in ContentAttributesRepeater.Items) { if (item.ItemIndex == i) { var contentStart = (TextBox)item.FindControl("ContentStart"); var contentEnd = (TextBox)item.FindControl("ContentEnd"); attributesXML[attributeName + "_ContentStart"] = StringUtils.ValueToUrl(contentStart.Text); attributesXML[attributeName + "_ContentEnd"] = StringUtils.ValueToUrl(contentEnd.Text); } } } gatherFileRuleInfo.ContentAttributesXml = TranslateUtils.NameValueCollectionToString(attributesXML); DataProvider.GatherFileRuleDao.Insert(gatherFileRuleInfo); } if (isNeedAdd) { Body.AddSiteLog(PublishmentSystemId, "添加单文件页采集规则", $"采集规则:{GatherRuleName.Text}"); } else { Body.AddSiteLog(PublishmentSystemId, "编辑单文件页采集规则", $"采集规则:{GatherRuleName.Text}"); } errorMessage = string.Empty; return(true); } catch { errorMessage = "操作失败!"; return(false); } }
public bool Validate_InsertGatherRule(out string errorMessage) { try { var isNeedAdd = false; if (_isEdit) { if (_theGatherRuleName != GatherRuleName.Text) { isNeedAdd = true; DataProvider.GatherRuleDao.Delete(_theGatherRuleName, PublishmentSystemId); } else { var gatherRuleInfo = DataProvider.GatherRuleDao.GetGatherRuleInfo(_theGatherRuleName, PublishmentSystemId); if (NodeIDDropDownList.SelectedValue != null) { gatherRuleInfo.NodeId = int.Parse(NodeIDDropDownList.SelectedValue); } gatherRuleInfo.Charset = ECharsetUtils.GetEnumType(Charset.SelectedValue); gatherRuleInfo.Additional.GatherNum = int.Parse(GatherNum.Text); gatherRuleInfo.Additional.IsSaveImage = TranslateUtils.ToBool(IsSaveImage.SelectedValue); gatherRuleInfo.Additional.IsSetFirstImageAsImageUrl = TranslateUtils.ToBool(IsSetFirstImageAsImageUrl.SelectedValue); gatherRuleInfo.Additional.IsEmptyContentAllowed = TranslateUtils.ToBool(IsEmptyContentAllowed.SelectedValue); gatherRuleInfo.Additional.IsSameTitleAllowed = TranslateUtils.ToBool(IsSameTitleAllowed.SelectedValue); gatherRuleInfo.Additional.IsChecked = TranslateUtils.ToBool(IsChecked.SelectedValue); gatherRuleInfo.Additional.IsAutoCreate = TranslateUtils.ToBool(IsAutoCreate.SelectedValue); gatherRuleInfo.Additional.IsOrderByDesc = TranslateUtils.ToBool(IsOrderByDesc.SelectedValue); gatherRuleInfo.GatherUrlIsCollection = GatherUrlIsCollection.Checked; gatherRuleInfo.GatherUrlCollection = GatherUrlCollection.Text; gatherRuleInfo.GatherUrlIsSerialize = GatherUrlIsSerialize.Checked; gatherRuleInfo.GatherUrlSerialize = GatherUrlSerialize.Text; gatherRuleInfo.SerializeFrom = TranslateUtils.ToInt(SerializeFrom.Text); gatherRuleInfo.SerializeTo = TranslateUtils.ToInt(SerializeTo.Text); gatherRuleInfo.SerializeInterval = TranslateUtils.ToInt(SerializeInterval.Text); gatherRuleInfo.SerializeIsOrderByDesc = SerializeIsOrderByDesc.Checked; gatherRuleInfo.SerializeIsAddZero = SerializeIsAddZero.Checked; gatherRuleInfo.UrlInclude = UrlInclude.Text; gatherRuleInfo.TitleInclude = TitleInclude.Text; gatherRuleInfo.ContentExclude = ContentExclude.Text; var htmlClearArrayList = new ArrayList(); foreach (ListItem item in ContentHtmlClearCollection.Items) { if (item.Selected) { htmlClearArrayList.Add(item.Value); } } gatherRuleInfo.ContentHtmlClearCollection = TranslateUtils.ObjectCollectionToString(htmlClearArrayList); var htmlClearTagArrayList = new ArrayList(); foreach (ListItem item in ContentHtmlClearTagCollection.Items) { if (item.Selected) { htmlClearTagArrayList.Add(item.Value); } } gatherRuleInfo.ContentHtmlClearTagCollection = TranslateUtils.ObjectCollectionToString(htmlClearTagArrayList); gatherRuleInfo.ListAreaStart = ListAreaStart.Text; gatherRuleInfo.ListAreaEnd = ListAreaEnd.Text; gatherRuleInfo.CookieString = CookieString.Text; gatherRuleInfo.ContentTitleStart = ContentTitleStart.Text; gatherRuleInfo.ContentTitleEnd = ContentTitleEnd.Text; gatherRuleInfo.ContentContentStart = ContentContentStart.Text; gatherRuleInfo.ContentContentEnd = ContentContentEnd.Text; gatherRuleInfo.Additional.ContentContentStart2 = ContentContentStart2.Text; gatherRuleInfo.Additional.ContentContentEnd2 = ContentContentEnd2.Text; gatherRuleInfo.Additional.ContentContentStart3 = ContentContentStart3.Text; gatherRuleInfo.Additional.ContentContentEnd3 = ContentContentEnd3.Text; gatherRuleInfo.Additional.ContentReplaceFrom = ContentReplaceFrom.Text; gatherRuleInfo.Additional.ContentReplaceTo = ContentReplaceTo.Text; gatherRuleInfo.ContentChannelStart = ContentChannelStart.Text; gatherRuleInfo.ContentChannelEnd = ContentChannelEnd.Text; gatherRuleInfo.ContentNextPageStart = ContentNextPageStart.Text; gatherRuleInfo.ContentNextPageEnd = ContentNextPageEnd.Text; var valueArrayList = ControlUtils.GetSelectedListControlValueArrayList(ContentAttributes); gatherRuleInfo.ContentAttributes = TranslateUtils.ObjectCollectionToString(valueArrayList); var attributesXML = new NameValueCollection(); for (var i = 0; i < valueArrayList.Count; i++) { var attributeName = valueArrayList[i] as string; foreach (RepeaterItem item in ContentAttributesRepeater.Items) { if (item.ItemIndex == i) { var contentStart = (TextBox)item.FindControl("ContentStart"); var contentEnd = (TextBox)item.FindControl("ContentEnd"); //采集为空时的默认值 var contentDefault = (TextBox)item.FindControl("ContentDefault"); attributesXML[attributeName + "_ContentStart"] = StringUtils.ValueToUrl(contentStart.Text); attributesXML[attributeName + "_ContentEnd"] = StringUtils.ValueToUrl(contentEnd.Text); //采集为空时的默认值 attributesXML[attributeName + "_ContentDefault"] = StringUtils.ValueToUrl(contentDefault.Text); } } } gatherRuleInfo.ContentAttributesXml = TranslateUtils.NameValueCollectionToString(attributesXML); DataProvider.GatherRuleDao.Update(gatherRuleInfo); } } else { isNeedAdd = true; } if (isNeedAdd) { var gatherRuleInfo = new GatherRuleInfo(); gatherRuleInfo.GatherRuleName = GatherRuleName.Text; gatherRuleInfo.PublishmentSystemId = PublishmentSystemId; if (NodeIDDropDownList.SelectedValue != null) { gatherRuleInfo.NodeId = int.Parse(NodeIDDropDownList.SelectedValue); } gatherRuleInfo.Charset = ECharsetUtils.GetEnumType(Charset.SelectedValue); gatherRuleInfo.Additional.GatherNum = int.Parse(GatherNum.Text); gatherRuleInfo.Additional.IsSaveImage = TranslateUtils.ToBool(IsSaveImage.SelectedValue); gatherRuleInfo.Additional.IsSetFirstImageAsImageUrl = TranslateUtils.ToBool(IsSetFirstImageAsImageUrl.SelectedValue); gatherRuleInfo.Additional.IsEmptyContentAllowed = TranslateUtils.ToBool(IsEmptyContentAllowed.SelectedValue); gatherRuleInfo.Additional.IsSameTitleAllowed = TranslateUtils.ToBool(IsSameTitleAllowed.SelectedValue); gatherRuleInfo.Additional.IsChecked = TranslateUtils.ToBool(IsChecked.SelectedValue); gatherRuleInfo.Additional.IsAutoCreate = TranslateUtils.ToBool(IsAutoCreate.SelectedValue); gatherRuleInfo.Additional.IsOrderByDesc = TranslateUtils.ToBool(IsOrderByDesc.SelectedValue); gatherRuleInfo.GatherUrlIsCollection = GatherUrlIsCollection.Checked; gatherRuleInfo.GatherUrlCollection = GatherUrlCollection.Text; gatherRuleInfo.GatherUrlIsSerialize = GatherUrlIsSerialize.Checked; gatherRuleInfo.GatherUrlSerialize = GatherUrlSerialize.Text; gatherRuleInfo.SerializeFrom = TranslateUtils.ToInt(SerializeFrom.Text); gatherRuleInfo.SerializeTo = TranslateUtils.ToInt(SerializeTo.Text); gatherRuleInfo.SerializeInterval = TranslateUtils.ToInt(SerializeInterval.Text); gatherRuleInfo.SerializeIsOrderByDesc = SerializeIsOrderByDesc.Checked; gatherRuleInfo.SerializeIsAddZero = SerializeIsAddZero.Checked; gatherRuleInfo.UrlInclude = UrlInclude.Text; gatherRuleInfo.TitleInclude = TitleInclude.Text; gatherRuleInfo.ContentExclude = ContentExclude.Text; var htmlClearArrayList = new ArrayList(); foreach (ListItem item in ContentHtmlClearCollection.Items) { if (item.Selected) { htmlClearArrayList.Add(item.Value); } } gatherRuleInfo.ContentHtmlClearCollection = TranslateUtils.ObjectCollectionToString(htmlClearArrayList); var htmlClearTagArrayList = new ArrayList(); foreach (ListItem item in ContentHtmlClearTagCollection.Items) { if (item.Selected) { htmlClearTagArrayList.Add(item.Value); } } gatherRuleInfo.ContentHtmlClearTagCollection = TranslateUtils.ObjectCollectionToString(htmlClearTagArrayList); gatherRuleInfo.ListAreaStart = ListAreaStart.Text; gatherRuleInfo.ListAreaEnd = ListAreaEnd.Text; gatherRuleInfo.CookieString = CookieString.Text; gatherRuleInfo.ContentTitleStart = ContentTitleStart.Text; gatherRuleInfo.ContentTitleEnd = ContentTitleEnd.Text; gatherRuleInfo.ContentContentStart = ContentContentStart.Text; gatherRuleInfo.ContentContentEnd = ContentContentEnd.Text; gatherRuleInfo.Additional.ContentContentStart2 = ContentContentStart2.Text; gatherRuleInfo.Additional.ContentContentEnd2 = ContentContentEnd2.Text; gatherRuleInfo.Additional.ContentContentStart3 = ContentContentStart3.Text; gatherRuleInfo.Additional.ContentContentEnd3 = ContentContentEnd3.Text; gatherRuleInfo.Additional.ContentReplaceFrom = ContentReplaceFrom.Text; gatherRuleInfo.Additional.ContentReplaceTo = ContentReplaceTo.Text; gatherRuleInfo.ContentChannelStart = ContentChannelStart.Text; gatherRuleInfo.ContentChannelEnd = ContentChannelEnd.Text; gatherRuleInfo.ContentNextPageStart = ContentNextPageStart.Text; gatherRuleInfo.ContentNextPageEnd = ContentNextPageEnd.Text; gatherRuleInfo.LastGatherDate = DateUtils.SqlMinValue; var valueArrayList = ControlUtils.GetSelectedListControlValueArrayList(ContentAttributes); gatherRuleInfo.ContentAttributes = TranslateUtils.ObjectCollectionToString(valueArrayList); var attributesXML = new NameValueCollection(); for (var i = 0; i < valueArrayList.Count; i++) { var attributeName = valueArrayList[i] as string; foreach (RepeaterItem item in ContentAttributesRepeater.Items) { if (item.ItemIndex == i) { var contentStart = (TextBox)item.FindControl("ContentStart"); var contentEnd = (TextBox)item.FindControl("ContentEnd"); //采集为空时的默认值 var contentDefault = (TextBox)item.FindControl("ContentDefault"); attributesXML[attributeName + "_ContentStart"] = StringUtils.ValueToUrl(contentStart.Text); attributesXML[attributeName + "_ContentEnd"] = StringUtils.ValueToUrl(contentEnd.Text); //采集为空时的默认值 attributesXML[attributeName + "_ContentDefault"] = StringUtils.ValueToUrl(contentDefault.Text); } } } gatherRuleInfo.ContentAttributesXml = TranslateUtils.NameValueCollectionToString(attributesXML); DataProvider.GatherRuleDao.Insert(gatherRuleInfo); } if (isNeedAdd) { Body.AddSiteLog(PublishmentSystemId, "添加Web页面采集规则", $"采集规则:{GatherRuleName.Text}"); } else { Body.AddSiteLog(PublishmentSystemId, "编辑Web页面采集规则", $"采集规则:{GatherRuleName.Text}"); } errorMessage = string.Empty; return(true); } catch { errorMessage = "操作失败!"; return(false); } }
public static DataSet GetStlDataSourceChecked(List <int> channelIdList, string tableName, int startNum, int totalNum, string orderByString, string whereString, LowerNameValueCollection others) { var cacheKey = StlCacheUtils.GetCacheKey(nameof(Content), nameof(GetStlDataSourceChecked), TranslateUtils.ObjectCollectionToString(channelIdList), tableName, startNum.ToString(), totalNum.ToString(), orderByString, whereString, TranslateUtils.NameValueCollectionToString(others)); var retval = StlCacheUtils.GetCache <DataSet>(cacheKey); if (retval != null) { return(retval); } lock (LockObject) { retval = StlCacheUtils.GetCache <DataSet>(cacheKey); if (retval == null) { retval = DataProvider.ContentDao.GetStlDataSourceChecked(channelIdList, tableName, startNum, totalNum, orderByString, whereString, others); StlCacheUtils.SetCache(cacheKey, retval); } } return(retval); }
public static string GetScript(int publishmentSystemID, ECategoryLoadingType loadingType, NameValueCollection additional) { var script = @" <script language=""JavaScript""> function getTreeLevel(e) { var length = 0; if (!isNull(e)){ if (e.tagName == 'TR') { length = parseInt(e.getAttribute('treeItemLevel')); } } return length; } function getTrElement(element){ if (isNull(element)) return; for (element = element.parentNode;;){ if (element != null && element.tagName == 'TR'){ break; }else{ element = element.parentNode; } } return element; } function getImgClickableElementByTr(element){ if (isNull(element) || element.tagName != 'TR') return; var img = null; if (!isNull(element.childNodes)){ var imgCol = element.getElementsByTagName('IMG'); if (!isNull(imgCol)){ for (x=0;x<imgCol.length;x++){ if (!isNull(imgCol.item(x).getAttribute('isOpen'))){ img = imgCol.item(x); break; } } } } return img; } var weightedLink = null; function fontWeightLink(element){ if (weightedLink != null) { weightedLink.style.fontWeight = 'normal'; } element.style.fontWeight = 'bold'; weightedLink = element; } var completedNodeID = null; function displayChildren(img){ if (isNull(img)) return; var tr = getTrElement(img); var isToOpen = img.getAttribute('isOpen') == 'false'; var isByAjax = img.getAttribute('isAjax') == 'true'; var nodeID = img.getAttribute('id'); if (!isNull(img) && img.getAttribute('isOpen') != null){ if (img.getAttribute('isOpen') == 'false'){ img.setAttribute('isOpen', 'true'); img.setAttribute('src', '{iconMinusUrl}'); }else{ img.setAttribute('isOpen', 'false'); img.setAttribute('src', '{iconPlusUrl}'); } } if (isToOpen && isByAjax) { var div = document.createElement('div'); div.innerHTML = ""<img align='absmiddle' border='0' src='{iconLoadingUrl}' /> 栏目加载中,请稍候...""; img.parentNode.appendChild(div); $(div).addClass('loading'); loadingChannels(tr, img, div, nodeID); } else { var level = getTreeLevel(tr); var collection = new Array(); var index = 0; for ( var e = tr.nextSibling; !isNull(e) ; e = e.nextSibling) { if (!isNull(e) && !isNull(e.tagName) && e.tagName == 'TR'){ var currentLevel = getTreeLevel(e); if (currentLevel <= level) break; if(e.style.display == '') { e.style.display = 'none'; }else{ if (currentLevel != level + 1) continue; e.style.display = ''; var imgClickable = getImgClickableElementByTr(e); if (!isNull(imgClickable)){ if (!isNull(imgClickable.getAttribute('isOpen')) && imgClickable.getAttribute('isOpen') =='true'){ imgClickable.setAttribute('isOpen', 'false'); imgClickable.setAttribute('src', '{iconPlusUrl}'); collection[index] = imgClickable; index++; } } } } } if (index > 0){ for (i=0;i<=index;i++){ displayChildren(collection[i]); } } } } "; //BackgroundService.GetRedirectUrl(publishmentSystemID, BackgroundService.TYPE_GetLoadingCategorys) script += $@" function loadingChannels(tr, img, div, nodeID){{ var url = '{string.Empty}'; var pars = 'parentID=' + nodeID + '&loadingType={ECategoryLoadingTypeUtils.GetValue(loadingType)}&additional={TranslateUtils.EncryptStringBySecretKey(TranslateUtils.NameValueCollectionToString(additional))}'; jQuery.post(url, pars, function(data, textStatus) {{ $($.parseHTML(data)).insertAfter($(tr)); img.setAttribute('isAjax', 'false'); img.parentNode.removeChild(div); }}); completedNodeID = nodeID; }} function loadingChannelsOnLoad(paths){{ if (paths && paths.length > 0){{ var nodeIDs = paths.split(','); var nodeID = nodeIDs[0]; var img = $('#' + nodeID); if (img.attr('isOpen') == 'false'){{ displayChildren(img[0]); // if (completedNodeID && completedNodeID == nodeID){{ // if (paths.indexOf(',') != -1){{ // setTimeout(""loadingChannelsOnLoad("" + paths + "")"", 3000); // }} // }} }} }} }} </script> "; var item = new CategoryTreeItem(); script = script.Replace("{iconEmptyUrl}", item.iconEmptyUrl); script = script.Replace("{iconFolderUrl}", item.iconFolderUrl); script = script.Replace("{iconMinusUrl}", item.iconMinusUrl); script = script.Replace("{iconPlusUrl}", item.iconPlusUrl); script = script.Replace("{iconLoadingUrl}", SiteServerAssets.GetIconUrl("loading.gif")); script = script.Replace("loadingChannels", "loadingChannels_Category"); script = script.Replace("displayChildren", "displayChildren_Category"); return(script); }
public override string ToString() { return(TranslateUtils.NameValueCollectionToString(Attributes)); }
private static void SaveColumnsMap(NameValueCollection columnsMap) { DbCacheManager.RemoveAndInsert("SiteServer.BackgroundPages.Cms.BackgroundGatherDatabaseRuleAdd.TableMatchColumnsMap", TranslateUtils.NameValueCollectionToString(columnsMap)); }