Example #1
0
        protected void TaoMoiUser(QuanLyDangKyPhongHopNeuDbContext context)
        {
            var manager = new UserManager <ApplicationUser>(new UserStore <ApplicationUser>(new QuanLyDangKyPhongHopNeuDbContext()));

            var roleManager = new RoleManager <IdentityRole>(new RoleStore <IdentityRole>(new QuanLyDangKyPhongHopNeuDbContext()));

            var user = new ApplicationUser()
            {
                UserName       = "******",
                Email          = "*****@*****.**",
                EmailConfirmed = true,
                DiaChi         = "Bắc Ninh",
                HoTen          = "Nguyễn Xuân Dũng"
            };

            manager.Create(user, "123654$");

            if (!roleManager.Roles.Any())
            {
                roleManager.Create(new IdentityRole {
                    Name = "Admin"
                });
                roleManager.Create(new IdentityRole {
                    Name = "User"
                });
            }

            var adminUser = manager.FindByEmail("*****@*****.**");

            manager.AddToRoles(adminUser.Id, new string[] { "Admin", "User" });
        }
Example #2
0
        protected void TaoMoiLoaiPhong(QuanLyDangKyPhongHopNeuDbContext context)
        {
            List <LoaiPhong> list = new List <LoaiPhong>()
            {
                new LoaiPhong {
                    TenLoaiPhong = "Đặc biệt"
                },
                new LoaiPhong {
                    TenLoaiPhong = "Loại thường"
                }
            };

            context.LoaiPhongs.AddRange(list);
            context.SaveChanges();
        }
Example #3
0
        protected void TaoMoiLichDangKy(QuanLyDangKyPhongHopNeuDbContext context)
        {
            var date = DateTime.Today;
            List <LichDangKy> list = new List <LichDangKy>()
            {
                new LichDangKy {
                    TieuDe = "Tiêu đề 1", IDPhong = 1, ThoiGianBatDau = date.AddHours(7.5), ThoiGianKetThuc = date.AddHours(8.5), NgayDangKy = DateTime.Now, TenNguoiDangKy = "Nguyen Xuan Dung", Email = "*****@*****.**", SoDienThoai = "0912946879", TinhTrang = "Đang chờ xử lý"
                },
                new LichDangKy {
                    TieuDe = "Tiêu đề 2", IDPhong = 5, ThoiGianBatDau = date.AddHours(9.5), ThoiGianKetThuc = date.AddHours(13), NgayDangKy = DateTime.Now, TenNguoiDangKy = "Phan Van Khai", Email = "*****@*****.**", SoDienThoai = "0165468489", TinhTrang = "Đang chờ xử lý"
                }
            };

            context.LichDangKies.AddRange(list);
            context.SaveChanges();
        }
Example #4
0
        protected void TaoMoiThietBi(QuanLyDangKyPhongHopNeuDbContext context)
        {
            List <ThietBi> list = new List <ThietBi>()
            {
                new ThietBi {
                    TenThietBi = "Máy chiếu", SoLuong = 100
                },
                new ThietBi {
                    TenThietBi = "Micro", SoLuong = 100
                },
                new ThietBi {
                    TenThietBi = "Video confering", SoLuong = 100
                }
            };

            context.ThietBis.AddRange(list);
            context.SaveChanges();
        }
Example #5
0
        protected void TaoMoiPhong(QuanLyDangKyPhongHopNeuDbContext context)
        {
            List <Phong> list = new List <Phong>()
            {
                new Phong {
                    TenPhong = "A101", IDKhuNha = 1, IDLoaiPhong = 2
                },
                new Phong {
                    TenPhong = "A102", IDKhuNha = 1, IDLoaiPhong = 2
                },
                new Phong {
                    TenPhong = "A103", IDKhuNha = 1, IDLoaiPhong = 2
                },
                new Phong {
                    TenPhong = "B101", IDKhuNha = 2, IDLoaiPhong = 1
                },
                new Phong {
                    TenPhong = "B102", IDKhuNha = 2, IDLoaiPhong = 1
                },
                new Phong {
                    TenPhong = "C103", IDKhuNha = 3, IDLoaiPhong = 1
                },
                new Phong {
                    TenPhong = "C105", IDKhuNha = 3, IDLoaiPhong = 1
                },
                new Phong {
                    TenPhong = "D106", IDKhuNha = 4, IDLoaiPhong = 1
                },
                new Phong {
                    TenPhong = "D104", IDKhuNha = 4, IDLoaiPhong = 2
                },
                new Phong {
                    TenPhong = "A2-201", IDKhuNha = 5, IDLoaiPhong = 1
                }
            };

            context.Phongs.AddRange(list);
            context.SaveChanges();
        }
Example #6
0
        protected void TaoMoiKhuNha(QuanLyDangKyPhongHopNeuDbContext context)
        {
            List <KhuNha> list = new List <KhuNha>()
            {
                new KhuNha {
                    TenKhuNha = "Khu A"
                },
                new KhuNha {
                    TenKhuNha = "Khu B"
                },
                new KhuNha {
                    TenKhuNha = "Khu C"
                },
                new KhuNha {
                    TenKhuNha = "Khu D"
                },
                new KhuNha {
                    TenKhuNha = "Khu A2"
                }
            };

            context.KhuNhas.AddRange(list);
            context.SaveChanges();
        }
Example #7
0
 public ApplicationUserStore(QuanLyDangKyPhongHopNeuDbContext context)
     : base(context)
 {
 }
Example #8
0
 public MailHelper()
 {
     this.db = new QuanLyDangKyPhongHopNeuDbContext();
 }
 public DangKyPhongHopRepository()
 {
     this.context = new QuanLyDangKyPhongHopNeuDbContext();
 }
Example #10
0
 public QuanLyDangKyPhongHopNeuDbContext Init()
 {
     return(dbContext ?? (dbContext = new QuanLyDangKyPhongHopNeuDbContext()));
 }