Added admin tool to fix hyphens

Fix hyphens when non-standard hyphens are pasted
This commit is contained in:
Rich
2017-06-26 15:19:47 +00:00
parent ee10dbde82
commit 850acf34b4
3 changed files with 72 additions and 1 deletions

View File

@@ -9,6 +9,53 @@ using Csla.Validation;
namespace VEPROMS.CSLA.Library
{
public class ESP_FixHyphens : CommandBase
{
private static readonly log4net.ILog _MyLog = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
#region Factory Methods
private string _StoredProcedure;
public string StoredProcedure
{
get { return _StoredProcedure; }
set { _StoredProcedure = value; }
}
private int _AffectedRows;
public int AffectedRows
{
get { return _AffectedRows; }
set { _AffectedRows = value; }
}
public static int Execute(string storedProcedure)
{
ESP_DeletePDFs cmd = new ESP_DeletePDFs();
cmd.StoredProcedure = storedProcedure;
DataPortal.Execute<ESP_DeletePDFs>(cmd);
return cmd.AffectedRows;
}
#endregion
#region Server-Side code
protected override void DataPortal_Execute()
{
try
{
using (SqlConnection cn = Database.VEPROMS_SqlConnection)
{
using (SqlCommand cmd = new SqlCommand(StoredProcedure, cn))
{
cmd.CommandType = CommandType.StoredProcedure;
cmd.CommandTimeout = 0;
AffectedRows = cmd.ExecuteNonQuery();
}
}
}
catch (Exception ex)
{
if (_MyLog.IsErrorEnabled) _MyLog.Error("ExecuteStoredProcedureRowsAffected Error", ex);
throw new ApplicationException("Failure on ExecuteStoredProcedureRowsAffected", ex);
}
}
#endregion
}
public class ESP_DeletePDFs : CommandBase
{
private static readonly log4net.ILog _MyLog = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);

View File

@@ -798,9 +798,14 @@ namespace VEPROMS.CSLA.Library
}
#endregion
#region SaveData
/// <summary>
/// B2017-121 Regular Express for all RTF tokens for Hyphens
/// </summary>
private static Regex regHyphen = new Regex(@"(?<!\\)(\\u8208\?|\\u8210\?|\\u8211\?|\\u8212\?|\\u8213\?|\\_|\\endash|\\emdash|-)");
public bool Save(RichTextBox rtb)
{
string rtbString = RtfToDbText(rtb.Rtf).Replace("<BackSlash>", "\\\\");
// B2017-121 Replace all types of hyphens with non-breaking hyphens
string rtbString = regHyphen.Replace( RtfToDbText(rtb.Rtf).Replace("<BackSlash>", "\\\\"),@"\u8209?");
return Save(rtbString);
}
public bool Save(string modtext)