void dbController_InsertEntity(object sender, EntityArgs e) { fillgdInventory(); IEntity entity = e.Entity; string nameField = string.Empty, message = string.Empty, action = string.Empty, petsize = string.Empty; if (entity is Product) { Product p = entity as Product; nameField = p.Description; message = string.Format("New product: {0} has been added", nameField); action = string.Format("has added a new product", nameField); } else if (entity is Inventory) { Inventory i = entity as Inventory; Product p = dbController.getProductFromBarcode(i.Barcode); nameField = p.Description; message = string.Format("New stock of product {0} has been added", nameField); action = string.Format("added a new stock of product", nameField); } MessageBanner banner = new MessageBanner(message, 2000); banner.Show(); dbController.insertAuditTrail(action); }
void conclusion() { // End the transaction concludeTransaction = true; toggleEncoding(false); Inventory inventory = null; foreach (ProductInvoice item in carts) { dbController.insertProductInvoice(item); inventory = new Inventory() { Barcode = item.product.Barcode, QtyReceived = 0, QtyOnHand = -item.QuantitySold, }; dbController.pullInventory(inventory); dbController.checkProductCriticalLevel(item.product); } // audit string message = string.Format("completed a transaction: {0}", lblTransactionno.Text); dbController.insertAuditTrail(message); masterController.clientClock(); }
void removeUser() { DialogResult result = MessageBox.Show("Are you sure you want to delete this user?", "Remove user", MessageBoxButtons.OKCancel, MessageBoxIcon.Warning); if (result == DialogResult.OK) { MessageBanner banner = new MessageBanner(String.Format("User {0} has been removed", lbUsers.SelectedItem.ToString()), 3000); string userid = lbUsers.SelectedItem.ToString(); if (dbController.removeUser(dbController.getUserFromId(userid))) { banner.Show(); } // audit string action = string.Format("removed the User {0}", userid); dbController.insertAuditTrail(action); } }
private void btnSave_Click(object sender, EventArgs e) { if (userAdministration.usernames.Contains(txtUsername.Text) && mode != UserAdminMode.Edit_user) { MessageBox.Show(String.Format("The username {0} did already exists!", txtUsername.Text)); txtUsername.Focus(); txtUsername.SelectAll(); return; } else if (txtPassword.Text != txtRepassword.Text) { MessageBox.Show("Passwords didn't match!"); txtPassword.Focus(); txtRepassword.Clear(); return; } if (hasPictureChanged) { saveImage(); } User user = new User() { UserId = txtUsername.Text, Password = txtPassword.Text, userLevel = domainPosition.Text }; Employee employee = new Employee(user) { Firstname = txtFirstname.Text, MiddleName = txtMiddlename.Text, Lastname = txtLastname.Text, MobileNo = txtMobno.Text, EmailAddress = textBox2.Text, TelNo = txtTelno.Text, ImagePath = txtImagepath.Text, Address = txtAddress.Text }; MessageBanner banner; if (mode == UserAdminMode.Add_user) { dbController.createUserEmployee(user, employee); banner = new MessageBanner(string.Format("New User was added: {0}", user.UserId), 2000); banner.Show(); // audit string action = string.Format("added new User {0}", user.UserId); dbController.insertAuditTrail(action); } else if (mode == UserAdminMode.Edit_user) { dbController.updateEmployee(currentEmployee, employee); banner = new MessageBanner(String.Format("User {0} was updated", employee.User_id), 2000); banner.Show(); // audit string action = string.Format("updated User {0}", employee.User_id); dbController.insertAuditTrail(action); } this.disappear(); }
private void btnSave_Click(object sender, EventArgs e) { if (Validation.isFilled(panel_AddUser, txtMiddlename, txtPassword, txtRepassword)) { if (mode == UserAdminMode.Add_user) { if (string.IsNullOrWhiteSpace(txtPassword.Text) || string.IsNullOrWhiteSpace(txtRepassword.Text)) { MessageBanner banner0 = new MessageBanner("Please fill up all the fields and try again.", 2000); banner0.BackColor = System.Drawing.Color.DarkRed; banner0.ForeColor = System.Drawing.Color.White; banner0.Opacity = 1; banner0.Show(); return; } } if (userAdministration.usernames.Contains(txtUsername.Text) && mode != UserAdminMode.Edit_user) { MessageBox.Show(String.Format("The username {0} did already exists!", txtUsername.Text)); txtUsername.Focus(); txtUsername.SelectAll(); return; } else if (txtPassword.Text != txtRepassword.Text) { MessageBox.Show("Passwords didn't match!"); txtPassword.Focus(); txtRepassword.Clear(); return; } if (hasPictureChanged) { saveImage(); } User user = new User() { UserId = txtUsername.Text, Password = txtPassword.Text, userLevel = domainPosition.Text, Squery = SelectedIndex(cmbSquery.SelectedIndex), FBAnswer = txtAnswer.Text, }; Employee employee = new Employee(user) { Firstname = txtFirstname.Text, MiddleName = txtMiddlename.Text, Lastname = txtLastname.Text, MobileNo = txtMobno.Text, EmailAddress = textBox2.Text, TelNo = txtTelno.Text, ImagePath = txtImagepath.Text, Address = txtAddress.Text }; MessageBanner banner; if (mode == UserAdminMode.Add_user) { dbController.createUserEmployee(user, employee); banner = new MessageBanner(string.Format("New User was added: {0}", user.UserId), 2000); banner.Show(); // audit string action = string.Format("added new User {0}", user.UserId); dbController.insertAuditTrail(action); } else if (mode == UserAdminMode.Edit_user) { dbController.updateEmployee(currentEmployee, employee); banner = new MessageBanner(String.Format("User {0} was updated", employee.User_id), 2000); banner.Show(); // audit string action = string.Format("updated User {0}", employee.User_id); dbController.insertAuditTrail(action); } this.disappear(); } else { MessageBanner banner1 = new MessageBanner("Please fill up all the fields and try again.", 2000); banner1.BackColor = System.Drawing.Color.DarkRed; banner1.ForeColor = System.Drawing.Color.White; banner1.Opacity = 1; banner1.Show(); } }