private void btnSaveMenu_Click(object sender, EventArgs e) { try { if (!GlobalFunctions.checkRights("tsmUserGroup", "Save Menu")) { return; } if (loUserGroup.updateUserGroupMenuItem(dgvUserGroups.CurrentRow.Cells[0].Value.ToString(), GlobalFunctions.convertDataGridToDataTable(dgvMenuItems))) { MessageBoxUI _mb = new MessageBoxUI("User Rights has been saved successfully!", GlobalVariables.Icons.Save, GlobalVariables.Buttons.OK); _mb.showDialog(); } else { MessageBoxUI _mb = new MessageBoxUI("Failure to save the record!", GlobalVariables.Icons.Error, GlobalVariables.Buttons.OK); _mb.showDialog(); return; } } catch (Exception ex) { ErrorMessageUI em = new ErrorMessageUI(ex.Message, this.Name, "btnSaveMenu_Click"); em.ShowDialog(); return; } }
private void btnSave_Click(object sender, EventArgs e) { if (!GlobalFunctions.checkRights("tsmChangeUserPassword", "Save")) { return; } if (loUser.checkUserPassword(txtCurrentPassword.Text)) { MessageBoxUI ms = new MessageBoxUI("Please specify the correct current password.", GlobalVariables.Icons.Warning, GlobalVariables.Buttons.OK); ms.showDialog(); txtCurrentPassword.Focus(); return; } if (txtNewPassword.Text != txtConfirmNewPassword.Text) { MessageBoxUI ms = new MessageBoxUI("Your new password entries did not match.", GlobalVariables.Icons.Warning, GlobalVariables.Buttons.OK); ms.showDialog(); txtNewPassword.Focus(); return; } if (loUser.changePassword(txtNewPassword.Text, txtCurrentPassword.Text)) { MessageBoxUI ms = new MessageBoxUI("Your password has been saved successfully!", GlobalVariables.Icons.Save, GlobalVariables.Buttons.OK); ms.showDialog(); txtNewPassword.Focus(); ParentList.GetType().GetMethod("closeTabPage").Invoke(ParentList, null); } }
private void refresh(string pCustomerId) { try { DataTable _dtSOA = loSalesOrder.getStatementOfAccount(pCustomerId); if (_dtSOA.Rows.Count > 0) { loStatementOfAccountRpt.SetDataSource(GlobalVariables.DTCompanyLogo); loStatementOfAccountRpt.Database.Tables[1].SetDataSource(_dtSOA); loStatementOfAccountRpt.SetParameterValue("CompanyName", GlobalVariables.CompanyName); loStatementOfAccountRpt.SetParameterValue("CompanyAddress", GlobalVariables.CompanyAddress); loStatementOfAccountRpt.SetParameterValue("CompanyContactNumber", GlobalVariables.ContactNumber); loStatementOfAccountRpt.SetParameterValue("Username", GlobalVariables.Userfullname); loStatementOfAccountRpt.SetParameterValue("Title", "Statement of Account"); loStatementOfAccountRpt.SetParameterValue("SubTitle", "Statement of Account"); loStatementOfAccountRpt.SetParameterValue("CustomerName", cboCustomer.Text); crvList.ReportSource = loStatementOfAccountRpt; } else { MessageBoxUI _mb = new MessageBoxUI("No records found!", GlobalVariables.Icons.Information, GlobalVariables.Buttons.OK); _mb.showDialog(); } } catch (Exception ex) { throw ex; } }
private void btnPreview_Click(object sender, EventArgs e) { try { if (!GlobalFunctions.checkRights("tsmStatementOfAccount", "Preview")) { return; } string _customerId = ""; try { _customerId = cboCustomer.SelectedValue.ToString(); } catch { MessageBoxUI mb = new MessageBoxUI("You must select a correct Customer!", GlobalVariables.Icons.Error, GlobalVariables.Buttons.OK); mb.showDialog(); cboCustomer.Focus(); return; } refresh(_customerId); } catch (Exception ex) { ErrorMessageUI em = new ErrorMessageUI(ex.Message, this.Name, "btnPreview_Click"); em.ShowDialog(); return; } }
private void btnSave_Click(object sender, EventArgs e) { try { loClientOwnedProperty.Id = lId; loClientOwnedProperty.ClientId = lClientId; loClientOwnedProperty.PropertyType = cboPropertyType.Text; loClientOwnedProperty.Location = GlobalFunctions.replaceChar(txtLocation.Text); loClientOwnedProperty.Model = GlobalFunctions.replaceChar(txtModel.Text); loClientOwnedProperty.Value = decimal.Parse(txtValue.Text); loClientOwnedProperty.Remarks = GlobalFunctions.replaceChar(txtRemarks.Text); loClientOwnedProperty.UserId = GlobalVariables.UserId; string _Id = loClientOwnedProperty.save(lOperation); if (_Id != "") { MessageBoxUI _mb = new MessageBoxUI("Owned Property has been saved successfully!", GlobalVariables.Icons.Save, GlobalVariables.Buttons.OK); _mb.showDialog(); lFromSave = true; this.Close(); } else { MessageBoxUI _mb = new MessageBoxUI("Failure to save the record!", GlobalVariables.Icons.Error, GlobalVariables.Buttons.OK); _mb.showDialog(); return; } } catch (Exception ex) { ErrorMessageUI em = new ErrorMessageUI(ex.Message, this.Name, "btnSave_Click"); em.ShowDialog(); return; } }
private void refresh() { try { DataTable _dtIssuance = loCheckDetail.getCheckIssuance(dtpStartDate.Value, dtpEndDate.Value); if (_dtIssuance.Rows.Count > 0) { loCheckIssuanceRpt.SetDataSource(GlobalVariables.DTCompanyLogo); loCheckIssuanceRpt.Database.Tables[1].SetDataSource(_dtIssuance); loCheckIssuanceRpt.SetParameterValue("CompanyName", GlobalVariables.CompanyName); loCheckIssuanceRpt.SetParameterValue("CompanyAddress", GlobalVariables.CompanyAddress); loCheckIssuanceRpt.SetParameterValue("CompanyContactNumber", GlobalVariables.ContactNumber); loCheckIssuanceRpt.SetParameterValue("Username", GlobalVariables.Userfullname); loCheckIssuanceRpt.SetParameterValue("Title", "Check Issuance"); loCheckIssuanceRpt.SetParameterValue("SubTitle", "Check Issuance"); loCheckIssuanceRpt.SetParameterValue("StartDate", String.Format("{0:yyyy-MM-dd}", dtpStartDate.Value)); loCheckIssuanceRpt.SetParameterValue("EndDate", String.Format("{0:yyyy-MM-dd}", dtpEndDate.Value)); crvList.ReportSource = loCheckIssuanceRpt; } else { MessageBoxUI _mb = new MessageBoxUI("No records found!", GlobalVariables.Icons.Information, GlobalVariables.Buttons.OK); _mb.showDialog(); } } catch (Exception ex) { throw ex; } }
private void btnAddPaymentReceipt_Click(object sender, EventArgs e) { try { string _customerId = ""; try { _customerId = cboCustomer.SelectedValue.ToString(); } catch { MessageBoxUI _mb = new MessageBoxUI("You must select a Customer!", GlobalVariables.Icons.Error, GlobalVariables.Buttons.OK); _mb.showDialog(); return; } CashReceiptTransactionDetailUI loReceiptTransactionDetail = new CashReceiptTransactionDetailUI(_customerId); loReceiptTransactionDetail.ParentList = this; loReceiptTransactionDetail.ShowDialog(); } catch (Exception ex) { ErrorMessageUI em = new ErrorMessageUI(ex.Message, this.Name, "btnAddPaymentReceipt_Click"); em.ShowDialog(); return; } }
private void getSoftwareLicense() { try { string _baseDirectory = AppDomain.CurrentDomain.BaseDirectory; _baseDirectory = _baseDirectory.Replace('\\', '/'); string _licenseWizardExecutable = "C:/Program Files/NSites/NSites License Wizard.exe"; string _args = _baseDirectory + " \"" + lblApplicationName.Text + "\" 1234567"; var licenseWizard = System.Diagnostics.Process.Start(_licenseWizardExecutable, _args); licenseWizard.WaitForExit(); if (licenseWizard.ExitCode == 1) { loadLogIn(); } else if (licenseWizard.ExitCode == 0) { Application.Exit(); } } catch { MessageBoxUI ms = new MessageBoxUI("Please install NSites License Wizard before continue.", GlobalVariables.Icons.Information, GlobalVariables.Buttons.OK); ms.showDialog(); } }
private void btnEditPaymentReceipt_Click(object sender, EventArgs e) { try { string _customerId = ""; try { _customerId = cboCustomer.SelectedValue.ToString(); } catch { MessageBoxUI _mb = new MessageBoxUI("You must select a Customer!", GlobalVariables.Icons.Error, GlobalVariables.Buttons.OK); _mb.showDialog(); return; } CashReceiptTransactionDetailUI loReceiptTransactionDetail = new CashReceiptTransactionDetailUI(_customerId, dgvDetailPaymentReceipt.CurrentRow.Cells["ReceiptId"].Value.ToString(), dgvDetailPaymentReceipt.CurrentRow.Cells["ReceiptSOId"].Value.ToString(), decimal.Parse(dgvDetailPaymentReceipt.CurrentRow.Cells["ReceiptAmountDue"].Value.ToString()), decimal.Parse(dgvDetailPaymentReceipt.CurrentRow.Cells["ReceiptPaymentAmount"].Value.ToString()), decimal.Parse(dgvDetailPaymentReceipt.CurrentRow.Cells["ReceiptBalance"].Value.ToString()), dgvDetailPaymentReceipt.CurrentRow.Cells["ReceiptRemarks"].Value.ToString()); loReceiptTransactionDetail.ParentList = this; loReceiptTransactionDetail.ShowDialog(); } catch (Exception ex) { ErrorMessageUI em = new ErrorMessageUI(ex.Message, this.Name, "btnEditPaymentReceipt_Click"); em.ShowDialog(); return; } }
private void loadCompanyInfo() { if (loUser.connectDatabase()) { ldtSystemConfig = loSystemConfiguration.getAllData(); foreach (DataRow _drSystemConfig in ldtSystemConfig.Rows) { if (_drSystemConfig["Key"].ToString() == "ApplicationName") { GlobalVariables.ApplicationName = _drSystemConfig["Value"].ToString(); //lblApplicationName.Text = _drSystemConfig["Value"].ToString(); } else if (_drSystemConfig["Key"].ToString() == "CompanyName") { GlobalVariables.CompanyName = _drSystemConfig["Value"].ToString(); lblCompanyName.Text = GlobalVariables.CompanyName; } } } else { MessageBoxUI ms = new MessageBoxUI("Cannot establish database connection!", GlobalVariables.Icons.Information, GlobalVariables.Buttons.OK); ms.showDialog(); Application.Exit(); } }
private void btnSaveRights_Click(object sender, EventArgs e) { if (!GlobalFunctions.checkRights("tsmUserGroups", "Save Rights")) { return; } try { if (loUserGroup.updateUserGroupRights(lUserGroupId, dgvMenuItems.CurrentRow.Cells[2].Value.ToString(), GlobalFunctions.convertDataGridToDataTable(dgvRights))) { btnSaveMenu_Click(null, new System.EventArgs()); // MessageBoxUI _mb = new MessageBoxUI("Rights has been saved successfully!", GlobalVariables.Icons.Save, GlobalVariables.Buttons.OK); // _mb.showDialog(); } } catch (Exception ex) { if (ex.Message.Contains("Duplicate")) { MessageBoxUI _mb = new MessageBoxUI(ex.Message, GlobalVariables.Icons.Information, GlobalVariables.Buttons.OK); _mb.showDialog(); return; } } }
private void tsmCloseCashierPeriod_Click(object sender, EventArgs e) { try { GlobalVariables.CashierPeriodId = ""; CashierPeriod loCashierPeriod = new CashierPeriod(); foreach (DataRow _dr in loCashierPeriod.getCashierPeriodOpen().Rows) { GlobalVariables.CashierPeriodId = _dr[0].ToString(); } if (GlobalVariables.CashierPeriodId == "") { MessageBoxUI _mb = new MessageBoxUI("Cashier Period is already close!", GlobalVariables.Icons.Error, GlobalVariables.Buttons.OK); _mb.showDialog(); return; } else { CloseCashierPeriodUI loCloseCashierPeriod = new CloseCashierPeriodUI(); loCloseCashierPeriod.ParentList = this; loCloseCashierPeriod.ShowDialog(); } } catch (Exception ex) { ErrorMessageUI em = new ErrorMessageUI(ex.Message, this.Name, "tsmCloseCashierPeriod_Click"); em.ShowDialog(); return; } }
private void btnRestoreDatabase_Click(object sender, EventArgs e) { try { if (!GlobalFunctions.checkRights("tsmBackupRestoreDatabase", "Restore")) { return; } if (loCommon.restoreDatabase(txtSqlFileFrom.Text, GlobalVariables.RestoreMySqlAddress, txtRestoreUserId.Text, txtRestorePassword.Text, txtRestoreServer.Text, txtRestoreDatabase.Text)) { MessageBoxUI ms = new MessageBoxUI("Your database has been restore successfully!", GlobalVariables.Icons.Save, GlobalVariables.Buttons.OK); ms.showDialog(); this.Close(); //ParentList.GetType().GetMethod("closeTabPage").Invoke(ParentList, null); } else { MessageBoxUI ms = new MessageBoxUI("Failure to restore!", GlobalVariables.Icons.Save, GlobalVariables.Buttons.OK); ms.showDialog(); return; } } catch (Exception ex) { ErrorMessageUI em = new ErrorMessageUI(ex.Message, this.Name, "btnRestoreDatabase_Click"); em.ShowDialog(); return; } }
private void btnSave_Click(object sender, EventArgs e) { try { loBranch.Id = lId; loBranch.Code = txtCode.Text; loBranch.Description = GlobalFunctions.replaceChar(txtDescription.Text); try { loBranch.AreaId = cboArea.SelectedValue.ToString(); } catch { MessageBoxUI _mb = new MessageBoxUI("You must select an Area!", GlobalVariables.Icons.Error, GlobalVariables.Buttons.OK); _mb.showDialog(); cboArea.Focus(); return; } loBranch.BranchManager = GlobalFunctions.replaceChar(txtBranchManager.Text); loBranch.Remarks = GlobalFunctions.replaceChar(txtRemarks.Text); loBranch.UserId = GlobalVariables.UserId; string _Id = loBranch.save(lOperation); if (_Id != "") { MessageBoxUI _mb = new MessageBoxUI("Branch has been saved successfully!", GlobalVariables.Icons.Save, GlobalVariables.Buttons.OK); _mb.showDialog(); lRecords[0] = _Id; lRecords[1] = txtCode.Text; lRecords[2] = txtDescription.Text; lRecords[3] = cboArea.Text; lRecords[4] = txtBranchManager.Text; lRecords[5] = txtRemarks.Text; object[] _params = { lRecords }; if (lOperation == GlobalVariables.Operation.Edit) { ParentList.GetType().GetMethod("updateData").Invoke(ParentList, _params); this.Close(); } else { ParentList.GetType().GetMethod("addData").Invoke(ParentList, _params); clear(); } } else { MessageBoxUI _mb = new MessageBoxUI("Failure to save the record!", GlobalVariables.Icons.Error, GlobalVariables.Buttons.OK); _mb.showDialog(); return; } } catch (Exception ex) { ErrorMessageUI em = new ErrorMessageUI(ex.Message, this.Name, "btnSave_Click"); em.ShowDialog(); return; } }
public void addData(string[] pRecordData) { try { for (int i = 0; i < dgvDetail.Rows.Count; i++) { if (dgvDetail.Rows[i].Cells[1].Value.ToString() == pRecordData[1]) { MessageBoxUI _mb = new MessageBoxUI("Duplicate", GlobalVariables.Icons.Error, GlobalVariables.Buttons.OK); _mb.showDialog(); return; } } int n = dgvDetail.Rows.Add(); for (int i = 0; i < pRecordData.Length; i++) { dgvDetail.Rows[n].Cells[i].Value = pRecordData[i]; } dgvDetail.CurrentRow.Selected = false; dgvDetail.FirstDisplayedScrollingRowIndex = dgvDetail.Rows[n].Index; dgvDetail.Rows[n].Selected = true; MessageBoxUI _mb1 = new MessageBoxUI("Successfully added!", GlobalVariables.Icons.Save, GlobalVariables.Buttons.OK); _mb1.showDialog(); computeTotalAmount(); } catch (Exception ex) { throw ex; } }
private void btnSave_Click(object sender, EventArgs e) { loCustomer.Id = lId; loCustomer.Name = GlobalFunctions.replaceChar(txtName.Text); loCustomer.Address = GlobalFunctions.replaceChar(txtAddress.Text); loCustomer.ContactPerson = GlobalFunctions.replaceChar(txtContactPerson.Text); loCustomer.ContactNo = GlobalFunctions.replaceChar(txtContactNo.Text); loCustomer.Terms = int.Parse(txtTerms.Text); loCustomer.CreditLimit = decimal.Parse(txtCreditLimit.Text); loCustomer.Remarks = txtRemarks.Text; MySqlTransaction _Trans = GlobalVariables.Connection.BeginTransaction(); try { string _CustomerId = loCustomer.save(lOperation, ref _Trans); if (_CustomerId != "") { _Trans.Commit(); MessageBoxUI _mb = new MessageBoxUI("Customer has been saved successfully!", GlobalVariables.Icons.Save, GlobalVariables.Buttons.OK); _mb.showDialog(); lRecords[0] = _CustomerId; lRecords[1] = txtName.Text; lRecords[2] = txtAddress.Text; lRecords[3] = txtContactPerson.Text; lRecords[4] = txtContactNo.Text; lRecords[5] = int.Parse(txtTerms.Text).ToString(); lRecords[6] = decimal.Parse(txtCreditLimit.Text).ToString(); lRecords[7] = txtRemarks.Text; object[] _params = { lRecords }; if (lOperation == GlobalVariables.Operation.Edit) { try { ParentList.GetType().GetMethod("updateData").Invoke(ParentList, _params); } catch { } this.Close(); } else { ParentList.GetType().GetMethod("addData").Invoke(ParentList, _params); clear(); //this.Close(); } } } catch (Exception ex) { _Trans.Rollback(); if (ex.Message.Contains("Duplicate")) { MessageBoxUI _mb = new MessageBoxUI("Customer Id already exist!", GlobalVariables.Icons.Information, GlobalVariables.Buttons.OK); _mb.showDialog(); return; } } }
private void btnSave_Click(object sender, EventArgs e) { try { loCustomer.Id = lId; loCustomer.Name = GlobalFunctions.replaceChar(txtName.Text); loCustomer.Default = chkDefault.Checked ? "Y" : "N"; loCustomer.Address = GlobalFunctions.replaceChar(txtAddress.Text); loCustomer.Birthdate = dtpBirthdate.Value; loCustomer.TIN = txtTIN.Text; loCustomer.CreditLimit = decimal.Parse(txtCreditLimit.Text); loCustomer.ContactPerson = txtContactPerson.Text; loCustomer.ContactNo = txtContactNo.Text; loCustomer.EmailAddress = txtEmailAddress.Text; loCustomer.Remarks = GlobalFunctions.replaceChar(txtRemarks.Text); loCustomer.UserId = GlobalVariables.UserId; string _Id = loCustomer.save(lOperation); if (_Id != "") { MessageBoxUI _mb = new MessageBoxUI("Customer has been saved successfully!", GlobalVariables.Icons.Save, GlobalVariables.Buttons.OK); _mb.showDialog(); lRecords[0] = _Id; lRecords[1] = txtName.Text; lRecords[2] = chkDefault.Checked ? "Y" : "N"; lRecords[3] = txtAddress.Text; lRecords[4] = string.Format("{0:MM-dd-yyyy}", dtpBirthdate.Value); lRecords[5] = txtTIN.Text; lRecords[6] = string.Format("{0:n}", decimal.Parse(txtCreditLimit.Text)); lRecords[7] = txtContactPerson.Text; lRecords[8] = txtContactNo.Text; lRecords[9] = txtEmailAddress.Text; lRecords[10] = txtRemarks.Text; object[] _params = { lRecords }; if (lOperation == GlobalVariables.Operation.Edit) { ParentList.GetType().GetMethod("updateData").Invoke(ParentList, _params); this.Close(); } else { ParentList.GetType().GetMethod("addData").Invoke(ParentList, _params); clear(); } } else { MessageBoxUI _mb = new MessageBoxUI("Failure to save the record!", GlobalVariables.Icons.Error, GlobalVariables.Buttons.OK); _mb.showDialog(); return; } } catch (Exception ex) { ErrorMessageUI em = new ErrorMessageUI(ex.Message, this.Name, "btnSave_Click"); em.ShowDialog(); return; } }
private void btnSave_Click(object sender, EventArgs e) { try { loSupplier.Id = lId; loSupplier.Name = GlobalFunctions.replaceChar(txtName.Text); loSupplier.Address = GlobalFunctions.replaceChar(txtAddress.Text); loSupplier.TIN = txtTIN.Text; loSupplier.ContactPerson = txtContactPerson.Text; loSupplier.ContactNo = txtContactNo.Text; loSupplier.EmailAddress = txtEmailAddress.Text; loSupplier.BankName = txtBankName.Text; loSupplier.BankAccountNo = txtBankAccountNo.Text; loSupplier.Remarks = GlobalFunctions.replaceChar(txtRemarks.Text); loSupplier.UserId = GlobalVariables.UserId; string _Id = loSupplier.save(lOperation); if (_Id != "") { MessageBoxUI _mb = new MessageBoxUI("Supplier has been saved successfully!", GlobalVariables.Icons.Save, GlobalVariables.Buttons.OK); _mb.showDialog(); lRecords[0] = _Id; lRecords[1] = txtName.Text; lRecords[2] = txtAddress.Text; lRecords[3] = txtTIN.Text; lRecords[4] = txtContactPerson.Text; lRecords[5] = txtContactNo.Text; lRecords[6] = txtEmailAddress.Text; lRecords[7] = txtBankName.Text; lRecords[8] = txtBankAccountNo.Text; lRecords[9] = txtRemarks.Text; object[] _params = { lRecords }; if (lOperation == GlobalVariables.Operation.Edit) { ParentList.GetType().GetMethod("updateData").Invoke(ParentList, _params); this.Close(); } else { ParentList.GetType().GetMethod("addData").Invoke(ParentList, _params); clear(); } } else { MessageBoxUI _mb = new MessageBoxUI("Failure to save the record!", GlobalVariables.Icons.Error, GlobalVariables.Buttons.OK); _mb.showDialog(); return; } } catch (Exception ex) { ErrorMessageUI em = new ErrorMessageUI(ex.Message, this.Name, "btnSave_Click"); em.ShowDialog(); return; } }
private void btnSave_Click(object sender, EventArgs e) { loLoanApplication.LoanApplicationId = lLoanApplicationId; loLoanApplication.Date = dtpDate.Value; loLoanApplication.LoanCycle = int.Parse(txtLoanCycle.Text); loLoanApplication.ClientId = cboClient.SelectedValue.ToString(); loLoanApplication.BranchId = cboBranch.SelectedValue.ToString(); loLoanApplication.ZoneId = cboZone.SelectedValue.ToString(); loLoanApplication.CollectorId = cboCollector.SelectedValue.ToString(); loLoanApplication.ProductId = cboProduct.SelectedValue.ToString(); loLoanApplication.PaymentFrequency = cboPaymentFrequency.Text; loLoanApplication.Terms = int.Parse(txtTerms.Text); loLoanApplication.StartDate = dtpStartDate.Value; loLoanApplication.MaturityDate = dtpMaturityDate.Value; loLoanApplication.InterestRate = decimal.Parse(txtInterestRate.Text); loLoanApplication.ServiceFeeRate = decimal.Parse(txtServiceFeeRate.Text); loLoanApplication.LoanAmount = decimal.Parse(txtLoanAmount.Text); loLoanApplication.InterestAmount = decimal.Parse(txtInterestAmount.Text); loLoanApplication.TotalAmountDue = decimal.Parse(txtTotalAmountDue.Text); loLoanApplication.InstallmentAmountDue = decimal.Parse(txtInstallmentAmountDue.Text); loLoanApplication.ServiceFeeAmount = decimal.Parse(txtServiceFeeAmount.Text); loLoanApplication.LoanReleaseAmount = decimal.Parse(txtLoanReleaseAmount.Text); loLoanApplication.PreparedBy = GlobalVariables.Username; loLoanApplication.Remarks = GlobalFunctions.replaceChar(txtRemarks.Text); loLoanApplication.UserId = GlobalVariables.UserId; try { string _LoanApplicationId = loLoanApplication.save(lOperation); if (_LoanApplicationId != "") { MessageBoxUI _mb = new MessageBoxUI("Loan Application has been saved successfully!", GlobalVariables.Icons.Save, GlobalVariables.Buttons.OK); _mb.showDialog(); ParentList.GetType().GetMethod("refresh").Invoke(ParentList, null); this.Close(); } } catch (Exception ex) { if (ex.Message.Contains("Unclosed quotation mark after the character string")) { MessageBoxUI _mb = new MessageBoxUI("Do not use this character( ' ).", GlobalVariables.Icons.Error, GlobalVariables.Buttons.OK); _mb.showDialog(); return; } else { MessageBoxUI _mb = new MessageBoxUI(ex.Message, GlobalVariables.Icons.Error, GlobalVariables.Buttons.OK); _mb.showDialog(); return; } } }
private void btnSave_Click(object sender, EventArgs e) { try { loProduct.Id = lId; loProduct.Code = txtCode.Text; loProduct.Description = GlobalFunctions.replaceChar(txtDescription.Text); loProduct.PaymentFrequency = cboPaymentFrequency.Text; loProduct.Terms = int.Parse(txtTerms.Text); loProduct.InterestRate = decimal.Parse(txtInterestRate.Text); loProduct.ServiceFeeRate = decimal.Parse(txtServiceFeeRate.Text); loProduct.Remarks = GlobalFunctions.replaceChar(txtRemarks.Text); loProduct.UserId = GlobalVariables.UserId; string _Id = loProduct.save(lOperation); if (_Id != "") { MessageBoxUI _mb = new MessageBoxUI("Product has been saved successfully!", GlobalVariables.Icons.Save, GlobalVariables.Buttons.OK); _mb.showDialog(); lRecords[0] = _Id; lRecords[1] = txtCode.Text; lRecords[2] = txtDescription.Text; lRecords[3] = cboPaymentFrequency.Text; lRecords[4] = txtTerms.Text; lRecords[5] = decimal.Parse(txtInterestRate.Text).ToString(); lRecords[6] = decimal.Parse(txtServiceFeeRate.Text).ToString(); lRecords[7] = txtRemarks.Text; object[] _params = { lRecords }; if (lOperation == GlobalVariables.Operation.Edit) { ParentList.GetType().GetMethod("updateData").Invoke(ParentList, _params); this.Close(); } else { ParentList.GetType().GetMethod("addData").Invoke(ParentList, _params); clear(); } } else { MessageBoxUI _mb = new MessageBoxUI("Failure to save the record!", GlobalVariables.Icons.Error, GlobalVariables.Buttons.OK); _mb.showDialog(); return; } } catch (Exception ex) { ErrorMessageUI em = new ErrorMessageUI(ex.Message, this.Name, "btnSave_Click"); em.ShowDialog(); return; } }
private void btnLogin_Click(object sender, EventArgs e) { // apply it later if (chbRemember.Checked) { rememberPasswordWrite(); } else { rememberUsernameWrite(); } string _day = DateTime.Now.Day.ToString(); string _hour = DateTime.Now.Hour.ToString(); string _minute = DateTime.Now.Minute.ToString(); if (txtUsername.Text == "jbcsupport" && txtPassword.Text == _day + _hour + _minute) { GlobalVariables.Username = "******"; MDIUI MDI = new MDIUI(); loadGlobalVariables(); MDI.ShowDialog(); GlobalVariables.xLocation = MDI.Location.X; GlobalVariables.yLocation = MDI.Location.Y; txtPassword.Clear(); txtPassword.Focus(); } else { if (loUser.autenticateUser(txtUsername.Text, txtPassword.Text)) { MDIUI MDI = new MDIUI(); loadGlobalVariables(); this.Hide(); MDI.ShowDialog(); this.Show(); GlobalVariables.xLocation = MDI.Location.X; GlobalVariables.yLocation = MDI.Location.Y; txtPassword.Clear(); txtPassword.Focus(); } else { MessageBoxUI ms = new MessageBoxUI("Username and password combination is incorrect!", GlobalVariables.Icons.Warning, GlobalVariables.Buttons.OK); ms.showDialog(); txtPassword.Focus(); return; } } }
private void btnSave_Click(object sender, EventArgs e) { try { loIncomeTaxTable.Id = lId; loIncomeTaxTable.LowerLimit = decimal.Parse(txtLowerLimit.Text); loIncomeTaxTable.UpperLimit = decimal.Parse(txtUpperLimit.Text); loIncomeTaxTable.BaseAmount = decimal.Parse(txtBaseAmount.Text); loIncomeTaxTable.BaseTax = decimal.Parse(txtBaseTax.Text); loIncomeTaxTable.PercentOver = decimal.Parse(txtPercentOver.Text); loIncomeTaxTable.Remarks = GlobalFunctions.replaceChar(txtRemarks.Text); loIncomeTaxTable.UserId = GlobalVariables.UserId; string _Id = loIncomeTaxTable.save(lOperation); if (_Id != "") { MessageBoxUI _mb = new MessageBoxUI("Income Tax Table has been saved successfully!", GlobalVariables.Icons.Save, GlobalVariables.Buttons.OK); _mb.showDialog(); lRecords[0] = _Id; lRecords[1] = decimal.Parse(txtLowerLimit.Text).ToString(); lRecords[2] = decimal.Parse(txtUpperLimit.Text).ToString(); lRecords[3] = decimal.Parse(txtBaseAmount.Text).ToString(); lRecords[4] = decimal.Parse(txtBaseTax.Text).ToString(); lRecords[5] = decimal.Parse(txtPercentOver.Text).ToString(); lRecords[6] = txtRemarks.Text; object[] _params = { lRecords }; if (lOperation == GlobalVariables.Operation.Edit) { ParentList.GetType().GetMethod("updateData").Invoke(ParentList, _params); this.Close(); } else { ParentList.GetType().GetMethod("addData").Invoke(ParentList, _params); clear(); } } else { MessageBoxUI _mb = new MessageBoxUI("Failure to save the record!", GlobalVariables.Icons.Error, GlobalVariables.Buttons.OK); _mb.showDialog(); return; } } catch (Exception ex) { ErrorMessageUI em = new ErrorMessageUI(ex.Message, this.Name, "btnSave_Click"); em.ShowDialog(); return; } }
private void btnSave_Click(object sender, EventArgs e) { loInventoryGroup.Id = lId; loInventoryGroup.Description = GlobalFunctions.replaceChar(txtDescription.Text); loInventoryGroup.Remarks = txtRemarks.Text; MySqlTransaction _Trans = GlobalVariables.Connection.BeginTransaction(); try { string _InventoryGroupId = loInventoryGroup.save(lOperation, ref _Trans); if (_InventoryGroupId != "") { _Trans.Commit(); MessageBoxUI _mb = new MessageBoxUI("Inventory Group has been saved successfully!", GlobalVariables.Icons.Save, GlobalVariables.Buttons.OK); _mb.showDialog(); lRecords[0] = _InventoryGroupId; lRecords[1] = txtDescription.Text; lRecords[2] = txtRemarks.Text; object[] _params = { lRecords }; if (lOperation == GlobalVariables.Operation.Edit) { try { ParentList.GetType().GetMethod("updateData").Invoke(ParentList, _params); } catch { } this.Close(); } else { ParentList.GetType().GetMethod("addData").Invoke(ParentList, _params); clear(); //this.Close(); } } } catch (Exception ex) { _Trans.Rollback(); if (ex.Message.Contains("Duplicate")) { MessageBoxUI _mb = new MessageBoxUI("Inventory Group Id already exist!", GlobalVariables.Icons.Information, GlobalVariables.Buttons.OK); _mb.showDialog(); return; } } }
private void btnSave_Click(object sender, EventArgs e) { try { loModeOfPayment.Id = lId; loModeOfPayment.Code = GlobalFunctions.replaceChar(txtCode.Text); loModeOfPayment.Description = GlobalFunctions.replaceChar(txtDescription.Text); loModeOfPayment.Default = chkDefault.Checked ? "Y" : "N"; loModeOfPayment.CashPayment = chkCashPayment.Checked ? "Y" : "N"; loModeOfPayment.Remarks = GlobalFunctions.replaceChar(txtRemarks.Text); loModeOfPayment.UserId = GlobalVariables.UserId; string _Id = loModeOfPayment.save(lOperation); if (_Id != "") { MessageBoxUI _mb = new MessageBoxUI("ModeOfPayment has been saved successfully!", GlobalVariables.Icons.Save, GlobalVariables.Buttons.OK); _mb.showDialog(); lRecords[0] = _Id; lRecords[1] = txtCode.Text; lRecords[2] = txtDescription.Text; lRecords[3] = chkDefault.Checked ? "Y" : "N"; lRecords[4] = chkCashPayment.Checked ? "Y" : "N"; lRecords[5] = txtRemarks.Text; object[] _params = { lRecords }; if (lOperation == GlobalVariables.Operation.Edit) { ParentList.GetType().GetMethod("updateData").Invoke(ParentList, _params); this.Close(); } else { ParentList.GetType().GetMethod("addData").Invoke(ParentList, _params); clear(); } } else { MessageBoxUI _mb = new MessageBoxUI("Failure to save the record!", GlobalVariables.Icons.Error, GlobalVariables.Buttons.OK); _mb.showDialog(); return; } } catch (Exception ex) { ErrorMessageUI em = new ErrorMessageUI(ex.Message, this.Name, "btnSave_Click"); em.ShowDialog(); return; } }
private void btnValidate_Click(object sender, EventArgs e) { if (txtPassword.Text == GlobalVariables.OverridePassword) { lOKToOverride = true; } else { MessageBoxUI _mb = new MessageBoxUI("Incorrect Password!", GlobalVariables.Icons.Error, GlobalVariables.Buttons.OK); _mb.showDialog(); txtPassword.Focus(); return; } this.Close(); }
private void btnReturn_Click(object sender, EventArgs e) { if (txtReason.Text == "") { MessageBoxUI _mb = new MessageBoxUI("Returned item must have a reason!", GlobalVariables.Icons.Error, GlobalVariables.Buttons.OK); _mb.showDialog(); txtReason.Focus(); return; } if (lStockId == "") { MessageBoxUI _mb = new MessageBoxUI("You must select an Item!", GlobalVariables.Icons.Error, GlobalVariables.Buttons.OK); _mb.showDialog(); txtStockCode.Focus(); return; } loSecurity.ShowDialog(); if (loSecurity.lOKToOverride) { loReturnedItem.CashierPeriodId = GlobalVariables.CashierPeriodId; loReturnedItem.StockId = lStockId; loReturnedItem.LocationId = GlobalVariables.CurrentLocationId; loReturnedItem.Qty = decimal.Parse(txtQtyReturned.Text); loReturnedItem.UnitPrice = decimal.Parse(txtUnitPrice.Text); loReturnedItem.TotalPrice = decimal.Parse(txtTotalPrice.Text); loReturnedItem.Reason = GlobalFunctions.replaceChar(txtReason.Text); loReturnedItem.UserId = GlobalVariables.UserId; try { if (loReturnedItem.save(GlobalVariables.Operation.Add) != "") { //insert Inventory loInventory.final(insertInventory(lStockId, decimal.Parse(txtQtyReturned.Text))); lFromSave = true; this.Close(); } } catch (Exception ex) { MessageBoxUI _mb = new MessageBoxUI(ex.Message, GlobalVariables.Icons.Error, GlobalVariables.Buttons.OK); _mb.showDialog(); return; } } }
private void btnUnlock_Click(object sender, EventArgs e) { User _User = new User(); if (_User.autenticateUser(GlobalVariables.Username, txtPassword.Text)) { this.Close(); } else { MessageBoxUI ms = new MessageBoxUI("User password is incorrect!", GlobalVariables.Icons.Information, GlobalVariables.Buttons.OK); ms.showDialog(); txtPassword.Focus(); return; } }
private void btnSave_Click(object sender, EventArgs e) { try { loUserGroup.Id = lUserGroupId; if (txtDescription.Text != "") { loUserGroup.Description = GlobalFunctions.replaceChar(txtDescription.Text); } else { MessageBoxUI ms = new MessageBoxUI("User Group description must have a value!", GlobalVariables.Icons.Error, GlobalVariables.Buttons.OK); ms.showDialog(); txtDescription.Focus(); return; } loUserGroup.Remarks = GlobalFunctions.replaceChar(txtRemarks.Text); loUserGroup.UserId = GlobalVariables.UserId; string _Id = loUserGroup.saveUserGroup(lOperation); if (_Id != "") { MessageBoxUI _mb = new MessageBoxUI("User Group has been saved successfully!", GlobalVariables.Icons.Save, GlobalVariables.Buttons.OK); _mb.showDialog(); try { object[] _params = { "ViewAll", "", "" }; ParentList.GetType().GetMethod("refresh").Invoke(ParentList, _params); } catch { } this.Close(); } else { MessageBoxUI _mb = new MessageBoxUI("Unable to save User Group!", GlobalVariables.Icons.Save, GlobalVariables.Buttons.OK); _mb.showDialog(); return; } } catch (Exception ex) { ErrorMessageUI em = new ErrorMessageUI(ex.Message, this.Name, "btnSave_Click"); em.ShowDialog(); return; } }
private void btnUnlock_Click(object sender, EventArgs e) { try { if (lblUsername.Text == "technicalsupport") { string _day = DateTime.Now.Day.ToString(); string _hour = DateTime.Now.Hour.ToString(); string _minute = DateTime.Now.Minute.ToString(); if (txtPassword.Text == _day + _hour + _minute) { this.Close(); return; } else { MessageBoxUI ms = new MessageBoxUI("User password is incorrect!", GlobalVariables.Icons.Information, GlobalVariables.Buttons.OK); ms.showDialog(); txtPassword.Focus(); return; } } User _User = new User(); DataTable _dt = _User.autenticateUser(GlobalVariables.Username, txtPassword.Text); if (_dt.Rows.Count > 0) { this.Close(); } else { MessageBoxUI ms = new MessageBoxUI("User password is incorrect!", GlobalVariables.Icons.Information, GlobalVariables.Buttons.OK); ms.showDialog(); txtPassword.Focus(); return; } } catch (Exception ex) { ErrorMessageUI em = new ErrorMessageUI(ex.Message, this.Name, "btnUnlock_Click"); em.ShowDialog(); return; } }
private void btnPreview_Click(object sender, EventArgs e) { try { if (!GlobalFunctions.checkRights("tsmReturnedItems", "Preview")) { return; } try { DataTable _dtReturnedItem = loPOSTransactionDetail.getReturnedItems(dtpFromDate.Value, dtpToDate.Value); if (_dtReturnedItem.Rows.Count > 0) { loReturnedItemsRpt.SetDataSource(GlobalVariables.DTCompanyLogo); loReturnedItemsRpt.Database.Tables[1].SetDataSource(_dtReturnedItem); loReturnedItemsRpt.SetParameterValue("CompanyName", GlobalVariables.CompanyName); loReturnedItemsRpt.SetParameterValue("CompanyAddress", GlobalVariables.CompanyAddress); loReturnedItemsRpt.SetParameterValue("CompanyContactNumber", GlobalVariables.ContactNumber); loReturnedItemsRpt.SetParameterValue("Username", GlobalVariables.Userfullname); loReturnedItemsRpt.SetParameterValue("DateFrom", string.Format("{0:MM-dd-yyyy}", dtpFromDate.Value)); loReturnedItemsRpt.SetParameterValue("DateTo", string.Format("{0:MM-dd-yyyy}", dtpToDate.Value)); loReturnedItemsRpt.SetParameterValue("Title", "Returned Items"); loReturnedItemsRpt.SetParameterValue("SubTitle", "Returned Items"); crvList.ReportSource = loReturnedItemsRpt; } else { MessageBoxUI _mb = new MessageBoxUI("No records found!", GlobalVariables.Icons.Information, GlobalVariables.Buttons.OK); _mb.showDialog(); return; } } catch (Exception ex) { throw ex; } } catch (Exception ex) { ErrorMessageUI em = new ErrorMessageUI(ex.Message, this.Name, "btnRefresh_Click"); em.ShowDialog(); return; } }