private void ClearAllCollections()
 {
     try
     {
         if (MyMaps != null)
         {
             MyMaps.Clear();
         }
         if (FeaturedItems != null)
         {
             FeaturedItems.Clear();
         }
         if (RecentItems != null)
         {
             RecentItems.Clear();
         }
         if (MostPopularItems != null)
         {
             MostPopularItems.Clear();
         }
         if (FavoriteItems != null && (FavoriteItems.Items != null && FavoriteItems.Items.Count > 0))
         {
             FavoriteItems.Items.Clear();
         }
         if (PortalGroups != null)
         {
             PortalGroups.Clear();
         }
     }
     catch (Exception ex)
     {
         var _ = App.ShowExceptionDialog(ex);
     }
 }
Пример #2
0
        private void More_Click(object sender, EventArgs e)
        {
            EventResume template      = (EventResume)((Control)sender).Parent;
            EventDetail myEventDetail = new EventDetail(template.MyEvent);

            pnl_EventDetails.Controls.Add(myEventDetail);
            MyMaps.Hide();
        }
Пример #3
0
        public async Task GetEmployeesTest()
        {
            MyMaps.Initialize();

            _IEmployeeRepository = new EmployeeRepository();

            EmployeeLogic obj       = new EmployeeLogic(_IEmployeeRepository);
            var           respuesta = obj.GetAll();

            Assert.IsTrue(respuesta.Result.Count() > 1);

            MyMaps.TearDown();
        }
Пример #4
0
        protected override void OnAppearing()
        {
            base.OnAppearing();
            MyMaps.MoveToRegion(MapSpan.FromCenterAndRadius(new Position(-12.0463731, -77.042754), Distance.FromKilometers(1000)));
            var pin = new Pin
            {
                Position = new Position(-12.0463731, -77.042754),
                Label    = "Position 1",
                Address  = "Address 1"
            };

            MyMaps.Pins.Add(pin);
        }
Пример #5
0
        public async Task GetEmployeesByIdTest()
        {
            MyMaps.Initialize();

            int expectedvalue = 1;

            _IEmployeeRepository = new EmployeeRepository();

            EmployeeLogic obj       = new EmployeeLogic(_IEmployeeRepository);
            var           respuesta = obj.GetById(1);

            Assert.AreEqual(expectedvalue, respuesta.Result.Count());

            MyMaps.TearDown();
        }
Пример #6
0
        // This method gets called by the runtime. Use this method to add services to the container.
        public void ConfigureServices(IServiceCollection services)
        {
            services.AddDbContext <ApplicationDbContext>(
                options => options.UseSqlServer(Configuration.GetConnectionString("DefaultConnection"))
                );

            services.AddMyDependencies(Configuration);

            services.AddAuthentication("Bearer")
            .AddIdentityServerAuthentication(options =>
            {
                options.Authority            = Configuration["Auth:Url"];
                options.RequireHttpsMetadata = false;
                options.ApiName = Configuration["Auth:ApiName"];

                // Agregamos esto para especificar donde se encuentra el role
                options.RoleClaimType = ClaimTypes.Role;
            });

            services.AddCors(options =>
            {
                options.AddPolicy("AllowSpecificOrigin", builder =>
                                  builder.AllowAnyHeader()
                                  .AllowAnyMethod()
                                  .AllowAnyOrigin()
                                  );
            });

            services.AddSwaggerGen(c =>
            {
                c.SwaggerDoc("v1", new Info {
                    Title = "Wimym.Api", Version = "v1"
                });
            });

            // Automapper config
            MyMaps.Initialize();

            services.AddMvc().SetCompatibilityVersion(CompatibilityVersion.Version_2_2);
        }
Пример #7
0
        // This method gets called by the runtime. Use this method to add services to the container.
        public void ConfigureServices(IServiceCollection services)
        {
            services.AddMvc().SetCompatibilityVersion(CompatibilityVersion.Version_2_1);
            services.AddTransient <IEmployeeRepository, EmployeeRepository>();
            services.AddTransient <IEmployeeLogic, EmployeeLogic>();

            services.AddSingleton(Configuration);

            services.AddSwaggerGen(options =>
            {
                options.DescribeAllEnumsAsStrings();
                options.SwaggerDoc("v1", new Swashbuckle.AspNetCore.Swagger.Info()
                {
                    Title          = "Hgaray MasGlobal Test",
                    Version        = "v1",
                    Description    = "Hgaray MasGlobal Test",
                    TermsOfService = "Test"
                });
            });

            MyMaps.Initialize();
        }
Пример #8
0
        public void ConfigureServices(IServiceCollection services)
        {
            // services.AddHttpContextAccessor();
            #region Current User
            //services.AddTransient<IHttpContextAccessor, HttpContextAccessor>();
            services.AddHttpContextAccessor();
            // services.AddTransient<ICurrentUserFactory, CurrentUserFactory>();
            #endregion
            services.AddScoped <ICurrentUserFactory, CurrentUserFactory>();
            services.AddSingleton <IHttpContextAccessor, HttpContextAccessor>();

            services.AddIdentity <ApplicationUser, IdentityRole>(cfg =>
            {
                cfg.Tokens.AuthenticatorTokenProvider = TokenOptions.DefaultAuthenticatorProvider;
                cfg.SignIn.RequireConfirmedEmail      = false;
                cfg.User.RequireUniqueEmail           = true;
                cfg.Password.RequireDigit             = false;
                cfg.Password.RequiredUniqueChars      = 0;
                cfg.Password.RequireLowercase         = false;
                cfg.Password.RequireNonAlphanumeric   = false;
                cfg.Password.RequireUppercase         = false;
                cfg.Password.RequiredLength           = 6;
            })
            .AddDefaultTokenProviders()
            .AddEntityFrameworkStores <DataContext>();

            //     services.AddDefaultIdentity<IdentityUser>().AddRoles<IdentityRole>()
            //.AddDefaultUI(UIFramework.Bootstrap4)
            //      .AddEntityFrameworkStores<DataContext>();

            services.AddAuthentication().AddCookie()
            .AddJwtBearer(cfg =>
            {
                cfg.TokenValidationParameters = new TokenValidationParameters
                {
                    ValidIssuer      = this.Configuration["Tokens:Issuer"],
                    ValidAudience    = this.Configuration["Tokens:Audience"],
                    IssuerSigningKey = new SymmetricSecurityKey(
                        Encoding.UTF8.GetBytes(this.Configuration["Tokens:Key"]))
                };
            });

            services.AddDbContext <DataContext>(cfg =>
            {
                cfg.UseSqlServer(this.Configuration.GetConnectionString("DefaultConnection"));
            });

            //services.Configure<IISServerOptions>(options =>
            //{
            //    options.AutomaticAuthentication = false;
            //});

            services.AddMyDependencies(Configuration);

            services.AddSwaggerGen(c =>
            {
                c.SwaggerDoc("v1", new Info {
                    Title = "Wimym.Api", Version = "v1"
                });
            });

            // Automapper config
            MyMaps.Initialize();

            //////Maintain only one instance of the string connection
            ////// SpaParameters.ApiUrl = Configuration["Api:Url"];

            //////services.AddScoped<IAuthorizationHandler,
            //////    ContactIsOwnerAuthorizationHandler>();

            //////services.AddSingleton<IAuthorizationHandler,
            //////    ContactAdministratorsAuthorizationHandler>();

            //////services.AddSingleton<IAuthorizationHandler,
            //////    ContactManagerAuthorizationHandler>();

            services.Configure <CookiePolicyOptions>(options =>
            {
                options.CheckConsentNeeded    = context => true;
                options.MinimumSameSitePolicy = SameSiteMode.None;
            });

            services.ConfigureApplicationCookie(options =>
            {
                options.LoginPath        = "/Account/NotAuthorized";
                options.AccessDeniedPath = "/Account/NotAuthorized";
            });

            services.AddMvc().SetCompatibilityVersion(CompatibilityVersion.Version_2_2);

            ////services.AddMvc(config =>
            ////{
            ////    // using Microsoft.AspNetCore.Mvc.Authorization;
            ////    // using Microsoft.AspNetCore.Authorization;
            ////    var policy = new AuthorizationPolicyBuilder()
            ////        .RequireAuthenticatedUser()
            ////        .Build();
            ////    config.Filters.Add(new AuthorizeFilter(policy));
            ////}).SetCompatibilityVersion(CompatibilityVersion.Version_2_2);
        }