Example #1
0
        /// <summary>
        /// 删除图片物理路径
        /// </summary>
        /// <param name="Param"></param>
        /// <param name="WebRootPath"></param>
        /// <returns></returns>
        public static String RemovePath(FromData Param, String WebRootPath)
        {
            String Path = Param.Path;

            if (String.IsNullOrEmpty(Path))
            {
                return(null);
            }
            //针对富文本图片删除
            if (Path.Contains("img"))
            {
                Regex           regImg  = new Regex(@"<img\b[^<>]*?\bsrc[\s\t\r\n]*=[\s\t\r\n]*[""']?[\s\t\r\n]*(?<imgUrl>[^\s\t\r\n""'<>]*)[^<>]*?/?[\s\t\r\n]*>", RegexOptions.IgnoreCase);
                MatchCollection matches = regImg.Matches(Path);
                //遍历所有的img标签对象
                foreach (Match match in matches)
                {
                    File.Delete(WebRootPath + match.Groups["imgUrl"].Value);
                }
            }
            else
            {
                if (Path.Contains(","))
                {
                    Path.Split(",").ToList().ForEach(t =>
                    {
                        File.Delete(WebRootPath + t);
                    });
                }
                else
                {
                    File.Delete(WebRootPath + Path);
                }
            }
            return(null);
        }
Example #2
0
        public JsonResult RemovePath(FromData data)
        {
            var    WebRootPath = Environment.WebRootPath;
            Object Result      = FileUtil.RemovePath(data, WebRootPath);

            return(new JsonResult(Result));
        }
Example #3
0
 /// <summary>
 /// Generates SQL command if some additional clauses specified, otherwise delegates call to the source.
 /// </summary>
 /// <param name="subQueryPrefix">
 /// The prefix for alias and parameter names when the query is part of another query.
 /// </param>
 /// <returns>
 /// The SQL command or table name as text and the dictionary of parameters.
 /// </returns>
 public ParameterizedSql GetSqlCommandOrTableName(string subQueryPrefix)
 {
     if (SelectClause == null && WhereClauses.Count == 0 && HavingClauses.Count == 0 &&
         Joins.Count == 0 && OrderByProperties.Count == 0 && GroupByKey == null)
     {
         return(FromData.GetSqlCommandOrTableName(subQueryPrefix));
     }
     else
     {
         var sql = commandBuilder.GetSelectCommand(this, subQueryPrefix);
         sql.Command = "(" + sql.Command + ")";
         return(sql);
     }
 }
Example #4
0
        private void ParseFormDataParameters(string requestBody)
        {
            if (!string.IsNullOrEmpty(requestBody))
            {
                string[] bodyParams = requestBody.Split(GlobalConstants.HttpNewLine, StringSplitOptions.RemoveEmptyEntries);

                foreach (var parameter in bodyParams)
                {
                    string parameterName  = parameter.Split('=')[0];
                    string parameterValue = parameter.Split('=')[1];

                    FromData.Add(parameterName, parameterValue);
                }
            }
        }