public async Task <IActionResult> Edit(int id, [Bind("EventsId,Information")] EventsInfo eventsInfo)
        {
            if (id != eventsInfo.EventsId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(eventsInfo);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!EventsInfoExists(eventsInfo.EventsId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction("Index"));
            }
            return(View(eventsInfo));
        }
示例#2
0
 public TestEventsInfo(EventsInfo r)
 {
     info = r ?? new EventsInfo();
     cancellation = new TestCancellation(info.Cancellation);
     source = new TestEventSource(info.Source);
     target = new TestEventTarget(info.Target);
 }
示例#3
0
 public TestEventsInfo(EventsInfo r)
 {
     info         = r ?? new EventsInfo();
     cancellation = new TestCancellation(info.Cancellation);
     source       = new TestEventSource(info.Source);
     target       = new TestEventTarget(info.Target);
 }
示例#4
0
 internal void UpdateTestEventsInfo(EventsInfo eventsInfo)
 {
     if (eventsInfo.Cancellation != null)
         cancellation = new TestCancellation(eventsInfo.Cancellation);
     if (eventsInfo.Source != null)
         source.UpdateTestEventSource(eventsInfo.Source);
     if (eventsInfo.Target != null)
         target.UpdateTestEventTarget(eventsInfo.Target);
 }
示例#5
0
 public TestEventsInfo(EventsInfo r)
 {
     if (r != null)
         info = r;
     else
         info = new EventsInfo();
     cancellation = new TestCancellation(info.Cancellation);
     source = new TestEventSource(info.Source);
     target = new TestEventTarget(info.Target);
 }
        public async Task <IActionResult> Create([Bind("EventsId,Information")] EventsInfo eventsInfo)
        {
            if (ModelState.IsValid)
            {
                _context.Add(eventsInfo);
                await _context.SaveChangesAsync();

                return(RedirectToAction("Index"));
            }
            return(View(eventsInfo));
        }
示例#7
0
 public TestEventsInfo(EventsInfo r)
 {
     if (r != null)
     {
         info = r;
     }
     else
     {
         info = new EventsInfo();
     }
     cancellation = new TestCancellation(info.Cancellation);
     source       = new TestEventSource(info.Source);
     target       = new TestEventTarget(info.Target);
 }
        public static async Task <EventsInfo> GetLatestEventsInfo(string accessToken)
        {
            var client = new HttpClient();

            client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", accessToken);

            var json = await client.GetStringAsync(Constants.ApiUrl + "Events/GetLatestEventsInfo");

            //var events = JsonConvert.DeserializeObject<List<EventsInfo>>(json);
            dynamic    resp   = JsonConvert.DeserializeObject(json);
            EventsInfo events = resp.ToObject <EventsInfo>();

            return(events);
        }
示例#9
0
 internal void UpdateTestEventsInfo(EventsInfo eventsInfo)
 {
     if (eventsInfo.Cancellation != null)
     {
         cancellation = new TestCancellation(eventsInfo.Cancellation);
     }
     if (eventsInfo.Source != null)
     {
         source.UpdateTestEventSource(eventsInfo.Source);
     }
     if (eventsInfo.Target != null)
     {
         target.UpdateTestEventTarget(eventsInfo.Target);
     }
 }
        // GET: EnquiryEvents/Create
        public async Task <IActionResult> Create(int?id)
        {
            if (HttpContext.Session.GetString("userName") == null)
            {
                ViewData["logintest"] = "0";
            }
            else
            {
                ViewData["logintest"] = "1";
            }
            ViewData["event"] = id;

            EnquiryEvents enquiryEvent = await _context.EnquiryEvents.Include(e => e.Events)
                                         .SingleOrDefaultAsync(m => m.EventsId == id);

            EventsInfo even = enquiryEvent.Events;

            ViewData["eventInfo"] = even.Information;

            return(View());
        }
示例#11
0
        private async Task <bool> AuthorizationService(HttpContext context)
        {
            string tokenStr   = context.Request.Headers["Authorization"].ToString();
            string requestUrl = context.Request.Path.Value;

            bool             isCan        = false;
            bool             isDecryption = false;
            JwtSecurityToken jst          = new JwtSecurityToken();

            // Token是否有效
            isCan = hash.IsCanReadToken(tokenStr);
            try
            {
                // 从 Token 里面解码出 JwtSecurityToken
                jst          = hash.GetJwtSecurityToken(tokenStr);
                isDecryption = true;
            }
            catch { }

            var    claims   = hash.GetClaims(jst);
            var    aud      = claims.FirstOrDefault(x => x.Type == JwtRegisteredClaimNames.Aud).Value;
            string userName = claims.FirstOrDefault(x => x.Type == ClaimTypes.Name).Value;
            string roleName = claims.FirstOrDefault(x => x.Type == ClaimTypes.Role).Value;

            EventsInfo info = new EventsInfo
            {
                UserName = userName,
                RoleName = roleName,
                Url      = requestUrl,
                Issuer   = jst.Issuer,
                Audience = jst.Audiences,
                Token    = tokenStr
            };

            /// 由于已经使用 app.UseAuthorization();,在此之前已经校验完毕,不需要这里在此校验/
            //// 未携带token时
            //if (string.IsNullOrWhiteSpace(tokenStr))
            //{
            //    if (AuthConfig.model.IsLoginAction)
            //    {
            //        context.Response.Redirect(AuthConfig.model.LoginAction);
            //    }
            //    Thread NoToken = new Thread(new ParameterizedThreadStart(_roleEventsHandler.NoToken));
            //    NoToken.Start(info);
            //    return false;
            //}


            // 如果是无效的Token
            if (!isCan)
            {
                loginfailed = AuthConfig.model.scheme.TokenEbnormal;
                Thread TokenEbnormal = new Thread(new ParameterizedThreadStart(_roleEventsHandler.TokenAbnormal));
                TokenEbnormal.Start(info);
                return(false);
            }
            if (!isDecryption)
            {
                Thread TokenEbnormal = new Thread(new ParameterizedThreadStart(_roleEventsHandler.TokenAbnormal));
                TokenEbnormal.Start(info);
                return(false);
            }


            // 校验 颁发主体
            if (!(jst.Issuer == AuthConfig.model.Issuer || aud != AuthConfig.model.Audience))
            {
                loginfailed = AuthConfig.model.scheme.TokenIssued;
                Thread TokenIssued = new Thread(new ParameterizedThreadStart(_roleEventsHandler.TokenIssued));
                TokenIssued.Start(info);
                return(false);
            }

            // 由于已经使用 app.UseAuthorization();,在此之前已经校验时间完毕,不需要这里在此校验
            //// 校验过期时间
            //long nowTime = DateTimeOffset.Now.ToUnixTimeSeconds();
            //// 有效期
            //var expiration = Convert.ToInt64(claims.FirstOrDefault(x => x.Type == ClaimTypes.Expiration).Value);
            //// 颁发时间
            //long issued = expiration + Convert.ToInt64(claims.FirstOrDefault(x => x.Type == JwtRegisteredClaimNames.Iat).Value);

            //// 令牌已过期
            //if (issued < nowTime)
            //{
            //    await _roleEventsHandler.TokenTime(requestUrl, issued, expiration);
            //    return false;
            //}



            // 角色无效
            // 可能后台已经删除了此角色,或者用户被取消此角色
            if (!_manaRole.IsUserToRole(userName, roleName))
            {
                loginfailed = AuthConfig.model.scheme.NoPermissions;
                Thread NoPermissions = new Thread(new ParameterizedThreadStart(_roleEventsHandler.NoPermissions));
                NoPermissions.Start(info);
                return(false);
            }

            // 是否有访问此 API 的权限
            RoleModel apiResource = _manaRole.GetRoleBeApis(roleName);

            if (apiResource == null)
            {
                loginfailed = AuthConfig.model.scheme.NoPermissions;
                Thread NoPermissions = new Thread(new ParameterizedThreadStart(_roleEventsHandler.NoPermissions));
                NoPermissions.Start(info);
                return(false);
            }

            bool isHas = apiResource.Apis.Any(x => x.ApiUrl.ToLower() == requestUrl.ToLower());

            if (!isHas)
            {
                if (AuthConfig.model.IsDeniedAction == true)
                {
                    //无权限时跳转到某个页面
                    context.Response.Redirect(AuthConfig.model.DeniedAction);
                }
                return(false);
            }
            new Thread(new ParameterizedThreadStart(_roleEventsHandler.Success)).Start(info);
            await _roleEventsHandler.End(context);

            return(true);
        }
        public Int32 Generation = 0; // номер поколоения, к которому относятся ОРД

        #endregion Fields

        #region Constructors

        public SharedDataInfo(OracleConnection Connection, FileLogger Log, string UpdatePath, UInt32 UpdateBlockSize, CardScriptPluginsInfo CardScripts)
            : this()
        {
            this.Log = Log;
              // Порядок создания важен. Не менять!
              this.CardScripts = CardScripts == null ? new CardScriptPluginsInfo(Connection, this) : CardScripts; // this - for Log

              PCParameters = new PCParametersInfo(Connection);

              Owners = new OwnersInfo(Connection, this);
              ProcessingCenters = new ProcessingCentersInfo(Connection, this); // this - for Owners, PCParameters

              Calc = new ScriptCalculations(ProcessingCenters.Current.Parameters.RoundingMethod);

              Devices = new DevicesInfo(Connection);
              DevicesGroups = new DevicesGroupsInfo(Connection, this); // this for Devices
              Networks = new NetworksInfo(Connection, this); // this - for Owners, DevicesGroups
              Currencies = new CurrenciesInfo(Connection);
              TimeOffsetPeriods = new TimeOffsetPeriodsInfo(Connection);
              Regions = new RegionsInfo(Connection, this); // this - for Currencies
              RetailSystems = new RetailSystemsInfo(Connection, this); // this - for Owners
              ServicePoints = new ServicePointsInfo(Connection, this); // this - for Regions, Networks, Retail systems
              Terminals = new TerminalsInfo(Connection, this); // this - for Service points, Devices
              ProductGoods = new LogicalProductGoodsInfo(Connection, this); // this - for Retail systems
              ProductGroups = new LogicalProductGroupsInfo(Connection);
              MeasureUnits = new MeasureUnitsInfo(Connection);
              Products = new LogicalProductsInfo(Connection, this); // this - for Groups, MeasureUnits
              Purses = new PursesInfo(this);
              Statuses = new CardStatusesInfo(Connection);
              Parameters = new ParametersInfo(Connection); // параметры скриптов обработки карты
              ParameterSets = new ParameterSetsInfo(Connection, this); // this - for Calc, CardScripts
              Counters = new CountersInfo(Connection, this); // this - for Calc
              Graduations = new GraduationsInfo(Connection, this); // this - for Calc, Products, ProductGroups, Counters
              GraduationGroups = new GraduationGroupsInfo(Connection, this); // this - for Graduations
              Tariffs = new TariffsInfo(Connection, this); // this - for Calc, GraduationGroups, Graduations
              CardRanges = new CardRangesInfo(Connection, this); // this - for ProcessingCenters
              DataElements = new DataElementsInfo(Connection, this); // this - for Owners
              EventActionTypes = new EventActionTypesInfo(Connection);
              Events = new EventsInfo(Connection, this); // this - for Owners, Counters, EventActionTypes
              EmailProviders = new EmailProvidersInfo(Connection, this); // this - for Owners
              SMSProviders = new SMSProvidersInfo(Connection, this); // this - for Owners
              DBVersion = new OnlineDBVersion(Connection, this); // this - for ProcessingCenters.Current

              this.UpdatePath = UpdatePath;
              this.UpdateBlockSize = UpdateBlockSize;
        }