protected virtual void RenderBrowserMode(ComponentController paComponentController) { paComponentController.AddElementType(ComponentController.ElementType.AjaxLoaderPopUp); paComponentController.AddElementAttribute(ComponentController.ElementAttribute.ea_Default, SC_DefaultStatusText); paComponentController.AddAttribute(HtmlAttribute.Class, ctCLSCompositeAjaxLoaderPopUp); paComponentController.RenderBeginTag(HtmlTag.Div); paComponentController.AddAttribute(HtmlAttribute.Class, ctCLSPopUp); paComponentController.RenderBeginTag(HtmlTag.Div); paComponentController.AddAttribute(HtmlAttribute.Class, ctCLSTextDiv); paComponentController.AddElementType(ComponentController.ElementType.AjaxLoaderStatusDisplay); paComponentController.RenderBeginTag(HtmlTag.Div); paComponentController.Write("Testing...."); paComponentController.RenderEndTag(); paComponentController.AddAttribute(HtmlAttribute.Class, ctCLSAjaxImageDiv); paComponentController.RenderBeginTag(HtmlTag.Div); paComponentController.AddAttribute(HtmlAttribute.Class, ctCLSAjaxImage); paComponentController.AddAttribute(HtmlAttribute.Src, AjaxManager.GetInstance().GetAjaxLoaderImageUrl(SC_AjaxLoaderImage)); paComponentController.AddElementAttribute(ComponentController.ElementAttribute.ea_GifDisplayMode, "inline-block"); paComponentController.RenderBeginTag(HtmlTag.Img); paComponentController.RenderEndTag(); paComponentController.RenderEndTag(); paComponentController.RenderEndTag(); paComponentController.RenderEndTag(); }
protected void Page_Load(object sender, EventArgs e) { InitPageData(); AjaxManager.RegisterClass(typeof(__Default), Page); //AjaxPro.Utility.RegisterTypeForAjax(typeof(__Default), Page); Page.ClientScript.RegisterClientScriptInclude("cookieFun", WebPath.GetFullPath("Root.js")); }
public ActionResult PPC_Checkpoint(EnquiryViewModel eViewModel) { ViewBag.Title = "KPCL ERP :: Create, Update"; AjaxManager ajaxMan = new AjaxManager(); try { eViewModel.Enquiry = _enquiryMan.Get_Enquiry_By_Id(eViewModel.Enquiry.Enquiry_Id); eViewModel.Enquiry.Supporting_Details = _enquiryMan.Get_Supporting_Details_By_Enquiry_Id(eViewModel.Enquiry.Enquiry_Id); eViewModel.Enquiry.Temp_Customer_Quality_Details = _enquiryMan.Get_Temp_Customer_Quality_Details_By_Id(eViewModel.Enquiry.Enquiry_Id); eViewModel.Enquiry.Attachments = ajaxMan.Get_Attachments_By_Ref_Type_Ref_Id(Convert.ToInt32(RefType.Enquiry), eViewModel.Enquiry.Enquiry_Id); } catch (Exception ex) { eViewModel.Friendly_Message.Add(MessageStore.Get("SYS01")); Logger.Error("Enquiry Controller - PPC_Checkpoint " + ex.ToString()); } return(View(eViewModel)); }
public JsonResult Get_Vendor_Autocomplete(string vendor_Name) { AjaxManager ajaxMan = new AjaxManager(); List <AutocompleteInfo> autoList = new List <AutocompleteInfo>(); autoList = ajaxMan.Get_Vendor_AutoComplete(vendor_Name); return(Json(autoList, JsonRequestBehavior.AllowGet)); }
public NameValueCollection CreateSiteByOnlineTemplateName(int siteId, bool isImportContents, bool isImportTableStyles, string onlineTemplateName, string onlineTemplateUrl, string userKeyPrefix, string administratorName) { var cacheTotalCountKey = userKeyPrefix + CacheTotalCount; var cacheCurrentCountKey = userKeyPrefix + CacheCurrentCount; var cacheMessageKey = userKeyPrefix + CacheMessage; CacheUtils.Insert(cacheTotalCountKey, "4"); //存储需要的页面总数 CacheUtils.Insert(cacheCurrentCountKey, "0"); //存储当前的页面总数 CacheUtils.Insert(cacheMessageKey, string.Empty); //存储消息 //返回“运行结果”、“错误信息”及“执行JS脚本”的字符串数组 NameValueCollection retval; try { CacheUtils.Insert(cacheCurrentCountKey, "1"); CacheUtils.Insert(cacheMessageKey, "开始下载模板压缩包,可能需要几分钟,请耐心等待..."); var filePath = PathUtility.GetSiteTemplatesPath($"T_{onlineTemplateName}.zip"); FileUtils.DeleteFileIfExists(filePath); //var downloadUrl = OnlineTemplateManager.GetDownloadUrl(onlineTemplateName); var downloadUrl = OnlineTemplateManager.GetDownloadUrlByUrl(onlineTemplateUrl); WebClientUtils.SaveRemoteFileToLocal(downloadUrl, filePath); CacheUtils.Insert(cacheCurrentCountKey, "2"); CacheUtils.Insert(cacheMessageKey, "模板压缩包下载成功,开始解压缩,可能需要几分钟,请耐心等待..."); var siteTemplateDir = $"T_{onlineTemplateName}"; var directoryPath = PathUtility.GetSiteTemplatesPath(siteTemplateDir); DirectoryUtils.DeleteDirectoryIfExists(directoryPath); ZipUtils.ExtractZip(filePath, directoryPath); CacheUtils.Insert(cacheCurrentCountKey, "3"); //存储当前的页面总数 CacheUtils.Insert(cacheMessageKey, "模板压缩包解压成功,正在导入数据..."); //存储消息 SiteTemplateManager.Instance.ImportSiteTemplateToEmptySite(siteId, siteTemplateDir, isImportContents, isImportTableStyles, administratorName); CreateManager.CreateByAll(siteId); CacheUtils.Insert(cacheCurrentCountKey, "4"); //存储当前的页面总数 CacheUtils.Insert(cacheMessageKey, "创建成功!"); //存储消息 var siteInfo = SiteManager.GetSiteInfo(siteId); retval = AjaxManager.GetWaitingTaskNameValueCollection($"站点 <strong>{siteInfo.SiteName}<strong> 创建成功!", string.Empty, $"top.location.href='{PageUtils.GetMainUrl(siteId)}';"); } catch (Exception ex) { retval = AjaxManager.GetWaitingTaskNameValueCollection(string.Empty, ex.Message, string.Empty); LogUtils.AddErrorLog(ex); } CacheUtils.Remove(cacheTotalCountKey); //取消存储需要的页面总数 CacheUtils.Remove(cacheCurrentCountKey); //取消存储当前的页面总数 CacheUtils.Remove(cacheMessageKey); //取消存储消息 CacheUtils.ClearAll(); return(retval); }
public NameValueCollection CreatePublishmentSystem(int publishmentSystemId, bool isUseSiteTemplate, bool isImportContents, bool isImportTableStyles, string siteTemplateDir, bool isUseTables, string userKeyPrefix, string returnUrl, string administratorName) { var cacheTotalCountKey = userKeyPrefix + CacheTotalCount; var cacheCurrentCountKey = userKeyPrefix + CacheCurrentCount; var cacheMessageKey = userKeyPrefix + CacheMessage; CacheUtils.Max(cacheTotalCountKey, "3"); //存储需要的页面总数 CacheUtils.Max(cacheCurrentCountKey, "0"); //存储当前的页面总数 CacheUtils.Max(cacheMessageKey, string.Empty); //存储消息 //返回“运行结果”、“错误信息”及“执行JS脚本”的字符串数组 NameValueCollection retval; try { CacheUtils.Max(cacheCurrentCountKey, "1"); //存储当前的页面总数 CacheUtils.Max(cacheMessageKey, "正在创建站点..."); //存储消息 var publishmentSystemInfo = PublishmentSystemManager.GetPublishmentSystemInfo(publishmentSystemId); CacheUtils.Max(cacheCurrentCountKey, "2"); //存储当前的页面总数 CacheUtils.Max(cacheMessageKey, "正在导入数据..."); //存储消息 if (isUseSiteTemplate && !string.IsNullOrEmpty(siteTemplateDir)) { SiteTemplateManager.Instance.ImportSiteTemplateToEmptyPublishmentSystem(publishmentSystemId, siteTemplateDir, isUseTables, isImportContents, isImportTableStyles, administratorName); } CacheUtils.Max(cacheCurrentCountKey, "3"); //存储当前的页面总数 CacheUtils.Max(cacheMessageKey, "创建成功!"); //存储消息 if (!string.IsNullOrEmpty(returnUrl)) { returnUrl = PageUtils.AddQueryString(StringUtils.ValueFromUrl(returnUrl), "PublishmentSystemID", publishmentSystemId.ToString()); retval = AjaxManager.GetWaitingTaskNameValueCollection( $"站点 <strong>{publishmentSystemInfo.PublishmentSystemName}<strong> 创建成功!", string.Empty, $"location.href='{returnUrl}';"); } else { retval = AjaxManager.GetWaitingTaskNameValueCollection( $"站点 <strong>{publishmentSystemInfo.PublishmentSystemName}<strong> 创建成功!", string.Empty, $"top.location.href='{PageInitialization.GetRedirectUrl()}';"); } } catch (Exception ex) { retval = AjaxManager.GetWaitingTaskNameValueCollection(string.Empty, ex.Message, string.Empty); LogUtils.AddErrorLog(ex); } CacheUtils.Remove(cacheTotalCountKey); //取消存储需要的页面总数 CacheUtils.Remove(cacheCurrentCountKey); //取消存储当前的页面总数 CacheUtils.Remove(cacheMessageKey); //取消存储消息 CacheUtils.Clear(); return(retval); }
public JsonResult Get_Vendor_Autocomplete(string Vendor_Name) { AjaxManager aMan = new AjaxManager(); List <AutocompleteInfo> vendorNames = new List <AutocompleteInfo>(); vendorNames = aMan.Get_Vendor_AutoComplete(Vendor_Name); return(Json(vendorNames, JsonRequestBehavior.AllowGet)); }
public JsonResult GetTestUnit(string testUnitName) { AjaxManager aMan = new AjaxManager(); List <TestUnitInfo> retVal = new List <TestUnitInfo>(); retVal = aMan.GetTestUnit(testUnitName); return(Json(retVal, JsonRequestBehavior.AllowGet)); }
/// <summary> /// When the control loads. /// </summary> /// <param name="e"></param> protected override void OnLoad(EventArgs e) { base.OnLoad(e); AjaxManager.RegisterCssReferences(this, new string[] { "Nequeo.Web.UI.ScriptControl.Style.demo_page.css", "Nequeo.Web.UI.ScriptControl.Style.demo_table.css", "Nequeo.Web.UI.ScriptControl.Style.demo_table_jui.css", "Nequeo.Web.UI.ScriptControl.Style.jquery-ui-smooth.css" }); }
public NameValueCollection GatherFile(int publishmentSystemId, string gatherRuleNameCollection, string userKeyPrefix, string administratorName) { var resultBuilder = new StringBuilder(); var errorBuilder = new StringBuilder(); var gatherRuleNameArrayList = TranslateUtils.StringCollectionToStringList(gatherRuleNameCollection); foreach (string gatherRuleName in gatherRuleNameArrayList) { GatherUtility.GatherFile(publishmentSystemId, gatherRuleName, resultBuilder, errorBuilder, true, userKeyPrefix, administratorName); } return(AjaxManager.GetProgressTaskNameValueCollection(resultBuilder.ToString(), errorBuilder.ToString())); }
public NameValueCollection GetCountArray(string userKeyPrefix)//进度及显示 { var retval = new NameValueCollection(); if (CacheUtils.Get(userKeyPrefix + CacheTotalCount) != null && CacheUtils.Get(userKeyPrefix + CacheCurrentCount) != null && CacheUtils.Get(userKeyPrefix + CacheMessage) != null) { var totalCount = TranslateUtils.ToInt((string)CacheUtils.Get(userKeyPrefix + CacheTotalCount)); var currentCount = TranslateUtils.ToInt((string)CacheUtils.Get(userKeyPrefix + CacheCurrentCount)); var message = (string)CacheUtils.Get(userKeyPrefix + CacheMessage); retval = AjaxManager.GetCountArrayNameValueCollection(totalCount, currentCount, message); } return(retval); }
public NameValueCollection SiteTemplateDownload(string downloadUrl, string directoryName, string userKeyPrefix) { var cacheTotalCountKey = userKeyPrefix + CacheTotalCount; var cacheCurrentCountKey = userKeyPrefix + CacheCurrentCount; var cacheMessageKey = userKeyPrefix + CacheMessage; CacheUtils.Insert(cacheTotalCountKey, "5"); //存储需要的页面总数 CacheUtils.Insert(cacheCurrentCountKey, "0"); //存储当前的页面总数 CacheUtils.Insert(cacheMessageKey, string.Empty); //存储消息 //返回“运行结果”和“错误信息”的字符串数组 NameValueCollection retval; try { CacheUtils.Insert(cacheCurrentCountKey, "1"); CacheUtils.Insert(cacheMessageKey, "开始下载模板压缩包,可能需要几分钟,请耐心等待"); var filePath = PathUtility.GetSiteTemplatesPath(directoryName + ".zip"); FileUtils.DeleteFileIfExists(filePath); WebClientUtils.SaveRemoteFileToLocal(downloadUrl, filePath); CacheUtils.Insert(cacheCurrentCountKey, "4"); CacheUtils.Insert(cacheMessageKey, "模板压缩包下载成功,开始解压缩"); var directoryPath = PathUtility.GetSiteTemplatesPath(directoryName); if (!DirectoryUtils.IsDirectoryExists(directoryPath)) { ZipUtils.UnpackFiles(filePath, directoryPath); } CacheUtils.Insert(cacheCurrentCountKey, "5"); CacheUtils.Insert(cacheMessageKey, string.Empty); retval = AjaxManager.GetProgressTaskNameValueCollection("站点模板下载成功,请到站点模板管理中查看。", string.Empty); } catch (Exception ex) { retval = AjaxManager.GetProgressTaskNameValueCollection(string.Empty, $@"<br />下载失败!<br />{ex.Message}"); } CacheUtils.Remove(cacheTotalCountKey); //取消存储需要的页面总数 CacheUtils.Remove(cacheCurrentCountKey); //取消存储当前的页面总数 CacheUtils.Remove(cacheMessageKey); //取消存储消息 return(retval); }
public JsonResult Get_Attachments_By_Ref_Type_Ref_Id(int ref_Type, int ref_Id) { List <AttachmentsInfo> Attachments = new List <AttachmentsInfo>(); try { AjaxManager aMan = new AjaxManager(); Attachments = aMan.Get_Attachments_By_Ref_Type_Ref_Id(ref_Type, ref_Id); } catch (Exception ex) { Logger.Error("Ajax Controller - Get_Attachments_By_Ref_Type_Ref_Id " + ex.ToString()); } return(Json(new { Attachments }, JsonRequestBehavior.AllowGet)); }
public NameValueCollection Backup(int siteId, string backupType, string userKeyPrefix) { //返回“运行结果”和“错误信息”的字符串数组 NameValueCollection retval; var request = new RequestImpl(Request); try { var eBackupType = EBackupTypeUtils.GetEnumType(backupType); var siteInfo = SiteManager.GetSiteInfo(siteId); var filePath = PathUtility.GetBackupFilePath(siteInfo, eBackupType); DirectoryUtils.CreateDirectoryIfNotExists(filePath); FileUtils.DeleteFileIfExists(filePath); if (eBackupType == EBackupType.Templates) { BackupUtility.BackupTemplates(siteId, filePath, request.AdminName); } else if (eBackupType == EBackupType.ChannelsAndContents) { BackupUtility.BackupChannelsAndContents(siteId, filePath, request.AdminName); } else if (eBackupType == EBackupType.Files) { BackupUtility.BackupFiles(siteId, filePath, request.AdminName); } else if (eBackupType == EBackupType.Site) { BackupUtility.BackupSite(siteId, filePath, request.AdminName); } string resultString = $"任务完成,备份地址:<br /><strong> {filePath} </strong> <a href='{ApiRouteActionsDownload.GetUrl(ApiManager.InnerApiUrl, filePath)}'><img src='{SiteServerAssets.GetIconUrl("download.gif")}' />下载</a>。"; retval = AjaxManager.GetWaitingTaskNameValueCollection(resultString, string.Empty, string.Empty); } catch (Exception ex) { retval = AjaxManager.GetWaitingTaskNameValueCollection(string.Empty, ex.Message, string.Empty); LogUtils.AddErrorLog(ex); } return(retval); }
public NameValueCollection PluginDownload(string downloadUrl, string userKeyPrefix) { var cacheTotalCountKey = userKeyPrefix + CacheTotalCount; var cacheCurrentCountKey = userKeyPrefix + CacheCurrentCount; var cacheMessageKey = userKeyPrefix + CacheMessage; CacheUtils.Insert(cacheTotalCountKey, "5"); //存储需要的页面总数 CacheUtils.Insert(cacheCurrentCountKey, "0"); //存储当前的页面总数 CacheUtils.Insert(cacheMessageKey, string.Empty); //存储消息 //返回“运行结果”和“错误信息”的字符串数组 NameValueCollection retval; try { CacheUtils.Insert(cacheCurrentCountKey, "1"); CacheUtils.Insert(cacheMessageKey, "开始下载插件压缩包,可能需要几分钟,请耐心等待"); var fileName = PageUtils.GetFileNameFromUrl(downloadUrl); var filePath = PathUtils.GetPluginPath(fileName); FileUtils.DeleteFileIfExists(filePath); WebClientUtils.SaveRemoteFileToLocal(downloadUrl, filePath); CacheUtils.Insert(cacheCurrentCountKey, "4"); CacheUtils.Insert(cacheMessageKey, "插件压缩包下载成功,开始安装"); ZipUtils.UnpackFiles(filePath, PathUtils.GetPluginPath(fileName.Substring(0, fileName.IndexOf(".", StringComparison.Ordinal)))); CacheUtils.Insert(cacheCurrentCountKey, "5"); CacheUtils.Insert(cacheMessageKey, string.Empty); retval = AjaxManager.GetProgressTaskNameValueCollection("插件安装成功,请刷新页面查看。", string.Empty); } catch (Exception ex) { retval = AjaxManager.GetProgressTaskNameValueCollection(string.Empty, $@"<br />下载失败!<br />{ex.Message}"); } CacheUtils.Remove(cacheTotalCountKey); //取消存储需要的页面总数 CacheUtils.Remove(cacheCurrentCountKey); //取消存储当前的页面总数 CacheUtils.Remove(cacheMessageKey); //取消存储消息 return(retval); }
public void Page_Load(object sender, EventArgs e) { if (IsForbidden) { return; } PageUtils.CheckRequestParameter("PublishmentSystemID"); var userKeyPrefix = Body.GetQueryString("UserKeyPrefix"); if (Body.IsQueryExists("CreatePublishmentSystem")) { LtlTitle.Text = "新建站点"; var pars = AjaxCreateService.GetCreatePublishmentSystemParameters(PublishmentSystemId, Body.GetQueryBool("IsUseSiteTemplate"), Body.GetQueryBool("IsImportContents"), Body.GetQueryBool("IsImportTableStyles"), Body.GetQueryString("SiteTemplateDir"), Body.GetQueryBool("IsUseTables"), userKeyPrefix, Body.GetQueryBool("isTop"), Body.GetQueryString("returnUrl")); LtlRegisterScripts.Text = AjaxManager.RegisterProgressTaskScript(AjaxCreateService.GetCreatePublishmentSystemUrl(), pars, userKeyPrefix, AjaxCreateService.GetCountArrayUrl(), true); } else if (Body.IsQueryExists("Backup") && Body.IsQueryExists("BackupType")) { LtlTitle.Text = "数据备份"; var parameters = AjaxBackupService.GetBackupParameters(PublishmentSystemId, Body.GetQueryString("BackupType"), userKeyPrefix); LtlRegisterScripts.Text = AjaxManager.RegisterWaitingTaskScript(AjaxBackupService.GetBackupUrl(), parameters); } else if (Body.IsQueryExists("Recovery") && Body.IsQueryExists("IsZip")) { LtlTitle.Text = "数据恢复"; var parameters = AjaxBackupService.GetRecoveryParameters(PublishmentSystemId, Body.GetQueryBool("IsDeleteChannels"), Body.GetQueryBool("IsDeleteTemplates"), Body.GetQueryBool("IsDeleteFiles"), Body.GetQueryBool("IsZip"), PageUtils.UrlEncode(Body.GetQueryString("Path")), Body.GetQueryBool("IsOverride"), Body.GetQueryBool("IsUseTable"), userKeyPrefix); LtlRegisterScripts.Text = AjaxManager.RegisterWaitingTaskScript(AjaxBackupService.GetRecoveryUrl(), parameters); } else if (Body.IsQueryExists("DeleteAllPage") && Body.IsQueryExists("TemplateType")) { DeleteAllPage(); } else if (Body.IsQueryExists("CreateIndex")) { CreateIndex(); } }
public void Page_Load(object sender, EventArgs e) { if (IsForbidden) { return; } PageUtils.CheckRequestParameter("siteId"); var userKeyPrefix = AuthRequest.GetQueryString("userKeyPrefix"); if (AuthRequest.IsQueryExists("createSite")) { LtlTitle.Text = "新建站点"; var pars = AjaxCreateService.GetCreateSiteParameters(SiteId, AuthRequest.GetQueryBool("isImportContents"), AuthRequest.GetQueryBool("isImportTableStyles"), AuthRequest.GetQueryString("siteTemplateDir"), AuthRequest.GetQueryString("onlineTemplateName"), AuthRequest.GetQueryBool("isUseTables"), userKeyPrefix); LtlRegisterScripts.Text = AjaxManager.RegisterProgressTaskScript(AjaxCreateService.GetCreateSiteUrl(), pars, userKeyPrefix, AjaxCreateService.GetCountArrayUrl(), true); } else if (AuthRequest.IsQueryExists("backup") && AuthRequest.IsQueryExists("backupType")) { LtlTitle.Text = "数据备份"; var parameters = AjaxBackupService.GetBackupParameters(SiteId, AuthRequest.GetQueryString("backupType"), userKeyPrefix); LtlRegisterScripts.Text = AjaxManager.RegisterWaitingTaskScript(AjaxBackupService.GetBackupUrl(), parameters); } else if (AuthRequest.IsQueryExists("recovery") && AuthRequest.IsQueryExists("isZip")) { LtlTitle.Text = "数据恢复"; var parameters = AjaxBackupService.GetRecoveryParameters(SiteId, AuthRequest.GetQueryBool("isDeleteChannels"), AuthRequest.GetQueryBool("isDeleteTemplates"), AuthRequest.GetQueryBool("isDeleteFiles"), AuthRequest.GetQueryBool("isZip"), PageUtils.UrlEncode(AuthRequest.GetQueryString("path")), AuthRequest.GetQueryBool("isOverride"), AuthRequest.GetQueryBool("isUseTable"), userKeyPrefix); LtlRegisterScripts.Text = AjaxManager.RegisterWaitingTaskScript(AjaxBackupService.GetRecoveryUrl(), parameters); } else if (AuthRequest.IsQueryExists("deleteAllPage") && AuthRequest.IsQueryExists("templateType")) { DeleteAllPage(); } else if (AuthRequest.IsQueryExists("createIndex")) { CreateIndex(); } }
public NameValueCollection CreateSiteBySiteTemplateDir(int siteId, bool isImportContents, bool isImportTableStyles, string siteTemplateDir, bool isUseTables, string userKeyPrefix, string administratorName) { var cacheTotalCountKey = userKeyPrefix + CacheTotalCount; var cacheCurrentCountKey = userKeyPrefix + CacheCurrentCount; var cacheMessageKey = userKeyPrefix + CacheMessage; CacheUtils.Insert(cacheTotalCountKey, "3"); //存储需要的页面总数 CacheUtils.Insert(cacheCurrentCountKey, "0"); //存储当前的页面总数 CacheUtils.Insert(cacheMessageKey, string.Empty); //存储消息 //返回“运行结果”、“错误信息”及“执行JS脚本”的字符串数组 NameValueCollection retval; try { CacheUtils.Insert(cacheCurrentCountKey, "1"); //存储当前的页面总数 CacheUtils.Insert(cacheMessageKey, "正在创建站点..."); //存储消息 var siteInfo = SiteManager.GetSiteInfo(siteId); CacheUtils.Insert(cacheCurrentCountKey, "2"); //存储当前的页面总数 CacheUtils.Insert(cacheMessageKey, "正在导入数据..."); //存储消息 SiteTemplateManager.Instance.ImportSiteTemplateToEmptySite(siteId, siteTemplateDir, isUseTables, isImportContents, isImportTableStyles, administratorName); CreateManager.CreateAll(siteId); CacheUtils.Insert(cacheCurrentCountKey, "3"); //存储当前的页面总数 CacheUtils.Insert(cacheMessageKey, "创建成功!"); //存储消息 retval = AjaxManager.GetWaitingTaskNameValueCollection( $"站点 <strong>{siteInfo.SiteName}<strong> 创建成功!", string.Empty, $"top.location.href='{PageInitialization.GetRedirectUrl()}';"); } catch (Exception ex) { retval = AjaxManager.GetWaitingTaskNameValueCollection(string.Empty, ex.Message, string.Empty); LogUtils.AddErrorLog(ex); } CacheUtils.Remove(cacheTotalCountKey); //取消存储需要的页面总数 CacheUtils.Remove(cacheCurrentCountKey); //取消存储当前的页面总数 CacheUtils.Remove(cacheMessageKey); //取消存储消息 CacheUtils.ClearAll(); return(retval); }
public NameValueCollection SiteTemplateZip(string directoryName, string userKeyPrefix) { var cacheTotalCountKey = userKeyPrefix + CacheTotalCount; var cacheCurrentCountKey = userKeyPrefix + CacheCurrentCount; var cacheMessageKey = userKeyPrefix + CacheMessage; CacheUtils.Insert(cacheTotalCountKey, "1"); //存储需要的页面总数 CacheUtils.Insert(cacheCurrentCountKey, "0"); //存储当前的页面总数 CacheUtils.Insert(cacheMessageKey, string.Empty); //存储消息 //返回“运行结果”和“错误信息”的字符串数组 NameValueCollection retval; try { directoryName = PathUtils.RemoveParentPath(directoryName); var fileName = directoryName + ".zip"; var filePath = PathUtility.GetSiteTemplatesPath(fileName); var directoryPath = PathUtility.GetSiteTemplatesPath(directoryName); FileUtils.DeleteFileIfExists(filePath); ZipUtils.PackFiles(filePath, directoryPath); CacheUtils.Insert(cacheCurrentCountKey, "1");//存储当前的页面总数 retval = AjaxManager.GetProgressTaskNameValueCollection( $"站点模板压缩成功,<a href='{PageUtils.GetSiteTemplatesUrl(fileName)}' target=_blank>点击下载</a>。", string.Empty); } catch (Exception ex) { retval = AjaxManager.GetProgressTaskNameValueCollection(string.Empty, $@"<br />站点模板压缩失败!<br />{ex.Message}"); } CacheUtils.Remove(cacheTotalCountKey); //取消存储需要的页面总数 CacheUtils.Remove(cacheCurrentCountKey); //取消存储当前的页面总数 CacheUtils.Remove(cacheMessageKey); //取消存储消息 return(retval); }
public NameValueCollection CreateSite(int siteId, string userKeyPrefix, string administratorName) { var cacheTotalCountKey = userKeyPrefix + CacheTotalCount; var cacheCurrentCountKey = userKeyPrefix + CacheCurrentCount; var cacheMessageKey = userKeyPrefix + CacheMessage; CacheUtils.Insert(cacheTotalCountKey, "2"); //存储需要的页面总数 CacheUtils.Insert(cacheCurrentCountKey, "0"); //存储当前的页面总数 CacheUtils.Insert(cacheMessageKey, string.Empty); //存储消息 //返回“运行结果”、“错误信息”及“执行JS脚本”的字符串数组 NameValueCollection retval; try { CacheUtils.Insert(cacheCurrentCountKey, "1"); //存储当前的页面总数 CacheUtils.Insert(cacheMessageKey, "正在创建站点..."); //存储消息 var siteInfo = SiteManager.GetSiteInfo(siteId); CacheUtils.Insert(cacheCurrentCountKey, "2"); //存储当前的页面总数 CacheUtils.Insert(cacheMessageKey, "创建成功!"); //存储消息 retval = AjaxManager.GetWaitingTaskNameValueCollection( $"站点 <strong>{siteInfo.SiteName}<strong> 创建成功!", string.Empty, $"top.location.href='{PageUtils.GetMainUrl(siteId)}';"); } catch (Exception ex) { retval = AjaxManager.GetWaitingTaskNameValueCollection(string.Empty, ex.Message, string.Empty); LogUtils.AddErrorLog(ex); } CacheUtils.Remove(cacheTotalCountKey); //取消存储需要的页面总数 CacheUtils.Remove(cacheCurrentCountKey); //取消存储当前的页面总数 CacheUtils.Remove(cacheMessageKey); //取消存储消息 CacheUtils.ClearAll(); return(retval); }
public JsonResult Delete_Attachment(long attachment_Id) { List <FriendlyMessageInfo> Friendly_Message = new List <FriendlyMessageInfo>(); AttachmentsInfo attachments = new AttachmentsInfo(); try { AjaxManager aMan = new AjaxManager(); attachments = aMan.Get_Attachment_By_Id(attachment_Id); var saveToFileLoc = string.Format("{0}\\{1}", Server.MapPath("/uploads/" + attachments.Ref_Type_Str + "/" + attachments.Ref_Id), attachments.Document_Name); if (saveToFileLoc != null || saveToFileLoc != string.Empty) { if ((System.IO.File.Exists(saveToFileLoc))) { System.IO.File.Delete(saveToFileLoc); } } aMan.Delete_Attachment_By_Id(attachment_Id); Friendly_Message.Add(MessageStore.Get("AJ002")); } catch (Exception ex) { Friendly_Message.Add(MessageStore.Get("SYS01")); Logger.Error("Ajax Controller - Delete_Attachment " + ex.ToString()); } return(Json(new { Friendly_Message }, JsonRequestBehavior.AllowGet)); }
public NameValueCollection SiteTemplateUnZip(string fileName, string userKeyPrefix) { var cacheTotalCountKey = userKeyPrefix + CacheTotalCount; var cacheCurrentCountKey = userKeyPrefix + CacheCurrentCount; var cacheMessageKey = userKeyPrefix + CacheMessage; CacheUtils.Insert(cacheTotalCountKey, "1"); //存储需要的页面总数 CacheUtils.Insert(cacheCurrentCountKey, "0"); //存储当前的页面总数 CacheUtils.Insert(cacheMessageKey, string.Empty); //存储消息 //返回“运行结果”和“错误信息”的字符串数组 NameValueCollection retval; try { var directoryPath = PathUtility.GetSiteTemplatesPath(PathUtils.GetFileNameWithoutExtension(fileName)); var zipFilePath = PathUtility.GetSiteTemplatesPath(fileName); ZipUtils.UnpackFiles(zipFilePath, directoryPath); CacheUtils.Insert(cacheCurrentCountKey, "1");//存储当前的页面总数 retval = AjaxManager.GetProgressTaskNameValueCollection("站点模板解压成功", string.Empty); } catch (Exception ex) { retval = AjaxManager.GetProgressTaskNameValueCollection(string.Empty, $@"<br />站点模板解压失败!<br />{ex.Message}"); } CacheUtils.Remove(cacheTotalCountKey); //取消存储需要的页面总数 CacheUtils.Remove(cacheCurrentCountKey); //取消存储当前的页面总数 CacheUtils.Remove(cacheMessageKey); //取消存储消息 return(retval); }
public NameValueCollection Recovery(int siteId, bool isDeleteChannels, bool isDeleteTemplates, bool isDeleteFiles, bool isZip, string path, bool isOverride, bool isUseTable, string userKeyPrefix, RequestImpl request) { //返回“运行结果”和“错误信息”的字符串数组 NameValueCollection retval; try { BackupUtility.RecoverySite(siteId, isDeleteChannels, isDeleteTemplates, isDeleteFiles, isZip, PageUtils.UrlDecode(path), isOverride, isUseTable, request.AdminName); request.AddSiteLog(siteId, "恢复备份数据", request.AdminName); retval = AjaxManager.GetWaitingTaskNameValueCollection("数据恢复成功!", string.Empty, string.Empty); //retval = new string[] { "数据恢复成功!", string.Empty, string.Empty }; } catch (Exception ex) { //retval = new string[] { string.Empty, ex.Message, string.Empty }; retval = AjaxManager.GetWaitingTaskNameValueCollection(string.Empty, ex.Message, string.Empty); LogUtils.AddErrorLog(ex); } return(retval); }
/// <summary> /// When the control loads. /// </summary> /// <param name="e"></param> protected override void OnLoad(EventArgs e) { base.OnLoad(e); AjaxManager.RegisterCssReferences(this, new string[] { "Nequeo.Web.UI.ScriptControl.Style.uploadStyle.css" }); }
public AjaxController() { _ajaxMgr = new AjaxManager(); }
public JsonResult Insert_Attachment(object obj) { AjaxViewModel aViewModel = new AjaxViewModel(); try { AjaxManager aMan = new AjaxManager(); var length = Request.ContentLength; var bytes = new byte[length]; Request.InputStream.Read(bytes, 0, length); // bytes has byte content here. what do do next? var fileName = Request.Headers["X-File-Name"]; var fileSize = Request.Headers["X-File-Size"]; var fileType = Request.Headers["X-File-Type"]; var ref_Id = Request.Headers["RefId"]; var ref_Type = Request.Headers["RefType"]; var remark = Request.Headers["Remark"]; aViewModel.Attachment.Document_Name = fileName; aViewModel.Attachment.Ref_Type = Convert.ToInt32(ref_Type); aViewModel.Attachment.Ref_Id = Convert.ToInt32(ref_Id); aViewModel.Attachment.CreatedBy = ((UserInfo)Session["User"]).UserId; aViewModel.Attachment.UpdatedBy = ((UserInfo)Session["User"]).UserId; aViewModel.Attachment.CreatedOn = DateTime.Now; aViewModel.Attachment.UpdatedOn = DateTime.Now; aViewModel.Attachment.Remark = remark; var saveToFileLoc = string.Format("{0}\\{1}", Server.MapPath("/uploads/" + aViewModel.Attachment.Ref_Type_Str + "/" + aViewModel.Attachment.Ref_Id), fileName); bool directoryExists = System.IO.Directory.Exists(Server.MapPath("/uploads/" + aViewModel.Attachment.Ref_Type_Str + "/" + aViewModel.Attachment.Ref_Id)); if (!directoryExists) { System.IO.Directory.CreateDirectory(Server.MapPath("/uploads/" + aViewModel.Attachment.Ref_Type_Str + "/" + aViewModel.Attachment.Ref_Id)); } bool FileExists = System.IO.File.Exists(Server.MapPath("/uploads/" + aViewModel.Attachment.Ref_Type_Str + "/" + aViewModel.Attachment.Ref_Id + "/" + fileName)); if (!FileExists) { // save the file. var fileStream = new FileStream(saveToFileLoc, FileMode.Create, FileAccess.ReadWrite); fileStream.Write(bytes, 0, length); fileStream.Close(); aViewModel.Attachment.Attachment_Id = aMan.Insert_Attachment(aViewModel.Attachment); aViewModel.Friendly_Message.Add(MessageStore.Get("AJ001")); } else { aViewModel.Friendly_Message.Add(MessageStore.Get("AJ003")); } // aViewModel.Attachments = aMan.Get_Attachments_By_Ref_Type_Ref_Id(aViewModel.Attachment.Ref_Type, aViewModel.Attachment.Ref_Id); } catch (Exception ex) { aViewModel.Friendly_Message.Add(MessageStore.Get("SYS01")); Logger.Error("Ajax Controller - Insert_Attachments " + ex.ToString()); } return(Json(aViewModel, JsonRequestBehavior.AllowGet)); }
public void Page_Load(object sender, EventArgs e) { if (IsForbidden) { return; } Page.Response.Cache.SetCacheability(HttpCacheability.NoCache); if (AuthRequest.IsQueryExists("CreateChannelsOneByOne") && AuthRequest.IsQueryExists("ChannelIDCollection")) { foreach (var channelId in TranslateUtils.StringCollectionToIntList(AuthRequest.GetQueryString("ChannelIDCollection"))) { CreateManager.CreateChannel(SiteId, channelId); } LayerUtils.CloseAndOpenPageCreateStatus(Page); //PageUtils.Redirect(ModalTipMessage.GetRedirectUrlString(SiteId, "已成功将栏目放入生成队列")); } else if (AuthRequest.IsQueryExists("CreateContentsOneByOne") && AuthRequest.IsQueryExists("channelId") && AuthRequest.IsQueryExists("contentIdCollection")) { foreach (var contentId in TranslateUtils.StringCollectionToIntList(AuthRequest.GetQueryString("contentIdCollection"))) { CreateManager.CreateContent(SiteId, AuthRequest.GetQueryInt("channelId"), contentId); } LayerUtils.CloseAndOpenPageCreateStatus(Page); //PageUtils.Redirect(ModalTipMessage.GetRedirectUrlString(SiteId, "已成功将内容放入生成队列")); } else if (AuthRequest.IsQueryExists("CreateByTemplate") && AuthRequest.IsQueryExists("templateID")) { CreateManager.CreateFile(SiteId, AuthRequest.GetQueryInt("templateID")); LayerUtils.CloseAndOpenPageCreateStatus(Page); //PageUtils.Redirect(ModalTipMessage.GetRedirectUrlString(SiteId, "已成功将文件放入生成队列")); } else if (AuthRequest.IsQueryExists("CreateByIDsCollection") && AuthRequest.IsQueryExists("IDsCollection")) { foreach (var channelIdContentId in TranslateUtils.StringCollectionToStringCollection(AuthRequest.GetQueryString("IDsCollection"))) { var pair = channelIdContentId.Split('_'); CreateManager.CreateContent(SiteId, TranslateUtils.ToInt(pair[0]), TranslateUtils.ToInt(pair[1])); } LayerUtils.CloseAndOpenPageCreateStatus(Page); //PageUtils.Redirect(ModalTipMessage.GetRedirectUrlString(SiteId, "已成功将文件放入生成队列")); } //---------------------------------------------------------------------------------------// else if (AuthRequest.IsQueryExists("SiteTemplateDownload")) { var userKeyPrefix = StringUtils.Guid(); var downloadUrl = TranslateUtils.DecryptStringBySecretKey(AuthRequest.GetQueryString("DownloadUrl")); var directoryName = PathUtils.GetFileNameWithoutExtension(downloadUrl); var parameters = AjaxOtherService.GetSiteTemplateDownloadParameters(downloadUrl, directoryName, userKeyPrefix); LtlScripts.Text = AjaxManager.RegisterProgressTaskScript(AjaxOtherService.GetSiteTemplateDownloadUrl(), parameters, userKeyPrefix, AjaxOtherService.GetCountArrayUrl()); } else if (AuthRequest.IsQueryExists("SiteTemplateZip")) { var userKeyPrefix = StringUtils.Guid(); var parameters = AjaxOtherService.GetSiteTemplateZipParameters(AuthRequest.GetQueryString("DirectoryName"), userKeyPrefix); LtlScripts.Text = AjaxManager.RegisterProgressTaskScript(AjaxOtherService.GetSiteTemplateZipUrl(), parameters, userKeyPrefix, AjaxOtherService.GetCountArrayUrl()); } else if (AuthRequest.IsQueryExists("SiteTemplateUnZip")) { var userKeyPrefix = StringUtils.Guid(); var parameters = AjaxOtherService.GetSiteTemplateUnZipParameters(AuthRequest.GetQueryString("FileName"), userKeyPrefix); LtlScripts.Text = AjaxManager.RegisterProgressTaskScript(AjaxOtherService.GetSiteTemplateUnZipUrl(), parameters, userKeyPrefix, AjaxOtherService.GetCountArrayUrl()); } //---------------------------------------------------------------------------------------// else if (AuthRequest.IsQueryExists("PluginDownload")) { var userKeyPrefix = StringUtils.Guid(); var parameters = AjaxOtherService.GetPluginDownloadParameters(AuthRequest.GetQueryString("DownloadUrl"), userKeyPrefix); LtlScripts.Text = AjaxManager.RegisterProgressTaskScript(AjaxOtherService.GetPluginDownloadUrl(), parameters, userKeyPrefix, AjaxOtherService.GetCountArrayUrl()); } }
public void Page_Load(object sender, EventArgs e) { if (IsForbidden) { return; } Page.Response.Cache.SetCacheability(HttpCacheability.NoCache); if (Body.IsQueryExists("Gather") && Body.IsQueryExists("GatherRuleNameCollection")) { var userKeyPrefix = StringUtils.Guid(); var parameters = AjaxGatherService.GetGatherParameters(PublishmentSystemId, Body.GetQueryString("GatherRuleNameCollection"), userKeyPrefix); RegisterScripts.Text = AjaxManager.RegisterProgressTaskScript(AjaxGatherService.GetGatherUrl(), parameters, userKeyPrefix, AjaxGatherService.GetCountArrayUrl()); } else if (Body.IsQueryExists("GatherDatabase") && Body.IsQueryExists("GatherRuleNameCollection")) { var userKeyPrefix = StringUtils.Guid(); var parameters = AjaxGatherService.GetGatherDatabaseParameters(PublishmentSystemId, Body.GetQueryString("GatherRuleNameCollection"), userKeyPrefix); RegisterScripts.Text = AjaxManager.RegisterProgressTaskScript(AjaxGatherService.GetGatherDatabaseUrl(), parameters, userKeyPrefix, AjaxGatherService.GetCountArrayUrl()); } else if (Body.IsQueryExists("GatherFile") && Body.IsQueryExists("GatherRuleNameCollection")) { var userKeyPrefix = StringUtils.Guid(); var parameters = AjaxGatherService.GetGatherFileParameters(PublishmentSystemId, Body.GetQueryString("GatherRuleNameCollection"), userKeyPrefix); RegisterScripts.Text = AjaxManager.RegisterProgressTaskScript(AjaxGatherService.GetGatherFileUrl(), parameters, userKeyPrefix, AjaxGatherService.GetCountArrayUrl()); } //----------------------------------------------------------------------------------------// else if (Body.IsQueryExists("CreateChannelsOneByOne") && Body.IsQueryExists("ChannelIDCollection")) { foreach (var channelId in TranslateUtils.StringCollectionToIntList(Body.GetQueryString("ChannelIDCollection"))) { CreateManager.CreateChannel(PublishmentSystemId, channelId); } PageUtils.Redirect(ModalTipMessage.GetRedirectUrlString("已成功将栏目放入生成队列")); } else if (Body.IsQueryExists("CreateContentsOneByOne") && Body.IsQueryExists("NodeID") && Body.IsQueryExists("ContentIDCollection")) { foreach (var contentId in TranslateUtils.StringCollectionToIntList(Body.GetQueryString("ContentIDCollection"))) { CreateManager.CreateContent(PublishmentSystemId, Body.GetQueryInt("NodeID"), contentId); } PageUtils.Redirect(ModalTipMessage.GetRedirectUrlString("已成功将内容放入生成队列")); } else if (Body.IsQueryExists("CreateByTemplate") && Body.IsQueryExists("templateID")) { CreateManager.CreateFile(PublishmentSystemId, Body.GetQueryInt("templateID")); PageUtils.Redirect(ModalTipMessage.GetRedirectUrlString("已成功将文件放入生成队列")); } else if (Body.IsQueryExists("CreateByIDsCollection") && Body.IsQueryExists("IDsCollection")) { foreach (var nodeIdContentId in TranslateUtils.StringCollectionToStringCollection(Body.GetQueryString("IDsCollection"))) { var pair = nodeIdContentId.Split('_'); CreateManager.CreateContent(PublishmentSystemId, TranslateUtils.ToInt(pair[0]), TranslateUtils.ToInt(pair[1])); } PageUtils.Redirect(ModalTipMessage.GetRedirectUrlString("已成功将文件放入生成队列")); } //---------------------------------------------------------------------------------------// else if (Body.IsQueryExists("SiteTemplateDownload")) { var userKeyPrefix = StringUtils.Guid(); var parameters = AjaxOtherService.GetSiteTemplateDownloadParameters(Body.GetQueryString("DownloadUrl"), Body.GetQueryString("DirectoryName"), userKeyPrefix); RegisterScripts.Text = AjaxManager.RegisterProgressTaskScript(AjaxOtherService.GetSiteTemplateDownloadUrl(), parameters, userKeyPrefix, AjaxOtherService.GetCountArrayUrl()); } else if (Body.IsQueryExists("SiteTemplateZip")) { var userKeyPrefix = StringUtils.Guid(); var parameters = AjaxOtherService.GetSiteTemplateZipParameters(Body.GetQueryString("DirectoryName"), userKeyPrefix); RegisterScripts.Text = AjaxManager.RegisterProgressTaskScript(AjaxOtherService.GetSiteTemplateZipUrl(), parameters, userKeyPrefix, AjaxOtherService.GetCountArrayUrl()); } }