Example #1
0
        public async Task <IActionResult> OnGetAsync(int?id)
        {
            string currentUser = HttpContext.User.Identity.Name.ToUpper();

            string[] currentUserFormat = currentUser.Split("\\");
            string   currentNameOnly   = currentUserFormat[1];

            string[] fullAccessUsers = _configuration.GetValue <string>("FullAccess").ToUpper().Split(";");

            foreach (var fullAccessUser in fullAccessUsers)
            {
                if (currentNameOnly == fullAccessUser)
                {
                    if (id == null)
                    {
                        return(NotFound());
                    }

                    CertificateCategory = await _context.CertificateCategory.FirstOrDefaultAsync(m => m.CertificateCategoryID == id);

                    if (CertificateCategory == null)
                    {
                        return(NotFound());
                    }
                    return(Page());
                }
            }

            return(RedirectToPage("/Error"));
        }
Example #2
0
 public static ICertificateOutRepository GetRepository(CertificateCategory category, AdoProxy ado)
 {
     switch (category)
     {
         default:
             return null;
     }
 }
Example #3
0
        public async Task <int> Handle(CreateCertificateCategoriesCommand request, CancellationToken cancellationToken)
        {
            var entity = new CertificateCategory
            {
                CertificateCategoryName = request.CertificateCategoryName,
                ActiveFlag = request.ActiveFlag,
                CreatedBy  = request.CreatedBy,
                CreatedOn  = _dateTime.Now
            };
            await _context.CertificateCategory.AddAsync(entity);

            await _context.SaveChangesAsync(cancellationToken);

            return(entity.CertificateCategoryId);
        }
Example #4
0
        public async Task <IActionResult> OnGetAsync(int?id)
        {
            if (id == null)
            {
                return(NotFound());
            }

            CertificateCategory = await _context.CertificateCategory.FirstOrDefaultAsync(m => m.CertificateCategoryID == id);

            if (CertificateCategory == null)
            {
                return(NotFound());
            }
            return(Page());
        }
Example #5
0
        public async Task <IActionResult> OnPostAsync(int?id)
        {
            if (id == null)
            {
                return(NotFound());
            }

            CertificateCategory = await _context.CertificateCategory.FindAsync(id);

            if (CertificateCategory != null)
            {
                _context.CertificateCategory.Remove(CertificateCategory);
                await _context.SaveChangesAsync();
            }

            return(RedirectToPage("./Index"));
        }
 public static ICertificateOutRepository GetRepository(CertificateCategory category, AdoProxy ado)
 {
     switch (category)
     {
         case CertificateCategory.MiChkInv:
             return new MiChkInvOutRepository(ado);
         case CertificateCategory.MiCommOver:
             return new MiCommOverOutRepository(ado);
         case CertificateCategory.MiCommLost:
             return new MiCommLostOutRepository(ado);
         case CertificateCategory.MiStockMove:
             return new MiStockMoveOutRepository(ado);
         case CertificateCategory.MINPI:
             return new MINPIOutRepository(ado);
         case CertificateCategory.MiPI:
             return new MiPIOutRepository(ado);
         case CertificateCategory.MIAccountCfm:
             return new MIAccountCfmOutRepository(ado);
         default:
             return null;
     }
 }