GetTime() приватный Метод

private GetTime ( ) : DateTime
Результат DateTime
Пример #1
0
 public override void Process(TagHelperContext context, TagHelperOutput output)
 {
     output.TagName = "div";
     output.Attributes.SetAttribute("class", "timer");
     output.Attributes.SetAttribute("style", $"color:{Color};");
     output.Content.SetContent($"Текущее время: {_service.GetTime()}");
 }
        // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
        public void Configure(IApplicationBuilder app, IMessageSender sender, TimeService timeService)
        {
            app.UseMiddleware <CounterMiddleware>();

            app.Run(async ctx =>
            {
                ctx.Response.ContentType = "text/plain;charset=utf-8";
                await ctx.Response.WriteAsync($"—ообщение: {sender.Send()}, {timeService.GetTime()}");
            });
        }
 public IViewComponentResult Invoke(bool includeSeconds)
 {
     if (includeSeconds)
     {
         return(Content($"Текущее время: {_service.GetTime()}"));
     }
     else
     {
         return(Content($"Текущее время: {DateTime.Now.ToString("hh:mm")}"));
     }
 }
Пример #4
0
 public async Task Invoke(HttpContext context)
 {
     if (context.Request.Path.Value.ToLower() == "/time")
     {
         await context.Response.WriteAsync($"Текущее время: {_timeService?.GetTime()}");
     }
     else
     {
         await _next.Invoke(context);
     }
 }
Пример #5
0
        // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
        public void Configure(IApplicationBuilder app, IHostingEnvironment env,
                              TimeService timeService)
        {
            if (env.IsDevelopment())
            {
                app.UseDeveloperExceptionPage();
            }

            app.Run(async(context) =>
            {
                //await context.Response.WriteAsync(messageSender.Send());
                context.Response.ContentType = "text/html; charset=utf-8";
                await context.Response.WriteAsync($"Текущее время: {timeService?.GetTime()}");
            });
        }
        public async Task <ActionResult <dynamic> > Get()
        {
            try
            {
                var timeService = new TimeService(new CustomHttpClient());
                var time        = await timeService.GetTime();

                dynamic result = new System.Dynamic.ExpandoObject();
                result.Time = time.CurrentDateTime;
                return(new ActionResult <dynamic>(result));
            }
            catch
            {
                return(StatusCode(500));
            }
        }
        public TimeReturnValue GetTime(HostSecurityToken oHostSecurityToken, int timeId)
        {
            TimeReturnValue returnValue = null;

            if (Functions.ValidateIWSToken(oHostSecurityToken))
            {
                oTimeService = new TimeService();
                returnValue  = oTimeService.GetTime(Functions.GetLogonIdFromToken(oHostSecurityToken), timeId);
            }
            else
            {
                returnValue         = new TimeReturnValue();
                returnValue.Success = false;
                returnValue.Message = "Invalid Token";
            }
            return(returnValue);
        }
Пример #8
0
        // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
        public void Configure(IApplicationBuilder app, IWebHostEnvironment env, TimeService timeService)
        {
            app.UseMiddleware <CounterMiddleware>();
            app.Run(async context =>
            {
                var sb = new StringBuilder();
                sb.Append("<h1>Все сервисы</h1>");
                sb.Append("<table>");
                sb.Append("<tr><th>Тип</th><th>Lifetime</th><th>Реализация</th></tr>");
                foreach (var svc in _services)
                {
                    sb.Append("<tr>");
                    sb.Append($"<td>{svc.ServiceType.FullName}</td>");
                    sb.Append($"<td>{svc.Lifetime}</td>");
                    sb.Append($"<td>{svc.ImplementationType?.FullName}</td>");
                    sb.Append("</tr>");
                }
                sb.Append("</table>");
                sb.Append($"<H1>Текущее время: {timeService?.GetTime()}</H1>");
                context.Response.ContentType = "text/html;charset=utf-8";

                await context.Response.WriteAsync(sb.ToString());
            });
        }
Пример #9
0
 public async Task Invoke(HttpContext context)
 {
     context.Response.ContentType = "text/html; charset=utf-8";
     await context.Response.WriteAsync($"Текущее время: {_timeService?.GetTime()}");
 }
Пример #10
0
 void SynchronousButton_Click(object sender, EventArgs e)
 {
     SynchronousLabel.Text = _timeService.GetTime();
 }
Пример #11
0
        public IActionResult Index()
        {
            ViewBag.Message = _timeService.GetTime() + " " + _messageSender.Send();

            return(View());
        }
 public TimeReturnValue GetTime(HostSecurityToken oHostSecurityToken, int timeId)
 {
     TimeReturnValue returnValue = null;
     if (Functions.ValidateIWSToken(oHostSecurityToken))
     {
         oTimeService = new TimeService();
         returnValue = oTimeService.GetTime(Functions.GetLogonIdFromToken(oHostSecurityToken), timeId);
     }
     else
     {
         returnValue = new TimeReturnValue();
         returnValue.Success = false;
         returnValue.Message = "Invalid Token";
     }
     return returnValue;
 }
Пример #13
0
 public object Get() => TimeService.GetTime <ClockModel>();
 public TimeModel Get() => TimeService.GetTime <BrokenClockModel>();