示例#1
0
 public AccountController(
     UserManager <ApplicationUser> userManager,
     SignInManager <ApplicationUser> signInManager,
     ILoggerFactory loggerFactory,
     ApplicationDbContext db,
     WebNutContext context)
 {
     _userManager   = userManager;
     _signInManager = signInManager;
     _logger        = loggerFactory.CreateLogger <AccountController>();
     _db            = db;
     _context       = context;
 }
 public ImplementerController(WebNutContext context)
 {
     _context = context;
 }
示例#3
0
 public hfstatusController(WebNutContext context)
 {
     _context = context;
 }
示例#4
0
 public ChecksController(WebNutContext db, ApplicationDbContext App)
 {
     _db  = db;
     _app = App;
 }
示例#5
0
 public msForm(WebNutContext context, UserManager <ApplicationUser> userManager)
 {
     _context     = context;
     _userManager = userManager;
 }
示例#6
0
 public ImportController(IHostingEnvironment env, WebNutContext context)
 {
     this.hostingEnv = env;
     _context        = context;
 }
 public FacilityTypesController(WebNutContext context)
 {
     _context = context;
 }
示例#8
0
 public DashboardController(WebNutContext db)
 {
     _db = db;
 }
示例#9
0
 public ProvinceController(WebNutContext context)
 {
     _context = context;
 }
示例#10
0
 public TlkpIycfsController(WebNutContext context)
 {
     _context = context;
 }
示例#11
0
 public FeedbackController(WebNutContext context)
 {
     _context = context;
 }
示例#12
0
 public TlkpOtptfusController(WebNutContext context)
 {
     _context = context;
 }
示例#13
0
 public mamViewController(WebNutContext context)
 {
     _context = context;
 }
示例#14
0
 public BnaqController(WebNutContext context)
 {
     _context = context;
 }
示例#15
0
        public async static void Initialize(WebNutContext db, RoleManager <IdentityRole> _roleManager, UserManager <ApplicationUser> _userManager)
        {
            db.Database.EnsureCreated();

            // Look for any students.
            if (db.TblkpStatus.Any() || db.LkpHfstatus.Any() || _roleManager.Roles.Any() || _userManager.Users.Any())
            {
                return;   // DB has been seeded
            }

            var stats = new TblkpStatus[]
            {
                new TblkpStatus {
                    StatusId = 1, StatusDescription = "Insert"
                },
                new TblkpStatus {
                    StatusId = 2, StatusDescription = "Update"
                },
                new TblkpStatus {
                    StatusId = 3, StatusDescription = "Accept"
                },
                new TblkpStatus {
                    StatusId = 4, StatusDescription = "Reject"
                },
            };

            foreach (TblkpStatus s in stats)
            {
                db.TblkpStatus.Add(s);
            }
            db.SaveChanges();

            var hfstats = new LkpHfstatus[]
            {
                new LkpHfstatus {
                    HfactiveStatusId = 1, HfstatusDescription = "Open"
                },
                new LkpHfstatus {
                    HfactiveStatusId = 2, HfstatusDescription = "Close"
                },
                new LkpHfstatus {
                    HfactiveStatusId = 3, HfstatusDescription = "Closed-no supply"
                },
                new LkpHfstatus {
                    HfactiveStatusId = 4, HfstatusDescription = "Closed-Security"
                },
            };

            foreach (LkpHfstatus s in hfstats)
            {
                db.LkpHfstatus.Add(s);
            }
            db.SaveChanges();

            var AgeGroups = new TlkpOtptfu[]
            {
                new TlkpOtptfu {
                    Active = true, AgeGroup = "<6 month"
                },
                new TlkpOtptfu {
                    Active = true, AgeGroup = "6-23 Months"
                },
                new TlkpOtptfu {
                    Active = true, AgeGroup = "24-59 Months"
                },
                new TlkpOtptfu {
                    Active = true, AgeGroup = "total"
                },
            };

            foreach (TlkpOtptfu s in AgeGroups)
            {
                db.TlkpOtptfu.Add(s);
            }
            db.SaveChanges();

            var MamAgeGroups = new TlkpSfp[]
            {
                new TlkpSfp {
                    Active = true, AgeGroup = "Children 6-23 months"
                },
                new TlkpSfp {
                    Active = true, AgeGroup = "Children 24-59 months"
                },
                new TlkpSfp {
                    Active = true, AgeGroup = "Lactating women"
                },
                new TlkpSfp {
                    Active = true, AgeGroup = "Pregnant women"
                },
                new TlkpSfp {
                    Active = true, AgeGroup = "total children"
                },
                new TlkpSfp {
                    Active = true, AgeGroup = "total women"
                },
            };

            foreach (TlkpSfp s in MamAgeGroups)
            {
                db.TlkpSfp.Add(s);
            }
            db.SaveChanges();

            var mnItems = new TlkpMn[]
            {
                new TlkpMn {
                    Mnid = 1, Active = true, Mnitems = "Vit A Capsule  (200000,100000 or 50000IU)"
                },
                new TlkpMn {
                    Mnid = 2, Active = true, Mnitems = "IFA (60mg Iron, 400Micogram Folic) Tab"
                },
                new TlkpMn {
                    Mnid = 3, Active = true, Mnitems = "Ferrous Sulfate drop/syrop "
                },
                new TlkpMn {
                    Mnid = 4, Active = true, Mnitems = "Ferrous Sulfate 200mg(base 60mg)"
                },
                new TlkpMn {
                    Mnid = 5, Active = true, Mnitems = "Folic Acid 1 mg Tab"
                },
                new TlkpMn {
                    Mnid = 6, Active = true, Mnitems = "Multiple Micronutrients Tablet"
                },
                new TlkpMn {
                    Mnid = 7, Active = true, Mnitems = "Multiple Micronutrients Powder"
                },
                new TlkpMn {
                    Mnid = 8, Active = true, Mnitems = "Zinc Tab or Syrup/Drop + ORS"
                },
                new TlkpMn {
                    Mnid = 9, Active = true, Mnitems = "Mebendasol Tab"
                },
            };

            foreach (TlkpMn s in mnItems)
            {
                db.TlkpMn.Add(s);
            }

            db.SaveChanges();


            IdentityRole Role = new IdentityRole();

            Role.NormalizedName = "ADMINISTRATOR";
            Role.Name           = "administrator";
            await _roleManager.CreateAsync(Role);

            IdentityRole Role2 = new IdentityRole();

            Role2.NormalizedName = "DATAENTRY";
            Role2.Name           = "dataentry";
            await _roleManager.CreateAsync(Role2);

            IdentityRole Role3 = new IdentityRole();

            Role3.NormalizedName = "GUEST";
            Role3.Name           = "guest";
            await _roleManager.CreateAsync(Role3);

            var user = new ApplicationUser
            {
                UserName    = "******",
                PhoneNumber = "99999999",
                FirstName   = "admin",
                LastName    = "admin",
                Email       = "*****@*****.**",
                Position    = "admin",
                Active      = true,
                TenantId    = 1
            };
            var result = await _userManager.CreateAsync(user, "159*951-Aa");

            if (result.Succeeded)
            {
                await _userManager.AddClaimAsync(user, new System.Security.Claims.Claim("super_admin", "1"));

                await _userManager.AddToRoleAsync(user, "administrator");
            }
        }
示例#16
0
 public SamoutController(WebNutContext context)
 {
     _context = context;
 }
示例#17
0
 public NmrController(WebNutContext context, ILoggerFactory loggerFactory, UserManager <ApplicationUser> userManager)
 {
     _logger  = loggerFactory.CreateLogger <NmrController>();
     _context = context; _userManager = userManager;
 }
示例#18
0
 public TlkpFstocksController(WebNutContext context)
 {
     _context = context;
 }
示例#19
0
 public samoutformController(WebNutContext context, IMapper mapper, UserManager <ApplicationUser> userManager)
 {
     _context     = context;
     _mapper      = mapper;
     _userManager = userManager;
 }
示例#20
0
 public FacilityInfoController(WebNutContext context)
 {
     _context = context;
 }
示例#21
0
 public TblMnsController(WebNutContext context)
 {
     _context = context;
 }
示例#22
0
 public TenantsController(WebNutContext context)
 {
     _context = context;
 }
示例#23
0
 public TlkpSfpsController(WebNutContext context)
 {
     _context = context;
 }
示例#24
0
 public ExportController(WebNutContext context, UserManager <ApplicationUser> userManager)
 {
     _context     = context;
     _userManager = userManager;
 }
示例#25
0
 public DistrictsController(WebNutContext context)
 {
     _context = context;
 }
示例#26
0
        // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
        public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory, WebNutContext context, RoleManager <IdentityRole> _roleManager, UserManager <ApplicationUser> _userManager)
        {
            loggerFactory.AddConsole(Configuration.GetSection("Logging"));
            loggerFactory.AddDebug();

            if (env.IsDevelopment())
            {
                app.UseDeveloperExceptionPage();
                app.UseDatabaseErrorPage();
                app.UseBrowserLink();
            }
            else
            {
                app.UseExceptionHandler("/Home/Error");
            }
            app.UseStatusCodePagesWithReExecute("/StatusCode/{0}");

            app.UseStaticFiles();

            app.UseIdentity();
            app.UseSession();
            // Add external authentication middleware below. To configure them please see http://go.microsoft.com/fwlink/?LinkID=532715

            app.UseMvc(routes =>
            {
                routes.MapRoute(
                    name: "default",
                    template: "{controller=Checks}/{action=Index}/{id?}");
            });

            DbInitializer.Initialize(context, _roleManager, _userManager);
        }