/// <summary> /// 创建默认的方案 /// </summary> /// <param name="siteDir">站点目录名</param> /// <param name="nodeCode">NodeCode</param> /// <param name="siteId">站点的ID</param> /// <returns>结果:1.成功,0或其他表示失败</returns> public string CreateDefaultProject(string siteDir, string nodeCode, int siteId) { KingTop.Model.TemplateProject model = new KingTop.Model.TemplateProject(); string result = string.Empty; //返回的目录 model.ID = Guid.NewGuid().ToString(); //方案对象赋值 model.Title = "系统方案"; model.Directory = CreateProDir(siteDir, siteId); model.Devise = "Admin"; model.Width = 1024; model.Intro = "系统自动创建的默认方案!"; model.IsDefault = true; model.Thumbnail = ""; model.IsDel = false; model.DeTime = DateTime.Now; model.NodeCode = nodeCode; model.AddMan = "Admin"; model.SiteID = siteId; model.AddTime = DateTime.Now; int ret = Utils.ParseInt(Save("NEW", model), 0); //创建方案 if (ret == 1) //成功 { result = model.Directory; //加载默认的样式和脚本到当前系统默认方案风格目录下 string fromDir = "~/SysAdmin/Template/Temp"; //源文件的目录 string destination = HttpContext.Current.Server.MapPath("~/SysAdmin/Template/" + result + "/Skins"); //当前的风格目录路径 DirectoryInfo sourceDir = new DirectoryInfo(HttpContext.Current.Server.MapPath(fromDir)); //创建临时存放系统风格文件目录 DirectoryInfo destinationDir = new DirectoryInfo(destination); //创建当前风格目录 LabelUtils.CopyDirectory(sourceDir, destinationDir); //移动系统风格文件到新建的风格 } return(result); }
/// <summary> ///系统默认风格 /// </summary> /// <param name="ret">方案是否创建成功</param> /// <param name="projectDir">方案的目录</param> public void CreateDefaultSkin(int ret, string projectDir) { if (ret == 1) //成功 { //加载默认的样式和脚本到当前系统默认方案风格目录下 string fromDir = "~/SysAdmin/Template/Temp"; //源文件的目录 string destination = HttpContext.Current.Server.MapPath("~/SysAdmin/Template/" + projectDir + "/Skins"); //当前的风格目录路径 DirectoryInfo sourceDir = new DirectoryInfo(HttpContext.Current.Server.MapPath(fromDir)); //创建临时存放系统风格文件目录 DirectoryInfo destinationDir = new DirectoryInfo(destination); //创建当前风格目录 LabelUtils.CopyDirectory(sourceDir, destinationDir); //移动系统风格文件到新建的风格 } }