private void verifysecurity() { if (!credentialsverified) { string ValueIWantFromProptForm = ""; this.Enabled = false; ScanEmpId invoiceFor = new ScanEmpId(); if (invoiceFor.ShowDialog() == System.Windows.Forms.DialogResult.OK) { ValueIWantFromProptForm = invoiceFor.ValueIWant; } if (ValueIWantFromProptForm.Length > 0) { if (connectapi.EmployeeExitsWithCribRights(ValueIWantFromProptForm)) { credentialsverified = true; toolStripDropDownButton1.DropDownItems[0].Enabled = true; toolStripDropDownButton1.DropDownItems[1].Enabled = true; toolStripDropDownButton1.DropDownItems[2].Enabled = true; toolStripDropDownButton1.DropDownItems[3].Enabled = true; } else { MessageBox.Show("Your request for gaining access to inventory options can't be completed based on your security settings.", "SPM Connect - Warning", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } } else { MetroFramework.MetroMessageBox.Show(this, "Please try again. Employee not found.", "SPM Connect - Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } this.Enabled = true; } }
private void addnewbttn_Click(object sender, EventArgs e) { DialogResult result = MetroFramework.MetroMessageBox.Show(this, "Are you sure want to create a new engineering change request?", "SPM Connect - Create New ECR?", MessageBoxButtons.YesNo, MessageBoxIcon.Question); if (result == DialogResult.Yes) { if (connectapi.getEmployeeId() != 0) { string status = connectapi.CreatenewECR(connectapi.getEmployeeId().ToString()); if (status.Length > 1) { showecrinvoice(status, true, connectapi.getEmployeeId().ToString()); } } else { // scan the employee barcode and grab the user name string scanEmployeeId = ""; ScanEmpId invoiceFor = new ScanEmpId(); if (invoiceFor.ShowDialog() == System.Windows.Forms.DialogResult.OK) { scanEmployeeId = invoiceFor.ValueIWant; } if (scanEmployeeId.Length > 0) { if (connectapi.EmployeeExits(scanEmployeeId)) { string status = connectapi.CreatenewECR(scanEmployeeId); if (status.Length > 1) { showecrinvoice(status, true, scanEmployeeId); } } else { MetroFramework.MetroMessageBox.Show(this, "Employee not found. Please contact the admin", "SPM Connect - Employee Not Found", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } } else { MetroFramework.MetroMessageBox.Show(this, "Please try again. Employee not found.", "SPM Connect - Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } } } }
private void showecrinvoice(string invoice, bool newcreated, string empid) { string invoiceopen = connectapi.InvoiceOpen(invoice); if (invoiceopen.Length > 0) { MetroFramework.MetroMessageBox.Show(this, "Inovice is opened for edit by " + invoiceopen + ". ", "SPM Connect - Open Invoice Failed", MessageBoxButtons.OK, MessageBoxIcon.Stop); } else { if (connectapi.getEmployeeId() != 0) { if (connectapi.CheckinInvoice(invoice)) { using (ECRDetails invoiceDetails = new ECRDetails(connectapi.getuserfullname(), invoice)) { invoiceDetails.ShowDialog(); this.Enabled = true; performreload(); this.Show(); this.Activate(); this.Focus(); } } } else { // scan the employee barcode and grab the user name string scanEmployeeId = ""; if (!(newcreated)) { ScanEmpId invoiceFor = new ScanEmpId(); if (invoiceFor.ShowDialog() == System.Windows.Forms.DialogResult.OK) { scanEmployeeId = invoiceFor.ValueIWant; } } else { scanEmployeeId = empid; } if (scanEmployeeId.Length > 0) { if (connectapi.CheckinInvoice(invoice)) { using (ECRDetails invoiceDetails = new ECRDetails(connectapi.getNameByEmpId(scanEmployeeId), invoice)) { invoiceDetails.ShowDialog(); this.Enabled = true; performreload(); this.Show(); this.Activate(); this.Focus(); } } } else { MetroFramework.MetroMessageBox.Show(this, "Please try again. Employee not found.", "SPM Connect - Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } } } }