Created
December 4, 2019 15:30
-
-
Save wickdninja/29befc54d7f5f2a83a506819c73cb814 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// SQL TO FIND PAYMENT | |
// select PayToAccount,PayFromAccount,PayToName,memo,shardkey,amount,payfrom,* from Payments where CollectionDate = '12/04/2019' and amount = 500 | |
// TEST TO FIX PAYMENT | |
[Test] | |
public void Remove_Special_Character() | |
{ | |
Guid paymentID = new Guid("871fa1b5-0b49-4444-8bde-17595fea7340"); | |
string pattern = @"[^a-zA-Z0-9\s\.\-\&\'\(\)\/\\\:\,\#\$\;\!\+\|]|[\t\u00a0]"; | |
Regex reg = new Regex(pattern); | |
string[] paymentIDs = new string[] | |
{ | |
}; | |
string payToAccount = ""; | |
string payFromAccount = ""; | |
string payToName = ""; | |
string memo = ""; | |
string payFrom = ""; | |
string amount = ""; | |
using (UserContext.AsSystem()) | |
{ | |
//foreach (string paymentID in paymentIDs) | |
//{ | |
using (var uow = UnitOfWork.Create()) | |
{ | |
var payment = Factory.GetById<Payment>(paymentID); | |
payToAccount = payment.PayToAccount; | |
payment.ChangePayToAccountNumber(reg.Replace(payment.PayToAccount, "")); | |
if (!string.Equals(payToAccount, payment.PayToAccount)) Console.WriteLine($"{payment.Id} PayToAccount"); | |
payFromAccount = payment.PayFromAccount; | |
payment.ChangePayFromBankAccount(reg.Replace(payment.PayFromAccount, ""), payment.PayFromRtn, payment.PayFromBankAccountDescription, true); | |
if (!string.Equals(payFromAccount, payment.PayFromAccount)) Console.WriteLine($"{payment.Id} PayFromAccount"); | |
payToName = payment.PayToName; | |
payment.ChangePayToName(reg.Replace(payment.PayToName, "")); | |
if (!string.Equals(payToName, payment.PayToName)) Console.WriteLine($"{payment.Id} PayToName"); | |
if (!string.IsNullOrEmpty(payment.Memo)) | |
{ | |
memo = payment.Memo; | |
payment.ModifyMemo(reg.Replace(payment.Memo, "")); | |
if (!string.Equals(memo, payment.Memo)) Console.WriteLine($"{payment.Id} PayToName"); | |
} | |
payFrom = payment.PayFrom; | |
payment.ChangePayFromAddressAndName(reg.Replace(payment.PayFrom, ""), payment.GetPayFromAddress()); | |
if (!string.Equals(payFrom, payment.PayFrom)) Console.WriteLine($"{payment.Id} PayFrom"); | |
//uow.Accept(); | |
} | |
//} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment