/// <summary> /// 行政分区、图层,角色使用到的part-all模式layer_role_all /// </summary> /// <param name="userInfoModel"></param> /// <param name="allConfig"></param> /// <param name="partConfig"></param> /// <returns></returns> public static Eva.Library.Collection.NoRepeatingStringCollection GetUserRoleRemarkPartAll(sara.dd.ldsw.model.userinfo userInfoModel, string allConfig, string partConfig) { Eva.Library.Collection.NoRepeatingStringCollection resultIdsList = new Eva.Library.Collection.NoRepeatingStringCollection(); List <string> userRolesList = userInfoModel.sys_roles.Split('^').ToList <string>(); //图层ID/行政区域的备注 List <string> resultRoleNameRemarksList = new List <string>(); //用户具备的全部角色备注 string[] userRoleNameRemarksArray = userInfoModel.sys_rolenameremarks.Split('^'); //判断当前用户是否具备全图层角色 if (("^" + userInfoModel.sys_roles + "^").IndexOf("^" + allConfig + "^") > -1) { int allResultIndex = userRolesList.IndexOf(allConfig); resultRoleNameRemarksList.Add(userRoleNameRemarksArray[allResultIndex].ToString()); } else { string[] partResultIdArray = userInfoModel.sys_roles.Split('^'); foreach (string partLayerIdString in partResultIdArray) { if (("," + partConfig + ",").IndexOf("," + partLayerIdString + ",") > -1) { int roleResultIndex = userRolesList.IndexOf(partLayerIdString); resultRoleNameRemarksList.Add(userRoleNameRemarksArray[roleResultIndex].ToString()); } } } foreach (string cc in resultRoleNameRemarksList) { string[] ccArray = cc.Split('|'); foreach (string resultid in ccArray) { if (resultid != "") { resultIdsList.Add(resultid); } } } return(resultIdsList); }
public string LibSaraPlatformOperationUIForDebugJs() { string projectName = "sara.dd.ldsw"; string errorFileName = ""; string rootPathString = @"C:\inetpub\wwwroot\sara\"; string sourcePathString = @"sara.platform.operation\"; string targetPathString = projectName + @"\sara.platform.operation\"; //删除已有文件 if (Directory.Exists(rootPathString + targetPathString)) { Directory.Delete(rootPathString + targetPathString, true); } //需要拷贝的文件 string[] copyExtNameArry = { ".html", ".css", ".js", ".asmx", ".png", ".gif" }; //需要修改参数的文件 string[] editExtNameArray = { ".html", ".js" }; //获取文件夹下的所有文件集合 List <FileInformation> list = DirectoryAllFiles.GetAllFiles(new System.IO.DirectoryInfo(rootPathString + sourcePathString)); Eva.Library.Collection.NoRepeatingStringCollection n = new Eva.Library.Collection.NoRepeatingStringCollection(); foreach (var item in list) { n.Add(item.FileExtName); #region 是否拷贝 bool isCopy = false; if (copyExtNameArry.Contains(item.FileExtName)) { if (item.FileExtName == ".js") { if (item.FileName.Contains(".min.js")) { isCopy = false; } else { isCopy = true; } } else if (item.FileExtName == ".css") { if (item.FileName.Contains(".min.css")) { isCopy = false; } else { isCopy = true; } } else if (item.FileExtName == ".config") { if (item.FileName.Contains(".Debug.config") || item.FileName.Contains(".Release.config")) { isCopy = false; } else { isCopy = true; } } else { isCopy = true; } } else { isCopy = false; } #endregion if (isCopy == true) { #region 拷贝文件 if (!Directory.Exists(item.FilePath.Replace(rootPathString + sourcePathString, rootPathString + targetPathString))) { Directory.CreateDirectory(item.FilePath.Replace(rootPathString + sourcePathString, rootPathString + targetPathString)); } System.IO.File.Copy(item.FilePath + "\\" + item.FileName, item.FilePath.Replace(rootPathString + sourcePathString, rootPathString + targetPathString) + "\\" + item.FileName, true); #endregion #region 修改文件内容 if (editExtNameArray.Contains(item.FileExtName)) { string targetFileFullName = item.FilePath.Replace(rootPathString + sourcePathString, rootPathString + targetPathString) + "\\" + item.FileName; string filecontent = FileOperation.ReadFile(targetFileFullName); #region 项目路径 //平台operation的路径 if (filecontent.IndexOf("【sara.platform.operation.url】") > -1) { filecontent = filecontent.Replace("【sara.platform.operation.url】", "//127.0.0.1/" + projectName + "/sara.platform.operation/"); } //资源文件路径 if (filecontent.IndexOf("【sara.resource.library.url】") > -1) { //如果是dd框架,那么sara.resource.library应该是在项目外,应该去掉 //如果是ee框架,那么sara.resource.library应该是在项目内,所以应该保留 if (projectName.IndexOf(".dd.") > -1) { filecontent = filecontent.Replace("【sara.resource.library.url】", "//162.16.166.1/sara.resource.library/"); } else { filecontent = filecontent.Replace("【sara.resource.library.url】", "//127.0.0.1/" + projectName + "/sara.resource.library/"); } } //附件文件路径 if (filecontent.IndexOf("【sara.project.url】") > -1) { filecontent = filecontent.Replace("【sara.project.url】", "//127.0.0.1/" + projectName + "/"); } //附件文件路径 if (filecontent.IndexOf("【sara.project.file.url】") > -1) { if (projectName.IndexOf(".dd.") > -1) { filecontent = filecontent.Replace("【sara.project.file.url】", "//127.0.0.1/" + projectName + ".file/"); } else { filecontent = filecontent.Replace("【sara.project.file.url】", "//127.0.0.1/" + projectName + "/sara.dd.ldsw.file/"); } } //rootip if (filecontent.IndexOf("【sara.include.rootip】") > -1) { if (projectName.IndexOf(".dd.") > -1) { filecontent = filecontent.Replace("【sara.include.rootip】", "127.0.0.1"); } else { filecontent = filecontent.Replace("【sara.include.rootip】", "127.0.0.1/" + projectName); } } #endregion #region min化问题 if (item.FileExtName == ".html" && filecontent.IndexOf("ismin: true,") > -1) { filecontent = filecontent.Replace("ismin: true,", "ismin: true,"); } if (item.FileExtName == ".html") { filecontent = filecontent.Replace(".min.js\"", ".js\"").Replace(".min.min.js\"", ".js\""); filecontent = filecontent.Replace(".min.css\"", ".css\"").Replace(".min.min.css\"", ".css\""); } #endregion errorFileName += FileOperation.writeFile(targetFileFullName, filecontent); //Console.WriteLine("拷贝并编辑文件" + item.FileName); } else { //Console.WriteLine("拷贝文件" + item.FileName); } #endregion } } return(errorFileName); }
public string GetDataXml(string dataNameString, string whereString, string columnsString, string orderByString, string pageSizeString, string pageIndexString) { Dictionary <string, string> resultDic = new Dictionary <string, string>(); resultDic["result"] = ""; resultDic["message"] = ""; string message = ""; try { string xmlPathString = Eva.Library.Configuration.ConfigurationManager.AppSettings["XmlPath"].ToString() + dataNameString; DataSet ds = new DataSet(); ds.ReadXml(xmlPathString); if (whereString != "") { DataRow[] drs = ds.Tables[0].Select((whereString)); if (drs.Length > 0) { DataTable dt1 = ds.Tables[0].Clone(); DataRow dra; Eva.Library.Collection.NoRepeatingStringCollection removeColumns = new Eva.Library.Collection.NoRepeatingStringCollection(); foreach (DataRow dr in drs) { dra = dt1.NewRow(); foreach (DataColumn dc1 in ds.Tables[0].Columns) { if (columnsString.Trim() != "") { if (("^" + columnsString + "^").IndexOf("^" + dc1.ColumnName + "^") > -1) { dra[dc1.ColumnName] = dr[dc1.ColumnName]; } else { removeColumns.Add(dc1.ColumnName); } } else { dra[dc1.ColumnName] = dr[dc1.ColumnName]; } } dt1.Rows.Add(dra); } foreach (string removeColumn in removeColumns) { if (removeColumn != "") { dt1.Columns.Remove(removeColumn); } } DataTable dtc = GetDataTable(dt1, pageIndexString, pageSizeString); message = "{\"total\":\"" + dt1.Rows.Count.ToString() + "\",\"rows\":" + Eva.Library.Format.FormatEntityTool.FormatDataTableToJson(dtc) + "}"; } else { message = "{\"total\":\"0\",\"rows\":[]}"; } } else { DataTable dtc = GetDataTable(ds.Tables[0], pageIndexString, pageSizeString); message = "{\"total\":\"" + ds.Tables[0].Rows.Count.ToString() + "\",\"rows\":" + Eva.Library.Format.FormatEntityTool.FormatDataTableToJson(dtc) + "}"; } resultDic["result"] = "true"; resultDic["message"] = message; } catch (Exception ex) { resultDic["result"] = "false"; resultDic["message"] = Eva.Library.Format.FormatTextTool.ErrorMessageFormat(ex.Message + ex.StackTrace); } return(Eva.Library.Format.FormatEntityTool.FormatDicToJson(resultDic)); }
public string PublishProject() { string errorFileName = ""; string sourceRootPathString = @"C:\inetpub\wwwroot\sara\sara.dd.ldsw"; string targetRootPathString = @"C:\inetpub\wwwroot\sara.dd.ldsw.ftp"; string str = ""; //.cs.csproj.user.suo.cache string[] copyExtNameArry = { ".html", ".txt", ".dll", ".pdb", ".xml", ".asax", ".asmx", ".ashx", ".aspx", ".png", ".gif", ".jpg", ".doc", ".db", ".woff2", ".eot", ".svg", ".ttf", ".woff", ".json", ".exe", ".xap", ".WD3", ".css", ".js", ".config", ".tcs", ".tjsp", ".txml", ".taspx", ".tjs", ".thtml", ".tcss", ".txaml", ".tsvc",".tasmx", ".zip", ".p12" }; //.html,.txt,.config,.asax,.cs,.asmx, //.csproj,.user,.suo,.dll,.pdb,.xml, //.css,.js,.png,.gif,.psd, //.cache,.jpg,.doc, //.ashx,.db,.woff2,.eot, //.svg,.ttf,.woff,.json, //.exe,.xap,.aspx,.WD3 string[] editExtNameArray = { ".html", ".config", ".js" }; List <FileInformation> list = DirectoryAllFiles.GetAllFiles(new System.IO.DirectoryInfo(sourceRootPathString)); Eva.Library.Collection.NoRepeatingStringCollection n = new Eva.Library.Collection.NoRepeatingStringCollection(); foreach (var item in list) { str += string.Format("文件目录:{0}文件名:{1}后缀:{2}", item.FilePath, item.FileName, item.FileExtName); n.Add(item.FileExtName); bool isCopy = false; if (copyExtNameArry.Contains(item.FileExtName)) { if (item.FileExtName == ".js") { if (item.FileName.Contains(".min.js")) { isCopy = true; } else { isCopy = false; } } else if (item.FileExtName == ".css") { if (item.FileName.Contains(".min.css")) { isCopy = true; } else { isCopy = false; } } else if (item.FileExtName == ".config") { if (item.FileName.Contains(".Debug.config") || item.FileName.Contains(".Release.config")) { isCopy = false; } else { isCopy = true; } } else { isCopy = true; } } else { isCopy = false; } if (isCopy == true) { if (!Directory.Exists(item.FilePath.Replace(sourceRootPathString, targetRootPathString))) { Directory.CreateDirectory(item.FilePath.Replace(sourceRootPathString, targetRootPathString)); } System.IO.File.Copy(item.FilePath + "\\" + item.FileName, item.FilePath.Replace(sourceRootPathString, targetRootPathString) + "\\" + item.FileName, true); if (editExtNameArray.Contains(item.FileExtName)) { string targetFileFullName = item.FilePath.Replace(sourceRootPathString, targetRootPathString) + "\\" + item.FileName; string filecontent = FileOperation.ReadFile(targetFileFullName); if (filecontent.IndexOf("127.0.0.1/sara.dd.ldsw") > -1) { filecontent = filecontent.Replace("127.0.0.1/sara.dd.ldsw", "www.hotworld.com.cn"); } if (item.FileExtName == ".html" && filecontent.IndexOf("ismin: true,") > -1) { filecontent = filecontent.Replace("ismin: true,", "ismin: true,"); } if (item.FileExtName == ".html") { filecontent = filecontent.Replace(".js\"", ".min.js\"").Replace(".min.min.js\"", ".min.js\""); filecontent = filecontent.Replace(".css\"", ".min.css\"").Replace(".min.min.css\"", ".min.css\""); } errorFileName += FileOperation.writeFile(targetFileFullName, filecontent) + "\r\n"; } } } return(errorFileName); }