public static void ApplyRoute(RouteCollection routes, ActionResult defaultHandler, string[] namespaces) { routes.MapRoute(HalamanC , "{controller}/{PageIndex}/{PageSize}/{SortField}/{SortOrder}/{id}" , defaultHandler , new { SortOrder = SortDirection.Ascending, id = UrlParameter.Optional } , new { PageIndex = @"\d+", PageSize = @"\d+" } , namespaces: namespaces ); routes.MapRoute(HalamanB , "{controller}/{PageIndex}/{PageSize}/{id}" , defaultHandler , new { id = UrlParameter.Optional } , new { PageIndex = @"\d+", PageSize = @"\d+" } , namespaces: namespaces ); routes.MapRoute(HalamanA , "{controller}/{PageIndex}/{id}" , defaultHandler , new { id = UrlParameter.Optional } , new { PageIndex = @"\d+" } , namespaces: namespaces ); }
public static void ApplyRoute(AreaRegistrationContext context, ActionResult defaultHandler) { string prefix = context.AreaName + "_"; string prefixUrl = context.AreaName + "/"; context.MapRouteArea(prefix + HalamanC , prefixUrl + "{controller}/{PageIndex}/{PageSize}/{SortField}/{SortOrder}/{id}" , defaultHandler , new { SortOrder = SortDirection.Ascending, id = UrlParameter.Optional } , new { PageIndex = @"\d+", PageSize = @"\d+" } ); context.MapRouteArea(prefix + HalamanB , prefixUrl + "{controller}/{PageIndex}/{PageSize}/{id}" , defaultHandler , new { id = UrlParameter.Optional } , new { PageIndex = @"\d+", PageSize = @"\d+" } ); context.MapRouteArea(prefix + HalamanA , prefixUrl + "{controller}/{PageIndex}/{id}" , defaultHandler , new { id = UrlParameter.Optional } , new { PageIndex = @"\d+" } ); }
public DynamicSitemapIndexProviderTests() { dynamicSitemapIndexProvider = new DynamicSitemapIndexProvider(); sitemapProvider = MockFor<ISitemapProvider>(); sitemapIndexConfiguration = MockFor<ISitemapIndexConfiguration<SampleData>>(); expectedResult = new EmptyResult(); }
public void OnFinish (ActionArguments arguments, ActionResult result) { if (callback != null) { callback.Invoke (arguments, result); } }
private void CreateRoteCallback(ActionResult actionResult) { if (actionResult != null) { Application.LoadLevelAsync("MainScene"); } }
public static void WriteAll(ActionResult output, TraceListener listener) { Trace.Listeners.Clear(); Trace.Listeners.Add(new ExtendedConsoleTraceListener()); foreach (var lineOutput in output.Output) { switch (lineOutput.TraceEventType) { case TraceEventType.Error: Trace.TraceError(lineOutput.Message); break; case TraceEventType.Warning: Trace.TraceWarning(lineOutput.Message); break; default: Trace.WriteLine(lineOutput.Message); break; } } if (output.Value != null) { Trace.TraceInformation(string.Format("=> {0}", output.Value.ToString())); } }
public override ActionResult POST(System.Net.HttpListenerContext context, string httpActionPath) { FileRepository.SaveFile(context); var result = new ActionResult(); result.HttpStatusCode = System.Net.HttpStatusCode.Redirect; result.Headers.Add(Tuple.Create("Location", "/")); return result; }
private void RegistCallback(ActionResult actionResult) { if (actionResult != null) { user = actionResult["passportID"]; pwd = actionResult["password"]; } }
private void RegistCallback(ActionResult actionResult) { if (actionResult != null) { user = actionResult.Get<string>("passportID"); pwd = actionResult.Get<string>("password"); } }
void OnRankingCallback(ActionResult actionResult) { Response1001Pack pack = actionResult.GetValue<Response1001Pack>(); if (pack == null) { return; } rankList = pack.Items; }
private void LoginCallback(ActionResult actionResult) { if (actionResult != null && int.Parse(actionResult["GuideID"]) == (int)ActionType.CreateRote) { Application.LoadLevelAsync("RoleScene"); return; } Application.LoadLevelAsync("MainScene"); }
public void FireEvent(EventHandler<EntityEventArgs> eventToFire) { EventHandler<EntityEventArgs> handler = eventToFire; if (handler != null) { var result = new ActionResult(); result.IsSuccessful = true; handler(this, new EntityEventArgs(result)); } }
public void OnMicrochipFirstTaken() { EventHandler<EntityEventArgs> handler = MicrochipFirstTaken; if (handler != null) { var result = new ActionResult(); result.IsSuccessful = true; handler(this, new EntityEventArgs(result)); } }
public ResultExecutingContext(ControllerContext controllerContext, ActionResult result) : base(controllerContext) { if (result == null) { throw new ArgumentNullException("result"); } Result = result; }
public void OnPlayerFirstInspected() { EventHandler<EntityEventArgs> handler = PlayerFirstInspected; if (handler != null) { var result = new ActionResult(); result.IsSuccessful = true; handler(this, new EntityEventArgs(result)); } }
protected override void DecodePackage(NetReader reader) { actionResult = new ActionResult(); actionResult["passportID"] = reader.readString(); actionResult["password"] = reader.readString(); //TODO:登录服务器获取账号 //var passport = reader.readValue<Passport>(); //actionResult["passportID"] = passport.PassportId; //actionResult["password"] = passport.Password; }
public ResultExecutedContext(ControllerContext controllerContext, ActionResult result, bool canceled, Exception exception) : base(controllerContext) { if (result == null) { throw new ArgumentNullException("result"); } Result = result; Canceled = canceled; Exception = exception; }
public override Action getNextAction(ref ActionResult result) { if (nextAction == null) { result = ActionResult.PlayerWait; return null; } else { energy = ENERGY_THRESHOLD; return base.getNextAction(ref result); } }
public void OnCallback(ActionResult result) { try { if(Callback != null) { Callback(result); } } catch (Exception ex) { Debug.Log(string.Format("Action {0} callback process error:{1}", ActionId, ex)); } }
protected override void DecodePackage(NetReader reader) { actionResult = new ActionResult(); //默认Scut流格式解包 actionResult["RoleID"] = reader.getInt(); actionResult["RoleName"] = reader.readString(); actionResult["HeadImg"] = reader.readString(); actionResult["Sex"] = reader.getByte(); actionResult["LvNum"] = reader.getInt(); actionResult["ExperienceNum"] = reader.getInt(); actionResult["LifeNum"] = reader.getInt(); actionResult["LifeMaxNum"] = reader.getInt(); GameSetting.Instance.RoleName = actionResult.Get<string>("RoleName"); }
public override Action getNextAction(ref ActionResult result) { if (nextAction == null) { if (_canSeePlayer) { setNextAction(new MoveTowardHeroAction()); } else { setNextAction(new MoveRandomlyAction()); } } return base.getNextAction(ref result); }
protected override void DecodePackage(NetReader reader) { actionResult = new ActionResult(); //默认Scut流格式解包 actionResult["SessionID"] = reader.readString(); actionResult["UserID"] = reader.readString(); actionResult["UserType"] = reader.getInt(); actionResult["LoginTime"] = reader.readString(); actionResult["GuideID"] = reader.getInt(); actionResult["PassportId"] = reader.readString(); actionResult["RefeshToken"] = reader.readString(); actionResult["QihooUserID"] = reader.readString(); actionResult["Scope"] = reader.readString(); NetWriter.setUserID(ulong.Parse(actionResult["UserID"].ToString())); NetWriter.setSessionID(actionResult.Get<string>("SessionID")); }
/// <summary> /// 执行 /// </summary> /// <param name="input"></param> /// <returns></returns> public override ActionResult Excute(BInput input) { if(this.m_iRunningIndex >= this.m_lstChildren.Count) { return this.m_eResult; } ActionResult result = this.m_lstChildren[this.m_iRunningIndex].RunNode(input); if(result == ActionResult.FAILURE) { this.m_eResult = ActionResult.FAILURE; } if(result != ActionResult.RUNNING) this.m_iRunningIndex++; return ActionResult.RUNNING; }
public AuthenticationChallengeContext(ControllerContext controllerContext, ActionDescriptor actionDescriptor, ActionResult result) : base(controllerContext) { if (actionDescriptor == null) { throw new ArgumentNullException("actionDescriptor"); } if (result == null) { throw new ArgumentNullException("result"); } _actionDescriptor = actionDescriptor; _result = result; }
public override ActionResult GET(System.Net.HttpListenerContext context, string httpActionPath) { JsonArray files = new JsonArray(); files.AddRange( FileRepository.GetFiles() .Select(f => (JsonValue)new JsonObject { { "Name", f.Name }, { "Size", f.Length }, { "Type", f.Extension }, { "Url", "/files/" + f.Name } }) ); var result = new ActionResult(); result.Data = System.Text.Encoding.UTF8.GetBytes(files.ToString()); result.ContentType = "application/json"; return result; }
protected override void DecodePackage(NetReader reader) { if (!reader.Success) { Debug.LogError(string.Format("Action {0} error {1}-{2}", reader.ActionId, reader.StatusCode, reader.Description)); return; } actionResult = new ActionResult(); //默认Scut流格式解包 actionResult["RoleID"] = reader.getInt(); actionResult["RoleName"] = reader.readString(); actionResult["HeadImg"] = reader.readString(); actionResult["Sex"] = reader.getByte(); actionResult["LvNum"] = reader.getInt(); actionResult["ExperienceNum"] = reader.getInt(); actionResult["LifeNum"] = reader.getInt(); actionResult["LifeMaxNum"] = reader.getInt(); GameSetting.Instance.RoleName = actionResult.Get<string>("RoleName"); }
public virtual Action getNextAction(ref ActionResult result) { if (nextAction == null) { result = ActionResult.Error; return null; } energy += speed; if (energy < ENERGY_THRESHOLD) { result = ActionResult.Wait; return null; } else { energy -= ENERGY_THRESHOLD; result = ActionResult.FetchedAction; Action action = nextAction; nextAction = null; return action; } }
protected override void DecodePackage(NetReader reader) { if (!reader.Success) { Debug.LogError(string.Format("Action {0} error {1}-{2}", reader.ActionId, reader.StatusCode, reader.Description)); return; } actionResult = new ActionResult(); //默认Scut流格式解包 int length = reader.Buffer.Length; while (reader.CurrentPos < reader.Buffer.Length) { int count = reader.getInt(); length -= count; StaticSever server = new StaticSever(); server.Id = reader.getInt(); server.Name = reader.readString(); server.Ip = reader.readString(); server.Port = reader.getInt(); serverList.Add(server); } Debug.Log(serverList); }
public static void ShouldBeView <TModel>(this ActionResult actionResult, TModel model, string viewName = "") { actionResult.ShouldBeView(viewName); actionResult.ShouldBeModel(model); }
public IServiceSetAction OnSuccess(ActionResult actionResult, bool isFragmentAtion = true) { _onSuccess = actionResult; _onSuccessIsFragmentAction = isFragmentAtion; return this; }
public ActionResult <UserInfo> Get(ActionResult <UserInfo> data) { return(data); }
public static void ShouldBeIncodingData <TData>(this ActionResult actionResult, TData data) { ShouldBeIncodingData <TData>(actionResult, r => r.ShouldEqualWeak(data)); }
public static void ShouldBeModel <TModel>(this ActionResult actionResult, TModel expected) { ShouldBeModel <TModel>(actionResult, model => model.ShouldEqualWeak(expected)); }
public static void ShouldBeIncodingDataIsNull(this ActionResult actionResult) { ShouldBeIncoding(actionResult, data => data.data.ShouldBeNull()); }
public static void ShouldBeIncodingSuccess(this ActionResult actionResult) { ShouldBeIncoding(actionResult, data => data.success.ShouldBeTrue()); }
private void ConnectClient(Socket clientSocket) { // Просто создаем новый экземпляр класса Client и передаем ему приведенный к классу TcpClient объект StateInfo //new Client((TcpClient)StateInfo, this); byte[] bytes = new byte[1024]; clientSocket.Receive(bytes); ActionTypeStruct command; var deserializer = new XmlSerializer(typeof(ActionTypeStruct)); using (Stream netstream = new NetworkStream(clientSocket)) { command = (ActionTypeStruct)deserializer.Deserialize(netstream);//.Serialize(netstream, actionID); } bool commandsucceed; lock (thislock) { switch (command.Type) { case ActionType.Increment: commandsucceed = IncValue(); break; case ActionType.Decrement: commandsucceed = DecValue(); break; case ActionType.Flush: commandsucceed = ZeroValue(); break; //Это не нужно,т.к. поступают уже проверенные команды default: throw new Exception("Incorrect incoming request"); commandsucceed = false; break; } } Console.WriteLine(command.Type.ToString() + " is made"); Console.WriteLine("N = {0}", N); //Отправляем результат клиенту ActionResult<ActionTypeStruct> result = new ActionResult<ActionTypeStruct>(command, commandsucceed); var serializer = new XmlSerializer(typeof(ActionResult<ActionTypeStruct>)); using (Stream netstream = new NetworkStream(clientSocket)) { serializer.Serialize(netstream, result); } clientSocket.Shutdown(SocketShutdown.Both); clientSocket.Close(); }
public ActionResult Execute(ArgumentCollection arguments) { List <string> movedFiles = new List <string>(); List <string> failedFiles = new List <string>(); try { // Must provide arguments if (arguments == null) { throw new ArgumentNullException(nameof(arguments)); } if (!arguments.HasArgument(FtpMoveFilesActionExecutionArgs.RemoteFilesCollection)) { throw new MissingArgumentException(FtpMoveFilesActionExecutionArgs.RemoteFilesCollection); } if (!(arguments[FtpMoveFilesActionExecutionArgs.RemoteFilesCollection] is List <string> remotePaths)) { throw new ArgumentsValidationException( $"unable to cast argument value into list of string. key({FtpMoveFilesActionExecutionArgs.RemoteFilesCollection})"); } using (FtpClient ftpClient = new FtpClient(Host, Port, Username, Password)) { if (!string.IsNullOrWhiteSpace(RemoteWorkingDir)) { ftpClient.SetWorkingDirectory(RemoteWorkingDir); } foreach (var remotePath in remotePaths) { try { LoggingService.Debug($"Moving remote file {remotePath} to {DestinationPath}"); if (ftpClient.MoveFile(remotePath, UriHelper.BuildPath(DestinationPath, Path.GetFileName(remotePath)))) { movedFiles.Add(remotePath); } failedFiles.Add(remotePath); } catch (Exception exception) { LoggingService.Error(exception); failedFiles.Add(remotePath); } } } if (movedFiles.Any()) { return(ActionResult.Succeeded() .WithAdditionInformation(ArgumentCollection.New() .WithArgument(FtpMoveFilesActionResultArgs.MovedFiles, movedFiles) .WithArgument(FtpMoveFilesActionResultArgs.FailedFiles, failedFiles) ) ); } return(ActionResult.Failed().WithAdditionInformation( ArgumentCollection.New() .WithArgument(FtpMoveFilesActionResultArgs.MovedFiles, movedFiles) .WithArgument(FtpMoveFilesActionResultArgs.FailedFiles, failedFiles) )); } catch (Exception exception) { LoggingService.Error(exception); return(ActionResult.Failed(exception) .WithAdditionInformation(ArgumentCollection.New() .WithArgument(FtpMoveFilesActionResultArgs.MovedFiles, movedFiles) .WithArgument(FtpMoveFilesActionResultArgs.FailedFiles, failedFiles))); } }
public IServiceSetAction OnFailure(ActionResult actionResult, bool isFragmentAtion = true) { _onFailure = actionResult; _onFailureIsFragmentAction = isFragmentAtion; return this; }
public static void ShouldBeIncodingRedirect(this ActionResult actionResult, string redirectTo) { ShouldBeIncoding(actionResult, data => data.redirectTo.ShouldEqual(redirectTo)); }
public static void ShouldBeIncodingSuccess <TData>(this ActionResult actionResult, Action <TData> verify) { ShouldBeIncoding(actionResult, data => data.success.ShouldBeTrue()); ShouldBeIncodingData(actionResult, verify); }
public static void ShouldBeIncodingFail(this ActionResult actionResult) { ShouldBeIncoding(actionResult, data => data.success.ShouldBeFalse()); }
protected RedirectToRouteResult RedirectToActionPermanent(ActionResult result) { var callInfo = result.GetT4MVCResult(); return(RedirectToRoutePermanent(callInfo.RouteValueDictionary)); }
public void ProcessedAdctionFired(Object sender, ActionResult<ActionTypeStruct> e) { Console.WriteLine("Action" + e.Identificator.Type.ToString() + " is processed"); }
public ActionResult ConsultaLogTransmisionDocumento(RequestBusquedaLogTransmisionDocumentoViewModel filtros, string requestExportar) { ActionResult actionResult = null; var manejadorLogEventos = new ManejadorLogEventos(); try { if (ModelState.IsValid) { if (!string.IsNullOrEmpty(Request.QueryString["export"])) { //ResourceManager rm = new ResourceManager("TRAMARSA.AGMA.ACUERDOCOMERCIAL.Resource.ResourceGrillas", Assembly.GetExecutingAssembly()); //var idGrilla = rm.GetString("IdGrilla_ConsultaPartidaArancelaria"); //filtros = GR.Frameworks.Helper.ConvertirJsonAObjeto<RequestBusquedaPartidaArancelariaViewModel>(requestExportar); //if (idGrilla != null) filtros.paginacionDTO.IdGrilla = new Guid(idGrilla); filtros.paginacionDTO.sord = new HelperDataScriptor().ObtenerCampoOrdenDefault(filtros.paginacionDTO.IdGrilla); //"NroItem";// columnaOrden; filtros.paginacionDTO.rows = 9999; filtros.paginacionDTO.page = 1; var listaRespuesta = new TransmisionesAgente().BusquedaLogTransmisionDocumento(filtros); listaRespuesta.NroPagina = 1; actionResult = HelperCtrl.ExportarExcel(listaRespuesta, listaRespuesta.ListaLogTransmisionDocumento, filtros.paginacionDTO.IdGrilla, "CodigoDocumento", Request.QueryString["export"], Response, "Lista_de_LogTransmisionDocumento_"); } else { var listaCliente = new TransmisionesAgente().BusquedaLogTransmisionDocumento(filtros); if (listaCliente.Result.Satisfactorio) { var totalPages = int.Parse("" + Math.Ceiling(Convert.ToDouble(listaCliente.TotalRegistros) / filtros.paginacionDTO.GetNroFilas())); var res = Grid.toJSONFormat2(listaCliente.ListaLogTransmisionDocumento, filtros.paginacionDTO.GetNroPagina(), listaCliente.TotalRegistros, totalPages, "CodigoDocumento"); actionResult = Content(res); } else { actionResult = Content(Grid.toJSONFormat2(listaCliente.ListaLogTransmisionDocumento, 0, 0, 0, "")); } } } else { var cadena = string.Empty; var objetos = GR.Frameworks.Helper.GetErrorsFromModelState(ref cadena, ModelState); actionResult = Content(Grid.emptyStrJSON(cadena, objetos)); } } catch (Exception ex) { HelperCtrl.GrabarLog(ex, "", PoliticaExcepcion.Win); } finally { manejadorLogEventos.RegistrarTiempoEjecucion("", HelperCtrl.ObtenerAtributosManejadorEventos(ControllerContext.ToString(), MethodBase.GetCurrentMethod().Name, HelperCtrl.ObtenerUsuario())); } return(actionResult); }