private void btnUpdate_Click(object sender, EventArgs e) { try { if (!GlobalFunctions.checkRights("tsmGeneralJournal", "Update")) { return; } foreach (DataRow _drStatus in loJournalEntry.getJournalEntryStatus(dgvList.CurrentRow.Cells[0].Value.ToString()).Rows) { if (_drStatus[0].ToString() == "Y") { MessageBoxUI _mbStatus = new MessageBoxUI("You cannot update a POSTED Journal Entry!", GlobalVariables.Icons.Warning, GlobalVariables.Buttons.OK); _mbStatus.ShowDialog(); return; } } if (dgvList.Rows.Count > 0) { JournalVoucherUI loJournalVoucher = new JournalVoucherUI(dgvList.CurrentRow.Cells[0].Value.ToString()); loJournalVoucher.ParentList = this; loJournalVoucher.ShowDialog(); } } catch (Exception ex) { ErrorMessageUI em = new ErrorMessageUI(ex.Message, this.Name, "btnUpdate_Click"); em.ShowDialog(); return; } }
public void Restore() { try { //Read file from C:\ string path; path = txtSqlFileAddress.Text;//.../Main/MySqlBackUp/POSBackup2012-1-6-18-44-57-353.sql StreamReader file = new StreamReader(path); string input = file.ReadToEnd(); file.Close(); ProcessStartInfo psi = new ProcessStartInfo(); psi.FileName = GlobalVariables.RestoreMySqlAddress; psi.RedirectStandardInput = true; psi.RedirectStandardOutput = false; psi.Arguments = string.Format(@"-u{0} -p{1} -h{2} {3}", txtBackupUserId.Text, txtBackupPassword.Text, txtBackupServer.Text, txtBackupDatabase.Text); psi.UseShellExecute = false; Process process = Process.Start(psi); process.StandardInput.WriteLine(input); process.StandardInput.Close(); process.WaitForExit(); process.Close(); MessageBoxUI mb = new MessageBoxUI("Database has been successfully restored!", GlobalVariables.Icons.Ok, GlobalVariables.Buttons.OK); mb.ShowDialog(); } catch (IOException ex) { MessageBoxUI mb = new MessageBoxUI(ex, GlobalVariables.Icons.Error, GlobalVariables.Buttons.Close); mb.ShowDialog(); } }
private void pbPicture_Click(object sender, EventArgs e) { OpenFileDialog openFD = new OpenFileDialog(); openFD.InitialDirectory = ".../Main/ScreenSaverImages/"; openFD.Title = "Insert an Image"; openFD.Filter = "JPEG Images|*.jpg|GIF Images|*.gif|PNG Images|*.png"; if (openFD.ShowDialog() == DialogResult.Cancel) { MessageBoxUI mb = new MessageBoxUI("Operation Cancelled", GlobalVariables.Icons.Information, GlobalVariables.Buttons.OK); mb.ShowDialog(); } else { string lChosenFile = openFD.FileName; string _FileName = openFD.SafeFileName; byte[] m_Bitmap = null; FileStream fs = new FileStream(lChosenFile, FileMode.Open); BinaryReader br = new BinaryReader(fs); int length = (int)br.BaseStream.Length; m_Bitmap = new byte[length]; m_Bitmap = br.ReadBytes(length); br.Close(); fs.Close(); lPicture = GlobalFunctions.ToHex(m_Bitmap); pbPicture.BackgroundImage = GlobalFunctions.ConvertByteArrayToImage(m_Bitmap); pbPicture.BackgroundImageLayout = ImageLayout.Stretch; } }
private void btnAuthenticate_Click(object sender, EventArgs e) { if (txtKey1.Text == lExpectedValue1 && txtKey2.Text == lExpectedValue2 && txtKey3.Text == lExpectedValue3 && txtKey4.Text == lExpectedValue4) { /* * if (!sendEmailForLicenseKeyRecording(GlobalFunctions.GetProcessorId(), txtKey1.Text + "-" + txtKey2.Text + "-" + txtKey3.Text + "-" + txtKey4.Text)) * { * MessageBoxUI mb1 = new MessageBoxUI("NO INTERNET CONNECTION!\nYou must have an internet connection or contact supplier!", GlobalVariables.Icons.Warning, GlobalVariables.Buttons.OK); * mb1.ShowDialog(); * Application.Exit(); * } */ MessageBoxUI mb = new MessageBoxUI("CONGRATULATIONS!\nLicense has been verified. Thank you for using NSites Business Applications!", GlobalVariables.Icons.Information, GlobalVariables.Buttons.OK); mb.ShowDialog(); //writeLicenseCertificate(); lLicenseNo = lExpectedValue1 + "-" + lExpectedValue2 + "-" + lExpectedValue3 + "-" + lExpectedValue4; lExpiryDate = DateTime.Parse("01/01/9999"); lSuccessFullyVerified = true; this.Close(); } else { MessageBoxUI mb = new MessageBoxUI("INVALID KEY!\nPlease input correct license key or contact supplier!", GlobalVariables.Icons.Warning, GlobalVariables.Buttons.OK); mb.ShowDialog(); return; } }
private void btnRemove_Click(object sender, EventArgs e) { try { if (!GlobalFunctions.checkRights("tsmUserGroup", "Remove")) { return; } if (lId != null) { DialogResult _dr = new DialogResult(); MessageBoxUI _mb = new MessageBoxUI("Are sure you want to continue removing this record?", GlobalVariables.Icons.QuestionMark, GlobalVariables.Buttons.YesNo); _mb.ShowDialog(); _dr = _mb.Operation; if (_dr == DialogResult.Yes) { if (loUserGroup.removeUserGroup(lId)) { MessageBoxUI _mb1 = new MessageBoxUI("User Group has been successfully removed!", GlobalVariables.Icons.Information, GlobalVariables.Buttons.OK); _mb1.ShowDialog(); refresh("ViewAll", "", ""); loadAllMenuItems(); } } } } catch (Exception ex) { ErrorMessageUI em = new ErrorMessageUI(ex.Message, this.Name, "btnRemove_Click"); em.ShowDialog(); return; } }
private void btnRemoveCreditExperience_Click(object sender, EventArgs e) { DialogResult _dr = new DialogResult(); MessageBoxUI _mb = new MessageBoxUI("Are sure you want to continue removing this record?", GlobalVariables.Icons.QuestionMark, GlobalVariables.Buttons.YesNo); _mb.ShowDialog(); _dr = _mb.Operation; if (_dr == DialogResult.Yes) { try { if (loClientCreditExperience.remove(dgvCreditExperience.CurrentRow.Cells[0].Value.ToString())) { MessageBoxUI _mb1 = new MessageBoxUI("Credit Experience has been successfully removed!", GlobalVariables.Icons.Information, GlobalVariables.Buttons.OK); _mb1.ShowDialog(); dgvCreditExperience.DataSource = loClientCreditExperience.getAllData(txtClientId.Text, ""); } } catch (Exception ex) { MessageBoxUI mb = new MessageBoxUI(ex, GlobalVariables.Icons.Error, GlobalVariables.Buttons.OK); mb.ShowDialog(); return; } } }
private void btnSave_Click(object sender, EventArgs e) { try { if (!GlobalFunctions.checkRights("tsmScreenSaver", "Save")) { return; } loSystemConfiguration.Value = lScreenSaverImage; loSystemConfiguration.Key = "ScreenSaverImage"; if (loSystemConfiguration.saveSystemConfiguration(GlobalVariables.Operation.Edit)) { GlobalVariables.ScreenSaverImage = lScreenSaverImage; MessageBoxUI ms = new MessageBoxUI("Screen Saver has been change successfully!", GlobalVariables.Icons.Information, GlobalVariables.Buttons.OK); ms.ShowDialog(); ParentList.GetType().GetMethod("changeHomeImage").Invoke(ParentList, null); } } catch (Exception ex) { ErrorMessageUI em = new ErrorMessageUI(ex.Message, this.Name, "btnSave_Click"); em.ShowDialog(); return; } }
public bool saveSystemConfiguration(GlobalVariables.Operation pOperation) { bool _Status = false; try { switch (pOperation) { case GlobalVariables.Operation.Add: _Status = lSystemConfigurationDAO.insertSystemConfiguration(this); break; case GlobalVariables.Operation.Edit: _Status = lSystemConfigurationDAO.updateSystemConfiguration(this); break; default: break; } } catch (Exception ex) { MessageBoxUI mb = new MessageBoxUI(ex, GlobalVariables.Icons.Error, GlobalVariables.Buttons.OK); mb.ShowDialog(); } return(_Status); }
private void btnSave_Click(object sender, EventArgs e) { try { if (!GlobalFunctions.checkRights("tsmSystemConfiguration", "Save")) { return; } lOperation = GlobalVariables.Operation.Edit; loadDataToHash(); foreach (DictionaryEntry Hash in lSystemConfigHash) { try { loSystemConfiguration.Key = Hash.Key.ToString(); loSystemConfiguration.Value = Hash.Value.ToString(); } catch (Exception ex) { throw ex; } loSystemConfiguration.saveSystemConfiguration(lOperation); } writeSystemSettings(); MessageBoxUI _mb = new MessageBoxUI("System Configuration has been saved successfully!", GlobalVariables.Icons.Save, GlobalVariables.Buttons.OK); _mb.ShowDialog(); } catch (Exception ex) { ErrorMessageUI em = new ErrorMessageUI(ex.Message, this.Name, "btnSave_Click"); em.ShowDialog(); return; } }
private void tsmPreviewDetail_Click(object sender, EventArgs e) { try { if (!GlobalFunctions.checkRights("tsmPriceQuotation", "Preview Detail")) { return; } foreach (DataRow _drStatus in loPriceQuotation.getPriceQuotationStatus(dgvList.CurrentRow.Cells[0].Value.ToString()).Rows) { if (_drStatus[0].ToString() == "N") { MessageBoxUI _mbStatus = new MessageBoxUI("Only APPROVED Price Quotation can be previewed!", GlobalVariables.Icons.Warning, GlobalVariables.Buttons.OK); _mbStatus.ShowDialog(); return; } else if (_drStatus[2].ToString() == "Y") { MessageBoxUI _mbStatus = new MessageBoxUI("You cannot preview a cancelled Price Quotation!", GlobalVariables.Icons.Warning, GlobalVariables.Buttons.OK); _mbStatus.ShowDialog(); return; } else { previewPriceQuotationDetail(dgvList.CurrentRow.Cells[0].Value.ToString()); } } } catch (Exception ex) { ErrorMessageUI em = new ErrorMessageUI(ex.Message, this.Name, "tsmPreviewDetail_Click"); em.ShowDialog(); return; } }
private void btnUpdate_Click(object sender, EventArgs e) { try { if (!GlobalFunctions.checkRights("tsmStockReceiving", "Update")) { return; } foreach (DataRow _drStatus in loInventory.getInventoryStatus(dgvList.CurrentRow.Cells[0].Value.ToString()).Rows) { if (_drStatus[0].ToString() == "Y") { MessageBoxUI _mbStatus = new MessageBoxUI("You cannot update a FINALIZED Stock Inventory!", GlobalVariables.Icons.Warning, GlobalVariables.Buttons.OK); _mbStatus.ShowDialog(); return; } } if (dgvList.Rows.Count > 0) { StockReceivingDetailUI loStockReceivingDetail = new StockReceivingDetailUI(dgvList.CurrentRow.Cells[0].Value.ToString()); loStockReceivingDetail.ParentList = this; loStockReceivingDetail.ShowDialog(); } } catch (Exception ex) { ErrorMessageUI em = new ErrorMessageUI(ex.Message, this.Name, "btnUpdate_Click"); em.ShowDialog(); return; } }
public string save(GlobalVariables.Operation pOperation, ref MySqlTransaction pTrans) { string _UserGroupId = ""; try { switch (pOperation) { case GlobalVariables.Operation.Add: _UserGroupId = lUserGroupDAO.insertUserGroup(this, ref pTrans); break; case GlobalVariables.Operation.Edit: _UserGroupId = lUserGroupDAO.updateUserGroup(this, ref pTrans); break; default: break; } } catch (Exception ex) { MessageBoxUI mb = new MessageBoxUI(ex, GlobalVariables.Icons.Error, GlobalVariables.Buttons.OK); mb.ShowDialog(); } return(_UserGroupId); }
public bool save(GlobalVariables.Operation pOperation, ref MySqlTransaction pTrans) { bool _Status = false; try { switch (pOperation) { case GlobalVariables.Operation.Add: _Status = lUserDAO.insertUser(this, ref pTrans); break; case GlobalVariables.Operation.Edit: _Status = lUserDAO.updateUser(this, ref pTrans); break; default: break; } } catch (Exception ex) { MessageBoxUI mb = new MessageBoxUI(ex, GlobalVariables.Icons.Error, GlobalVariables.Buttons.OK); mb.ShowDialog(); } return(_Status); }
private void btnPreview_Click(object sender, EventArgs e) { if (!GlobalFunctions.checkRights("tsmAuditTrail", "Preview")) { return; } try { loAuditTrailRpt.SetDataSource(ldtAuditTrail); loAuditTrailRpt.Database.Tables[1].SetDataSource(GlobalVariables.DTCompanyLogo); loAuditTrailRpt.SetParameterValue("CompanyName", GlobalVariables.CompanyName); loAuditTrailRpt.SetParameterValue("CompanyAddress", GlobalVariables.CompanyAddress); loAuditTrailRpt.SetParameterValue("CompanyContactNumber", GlobalVariables.ContactNumber); loAuditTrailRpt.SetParameterValue("Username", GlobalVariables.Userfullname); loAuditTrailRpt.SetParameterValue("Title", "Audit Trail"); loAuditTrailRpt.SetParameterValue("SubTitle", "Audit Trail"); loReportViewer.crystalReportViewer.ReportSource = loAuditTrailRpt; loReportViewer.ShowDialog(); } catch (Exception ex) { MessageBoxUI mb = new MessageBoxUI(ex, GlobalVariables.Icons.Error, GlobalVariables.Buttons.Close); mb.ShowDialog(); return; } }
private void btnSearch_Click(object sender, EventArgs e) { if (!GlobalFunctions.checkRights("tsmAuditTrail", "Search")) { return; } try { string _AuditTrailDisplayFields = "SELECT DATE_FORMAT(`Date`,'%M %d, %Y') AS `TransactionDate`,DATE_FORMAT(`Date`,'%h:%i:%s %p') AS `Transaction Time`,LogDescription AS `Log Description`, Hostname AS `Computer Name` " + "FROM audittrail "; string __AuditTrailWhereFields = " ORDER BY `Date` ASC;"; loSearches.lAlias = ""; loSearches.ShowDialog(); if (loSearches.lFromShow) { ldtAuditTrail = loCommon.getDataFromSearch(_AuditTrailDisplayFields + loSearches.lQuery + __AuditTrailWhereFields); GlobalFunctions.refreshGrid(ref dgvAuditTrail, ldtAuditTrail); } } catch (Exception ex) { MessageBoxUI mb = new MessageBoxUI(ex, GlobalVariables.Icons.Error, GlobalVariables.Buttons.Close); mb.ShowDialog(); return; } }
private void btnSave_Click(object sender, EventArgs e) { try { if (decimal.Parse(txtQtyIN.Text) == 0) { MessageBoxUI _mbStatus = new MessageBoxUI("Qty must not be Zero(0)!", GlobalVariables.Icons.Error, GlobalVariables.Buttons.OK); _mbStatus.ShowDialog(); return; } lRecordData[0] = lDetailId; try { lRecordData[1] = cboStockDescription.SelectedValue.ToString(); } catch { MessageBoxUI _mbStatus = new MessageBoxUI("You must select a correct Stock!", GlobalVariables.Icons.Error, GlobalVariables.Buttons.OK); _mbStatus.ShowDialog(); cboStockDescription.Focus(); return; } lRecordData[2] = txtStockCode.Text; lRecordData[3] = cboStockDescription.Text; lRecordData[4] = txtUnit.Text; try { lRecordData[5] = cboLocation.SelectedValue.ToString(); } catch { lRecordData[5] = ""; } lRecordData[6] = cboLocation.Text; lRecordData[7] = string.Format("{0:n}", decimal.Parse(txtQtyIN.Text)); lRecordData[8] = GlobalFunctions.replaceChar(txtRemarks.Text); object[] _params = { lRecordData }; if (lOperator == "Add") { lRecordData[9] = "Add"; ParentList.GetType().GetMethod("addData").Invoke(ParentList, _params); clear(); } else if (lOperator == "Edit") { lRecordData[9] = "Edit"; ParentList.GetType().GetMethod("updateData").Invoke(ParentList, _params); this.Close(); } } catch (Exception ex) { ErrorMessageUI em = new ErrorMessageUI(ex.Message, this.Name, "btnSave_Click"); em.ShowDialog(); return; } }
private void btnSave_Click(object sender, EventArgs e) { /*if (decimal.Parse(txtQtyIN.Text) == 0 && decimal.Parse(txtQtyOUT.Text) == 0) * { * MessageBoxUI _mbStatus = new MessageBoxUI("Qty must not be Zero(0)!", GlobalVariables.Icons.Error, GlobalVariables.Buttons.OK); * _mbStatus.ShowDialog(); * return; * }*/ if (decimal.Parse(txtQtyIN.Text) != 0 && decimal.Parse(txtQtyOUT.Text) != 0) { MessageBoxUI _mbStatus = new MessageBoxUI("Only 1 (one) Qty must not be Zero(0)!", GlobalVariables.Icons.Error, GlobalVariables.Buttons.OK); _mbStatus.ShowDialog(); return; } lRecordData[0] = lDetailId; try { lRecordData[1] = cboStockDescription.SelectedValue.ToString(); } catch { MessageBoxUI _mbStatus = new MessageBoxUI("You must select a correct Stock!", GlobalVariables.Icons.Error, GlobalVariables.Buttons.OK); _mbStatus.ShowDialog(); cboStockDescription.Focus(); return; } lRecordData[2] = cboStockDescription.Text; lRecordData[3] = txtUnit.Text; lRecordData[4] = txtBrand.Text; lRecordData[5] = txtSupplier.Text; lRecordData[6] = lPicture; lRecordData[7] = cboLocation.SelectedValue.ToString(); lRecordData[8] = cboLocation.Text; lRecordData[9] = string.Format("{0:n}", decimal.Parse(txtQtyIN.Text)); lRecordData[10] = string.Format("{0:n}", decimal.Parse(txtQtyOUT.Text)); lRecordData[11] = string.Format("{0:n}", decimal.Parse(txtBalance.Text)); lRecordData[12] = string.Format("{0:n}", decimal.Parse(txtUnitPrice.Text)); lRecordData[13] = string.Format("{0:n}", decimal.Parse(txtTotalPrice.Text)); lRecordData[14] = GlobalFunctions.replaceChar(txtRemarks.Text); object[] _params = { lRecordData }; if (lOperator == "Add") { lRecordData[15] = "Add"; ParentList.GetType().GetMethod("addData").Invoke(ParentList, _params); MessageBoxUI _mbStatus = new MessageBoxUI("Successfully added!", GlobalVariables.Icons.Save, GlobalVariables.Buttons.OK); _mbStatus.ShowDialog(); clear(); } else if (lOperator == "Edit") { lRecordData[15] = "Edit"; ParentList.GetType().GetMethod("updateData").Invoke(ParentList, _params); Close(); } }
private void btnFinalize_Click(object sender, EventArgs e) { if (!GlobalFunctions.checkRights("tsmStockWithdrawal", "Finalize")) { return; } try { if (dgvList.Rows.Count > 0) { foreach (DataRow _drF in loInventoryHeader.getAllData("", dgvList.CurrentRow.Cells[0].Value.ToString(), "", "Stock Withdtrawal").Rows) { if (_drF["Final"].ToString() == "Y") { MessageBoxUI mb = new MessageBoxUI("Stock Withdrawal is already FINALIZED!", GlobalVariables.Icons.Information, GlobalVariables.Buttons.OK); mb.ShowDialog(); return; } } DialogResult _dr = new DialogResult(); MessageBoxUI _mb = new MessageBoxUI("Are sure you want to continue finalizing this record?", GlobalVariables.Icons.QuestionMark, GlobalVariables.Buttons.YesNo); _mb.ShowDialog(); _dr = _mb.Operation; if (_dr == DialogResult.Yes) { MySqlTransaction Trans = GlobalVariables.Connection.BeginTransaction(); try { if (loInventoryHeader.finalize(dgvList.CurrentRow.Cells[0].Value.ToString(), ref Trans)) { foreach (DataRow _dr1 in loInventoryDetail.getAllData(dgvList.CurrentRow.Cells[0].Value.ToString()).Rows) { loInventoryDetail.updateQtyOnHand(_dr1[0].ToString(), ref Trans); } Trans.Commit(); MessageBoxUI _mb1 = new MessageBoxUI("Record has been successfully finalized!", GlobalVariables.Icons.Information, GlobalVariables.Buttons.OK); _mb1.ShowDialog(); previewDetails(dgvList.CurrentRow.Cells[0].Value.ToString()); refresh("ViewAll", "", "", "Stock Withdrawal"); } } catch (Exception ex) { Trans.Rollback(); MessageBoxUI mb = new MessageBoxUI(ex, GlobalVariables.Icons.Error, GlobalVariables.Buttons.OK); mb.ShowDialog(); return; } } } } catch { } }
private void btnRemove_Click(object sender, EventArgs e) { try { if (!GlobalFunctions.checkRights("tsmLoanApplication", "Remove")) { return; } DataTable _dt = loLoanApplication.getLoanApplicationStatus(dgvList.CurrentRow.Cells[0].Value.ToString()); if (_dt.Rows.Count > 0) { foreach (DataRow _drStatus in _dt.Rows) { if (_drStatus[0].ToString() != "In Process") { MessageBoxUI _mbStatus = new MessageBoxUI("Only IN PROCESS application can be removed!", GlobalVariables.Icons.Warning, GlobalVariables.Buttons.OK); _mbStatus.ShowDialog(); return; } } } else { MessageBoxUI _mbStatus = new MessageBoxUI("Loan Application Id does not exist!", GlobalVariables.Icons.Warning, GlobalVariables.Buttons.OK); _mbStatus.ShowDialog(); return; } if (dgvList.Rows.Count > 0) { DialogResult _dr = new DialogResult(); MessageBoxUI _mb = new MessageBoxUI("Are sure you want to continue removing this Loan Application record?", GlobalVariables.Icons.QuestionMark, GlobalVariables.Buttons.YesNo); _mb.ShowDialog(); _dr = _mb.Operation; if (_dr == DialogResult.Yes) { if (loLoanApplication.remove(dgvList.CurrentRow.Cells[0].Value.ToString())) { MessageBoxUI _mb1 = new MessageBoxUI("Loan Application record has been successfully removed!", GlobalVariables.Icons.Information, GlobalVariables.Buttons.OK); _mb1.ShowDialog(); refresh(); } else { } } } } catch (Exception ex) { ErrorMessageUI em = new ErrorMessageUI(ex.Message, this.Name, "btnRemove_Click"); em.ShowDialog(); return; } }
private void btnApprove_Click(object sender, EventArgs e) { try { if (!GlobalFunctions.checkRights("tsmPriceQuotation", "Approved")) { return; } foreach (DataRow _drStatus in loPriceQuotation.getPriceQuotationStatus(dgvList.CurrentRow.Cells[0].Value.ToString()).Rows) { if (_drStatus[0].ToString() == "Y") { MessageBoxUI _mbStatus = new MessageBoxUI("Price Quotation is already APPROVED!", GlobalVariables.Icons.Warning, GlobalVariables.Buttons.OK); _mbStatus.ShowDialog(); return; } /* * if (_drStatus[4].ToString() == GlobalVariables.Username) * { * MessageBoxUI _mbStatus = new MessageBoxUI("You cannot APPROVE a Price Quotation you preprared!", GlobalVariables.Icons.Warning, GlobalVariables.Buttons.OK); * _mbStatus.ShowDialog(); * return; * } */ } if (dgvList.Rows.Count > 0) { DialogResult _dr = new DialogResult(); MessageBoxUI _mb = new MessageBoxUI("Are sure you want to continue approving this Price Quotation record?", GlobalVariables.Icons.QuestionMark, GlobalVariables.Buttons.YesNo); _mb.ShowDialog(); _dr = _mb.Operation; if (_dr == DialogResult.Yes) { if (loPriceQuotation.approve(dgvList.CurrentRow.Cells[0].Value.ToString())) { MessageBoxUI _mb1 = new MessageBoxUI("Price Quotation record has been successfully approved!", GlobalVariables.Icons.Information, GlobalVariables.Buttons.OK); _mb1.ShowDialog(); previewPriceQuotationDetail(dgvList.CurrentRow.Cells[0].Value.ToString()); //sendEmailToCreator(); refresh(); } else { } } } } catch (Exception ex) { ErrorMessageUI em = new ErrorMessageUI(ex.Message, this.Name, "btnApprove_Click"); em.ShowDialog(); return; } }
private void btnFinalize_Click(object sender, EventArgs e) { try { if (!GlobalFunctions.checkRights("tsmStockTransferIn", "Finalize")) { return; } foreach (DataRow _drStatus in loInventory.getInventoryStatus(dgvList.CurrentRow.Cells[0].Value.ToString()).Rows) { if (_drStatus[0].ToString() == "Y") { MessageBoxUI _mbStatus = new MessageBoxUI("Stock Inventory is already FINALIZED!", GlobalVariables.Icons.Warning, GlobalVariables.Buttons.OK); _mbStatus.ShowDialog(); return; } /* * if (_drStatus[4].ToString() == GlobalVariables.Username) * { * MessageBoxUI _mbStatus = new MessageBoxUI("You cannot FINALIZE a Stock Inventory you preprared!", GlobalVariables.Icons.Warning, GlobalVariables.Buttons.OK); * _mbStatus.ShowDialog(); * return; * } */ } if (dgvList.Rows.Count > 0) { DialogResult _dr = new DialogResult(); MessageBoxUI _mb = new MessageBoxUI("Are sure you want to continue finalizing this Stock Inventory record?", GlobalVariables.Icons.QuestionMark, GlobalVariables.Buttons.YesNo); _mb.ShowDialog(); _dr = _mb.Operation; if (_dr == DialogResult.Yes) { if (loInventory.final(dgvList.CurrentRow.Cells[0].Value.ToString())) { MessageBoxUI _mb1 = new MessageBoxUI("Stock Inventory record has been successfully finalized!", GlobalVariables.Icons.Information, GlobalVariables.Buttons.OK); _mb1.ShowDialog(); previewInventoryDetail(dgvList.CurrentRow.Cells[0].Value.ToString()); //sendEmailToCreator(); refresh("Stock Transfer In"); } else { } } } } catch (Exception ex) { ErrorMessageUI em = new ErrorMessageUI(ex.Message, this.Name, "btnFinalize_Click"); em.ShowDialog(); return; } }
private void SoftwareLicenseUI_Load(object sender, EventArgs e) { try { lblCompanyName.Text = lCompanyName; lSuccessFullyVerified = false; //for every software varies... string SoftwareNo = "1"; string[] lValueWithNumbers2 = generateCode(ref txtCode2, ref lblKey2).Split('*'); string[] lValueWithNumbers3 = generateCode(ref txtCode3, ref lblKey3).Split('*'); string[] lValueWithNumbers4 = generateCode(ref txtCode4, ref lblKey4).Split('*'); lExpectedValue2 = lValueWithNumbers2[0].ToString(); lGetExpectedValueNumber2 = lValueWithNumbers2[1].ToString(); lNumbers2 = lValueWithNumbers2[2].ToString(); lExpectedValue3 = lValueWithNumbers3[0].ToString(); lGetExpectedValueNumber3 = lValueWithNumbers3[1].ToString(); lNumbers3 = lValueWithNumbers3[2].ToString(); lExpectedValue4 = lValueWithNumbers4[0].ToString(); lGetExpectedValueNumber4 = lValueWithNumbers4[1].ToString(); lNumbers4 = lValueWithNumbers4[2].ToString(); //for number 1 string _Value1 = expectedValue(int.Parse(SoftwareNo), int.Parse(SoftwareNo)); string _Value2 = expectedValue(int.Parse(SoftwareNo), int.Parse(lGetExpectedValueNumber2)); string _Value3 = expectedValue(int.Parse(SoftwareNo), int.Parse(lGetExpectedValueNumber3)); string _Value4 = expectedValue(int.Parse(SoftwareNo), int.Parse(lGetExpectedValueNumber4)); lExpectedValue1 = _Value1 + _Value2 + _Value3 + _Value4; lGetExpectedValueNumber1 = "2"; lNumbers1 = SoftwareNo + lGetExpectedValueNumber2 + lGetExpectedValueNumber3 + lGetExpectedValueNumber4; txtCode1.Text = lNumbers1; lblKey1.Text = lNumbers1 + " = " + SoftwareNo + ", " + lGetExpectedValueNumber2 + ", " + lGetExpectedValueNumber3 + ", " + lGetExpectedValueNumber4; if (!sendSoftwareLicenseEmail(GlobalFunctions.GetProcessorId(), txtCode1.Text + "-" + txtCode2.Text + "-" + txtCode3.Text + "-" + txtCode4.Text)) { MessageBoxUI mb = new MessageBoxUI("NO INTERNET CONNECTION!\nYou must have an internet connection or contact supplier!", GlobalVariables.Icons.Warning, GlobalVariables.Buttons.OK); mb.ShowDialog(); Application.Exit(); } txtLicenseKey.Focus(); } catch (Exception ex) { ErrorMessageUI em = new ErrorMessageUI(ex.Message, this.Name, "SoftwareLicenseUI_Load"); em.ShowDialog(); Application.Exit(); } }
private void btnSave_Click(object sender, EventArgs e) { try { if (decimal.Parse(txtCheckAmount.Text) == 0) { MessageBoxUI _mbStatus = new MessageBoxUI("Check Amount must not be Zero(0)!", GlobalVariables.Icons.Error, GlobalVariables.Buttons.OK); _mbStatus.ShowDialog(); return; } lRecordData[0] = lDetailId; try { lRecordData[1] = cboBank.SelectedValue.ToString(); lRecordData[2] = cboBank.Text; } catch { MessageBoxUI _mbStatus = new MessageBoxUI("You must select a correct Bank!", GlobalVariables.Icons.Error, GlobalVariables.Buttons.OK); _mbStatus.ShowDialog(); cboBank.Focus(); return; } lRecordData[3] = txtCheckNo.Text; lRecordData[4] = string.Format("{0:n}", decimal.Parse(txtCheckAmount.Text)); lRecordData[5] = string.Format("{0:MM-dd-yyyy}", dtpCheckDate.Value); lRecordData[6] = GlobalFunctions.replaceChar(txtRemarks.Text); object[] _params = { lRecordData, false }; if (lOperator == "Add") { lRecordData[7] = "Add"; ParentList.GetType().GetMethod("addDataCheck").Invoke(ParentList, _params); //MessageBoxUI _mbStatus = new MessageBoxUI("Successfully added!", GlobalVariables.Icons.Save, GlobalVariables.Buttons.OK); //_mbStatus.ShowDialog(); clear(); } else if (lOperator == "Edit") { lRecordData[7] = "Edit"; ParentList.GetType().GetMethod("updateDataCheck").Invoke(ParentList, _params); this.Close(); } } catch (Exception ex) { ErrorMessageUI em = new ErrorMessageUI(ex.Message, this.Name, "btnSave_Click"); em.ShowDialog(); return; } }
private void btnView_Click(object sender, EventArgs e) { if (dtpDate.Value.Year == dtpFinancialYear.Value.Year) { viewLedgerByDate(); } else { MessageBoxUI _mbStatus = new MessageBoxUI("Year must be the same with the Financial Year!", GlobalVariables.Icons.Error, GlobalVariables.Buttons.OK); _mbStatus.ShowDialog(); dtpDate.Focus(); return; } }
private void tsmPreviewDetails_Click(object sender, EventArgs e) { foreach (DataRow _dr in loInventoryHeader.getAllData("", dgvList.CurrentRow.Cells[0].Value.ToString(), "", "Stock Receiving").Rows) { if (_dr["Final"].ToString() == "N") { MessageBoxUI mb = new MessageBoxUI("Stock Receiving must be FINALIZED!", GlobalVariables.Icons.Information, GlobalVariables.Buttons.OK); mb.ShowDialog(); return; } } previewDetails(dgvList.CurrentRow.Cells[0].Value.ToString()); }
private void tsmiForcedRemove_Click(object sender, EventArgs e) { if (!GlobalFunctions.checkRights("tsmStockReceiving", "Forced Remove")) { return; } try { if (dgvList.Rows.Count > 0) { foreach (DataRow _drF in loInventoryHeader.getAllData("", dgvList.CurrentRow.Cells[0].Value.ToString(), "", "Stock Receiving").Rows) { if (_drF["Final"].ToString() == "N") { MessageBoxUI mb = new MessageBoxUI("Stock Receiving must be finalized to be forced removed!", GlobalVariables.Icons.Information, GlobalVariables.Buttons.OK); mb.ShowDialog(); return; } } DialogResult _dr = new DialogResult(); MessageBoxUI _mb = new MessageBoxUI("Are sure you want to continue removing this record?", GlobalVariables.Icons.QuestionMark, GlobalVariables.Buttons.YesNo); _mb.ShowDialog(); _dr = _mb.Operation; if (_dr == DialogResult.Yes) { MySqlTransaction Trans = GlobalVariables.Connection.BeginTransaction(); try { if (loInventoryHeader.remove(dgvList.CurrentRow.Cells[0].Value.ToString(), ref Trans)) { Trans.Commit(); MessageBoxUI _mb1 = new MessageBoxUI("Record has been successfully forced remove!", GlobalVariables.Icons.Information, GlobalVariables.Buttons.OK); _mb1.ShowDialog(); refresh("ViewAll", "", "", "Stock Receiving"); } } catch (Exception ex) { Trans.Rollback(); MessageBoxUI mb = new MessageBoxUI(ex, GlobalVariables.Icons.Error, GlobalVariables.Buttons.OK); mb.ShowDialog(); return; } } } } catch { } }
public bool updateUserGroupRights(string pUserGroupId, string pItemName, DataTable pRights) { bool _Status = false; try { _Status = lUserGroupDAO.updateUserGroupRights(pUserGroupId, pItemName, pRights); } catch (Exception ex) { MessageBoxUI mb = new MessageBoxUI(ex, GlobalVariables.Icons.Error, GlobalVariables.Buttons.OK); mb.ShowDialog(); } return(_Status); }
public bool removeSystemConfiguration(string pKey) { bool _Status = false; try { _Status = lSystemConfigurationDAO.removeSystemConfiguration(pKey); } catch (Exception ex) { MessageBoxUI mb = new MessageBoxUI(ex, GlobalVariables.Icons.Error, GlobalVariables.Buttons.OK); mb.ShowDialog(); } return(_Status); }
public bool remove(string pUsername, ref MySqlTransaction pTrans) { bool _Status = false; try { _Status = lUserDAO.removeUser(pUsername, ref pTrans); } catch (Exception ex) { MessageBoxUI mb = new MessageBoxUI(ex, GlobalVariables.Icons.Error, GlobalVariables.Buttons.OK); mb.ShowDialog(); } return(_Status); }
private void btnFinalize_Click(object sender, EventArgs e) { //loStock.finalizeStockReinventory(); if (!GlobalFunctions.checkRights("tsmStockReinventory", "Finalize")) { return; } try { if (dgvReport.Rows.Count > 0) { DialogResult _dr = new DialogResult(); MessageBoxUI _mb = new MessageBoxUI("Are sure you want to continue finalizing this record?", GlobalVariables.Icons.QuestionMark, GlobalVariables.Buttons.YesNo); _mb.ShowDialog(); _dr = _mb.Operation; if (_dr == DialogResult.Yes) { MySqlTransaction Trans = GlobalVariables.Connection.BeginTransaction(); try { if (loStock.finalizeStockReinventory(dgvReport.CurrentRow.Cells[1].Value.ToString(), dgvReport.CurrentRow.Cells[0].Value.ToString(), ref Trans)) { /* Probably Needed */ /*foreach (DataRow _dr1 in loInventoryDetail.getAllData(dgvList.CurrentRow.Cells[0].Value.ToString()).Rows) * { * loInventoryDetail.updateQtyOnHand(_dr1[0].ToString(), ref Trans); * }*/ Trans.Commit(); MessageBoxUI _mb1 = new MessageBoxUI("Record has been successfully finalized!", GlobalVariables.Icons.Information, GlobalVariables.Buttons.OK); _mb1.ShowDialog(); btnRefresh_Click(null, new EventArgs()); } } catch (Exception ex) { Trans.Rollback(); MessageBoxUI mb = new MessageBoxUI(ex, GlobalVariables.Icons.Error, GlobalVariables.Buttons.OK); mb.ShowDialog(); return; } } } } catch { } }