本文整理汇总了C#中ActionResult.EnsureJsonCompatibility方法的典型用法代码示例。如果您正苦于以下问题:C# ActionResult.EnsureJsonCompatibility方法的具体用法?C# ActionResult.EnsureJsonCompatibility怎么用?C# ActionResult.EnsureJsonCompatibility使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ActionResult
的用法示例。
在下文中一共展示了ActionResult.EnsureJsonCompatibility方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ActionResult
//.........这里部分代码省略.........
ViewPage page = CreateViewPage();
PopulatePageFields(page);
string originalCommandText = command.CommandText;
foreach (string sv in args.SelectedValues)
{
result.Canceled = false;
_serverRules.ClearBlackAndWhiteLists();
string[] key = sv.Split(',');
int keyIndex = 0;
foreach (FieldValue v in args.Values)
{
DataField field = page.FindField(v.Name);
if (field != null)
if (!(field.IsPrimaryKey))
v.Modified = true;
else
if (v.Name == field.Name)
{
v.OldValue = key[keyIndex];
v.Modified = false;
keyIndex++;
}
}
ExecutePreActionCommands(args, result, connection);
if (handler != null)
handler.BeforeSqlAction(args, result);
else
_serverRules.ExecuteServerRules(args, result, ActionPhase.Before);
if ((result.Errors.Count == 0) && !(result.Canceled))
{
ConfigureCommand(command, null, args.SqlCommandType, args.Values);
result.RowsAffected = (result.RowsAffected + TransactionManager.ExecuteNonQuery(command));
if (handler != null)
handler.AfterSqlAction(args, result);
else
_serverRules.ExecuteServerRules(args, result, ActionPhase.After);
command.CommandText = originalCommandText;
command.Parameters.Clear();
if (_config.PlugIn != null)
_config.PlugIn.ProcessArguments(args, result, page);
}
}
}
else
{
ExecutePreActionCommands(args, result, connection);
if (handler != null)
handler.BeforeSqlAction(args, result);
else
_serverRules.ExecuteServerRules(args, result, ActionPhase.Before);
if ((result.Errors.Count == 0) && !(result.Canceled))
{
if (ConfigureCommand(command, null, args.SqlCommandType, args.Values))
{
result.RowsAffected = TransactionManager.ExecuteNonQuery(args, result, CreateViewPage(), command);
if (result.RowsAffected == 0)
{
result.RowNotFound = true;
result.Errors.Add(Localizer.Replace("RecordChangedByAnotherUser", "The record has been changed by another user."));
}
else
ExecutePostActionCommands(args, result, connection);
}
if (handler != null)
handler.AfterSqlAction(args, result);
else
_serverRules.ExecuteServerRules(args, result, ActionPhase.After);
if (_config.PlugIn != null)
_config.PlugIn.ProcessArguments(args, result, CreateViewPage());
}
}
}
else
if (args.CommandName.StartsWith("Export"))
ExecuteDataExport(args, result);
else
if (args.CommandName.Equals("PopulateDynamicLookups"))
PopulateDynamicLookups(args, result);
else
if (args.CommandName.Equals("ProcessImportFile"))
ImportProcessor.Execute(args);
else
if (args.CommandName.Equals("Execute"))
using (DbConnection connection = CreateConnection())
{
DbCommand command = CreateCommand(connection, args);
TransactionManager.ExecuteNonQuery(command);
}
else
_serverRules.ProcessSpecialActions(args, result);
}
catch (Exception ex)
{
if (ex.GetType() == typeof(System.Reflection.TargetInvocationException))
ex = ex.InnerException;
HandleException(ex, args, result);
}
result.EnsureJsonCompatibility();
return result;
}