public async Task <IActionResult> Index(/*[Bind("ID,MaintenanceDate,Scheduled,MaintenanceTime")]*/ AdminView admin) { if (ModelState.IsValid) { if (_context.AdminSettings.ToList().Count() != 0) { foreach (var item in _context.AdminSettings.ToList()) { _context.Remove(_context.AdminSettings.Single(m => m.ID == item.ID)); await _context.SaveChangesAsync(); } } AdminSettings AS = new AdminSettings { MaintenanceDate = admin.settingsAdmin.MaintenanceDate, MaintenanceTime = admin.settingsAdmin.MaintenanceTime, Scheduled = admin.settingsAdmin.Scheduled, }; await _context.AddAsync(AS); await _context.SaveChangesAsync(); AdminSettings.MaintenaceInfo = admin.settingsAdmin.MaintenanceDate; AdminSettings.ScheduledBool = admin.settingsAdmin.Scheduled; AdminSettings.MaintenaceTimeInfo = admin.settingsAdmin.MaintenanceTime; //Handle the other views here? return(RedirectToAction("Index")); } return(View(admin)); }
/// <summary> /// Gets the earnings of all sold books and sends it to the veiw for print out /// </summary> /// <param name="admin">Takes a user with admin priviliges</param> private static void Earnings(User admin) { AdminView.Earnings(api.MoneyEarned(admin.Id)); }
/// <summary> /// Gets all the sold books and sends it to the view for printing /// </summary> /// <param name="admin">Takes a user with admin priviliges</param> private static void SoldBooks(User admin) { var listWithSoldBooks = api.SoldItems(admin.Id); AdminView.SoldBooks(listWithSoldBooks); }
/// <summary> /// Prints all admin functions and takes a menuinput /// </summary> /// <param name="admin">Takes a user with admin priviliges</param> private static void AdminFunctions(User admin) { var continueLoop = true; do { AdminView.PrintAdminFunctions(); var input = SharedController.GetAndValidateInput(); switch (input.validatedInput) { case 1: AddUser(admin); break; case 2: ListAllUsers(admin); break; case 3: SearchForUser(admin); break; case 4: AddBook(admin); break; case 5: GetBookAndEnterBookOptions(admin); break; case 6: GetBookAndEnterBookOptions(admin); break; case 7: GetAllBooksAndEnterBookOptions(admin); break; case 8: AddCategory(admin); break; case 9: DeleteCategory(admin); break; case 10: UpdateCategory(admin); break; case 11: SoldBooks(admin); break; case 12: Earnings(admin); break; case 13: BestCustomer(admin); break; case 0: continueLoop = SharedController.GoBackIf_X_IsPressedOrPrintErrorMsg(input.menuInput); break; } } while (continueLoop); }
/// <summary> /// Method for getting the best customer and pass it on to the view /// </summary> /// <param name="admin">Takes a user with admin priviliges</param> private static void BestCustomer(User admin) { AdminView.BestCustomer(api.BestCustomer(admin.Id)); }
private void btnSubmit_Click(object sender, RoutedEventArgs e) { if (txtUsername.Text == "WPFMaster" && txtPassword.Password == "WPFAccess") { _logged = true; MasterView view = new MasterView(); view.Show(); } else { try { using (CompanyDBEntities db = new CompanyDBEntities()) { foreach (tblUser user in db.tblUsers) { if (user.Username == txtUsername.Text && user.UserPassword == txtPassword.Password) { foreach (tblAdmin admin in db.tblAdmins) { if (admin.UserID == user.UserID) { AdminView view = new AdminView(); view.ShowDialog(); _logged = true; return; } } foreach (tblManager manager in db.tblManagers) { if (manager.UserID == user.UserID) { ManagerView view = new ManagerView(); view.ShowDialog(); _logged = true; return; } } foreach (tblWorker worker in db.tblWorkers) { if (worker.UserID == user.UserID) { WorkerView view = new WorkerView(); view.ShowDialog(); _logged = true; return; } } } } } } catch (Exception ex) { System.Diagnostics.Debug.WriteLine(ex.Message); } } if (_logged == false) { MessageBox.Show("Username or Password Incorrect."); } }
private void ClientClick(object obj) { AdminView AV = new AdminView(); AV.ShowDialog(); }
public AdminViewModel(AdminView av) { view = av; foodOrders = fom.GetAllFoodOrders(); }
private void btAdminPanel_Click(object sender, RoutedEventArgs e) { AdminView adminView = new AdminView(); adminView.ShowDialog(); }
public void Exit(MainWindow mainWindow, AdminView adminView) { adminView.Hide(); mainWindow.ShowDialog(); }
public AdminViewModel(AdminView adminView, vwAdmin adminInstance) { this.adminView = adminView; admin = adminInstance; }
public static void TrainerMenuView(int userID) { int user_ID = userID; bool count = true; do { Console.WriteLine(); Console.WriteLine("---------------------"); Console.WriteLine("1. View Enrolled Courses. "); Console.WriteLine("2. View Students per Course."); Console.WriteLine("3. View Assignments per Student per Course."); Console.WriteLine("4. Mark all the Assignments per Student per Course."); Console.WriteLine("5. Exit"); Console.WriteLine("---------------------"); int menuSelect = int.Parse(Console.ReadLine()); Console.Clear(); switch (menuSelect) { case 1: bool count1 = true; do { AdminView.NotImplementedYet(); count1 = LoginView.EnterAnotherOrNot("view"); } while (count1); break; case 2: count1 = true; do { AdminView.NotImplementedYet(); count1 = LoginView.EnterAnotherOrNot("view"); } while (count1); break; case 3: count1 = true; do { AdminView.NotImplementedYet(); count1 = LoginView.EnterAnotherOrNot("submit"); } while (count1); break; case 4: count1 = true; do { AdminView.NotImplementedYet(); count1 = LoginView.EnterAnotherOrNot("submit"); } while (count1); break; default: count = false; break; } } while (count); }
public EditVehicleCommand(AdminViewModel viewModel, NetTcpBinding binding, EndpointAddress address, AdminView view) { this.viewModel = viewModel; this.binding = binding; this.address = address; this.view = view; }
/// <summary> /// Creates the tabs. /// </summary> private void CreateTabs() { AdminView view = ManagementContext.Current.FindView(this.AppId, this.ViewId); // Check view permissions if (view.Attributes.Contains("permissions")) { if (!ProfileContext.Current.CheckPermission(view.Attributes["permissions"].ToString())) { throw new UnauthorizedAccessException("Current user does not have enough rights to access the requested operation."); } } if (view == null) { return; } phTabs.Controls.Clear(); AjaxControlToolkit.TabContainer tc = new AjaxControlToolkit.TabContainer(); tc.ID = _DefaultTabContainerId; tc.CssClass = "gray"; tc.OnClientActiveTabChanged = "SaveTabState_" + tc.ID; tc.Tabs.Clear(); foreach (ViewTab node in view.Tabs) { // Check if the node is visible if (!IsVisible(node)) { continue; } TabPanel tabPanel = new TabPanel(); if (node.Attributes["Name"] != null) { tabPanel.HeaderText = UtilHelper.GetResFileString(node.Attributes["Name"].ToString()); } // Load custom control string controlUrl = String.Format("~/Apps/{0}", node.ControlUrl); if (File.Exists(Server.MapPath(controlUrl))) { Control ctrl = this.LoadControl(controlUrl); tabPanel.Controls.Add(ctrl); } else { throw new FileNotFoundException(Server.MapPath(controlUrl)); } // Add tabs tc.Tabs.Add(tabPanel); } phTabs.Controls.Add(tc); if (tc.Tabs.Count > 0) { tc.ActiveTabIndex = 0; } }