private void RegisterNewUserForm_Load(object sender, EventArgs e) { // Identifying correct protocol for current user in session if (SystemProtocols.ApplySessionsProtocols(1, null, null)) { // Disabling the other Products option registerNewProductMenuSubOption.Visible = false; registerNewProductMenuSubOption.Enabled = false; restockProductsMenuSubOption.Visible = false; restockProductsMenuSubOption.Enabled = false; // Disabling all admin options adminMenuOption.Visible = false; adminMenuOption.Enabled = false; } // Inictializing message labels messageLabel.Text = ""; usernameErrorLable.Visible = false; passwordErrorLabel.Text = "Invalid Password"; passwordErrorLabel.Visible = false; confirmationPasswordErrorLabel.Visible = false; // Executing correct activity according to given code SystemProtocols.ApplyActivityProtocols("USE2", null, null); }
private void ReportsAnalyticsForm_Load(object sender, EventArgs e) { // Identifying correct protocol for current user in session if (SystemProtocols.ApplySessionsProtocols(1, null, null)) { // Disabling the other Products option registerNewProductMenuSubOption.Visible = false; registerNewProductMenuSubOption.Enabled = false; restockProductsMenuSubOption.Visible = false; restockProductsMenuSubOption.Enabled = false; // Disabling all admin options adminMenuOption.Visible = false; adminMenuOption.Enabled = false; } // Initializing latest date time pickers #region Users' Timesheet Report newestTimesheetDateTimePicker.Value = DateTime.Now; newestTimesheetDateTimePicker.MaxDate = DateTime.Today.AddDays(1); #endregion #region Users's Sales Record newestSalesRecordDateTimePicker.Value = DateTime.Now; newestSalesRecordDateTimePicker.MaxDate = DateTime.Today.AddDays(1); #endregion // Recording admin access to this form SystemProtocols.ApplyActivityProtocols("REP1", null, null); }
private void RegisterNewSaleFrom_Load(object sender, EventArgs e) { // Identifying correct protocol for current user in session if (SystemProtocols.ApplySessionsProtocols(1, null, null)) { // Disabling the other Products option registerNewProductMenuSubOption.Visible = false; registerNewProductMenuSubOption.Enabled = false; restockProductsMenuSubOption.Visible = false; restockProductsMenuSubOption.Enabled = false; // Disabling all admin options adminMenuOption.Visible = false; adminMenuOption.Enabled = false; SystemProtocols.ApplyActivityProtocols("SAL1", null, null); } else { SystemProtocols.ApplyActivityProtocols("SAL4", null, null); } PopulateProductDataGrid(); UpdateCartSummaryDataGrid(); }
/// <summary> /// Function used by grandchild to notify when a new transaction has originated from a successfull return /// </summary> /// <param name="newSaleId">Identification number of the new transaction</param> public void ShowNewReturnedTransactionInformation(String newSaleId) { if (!SystemProtocols.ApplySessionsProtocols(1, null, null)) // option only available for non basic users { // Creating a new child given the new information available SaleInformationTemplateForm child = new SaleInformationTemplateForm(newSaleId); child.Show(); children.Add(child); // adding that new child to the list of living children } }
private void ProductList_CellDoubleClick(object sender, DataGridViewCellEventArgs e) { if (!SystemProtocols.ApplySessionsProtocols(1, null, null)) { // Declare an non oficial auxiliary form to display product information, given a product's internal identification number ProductInformationTemplateForm child = new ProductInformationTemplateForm(productList.SelectedCells[0].Value.ToString()); child.Show(); // Summon the temporary summary form children.Add(child); // adding product to list of children } }
private void SalesList_CellDoubleClick(object sender, DataGridViewCellEventArgs e) { if (!SystemProtocols.ApplySessionsProtocols(1, null, null)) // option only available for non basic users { if (!IsChildAlive(salesList.SelectedCells[0].Value.ToString())) // Verifying that requested child is killed or active before proceeding { // Starting or resecusating child SaleInformationTemplateForm child = new SaleInformationTemplateForm(salesList.SelectedCells[0].Value.ToString()); child.Show(); children.Add(child); // adding child to the list of children to keep track of opened auxiliary forms } } }
private void GraphsAnalyticsForm_Load(object sender, EventArgs e) { // Identifying correct protocol for current user in session if (SystemProtocols.ApplySessionsProtocols(1, null, null)) { // Disabling the entire Products option given the remainder of options are prohibited for a basic user registerNewProductMenuSubOption.Visible = false; registerNewProductMenuSubOption.Enabled = false; restockProductsMenuSubOption.Visible = false; restockProductsMenuSubOption.Enabled = false; // Disabling all admin options adminMenuOption.Visible = false; adminMenuOption.Enabled = false; } // Recording user access to this form SystemProtocols.ApplyActivityProtocols("GRA1", null, null); // Hiding message lables missingMessageLabel.Visible = false; shownMessageLabel.Visible = false; // Initilizing combo box timeComboBox.Items.Add("24 hours"); timeComboBox.Items.Add("72 hours"); timeComboBox.Items.Add("week"); timeComboBox.Items.Add("2 weeks"); timeComboBox.Items.Add("month"); timeComboBox.Items.Add("2 months"); timeComboBox.SelectedIndex = 0; // Populating Graphs PopulateUsernameTimesheetListBox(); PopulateUsernameSalesListBox(); // Initializing date time pickers #region Bubble Chart newestBubbleDateTimePicker.Value = DateTime.Now; newestBubbleDateTimePicker.MaxDate = DateTime.Today.AddDays(1); #endregion #region Sales Bar Chart newestSalesBarChartDateTimePicker.Value = DateTime.Now; newestSalesBarChartDateTimePicker.MaxDate = DateTime.Today.AddDays(1); #endregion }
private void ProductInformationTemplateForm_Load(object sender, EventArgs e) { // Limiting user features to prevent non admins to edit a product's information if (SystemProtocols.ApplySessionsProtocols(1, null, null)) { // Disabling the text fields and combo boxes for basic users keyTextBox.Enabled = false; unitTextBox.Enabled = false; unitCostNumericUpDown.Enabled = false; unitPriceNumericUpDown.Enabled = false; quantityNumericUpDown.Enabled = false; minimumQuantityNumericUpDown.Enabled = false; maximumQuantityNumericUpDown.Enabled = false; brandComboBox.Enabled = false; supplierComboBox.Enabled = false; categoryComboBox.Enabled = false; typeComboBox.Enabled = false; discontinuedCheckBox.Enabled = false; // Disabling and hiding the edit button editButton.Enabled = false; editButton.Visible = false; } else { // Enabling the text fields and combo boxes for basic users keyTextBox.Enabled = true; unitTextBox.Enabled = true; unitCostNumericUpDown.Enabled = true; unitPriceNumericUpDown.Enabled = true; quantityNumericUpDown.Enabled = true; minimumQuantityNumericUpDown.Enabled = true; maximumQuantityNumericUpDown.Enabled = true; brandComboBox.Enabled = true; supplierComboBox.Enabled = true; categoryComboBox.Enabled = true; typeComboBox.Enabled = true; discontinuedCheckBox.Enabled = true; // Enabling and hiding the edit button editButton.Enabled = false; } }
private void ErrorsLogForm_Load(object sender, EventArgs e) { // Identifying correct protocol for current user in session if (SystemProtocols.ApplySessionsProtocols(1, null, null)) { // Disabling the entire Products option given the remainder of options are prohibited for a basic user registerNewProductMenuSubOption.Visible = false; registerNewProductMenuSubOption.Enabled = false; restockProductsMenuSubOption.Visible = false; restockProductsMenuSubOption.Enabled = false; // Disabling all admin options adminMenuOption.Visible = false; adminMenuOption.Enabled = false; } SystemProtocols.ApplyActivityProtocols("ERR1", null, null); }
private void InventorySearchForm_Load(object sender, EventArgs e) { // Identifying correct protocol for current user in session if (SystemProtocols.ApplySessionsProtocols(1, null, null)) { // Disabling the entire Products option given the remainder of options are prohibited for a basic user productsMenuOption.Visible = false; productsMenuOption.Enabled = false; // Disabling all admin options adminMenuOption.Visible = false; adminMenuOption.Enabled = false; } PopulateProductListDataGrid(); // Initializing the data grid upon load // Executing correct activity according to given code SystemProtocols.ApplyActivityProtocols("INV1", null, null); }
private void RestockProductsForm_Load(object sender, EventArgs e) { // Identifying correct protocol for current user in session if (SystemProtocols.ApplySessionsProtocols(1, null, null)) { // Disabling the other Products option registerNewProductMenuSubOption.Visible = false; registerNewProductMenuSubOption.Enabled = false; // Disabling all admin options adminMenuOption.Visible = false; adminMenuOption.Enabled = false; } SystemProtocols.ApplyActivityProtocols("PRO1", null, null); PopulateProductListDataGrid(); UpdateDisplayLabels(); }
private void ActivitiesLogForm_Load(object sender, EventArgs e) { // Limiting option according to current user's access level if (SystemProtocols.ApplySessionsProtocols(1, null, null)) { // Disabling the entire Products option given the remainder of options are prohibited for a basic user registerNewProductMenuSubOption.Visible = false; registerNewProductMenuSubOption.Enabled = false; restockProductsMenuSubOption.Visible = false; restockProductsMenuSubOption.Enabled = false; // Disabling all admin options adminMenuOption.Visible = false; adminMenuOption.Enabled = false; } // Executing correct activity according to given code SystemProtocols.ApplyActivityProtocols("ACT1", null, null); PopulateActivityListDataGrid(); }
private void ChangeAccessLevelButtom_Click(object sender, EventArgs e) { // Requesting a access level change for a target user UserInformationManager.UpdateTargetUserAccessLevelInformation(user.Username, user.Role == "Admin" ? "User" : "Admin"); // Updating information of the form user.Role = user.Role == "Admin" ? "User" : "Admin"; roleTextBox.Text = user.Role; changeAccessLevelButtom.Text = user.Role == "Admin" ? "Demote to User Level" : "Promote to Admin Level"; // Disabling features according to target user's access level compared to current user in session's access level if (SystemProtocols.ApplySessionsProtocols(2, user.Username, user.Role)) { changeAccessLevelButtom.Visible = false; changeAccessLevelButtom.Enabled = false; changePasswordButton.Visible = false; changePasswordButton.Enabled = false; } // Refreshing and updating information of parent form FormsMenuList.usersRegistryForm.RefreshDatagridInformation(); }
private void UserInformationTemplateForm_Load(object sender, EventArgs e) { // Disabling features according to target user's aacces level compared to current user in session's access level if (SystemProtocols.ApplySessionsProtocols(2, user.Username, user.Role)) // If the target user is of a different account and access level is equals to the current user in session { // TODO: Hide System resources in business layer changeAccessLevelButtom.Visible = false; changeAccessLevelButtom.Enabled = false; changePasswordButton.Visible = false; changePasswordButton.Enabled = false; } else if (SystemProtocols.ApplySessionsProtocols(3, user.Username, null)) // If the target user the one with the current open sesison { changeAccessLevelButtom.Visible = false; changeAccessLevelButtom.Enabled = false; suspendUserButton.Visible = false; suspendUserButton.Enabled = false; } else // If the target user is of a different account and access level is different to the current user in session { changePasswordButton.Visible = false; changePasswordButton.Enabled = false; } // Modifuing components based on target user's access level changeAccessLevelButtom.Text = user.Role == "Admin" ? "Demote to User Level" : "Promote to Admin Level"; suspendUserButton.Text = user.Status == "Active" ? "Suspend User" : "Reinstate User"; // Displaying target user's information usernameTextBox.Text = user.Username; firstNameTextBox.Text = user.FirstName; lastNameTextBox.Text = user.LastName; roleTextBox.Text = user.Role; creatorTextBox.Text = user.Creator; statusTextBox.Text = user.Status; createdOnLabel.Text = user.RegistrationDate.ToString(); LastLabel.Text = user.LastLogin.ToString(); PopulateActivityList(); }
private void RegisterNewProductForm_Load(object sender, EventArgs e) { // Identifying correct protocol for current user in session if (SystemProtocols.ApplySessionsProtocols(1, null, null)) { // Disabling the other Products option restockProductsMenuSubOption.Visible = false; restockProductsMenuSubOption.Enabled = false; // Disabling all admin options adminMenuOption.Visible = false; adminMenuOption.Enabled = false; } PopulateBrandListBox(); PopulateSupplierListBox(); PopulateCategoryComboBox(); PopulateTypeComboBox(); // Executing correct activity according to given code SystemProtocols.ApplyActivityProtocols("PRO2", null, null); }
private void UsersRegistryForm_Load(object sender, EventArgs e) { // Identifying correct protocol for current user in session if (SystemProtocols.ApplySessionsProtocols(1, null, null)) { // Disabling the other Products option registerNewProductMenuSubOption.Visible = false; registerNewProductMenuSubOption.Enabled = false; restockProductsMenuSubOption.Visible = false; restockProductsMenuSubOption.Enabled = false; // Disabling all admin options adminMenuOption.Visible = false; adminMenuOption.Enabled = false; } PopulateUserResigtryDataGrid(); // Executing correct activity according to given code SystemProtocols.ApplyActivityProtocols("USE1", null, null); PopulateActicityListDataGrid(); }
private void InventoryBrowserForm_KeyDown(object sender, KeyEventArgs e) { switch (e.KeyCode) { case Keys.F1: #region View Sales // Summon Sales Registry Form FormsMenuList.salesRecordForm = new SalesRecordForm(); FormsMenuList.salesRecordForm.Show(); // Disposing any open child DisposeAllChildren(); // Closing form while freeing system resources FormsMenuList.inventorySearchForm.Dispose(); #endregion break; case Keys.F2: #region Make a Sale // Summon Register New Sale Form FormsMenuList.registerNewSaleForm = new RegisterNewSaleFrom(); FormsMenuList.registerNewSaleForm.Show(); // Disposing any open child DisposeAllChildren(); // Closing form while freeing system resources FormsMenuList.inventorySearchForm.Dispose(); #endregion break; case Keys.F3: // The user is already viewing the desired page if (assistance < 3) { assistance++; } else { MessageBox.Show("\t---Menu Shortcuts---\n\n" + "View Sales\t\t(F1)\n" + "Make Sales\t(F2)\n" + "Product Browser\t(You are here!)\n" + "Register Product\t(F4)\n" + "Restock Products\t(F5)\n" + "View Users\t(F6)\n" + "Register New User\t(F7)\n" + "View Graphs\t(F8)\n" + "View Reports\t(F9)\n" + "View Activities Log\t(F10)\n" + "View Errors Log\t(F11)\n" + "View Cart\t\t(F12)"); } break; case Keys.F4: #region Register New Product // Identifying correct protocol for current user in session if (!SystemProtocols.ApplySessionsProtocols(1, null, null)) { // Summon Register New Product Form FormsMenuList.registerNewProduct = new RegisterNewProductForm(); FormsMenuList.registerNewProduct.Show(); // Disposing any open child DisposeAllChildren(); // Closing form while freeing system resources FormsMenuList.inventorySearchForm.Dispose(); } #endregion break; case Keys.F5: #region Restock Products // Identifying correct protocol for current user in session if (!SystemProtocols.ApplySessionsProtocols(1, null, null)) { // Summon Restock Products Form FormsMenuList.restockProductsFrom = new RestockProductsForm(); FormsMenuList.restockProductsFrom.Show(); // Disposing any open child DisposeAllChildren(); // Closing form while freeing system resources FormsMenuList.inventorySearchForm.Dispose(); } #endregion break; case Keys.F6: #region View Users // Identifying correct protocol for current user in session if (!SystemProtocols.ApplySessionsProtocols(1, null, null)) { // Summon Users Registry Form FormsMenuList.usersRegistryForm = new UsersRegistryForm(); FormsMenuList.usersRegistryForm.Show(); // Disposing any open child DisposeAllChildren(); // Closing form while freeing system resources FormsMenuList.inventorySearchForm.Dispose(); } #endregion break; case Keys.F7: #region Register New User // Identifying correct protocol for current user in session if (!SystemProtocols.ApplySessionsProtocols(1, null, null)) { // Summon Register New User Form FormsMenuList.registerNewUserForm = new RegisterNewUserForm(); FormsMenuList.registerNewUserForm.Show(); // Disposing any open child DisposeAllChildren(); // Closing form while freeing system resources FormsMenuList.inventorySearchForm.Dispose(); } #endregion break; case Keys.F8: #region Graphs Analytics // Identifying correct protocol for current user in session if (!SystemProtocols.ApplySessionsProtocols(1, null, null)) { // Summon Graphs Analytics Form FormsMenuList.graphsAnaliticsForm = new GraphsAnalyticsForm(); FormsMenuList.graphsAnaliticsForm.Show(); // Disposing any open child DisposeAllChildren(); // Closing form while freeing system resources FormsMenuList.inventorySearchForm.Dispose(); } #endregion break; case Keys.F9: #region Reports Analytics // Identifying correct protocol for current user in session if (!SystemProtocols.ApplySessionsProtocols(1, null, null)) { // Summon Reports Analytics Form FormsMenuList.reportsAnalyticsForm = new ReportsAnalyticsForm(); FormsMenuList.reportsAnalyticsForm.Show(); // Disposing any open child DisposeAllChildren(); // Closing form while freeing system resources FormsMenuList.inventorySearchForm.Dispose(); } #endregion break; case Keys.F10: #region Activity Logs // Identifying correct protocol for current user in session if (!SystemProtocols.ApplySessionsProtocols(1, null, null)) { // Summon Activity Logs Form FormsMenuList.activitiesLogForm = new ActivitiesLogForm(); FormsMenuList.activitiesLogForm.Show(); // Disposing any open child DisposeAllChildren(); // Closing form while freeing system resources FormsMenuList.inventorySearchForm.Dispose(); } #endregion break; case Keys.F11: #region Error Logs // Identifying correct protocol for current user in session if (!SystemProtocols.ApplySessionsProtocols(1, null, null)) { // Summon Error Logs Form FormsMenuList.errorsLogForm = new ErrorsLogForm(); FormsMenuList.errorsLogForm.Show(); // Disposing any open child DisposeAllChildren(); // Closing form while freeing system resources FormsMenuList.inventorySearchForm.Dispose(); } #endregion break; case Keys.F12: #region View Cart // Summon View Cart Form FormsMenuList.viewCartForm = new ViewCartForm(); FormsMenuList.viewCartForm.Show(); // Disposing any open child DisposeAllChildren(); // Closing form while freeing system resources FormsMenuList.inventorySearchForm.Dispose(); #endregion break; default: break; } }