private void btnSave_Click(object sender, EventArgs e) { customerInformation = new CustomerInformation() { Firstname = txtFname.Text, Middlename = txtMname.Text, Lastname = txtLname.Text, Mobile_number = txtMobile.Text, Telephone_number = txtMobile.Text, Email_address = txtEmail.Text, Address = txtAdd1.Text + " " + txtAdd2.Text }; if (Validation.isFilled(customerInfo_panel)) { dbController.customerInformationMapper.insertCustomerInformation(customerInformation); } else { MessageBanner banner = new MessageBanner("Please fill up the required fields.", 2000); banner.ForeColor = System.Drawing.Color.Red; banner.Show(); } MyExtension.Validation.clearFields(newClient_tab); }
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); }
private void btnSave_Click(object sender, EventArgs e) { customerInformation = new CustomerInformation() { Firstname = txtFname.Text, Middlename = txtMname.Text, Lastname = txtLname.Text, Mobile_number = txtMobile.Text, Email_address = txtEmail.Text, Address = txtAdd1.Text, }; if (Validation.isFilled(newClient_tab)) { dbController.customerInformationMapper.insertCustomerInformation(customerInformation); } else { MessageBanner banner = new MessageBanner("Please fill up all the fields and try again.", 2000); banner.BackColor = System.Drawing.Color.DarkRed; banner.ForeColor = System.Drawing.Color.White; banner.Opacity = 1; banner.Show(); } MyExtension.Validation.clearFields(newClient_tab); }
private void btnSaveUpdate_Click(object sender, EventArgs e) { MessageBanner banner; if (MyExtension.Validation.isFilled(updateContacts_panel)) { customerInformation = new CustomerInformation() { Mobile_number = mob }; if (dbController.updateContacts(customerInformation.Mobile_number, txtUpdateMobile.Text, txtUpdateOtherContacts.Text)) { banner = new MessageBanner("Successful updating contact details.", 2000); banner.Show(); } else { banner = new MessageBanner("Failed updating contact details.", 2000); banner.ForeColor = Color.Red; banner.Show(); } } MyExtension.Validation.clearFields(updateContacts_panel); }
//private void OnCustomerAdded(EventArgs e) //{ // EventHandler onCustomerAdded = CustomerAdded; // if (onCustomerAdded != null) // onCustomerAdded(this, e); //} public void insertCustomerInformation(CustomerInformation customer) { if (create(insertValues(customer.Firstname, customer.Middlename, customer.Lastname, customer.Mobile_number, customer.Telephone_number, customer.Email_address, customer.Address))) { // OnCustomerAdded(new EventArgs()); MessageBanner banner = new MessageBanner("Successful adding information.", 2000); banner.Show(); } }
//private void OnCustomerAdded(EventArgs e) //{ // EventHandler onCustomerAdded = CustomerAdded; // if (onCustomerAdded != null) // onCustomerAdded(this, e); //} public void insertCustomerInformation(CustomerInformation customer) { if (create(insertValues(customer.Firstname, customer.Middlename, customer.Lastname, customer.Mobile_number, customer.Email_address, customer.Address))) { // OnCustomerAdded(new EventArgs()); MessageBanner banner = new MessageBanner("Successful adding information.", 2000); banner.Opacity = 1; banner.ForeColor = System.Drawing.Color.White; banner.Show(); } }
private void deleteProduct(string barcode) { DialogResult result = MessageBox.Show("Are you sure you want to delete this product, this command is irreversible", "Caution", MessageBoxButtons.YesNo, MessageBoxIcon.Warning); if (result == DialogResult.OK) { if (dbController.productMapper.deactiveProduct(barcode)) { MessageBanner banner = new MessageBanner("Product has been removed"); banner.Show(this); fillgdInventory(); } } }
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); } }
void dbController_UpdateEntity(object sender, EntityArgs e) { fillgdInventory(); IEntity entity = e.Entity; string message = string.Empty, action = string.Empty, nameField = string.Empty, petsize = string.Empty; if (entity is Product) { Product p = entity as Product; nameField = p.Description; message = string.Format("Product {0} has been updated", nameField); action = string.Format("has updated the product {0}", nameField); } MessageBanner banner = new MessageBanner(message, 3000); banner.Show(); 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 btnSaveUpdate_Click(object sender, EventArgs e) { MessageBanner banner; if (MyExtension.Validation.isFilled(updateContacts_panel)) { customerInformation = new CustomerInformation() { Mobile_number = mob }; if (dbController.updateContacts(customerInformation.Mobile_number, txtUpdateMobile.Text)) { banner = new MessageBanner("Successful updating contact details.", 2000); banner.Show(); } else { banner = new MessageBanner("Failed updating contact details.", 2000); banner.ForeColor = Color.Red; banner.Show(); } } MyExtension.Validation.clearFields(updateContacts_panel); }
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(); } }
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(); } }