/// <summary> /// /// </summary> /// <param name="message"></param> /// <param name="type"></param> string InsertNewMessage(string message) { string type = "01"; message = ParseCorrectMessage(message, out type); string cdMsg = string.Empty; OracleDacHelper db = null; OracleTransaction trans = null; try { db = new OracleDacHelper(); trans = db.BeginTransaction(); var query = "SELECT NVL(MAX(CD_MSG),'00000') FROM SYT012T WHERE CD_MSG_DIV = 'A' AND CD_BIZ_DIV = 'PS'"; var max = db.ExecuteScalar(query, null, null, trans); int nm = TypeHelper.ToInt32(max) + 1; cdMsg = nm.ToString("d5"); query = string.Format(@"INSERT INTO SYT012T(CD_MSG_DIV,CD_BIZ_DIV,CD_MSG,CD_MSG_TYPE,NM_MSG_TITLE,NM_MSG, NM_DESC,FG_USE,DT_CRTN,NO_CRTN,DT_CHG,NO_CHG,TT_IUDT) VALUES('A','PS',:CD_MSG,:MSG_TYPE,' ',:NM_MSG, '','1',sysdate,'9999999',sysdate,'9999999','{0:yyyyMMddHHmmss}')", DateTime.Now); db.ExecuteNonQuery(query, new string[] { ":CD_MSG", ":MSG_TYPE", ":NM_MSG" }, new object[] { cdMsg, type, message }, trans); trans.Commit(); } catch (Exception ex) { new LogFileHandler().LogException(ex); trans.Rollback(); } finally { db.Dispose(); trans.Dispose(); } return(cdMsg); }
string FindMessageCode(string message) { string type = string.Empty; string msg = ParseCorrectMessage(message, out type); try { using (var dac = new OracleDacHelper()) { var query = "SELECT CD_MSG FROM SYT012T WHERE CD_MSG_DIV = 'A' AND CD_BIZ_DIV = 'PS' AND NM_MSG = :NM_MSG"; var code = dac.ExecuteScalar(query, new string[] { ":NM_MSG" }, new object[] { msg }); string codeMsg = string.Empty; bool found = code != null && !string.IsNullOrEmpty(code.ToString()); if (!found) { codeMsg = InsertNewMessage(message); } else { codeMsg = code.ToString(); } return(string.Format("WSWD.WmallPos.FX.Shared.ConfigData.Current.SysMessage.GetMessage(\"{0}\")", codeMsg)); } } catch (Exception ex) { new LogFileHandler().LogException(ex); } finally { } return(string.Empty); }