public ActionResult Reporting_Hangar() { var context = new AllDbContext(); List <HangarDetails> hangar = context.Hangars.ToList(); return(View(hangar)); }
public ActionResult Reporting_Planes() { var context = new AllDbContext(); List <PlaneDetails> planes = context.Planes.ToList(); return(View("Reporting_Planes", planes)); }
public ActionResult FlightDetailsUpdate(FlightPlanDetails flight) { if (ModelState.IsValid) { AllDbContext context = new AllDbContext(); PlanesDbContext db = new PlanesDbContext(); ViewBag.PlaneID = new SelectList(db.Planes.Where(n => n.isAllotted == false), "PlaneID", "PlaneID"); var items = context.Planes.Where(n => n.isAllotted == false); ViewBag.PlaneId = items; if (items != null) { ViewBag.data = items; } var pilot = db.Planes.Where(n => n.PlaneID == flight.PlaneID); foreach (var i in pilot) { i.isAllotted = true; } flight.isActive = true; flight.PilotID = User.Identity.GetUserName(); context.Flights.Add(flight); db.SaveChanges(); context.SaveChanges(); TempData["savedFlight"] = "Flight Details Added to Database Sucessfull!"; return(RedirectToAction("Index", "Pilot")); } return(View()); }
public ActionResult AllotmentOfPlanes(PlanesAllotments hangar) { AllDbContext db = new AllDbContext(); var user = db.Hangars.Where(n => n.HangerName == hangar.HangarName); var planeUser = db.Planes.Where(n => n.PlaneID == hangar.PlaneID); if (ModelState.IsValid) { foreach (var i in user) { i.isPlaneAllocated = true; } foreach (var j in planeUser) { j.isAllotted = true; } hangar.isPlaneAllocated = true; hangar.ManagerID = User.Identity.GetUserName().ToString(); db.Entry(hangar).State = EntityState.Added; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.HangarName = new SelectList(db.Hangars.Where(n => n.isPlaneAllocated == false && n.isActive == true), "HangerName", "HangerName"); ViewBag.PlaneID = new SelectList(db.Planes.Where(n => n.isAllotted == false), "PlaneID", "planeID"); return(View(hangar)); }
public ActionResult AddHangar(HangarDetails hangar) { if (ModelState.IsValid) { AllDbContext context = new AllDbContext(); var isUnique = context.Hangars.Where(n => n.HangerName == hangar.HangerName); AdminDbContext db = new AdminDbContext(); foreach (var i in isUnique) { if (i.HangerName == hangar.HangerName) { ViewData["HError"] = "Hangar Name Already Exists"; return(View(hangar)); } } ViewBag.AdminID = new SelectList(db.Admin, "AdminID", "AdminID"); var items = context.Admins.Select(n => n.AdminID); if (items != null) { ViewBag.data = items; } hangar.AdminID = User.Identity.GetUserName(); context.Hangars.Add(hangar); context.SaveChanges(); TempData["hangarSaved"] = "Hangar Details Added to Database Successfully"; return(RedirectToAction("Hangars", "Admin")); } return(View()); }
async void Init() { await Task.Run(() => context = new AllDbContext()); UpdateLists(); //RoleCombo.ItemsSource = Enum.GetValues(typeof(Role)); }
public ToursViewModel(PageService pageservice, AllDbContext dbContext, FieldsGenerator fieldsGenerator, CloneItemsSerivce cloneItems, EventBus eventBus) : base(pageservice, dbContext, fieldsGenerator, cloneItems, eventBus) { }
public ActionResult Reporting() { var context = new AllDbContext(); List <PlaneDetails> planes = context.Planes.ToList(); List <FlightPlanDetails> hangar = context.Flights.ToList(); return(View()); }
public UserRegisterService(AllDbContext allDbContext, UserService userService, MapperService mapper) { this.db = allDbContext; this.userService = userService; this.mapper = mapper; }
public static async Task ExecuteStatement(AllDbContext context, string text, SqlParameter[][] @params) { var db = context.Database; foreach (var param in @params) { await db.ExecuteSqlCommandAsync(text, param); } }
public ActionResult AllotmentOfPlanes() { AllDbContext db = new AllDbContext(); ViewBag.HangarName = new SelectList(db.Hangars.Where(n => n.isPlaneAllocated == false && n.isActive == true), "HangerName", "HangerName"); ViewBag.PlaneID = new SelectList(db.Planes.Where(n => n.isAllotted == false), "PlaneID", "planeID"); ViewBag.ManagerID = User.Identity.GetUserName(); return(View()); }
public static async Task ExecuteServices() { using (AllDbContext context = new AllDbContext()) { await context.Services.LoadAsync(); context.Services.RemoveRange(context.Services); await ExecuteStatement(context, ServicesTableStatement, ServicesTableParams); } }
public void StartLoading() { t = new Thread(() => { _context = new AllDbContext(); _context.Services.Load(); IsLoaded = true; t = null; }); t.Start(); }
public ActionResult UpdateHangar(int?id) { var db = new AllDbContext(); var model = db.Hangars.FirstOrDefault(r => r.ID == id); if (model == null) { return(HttpNotFound()); } return(View(model)); }
protected ItemsViewModel(PageService pageservice, AllDbContext dbContext, Services.FieldsGenerator fieldsGenerator, CloneItemsSerivce cloneItems, EventBus eventBus) : base(pageservice) { this.pageservice = pageservice; this.dbContext = dbContext; this.fieldsGenerator = fieldsGenerator; this.cloneItems = cloneItems; this.eventBus = eventBus; Init(); }
public ActionResult AddSchedule(PilotSchedule ps) { var db = new AllDbContext(); if (ModelState.IsValid) { db.Entry(ps).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.PilotID = new SelectList(db.Pilots, "PilotID", "PilotID", ps.PilotID); return(View(ps)); }
public AdminViewModel(PageManager pageservice, AllDbContext dbContext, Validator validator, OrderService orderService, FileBrowserService fileBrowser, MapperService mapper) : base(pageservice) { this.dbContext = dbContext; this.validator = validator; this.orderService = orderService; this.fileBrowser = fileBrowser; this.mapper = mapper; Init(); }
public ActionResult UpdateHangar(HangarDetails hangar) { var db = new AllDbContext(); var entry = db.Entry(hangar); if (ModelState.IsValid) { entry.State = EntityState.Modified; db.SaveChanges(); TempData["HangarUpdate"] = "Hangar Details Updated Successfully"; return(RedirectToAction("Hangars", "Admin")); } return(View(entry)); }
public async Task LoadAsync() { Thread thread = new Thread(() => { DbContext = new AllDbContext(); DbContext.Autos.Load(); _loaded = true; }); thread.Start(); await Task.Run(() => { while (!_loaded) { Task.Delay(100); } }); }
public async Task ReloadAsync(int clId) { using (var context = new AllDbContext()) { await context.Orders.Where(x => x.ClientId.Equals(clId)).Include(x => x.Services).Include(x => x.OrderDetail).LoadAsync(); _orders = context.Orders.Local.ToList(); foreach (var ord in _orders.Where(x => x.Services.Any(y => y.NeedDetails))) { await context.Entry(ord.OrderDetail).Reference(x => x.Style).LoadAsync(); } } }
public static async Task ExecuteEmployee() { using (AllDbContext context = new AllDbContext()) { await context.Employees.LoadAsync(); await context.EmployeeAdmins.LoadAsync(); context.EmployeeAdmins.RemoveRange(context.EmployeeAdmins); context.Employees.RemoveRange(context.Employees); await ExecuteStatement(context, EmployeesTableStatement, EmployeesTableParams); await ExecuteStatement(context, EmpAdminTableStatement, EmpAdminsTableParams); } }
public async Task <bool> TryLogin(string login, string password, bool isAdmin) { await Task.Run(() => dbContext = new AllDbContext()); IUser user; if (isAdmin) { //await dbContext.EmployeeAdmins.LoadAsync(); //user = await dbContext.EmployeeAdmins.FirstOrDefaultAsync(u => // string.Compare(login, u.Login, false) == 0 && // string.Compare(password, u.Password, false) == 0); user = new EmployeeAdmin { Employee = new Employee { Name = "Администратор" }, Id = 1, }; } else { await dbContext.Clients.LoadAsync(); user = await dbContext.Clients.FirstOrDefaultAsync(u => (string.Compare(login, u.Login, false) == 0 || string.Compare(login, u.Email, false) == 0) && string.Compare(password, u.Password, false) == 0); } if (user != null) { userService.SetupUser(user, isAdmin); } else { ErrorMessage = isAdmin ? "Данные для входа некорректные" : "Пользователь не найден"; } return(user != null); }
public ActionResult AddSchedule(int?id) { var db = new AdminDbContext(); if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } var db1 = new AllDbContext(); PilotSchedule ps = db1.Pilot_schedule.Find(id); if (ps == null) { return(HttpNotFound()); } ViewBag.PilotID = new SelectList(db1.Pilots, "PilotID", "PilotID", ps.PilotID); return(View(ps)); }
public ServicesService(AllDbContext dbContext, MapperService mapper) { this.dbContext = dbContext; this.mapper = mapper; }
public FieldsGenerator(AllDbContext allDbContext) { this.allDbContext = allDbContext; }
public LoginService(AllDbContext dbContext, UserService userService, MapperService mapper) { this.dbContext = dbContext; this.userService = userService; this.mapper = mapper; }
public ClientOrders(ICurrentUserService currentUser, DAL.AllDbContext dbContext) { _client = currentUser.CurrentUser as Client; this.dbContext = dbContext; }
public OrderService(AllDbContext dbContext, MapperService mapperService) { this.dbContext = dbContext; this.mapper = mapperService; }
public OrderService(AllDbContext dbContext, MapperService mapperService, InsurancesService insurancesService) { this.dbContext = dbContext; this.mapper = mapperService; this.insurancesService = insurancesService; }
public AdminViewModel(PageService pageservice, AllDbContext dbContext) : base(pageservice) { this.dbContext = dbContext; Init(); }