當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。