예제 #1
0
 public AuthenticationService(EvaluateContext dbContext, ProtectedSessionStorage storage, IToastService toastService, NavigationManager navigation)
 {
     _db           = dbContext;
     _storage      = storage;
     _toastService = toastService;
     _navigation   = navigation;
 }
예제 #2
0
 public JWTAuthenticationProvider(IHttpClientFactory httpClientFactory, ProtectedSessionStorage protectedSessionStorage,
                                  ITokenService tokenService)
 {
     this._httpClientFactory      = httpClientFactory;
     _tokenService                = tokenService;
     this.protectedSessionStorage = protectedSessionStorage;
 }
        protected override async Task OnInitializedAsync()
        {
            Loader                  = "none";
            NewLoader               = "none";
            model                   = new RegistrationViewModel();
            model.Year              = DateTime.Now.Year.ToString();
            model.GradutionName     = "Graduation";
            model.PostGradutionName = "Post Graduation";
            if (ShowOptions == "B_Ed")
            {
                model.CourseName = "Bachelor of Education";
                IsM_Ed           = false;
                HeadingText      = "B.Ed";
            }
            else
            {
                model.CourseName    = "Master of Education";
                IsM_Ed              = true;
                model.GradutionName = "Bachelor of Education";
                HeadingText         = "M.Ed";
            }

            // To get Email and Mobile Number from DB.
            var authState = await authenticationStateTask;
            var user      = await UserManager.GetUserAsync(authState.User);

            if (user != null)
            {
                model.EmailAddress = user.Email;
                model.MobileNo     = user.PhoneNumber;
            }

            DomicileUksList          = new List <string>();
            FreedomFightersList      = new List <string>();
            DefencePersonalList      = new List <string>();
            PhysicallyChallengesList = new List <string>();
            PunishedByCourtList      = new List <string>();
            DabarredCollegeList      = new List <string>();
            ExamCenterList           = new List <string>();
            GroupList                    = new List <string>();
            MaritalStatusList            = new List <string>();
            NationalityList              = new List <string>();
            CategoryList                 = new List <string>();
            PhysicallyChallengesTypeList = new List <string>();
            GendersList                  = new List <string>();
            StreamList                   = new List <string>();
            CoursesList                  = new List <string>();
            PassingYearList              = new List <string>();
            StateList                    = new List <string>();
            EWS = new List <string>();
            M_EdGraducationRequired = new List <string>();
            await LoadDropDownData();

            await ProtectedSessionStorage.SetAsync("gradu", true);
        }
 public RegistrationEntranceFormBase(IWebHostEnvironment hostingEnvironment, ICenterService centerService,
                                     ProtectedSessionStorage protectedSessionStorage, UserManager <ApplicationUser> userManager, HttpClient httpClient,
                                     IJSRuntime js, DapperService dapperService, IPaymentService paymentService)
 {
     _paymentService         = paymentService;
     _hostingEnvironment     = hostingEnvironment;
     _httpClient             = httpClient;
     CenterService           = centerService;
     ProtectedSessionStorage = protectedSessionStorage;
     UserManager             = userManager;
     Js = js;
     this.dapperService = dapperService;
 }
        protected async Task UploadSignatureAsync(UploadChangeEventArgs args)
        {
            if (args.Files.Any())
            {
                try
                {
                    var file = args.Files.FirstOrDefault();
                    if (file != null)
                    {
                        if (file.FileInfo.Size < 1000 || file.FileInfo.Size > 200000)
                        {
                            await ToastObjRegistration.Show(new ToastModel
                            {
                                Title    = "Error!", Content = "Please upload file in betwen 1 kB to 200 KB!",
                                CssClass = "e-toast-danger", Icon = "e-error toast-icons"
                            });
                        }
                        else
                        {
                            string uniqueFileName = Guid.NewGuid().ToString() + "_" + file.FileInfo.Name;
                            await ProtectedSessionStorage.SetAsync("UniqueSignatureName", uniqueFileName);

                            model.SignatureFile = file;
                        }
                    }
                    else
                    {
                        await ToastObjRegistration.Show(new ToastModel
                        {
                            Title = "Error!", Content = "Please upload the file!", CssClass = "e-toast-danger",
                            Icon  = "e-error toast-icons"
                        });
                    }
                }
                catch (Exception ex)
                {
                    await ToastObjRegistration.Show(new ToastModel
                    {
                        Title = "Error!", Content = ex.Message, CssClass = "e-toast-danger",
                        Icon  = "e-error toast-icons"
                    });
                }
            }
        }
        protected async Task CheckCrimicalRecord(string value)
        {
            if (value == "Yes")
            {
                await ToastObjRegistration.Show(new ToastModel
                {
                    Title    = "Error!",
                    Content  = "You are not eligible!",
                    CssClass = "e-toast-danger",
                    Icon     = "e-error toast-icons"
                });

                await ProtectedSessionStorage.SetAsync("gradu", false);
            }
            else
            {
                await ProtectedSessionStorage.SetAsync("gradu", true);
            }
        }
예제 #7
0
 public CartService(ProtectedSessionStorage session)
 {
     _session = session;
 }
 public MyBlogProtectedBrowserStorage(ProtectedSessionStorage storage)
 {
     Storage = storage;
 }
예제 #9
0
 public RestClient(ProtectedSessionStorage protectedSessionStorage, IConfiguration configuration)
 {
     this.protectedSessionStorage = protectedSessionStorage;
     this.configuration           = configuration;
 }
예제 #10
0
 public CustomAuthStateProvider(ProtectedSessionStorage protectedSessionStorage)
 {
     this.protectedSessionStorage = protectedSessionStorage;
 }
예제 #11
0
 public CustomAuthStateProvider(IHttpClientFactory httpClientFactory, ProtectedSessionStorage protectedSessionStore)
 {
     _protectedSessionStore = protectedSessionStore;
     _httpClientFactory     = httpClientFactory;
 }
        protected async Task RegisterNewFormAsync()
        {
            NewLoader = "inline";
            StateHasChanged();
            try
            {
                var changeEventValue = await ProtectedSessionStorage.GetAsync <bool>("gradu");

                if (changeEventValue)
                {
                    var UniqueSignatureName = await ProtectedSessionStorage.GetAsync <string>("UniqueSignatureName");

                    var UniquePhotoName = await ProtectedSessionStorage.GetAsync <string>("UniquePhotoName");

                    if (!string.IsNullOrEmpty(UniqueSignatureName) && !string.IsNullOrEmpty(UniqueSignatureName))
                    {
                        var authState = await authenticationStateTask;
                        var user      = await UserManager.GetUserAsync(authState.User);

                        //model.UniqueKey = Guid.NewGuid().ToString().GetHashCode().ToString("x");
                        model.UserId = user.Id;
                        var result = await CenterService.InsertRegistrationFormDataAsync(model);

                        if (result == "success")
                        {
                            await ToastObjRegistration.Show(new ToastModel
                            {
                                Title    = "Success!",
                                Content  = "You have submitted your registration form successfully.",
                                CssClass = "e-toast-success",
                                Icon     = "e-success toast-icons"
                            });

                            model      = new RegistrationViewModel();
                            NewLoader  = "none";
                            model.Year = DateTime.Now.Year.ToString();
                            await ProtectedSessionStorage.SetAsync("gradu", true);

                            model.GradutionName     = "Graduation";
                            model.PostGradutionName = "Post Graduation";
                            await Js.CloseModel("modalConfirmDelete");
                        }
                        else if (result == "failure")
                        {
                            NewLoader = "none";
                            await ToastObjRegistration.Show(new ToastModel
                            {
                                Title    = "Error!",
                                Content  = "You are sending bad request, please try again later!",
                                CssClass = "e-toast-danger",
                                Icon     = "e-error toast-icons"
                            });

                            await Js.CloseModel("modalConfirmDelete");
                        }
                        else
                        {
                            NewLoader = "none";
                            await ToastObjRegistration.Show(new ToastModel
                            {
                                Title    = "Error!",
                                Content  = result,
                                CssClass = "e-toast-danger",
                                Icon     = "e-error toast-icons"
                            });

                            await Js.CloseModel("modalConfirmDelete");
                        }
                    }
                    else
                    {
                        NewLoader = "none";
                        await ToastObjRegistration.Show(new ToastModel
                        {
                            Title    = "Error!",
                            Content  = "Please upload both files then try again!",
                            CssClass = "e-toast-danger",
                            Icon     = "e-error toast-icons"
                        });

                        await Js.CloseModel("modalConfirmDelete");
                    }
                }
                else
                {
                    NewLoader = "none";
                    await ToastObjRegistration.Show(new ToastModel
                    {
                        Title    = "Error!",
                        Content  = "You are not eligible!",
                        CssClass = "e-toast-danger",
                        Icon     = "e-error toast-icons"
                    });

                    await Js.CloseModel("modalConfirmDelete");
                }
            }
            catch (Exception ex)
            {
                NewLoader = "none";
                await ToastObjRegistration.Show(new ToastModel
                {
                    Title    = "Error!",
                    Content  = ex.Message,
                    CssClass = "e-toast-danger",
                    Icon     = "e-error toast-icons"
                });

                await Js.CloseModel("modalConfirmDelete");
            }
        }
        protected async Task GraduationPercentageCalc()
        {
            if (model.GradutionObtMarks != "")
            {
                if (model.GradutionMaxMarks != "")
                {
                    double percentage = Convert.ToDouble((Convert.ToInt32(model.GradutionObtMarks) * 100) /
                                                         Convert.ToInt32(model.GradutionMaxMarks));
                    model.GradutionPercentageMarks = percentage.ToString();
                    if (model.Category.ToLower() == "Unreserved General".ToLower())
                    {
                        if (percentage > 50)
                        {
                            await ProtectedSessionStorage.SetAsync("gradu", true);
                        }
                        else
                        {
                            await ToastObjRegistration.Show(new ToastModel
                            {
                                Title    = "Error!",
                                Content  = "You are not eligible!",
                                CssClass = "e-toast-danger",
                                Icon     = "e-error toast-icons"
                            });

                            await ProtectedSessionStorage.SetAsync("gradu", false);
                        }
                    }
                    else
                    {
                        if (percentage > 45)
                        {
                            await ProtectedSessionStorage.SetAsync("gradu", true);
                        }
                        else
                        {
                            await ToastObjRegistration.Show(new ToastModel
                            {
                                Title    = "Error!",
                                Content  = "You are not eligible!",
                                CssClass = "e-toast-danger",
                                Icon     = "e-error toast-icons"
                            });

                            await ProtectedSessionStorage.SetAsync("gradu", false);
                        }
                    }
                }
                else
                {
                    await ToastObjRegistration.Show(new ToastModel
                    {
                        Title    = "Error!",
                        Content  = "Please fill graduation maximum marks!",
                        CssClass = "e-toast-danger",
                        Icon     = "e-error toast-icons"
                    });
                }
            }
            else
            {
                await ToastObjRegistration.Show(new ToastModel
                {
                    Title    = "Error!",
                    Content  = "Please fill graduation obtained marks!",
                    CssClass = "e-toast-danger",
                    Icon     = "e-error toast-icons"
                });
            }
        }