private void insertNewAuditToolStripMenuItem_Click(object sender, EventArgs e) { if (UserAction.IsLegal(Action.Audit_Create)) { InsertNewAudit frmInsertNewAudit = new InsertNewAudit(); frmInsertNewAudit.ShowDialog(); } }
private void btnSave_Click(object sender, EventArgs e) { if (txtHeaderTitle.Text.Trim() == "") { MessageBox.Show("Please insert a Title!"); return; } if (cbCategory.Text.Trim() == "") { MessageBox.Show("Please choose a Category!"); return; } newFIHeaderRecord = new FIHeader() { Id = oldFIHeaderRecord.Id, Title = txtHeaderTitle.Text, FICategory = InsertNewAudit.getComboboxItem <FICategory>(cbCategory), FICategoryId = InsertNewAudit.getComboboxItem <FICategory>(cbCategory).Id, AuditId = currentAudit.Id }; if (isInsert) //insert { if (InsertIntoTable_FIHeader(newFIHeaderRecord)) { MessageBox.Show("New F/I Header inserted successfully!"); success = true; Close(); } else { MessageBox.Show("The New F/I Header has not been inserted!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } } else //update { if (FIHeader.isEqual(oldFIHeaderRecord, newFIHeaderRecord) == false) { if (UpdateTable_Headers(newFIHeaderRecord)) { success = true; MessageBox.Show("Header updated successfully!"); Close(); } else { MessageBox.Show("The F/I Header has not been updated!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } } else { Close(); } } }
public void ApplyFilters() { List <AuditRev> filteredLines = new List <AuditRev>(); filteredLines = auditRevList.Where(i => i.UpdDt >= dtpUpdDtFrom.Value.Date && i.UpdDt < dtpUpdDtTo.Value.Date.AddDays(1)).ToList(); if (cbUpdUser.SelectedIndex > 0) { filteredLines = filteredLines.Where(i => i.UpdUserId == InsertNewAudit.getComboboxItem <Users>(cbUpdUser).Id).ToList(); } FillDataGridViewRev(dgvAuditRevView, filteredLines); toolStripCounter.Text = "Records: " + filteredLines.Count.ToString(); }
private void btnSave_Click(object sender, EventArgs e) { if (txtUserName.Text.Trim() == "") { MessageBox.Show("Please insert a User Name!"); return; } if (txtFullName.Text.Trim() == "") { MessageBox.Show("Please insert a Full Name!"); return; } if (txtEmail.Text.Trim() == "") { MessageBox.Show("Please insert an Email!"); return; } if (cbRoles.Text.Trim() == "") { MessageBox.Show("Please choose a Role!"); return; } newUserRecord = new User(); newUserRecord.Email = txtEmail.Text; newUserRecord.FullName = txtFullName.Text; newUserRecord.UserName = txtUserName.Text; newUserRecord.Role = InsertNewAudit.getComboboxItem <Role>(cbRoles); newUserRecord.RolesId = InsertNewAudit.getComboboxItem <Role>(cbRoles).Id; newUserRecord.Id = oldUserRecord.Id; //update only if (isInsert) //insert { int NewUserId = InsertUser(newUserRecord); if (NewUserId > -1) { MessageBox.Show("New User inserted successfully!"); success = true; string initPass = GetRandomPassword(); byte[] HashPass = ChangePassword.Encrypt(initPass); if (ChangePassword.insertInto_PasswordHistory_Table(NewUserId, HashPass)) { NewPassword frmNewPass = new NewPassword(initPass); frmNewPass.ShowDialog(); } else { MessageBox.Show("Error while creating new password!"); } Close(); } else { MessageBox.Show("The New User has not been inserted!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } } else //update { if (UpdateTable_User(newUserRecord)) { MessageBox.Show("User updated successfully!"); success = true; Close(); } else { MessageBox.Show("The User has not been updated!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } } }