当前位置: 首页>>代码示例>>C#>>正文


C# ActionResult.EnsureJsonCompatibility方法代码示例

本文整理汇总了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;
 }
开发者ID:mehedi09,项目名称:GridWork,代码行数:101,代码来源:Controller.Core.cs


注:本文中的ActionResult.EnsureJsonCompatibility方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。