Ejemplo n.º 1
0
            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
                );
            }
Ejemplo n.º 2
0
            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);
			}
		}
Ejemplo n.º 5
0
 private void CreateRoteCallback(ActionResult actionResult)
 {
     if (actionResult != null)
     {
         Application.LoadLevelAsync("MainScene");
     }
 }
Ejemplo n.º 6
0
        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()));
            }
        }
Ejemplo n.º 7
0
 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;
 }
Ejemplo n.º 8
0
 private void RegistCallback(ActionResult actionResult)
 {
     if (actionResult != null)
     {
         user = actionResult["passportID"];
         pwd = actionResult["password"];
     }
 }
Ejemplo n.º 9
0
 private void RegistCallback(ActionResult actionResult)
 {
     if (actionResult != null)
     {
         user = actionResult.Get<string>("passportID");
         pwd = actionResult.Get<string>("password");
     }
 }
Ejemplo n.º 10
0
 void OnRankingCallback(ActionResult actionResult)
 {
     Response1001Pack pack = actionResult.GetValue<Response1001Pack>();
     if (pack == null)
     {
         return;
     }
     rankList = pack.Items;
 }
Ejemplo n.º 11
0
 private void LoginCallback(ActionResult actionResult)
 {
     if (actionResult != null && int.Parse(actionResult["GuideID"]) == (int)ActionType.CreateRote)
     {
         Application.LoadLevelAsync("RoleScene");
         return;
     }
        Application.LoadLevelAsync("MainScene");
 }
Ejemplo n.º 12
0
 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));
     }
 }
Ejemplo n.º 13
0
 public void OnMicrochipFirstTaken()
 {
     EventHandler<EntityEventArgs> handler = MicrochipFirstTaken;
     if (handler != null)
     {
         var result = new ActionResult();
         result.IsSuccessful = true;
         handler(this, new EntityEventArgs(result));
     }
 }
Ejemplo n.º 14
0
        public ResultExecutingContext(ControllerContext controllerContext, ActionResult result)
            : base(controllerContext)
        {
            if (result == null)
            {
                throw new ArgumentNullException("result");
            }

            Result = result;
        }
Ejemplo n.º 15
0
 public void OnPlayerFirstInspected()
 {
     EventHandler<EntityEventArgs> handler = PlayerFirstInspected;
     if (handler != null)
     {
         var result = new ActionResult();
         result.IsSuccessful = true;
         handler(this, new EntityEventArgs(result));
     }
 }
Ejemplo n.º 16
0
    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;
    }
Ejemplo n.º 17
0
        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;
        }
Ejemplo n.º 18
0
 public override Action getNextAction(ref ActionResult result)
 {
     if (nextAction == null)
     {
         result = ActionResult.PlayerWait;
         return null;
     }
     else
     {
         energy = ENERGY_THRESHOLD;
         return base.getNextAction(ref result);
     }
 }
Ejemplo n.º 19
0
    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));
        }
    }
Ejemplo n.º 20
0
 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");
 }
Ejemplo n.º 21
0
 public override Action getNextAction(ref ActionResult result)
 {
     if (nextAction == null)
     {
         if (_canSeePlayer)
         {
             setNextAction(new MoveTowardHeroAction());
         }
         else
         {
             setNextAction(new MoveRandomlyAction());
         }
     }
     return base.getNextAction(ref result);
 }
Ejemplo n.º 22
0
 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;
        }
Ejemplo n.º 25
0
        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;
        }
Ejemplo n.º 26
0
 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");
 }
Ejemplo n.º 27
0
        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;
            }
        }
Ejemplo n.º 28
0
    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);
    }
Ejemplo n.º 29
0
 public static void ShouldBeView <TModel>(this ActionResult actionResult, TModel model, string viewName = "")
 {
     actionResult.ShouldBeView(viewName);
     actionResult.ShouldBeModel(model);
 }
Ejemplo n.º 30
0
 public IServiceSetAction OnSuccess(ActionResult actionResult, bool isFragmentAtion = true)
 {
     _onSuccess = actionResult;
     _onSuccessIsFragmentAction = isFragmentAtion;
     return this;
 }
Ejemplo n.º 31
0
 public ActionResult <UserInfo> Get(ActionResult <UserInfo> data)
 {
     return(data);
 }
Ejemplo n.º 32
0
 public static void ShouldBeIncodingData <TData>(this ActionResult actionResult, TData data)
 {
     ShouldBeIncodingData <TData>(actionResult, r => r.ShouldEqualWeak(data));
 }
Ejemplo n.º 33
0
 public static void ShouldBeModel <TModel>(this ActionResult actionResult, TModel expected)
 {
     ShouldBeModel <TModel>(actionResult, model => model.ShouldEqualWeak(expected));
 }
Ejemplo n.º 34
0
 public static void ShouldBeIncodingDataIsNull(this ActionResult actionResult)
 {
     ShouldBeIncoding(actionResult, data => data.data.ShouldBeNull());
 }
Ejemplo n.º 35
0
 public static void ShouldBeIncodingSuccess(this ActionResult actionResult)
 {
     ShouldBeIncoding(actionResult, data => data.success.ShouldBeTrue());
 }
Ejemplo n.º 36
0
        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();
        }
Ejemplo n.º 37
0
        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)));
            }
        }
Ejemplo n.º 38
0
 public IServiceSetAction OnFailure(ActionResult actionResult, bool isFragmentAtion = true)
 {
     _onFailure = actionResult;
     _onFailureIsFragmentAction = isFragmentAtion;
     return this;
 }
Ejemplo n.º 39
0
 public static void ShouldBeIncodingRedirect(this ActionResult actionResult, string redirectTo)
 {
     ShouldBeIncoding(actionResult, data => data.redirectTo.ShouldEqual(redirectTo));
 }
Ejemplo n.º 40
0
 public static void ShouldBeIncodingSuccess <TData>(this ActionResult actionResult, Action <TData> verify)
 {
     ShouldBeIncoding(actionResult, data => data.success.ShouldBeTrue());
     ShouldBeIncodingData(actionResult, verify);
 }
Ejemplo n.º 41
0
 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));
        }
Ejemplo n.º 43
0
 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);
        }