public virtual XVar writeToLogFile(dynamic _param_str) { #region pass-by-value parameters dynamic str = XVar.Clone(_param_str); #endregion dynamic fsize = null, fullname = null, logfileExt = null, logfileName = null, p = null, str_to_append = null, tn = null; p = XVar.Clone(MVCFunctions.strrpos((XVar)(this.logfile), new XVar("."))); logfileName = XVar.Clone(MVCFunctions.runner_substr((XVar)(this.logfile), new XVar(0), (XVar)(p))); logfileExt = XVar.Clone(MVCFunctions.runner_substr((XVar)(this.logfile), (XVar)(p + 1), (XVar)(MVCFunctions.strlen((XVar)(this.logfile)) - 1))); tn = XVar.Clone(MVCFunctions.Concat(logfileName, "_", CommonFunctions.format_datetime_custom((XVar)(CommonFunctions.db2time((XVar)(MVCFunctions.now()))), new XVar("yyyyMMdd")), ".", logfileExt)); fullname = XVar.Clone(MVCFunctions.getabspath((XVar)(tn))); fsize = new XVar(0); if (XVar.Pack(MVCFunctions.file_exists((XVar)(fullname)))) { fsize = XVar.Clone(MVCFunctions.filesize((XVar)(fullname))); } str_to_append = new XVar(""); if (XVar.Pack(!(XVar)(fsize))) { str_to_append = XVar.Clone(MVCFunctions.Concat(this.columnDate, MVCFunctions.chr(new XVar(9)), this.columnTime, MVCFunctions.chr(new XVar(9)), this.columnIP, MVCFunctions.chr(new XVar(9)), this.columnUser, MVCFunctions.chr(new XVar(9)), this.columnTable, MVCFunctions.chr(new XVar(9)), this.columnAction, MVCFunctions.chr(new XVar(9)), this.columnKey, MVCFunctions.chr(new XVar(9)), this.columnField, MVCFunctions.chr(new XVar(9)), this.columnOldValue, MVCFunctions.chr(new XVar(9)), this.columnNewValue, "\r\n")); } str_to_append = MVCFunctions.Concat(str_to_append, str); MVCFunctions.append_to_file((XVar)(fullname), (XVar)(str_to_append)); return(null); }
protected virtual XVar RTESafe(dynamic _param_text) { #region pass-by-value parameters dynamic text = XVar.Clone(_param_text); #endregion dynamic tmpString = null; tmpString = XVar.Clone(MVCFunctions.trim((XVar)(text))); if (XVar.Pack(!(XVar)(tmpString))) { return(""); } tmpString = XVar.Clone(MVCFunctions.str_replace(new XVar("'"), new XVar("'"), (XVar)(tmpString))); tmpString = XVar.Clone(MVCFunctions.str_replace((XVar)(MVCFunctions.chr(new XVar(10))), new XVar(" "), (XVar)(tmpString))); tmpString = XVar.Clone(MVCFunctions.str_replace((XVar)(MVCFunctions.chr(new XVar(13))), new XVar(" "), (XVar)(tmpString))); return(tmpString); }
public virtual XVar LogAddEvent(dynamic _param_message, dynamic _param_description = null, dynamic _param_str_table = null) { #region default values if (_param_description as Object == null) { _param_description = new XVar(""); } if (_param_str_table as Object == null) { _param_str_table = new XVar(""); } #endregion #region pass-by-value parameters dynamic message = XVar.Clone(_param_message); dynamic description = XVar.Clone(_param_description); dynamic str_table = XVar.Clone(_param_str_table); #endregion dynamic arr = null, retval = null, table = null; retval = new XVar(true); table = XVar.Clone(str_table); arr = XVar.Clone(XVar.Array()); if (XVar.Pack(GlobalVars.globalEvents.exists(new XVar("OnAuditLog")))) { retval = XVar.Clone(GlobalVars.globalEvents.OnAuditLog((XVar)(message), (XVar)(this.var_params), (XVar)(table), (XVar)(arr), (XVar)(arr), (XVar)(arr))); } if (XVar.Pack(retval)) { dynamic str = null, var_params = XVar.Array(); str = XVar.Clone(MVCFunctions.Concat(CommonFunctions.format_datetime_custom((XVar)(CommonFunctions.db2time((XVar)(MVCFunctions.now()))), new XVar("MMM dd,yyyy")), MVCFunctions.chr(new XVar(9)), CommonFunctions.format_datetime_custom((XVar)(CommonFunctions.db2time((XVar)(MVCFunctions.now()))), new XVar("HH:mm:ss")), MVCFunctions.chr(new XVar(9)), var_params[0], MVCFunctions.chr(new XVar(9)), var_params[1], MVCFunctions.chr(new XVar(9)), table, MVCFunctions.chr(new XVar(9)), message, MVCFunctions.chr(new XVar(9)), description, "\r\n")); writeToLogFile((XVar)(str)); } return(retval); }
public virtual XVar LogDelete(dynamic _param_str_table, dynamic _param_values, dynamic _param_keys) { #region pass-by-value parameters dynamic str_table = XVar.Clone(_param_str_table); dynamic values = XVar.Clone(_param_values); dynamic keys = XVar.Clone(_param_keys); #endregion dynamic arr = null, retval = null, table = null; ProjectSettings pSet; retval = new XVar(true); table = XVar.Clone(str_table); pSet = XVar.UnPackProjectSettings(new ProjectSettings((XVar)(str_table))); arr = XVar.Clone(XVar.Array()); if (XVar.Pack(GlobalVars.globalEvents.exists(new XVar("OnAuditLog")))) { retval = XVar.Clone(GlobalVars.globalEvents.OnAuditLog((XVar)(this.strDelete), (XVar)(this.var_params), (XVar)(table), (XVar)(keys), (XVar)(values), (XVar)(arr))); } if (XVar.Pack(retval)) { dynamic key = null, str = null, str_add = null; if (0 < MVCFunctions.count(keys)) { key = new XVar(""); foreach (KeyValuePair <XVar, dynamic> val in keys.GetEnumerator()) { if (key != XVar.Pack("")) { key = MVCFunctions.Concat(key, ","); } key = MVCFunctions.Concat(key, val.Value); } } str = XVar.Clone(MVCFunctions.Concat(CommonFunctions.format_datetime_custom((XVar)(CommonFunctions.db2time((XVar)(MVCFunctions.now()))), new XVar("MMM dd,yyyy")), MVCFunctions.chr(new XVar(9)), CommonFunctions.format_datetime_custom((XVar)(CommonFunctions.db2time((XVar)(MVCFunctions.now()))), new XVar("HH:mm:ss")), MVCFunctions.chr(new XVar(9)), this.var_params[0], MVCFunctions.chr(new XVar(9)), this.var_params[1], MVCFunctions.chr(new XVar(9)), table, MVCFunctions.chr(new XVar(9)), this.strDelete, MVCFunctions.chr(new XVar(9)), key)); str_add = new XVar(""); if (XVar.Pack(logValueEnable((XVar)(str_table)))) { foreach (KeyValuePair <XVar, dynamic> val in values.GetEnumerator()) { dynamic v = null; v = new XVar(""); if (XVar.Pack(CommonFunctions.IsBinaryType((XVar)(pSet.getFieldType((XVar)(val.Key)))))) { v = new XVar("<binary value>"); } else { v = XVar.Clone(MVCFunctions.str_replace((XVar)(new XVar(0, "\r\n", 1, "\n", 2, "\t")), new XVar(" "), (XVar)(val.Value))); if (this.maxFieldLength < MVCFunctions.strlen((XVar)(v))) { v = XVar.Clone(MVCFunctions.runner_substr((XVar)(v), new XVar(0), (XVar)(this.maxFieldLength))); } } str_add = MVCFunctions.Concat(str_add, str, MVCFunctions.chr(new XVar(9)), val.Key, MVCFunctions.chr(new XVar(9)), v, "\r\n"); } } else { str_add = XVar.Clone(MVCFunctions.Concat(str, "\r\n")); } writeToLogFile((XVar)(str_add)); } return(retval); }
public virtual XVar LogEdit(dynamic _param_str_table, dynamic _param_newvalues, dynamic _param_oldvalues, dynamic _param_keys) { #region pass-by-value parameters dynamic str_table = XVar.Clone(_param_str_table); dynamic newvalues = XVar.Clone(_param_newvalues); dynamic oldvalues = XVar.Clone(_param_oldvalues); dynamic keys = XVar.Clone(_param_keys); #endregion dynamic retval = null, table = null; ProjectSettings pSet; retval = new XVar(true); table = XVar.Clone(str_table); pSet = XVar.UnPackProjectSettings(new ProjectSettings((XVar)(str_table))); if (XVar.Pack(GlobalVars.globalEvents.exists(new XVar("OnAuditLog")))) { retval = XVar.Clone(GlobalVars.globalEvents.OnAuditLog((XVar)(this.strEdit), (XVar)(this.var_params), (XVar)(table), (XVar)(keys), (XVar)(newvalues), (XVar)(oldvalues))); } if (XVar.Pack(retval)) { dynamic key = null, putsValue = null, str = null, str_add = null; if (0 < MVCFunctions.count(keys)) { key = new XVar(""); foreach (KeyValuePair <XVar, dynamic> val in keys.GetEnumerator()) { if (key != XVar.Pack("")) { key = MVCFunctions.Concat(key, ","); } key = MVCFunctions.Concat(key, val.Value); } } str = XVar.Clone(MVCFunctions.Concat(CommonFunctions.format_datetime_custom((XVar)(CommonFunctions.db2time((XVar)(MVCFunctions.now()))), new XVar("MMM dd,yyyy")), MVCFunctions.chr(new XVar(9)), CommonFunctions.format_datetime_custom((XVar)(CommonFunctions.db2time((XVar)(MVCFunctions.now()))), new XVar("HH:mm:ss")), MVCFunctions.chr(new XVar(9)), this.var_params[0], MVCFunctions.chr(new XVar(9)), this.var_params[1], MVCFunctions.chr(new XVar(9)), table, MVCFunctions.chr(new XVar(9)), this.strEdit, MVCFunctions.chr(new XVar(9)), key)); putsValue = new XVar(true); str_add = new XVar(""); if (XVar.Pack(logValueEnable((XVar)(str_table)))) { foreach (KeyValuePair <XVar, dynamic> val in newvalues.GetEnumerator()) { dynamic newvalue = null, oldvalue = null, var_type = null; var_type = XVar.Clone(pSet.getFieldType((XVar)(val.Key))); if (XVar.Pack(CommonFunctions.IsBinaryType((XVar)(var_type)))) { continue; } if (XVar.Pack(CommonFunctions.IsDateFieldType((XVar)(var_type)))) { newvalue = XVar.Clone(CommonFunctions.format_datetime_custom((XVar)(CommonFunctions.db2time((XVar)(newvalues[val.Key]))), new XVar("yyyy-MM-dd HH:mm:ss"))); oldvalue = XVar.Clone(CommonFunctions.format_datetime_custom((XVar)(CommonFunctions.db2time((XVar)(oldvalues[val.Key]))), new XVar("yyyy-MM-dd HH:mm:ss"))); } else { newvalue = XVar.Clone(newvalues[val.Key]); oldvalue = XVar.Clone(oldvalues[val.Key]); } if (newvalue != oldvalue) { dynamic v1 = null, v2 = null; v1 = new XVar(""); if (XVar.Pack(CommonFunctions.IsBinaryType((XVar)(var_type)))) { v1 = new XVar("<binary value>"); } else { v1 = XVar.Clone(MVCFunctions.str_replace((XVar)(new XVar(0, "\r\n", 1, "\n", 2, "\t")), new XVar(" "), (XVar)(oldvalue))); if (this.maxFieldLength < MVCFunctions.strlen((XVar)(v1))) { v1 = XVar.Clone(MVCFunctions.runner_substr((XVar)(v1), new XVar(0), (XVar)(this.maxFieldLength))); } } v2 = new XVar(""); if (XVar.Pack(CommonFunctions.IsBinaryType((XVar)(var_type)))) { v2 = new XVar("<binary value>"); } else { v2 = XVar.Clone(MVCFunctions.str_replace((XVar)(new XVar(0, "\r\n", 1, "\n", 2, "\t")), new XVar(" "), (XVar)(newvalue))); if (this.maxFieldLength < MVCFunctions.strlen((XVar)(v2))) { v2 = XVar.Clone(MVCFunctions.runner_substr((XVar)(v2), new XVar(0), (XVar)(this.maxFieldLength))); } } str_add = MVCFunctions.Concat(str_add, str, MVCFunctions.chr(new XVar(9)), val.Key, MVCFunctions.chr(new XVar(9)), v1, MVCFunctions.chr(new XVar(9)), v2, "\r\n"); } } } else { str_add = MVCFunctions.Concat(str_add, str, "\r\n"); } writeToLogFile((XVar)(str_add)); } return(retval); }