private void mCodeOLV_KeyDown(object sender, KeyEventArgs e) { if (e.KeyCode == Keys.Delete) { CodesController.getInstance().DeleteCodes((ArrayList)this.mCodeOLV.SelectedObjects); } }
private void EditCode() { if (String.IsNullOrEmpty(mCCodeTxtbox.Text) || String.IsNullOrEmpty(mCDescTxtbox.Text)) { MessageBox.Show("Fields cannot be emptied."); this.ClearForm(); return; } DialogResult nResult = MessageBox.Show("Confirm Overwrite?", "Edit Confirmation", MessageBoxButtons.YesNo); if (nResult == DialogResult.Yes) { if (mCIncomeRbutton.Checked) { this.CurCode.Type = GLCode.GLType.IE; } else if (mCBalRButton.Checked) { this.CurCode.Type = GLCode.GLType.BAL; } this.CurCode.Code = mCCodeTxtbox.Text; this.CurCode.Desc = mCDescTxtbox.Text; CodesController.getInstance().EditCode(this.CurCode); } }
private void mCExportButton_Click(object sender, EventArgs e) { DialogResult nResult = this.mSaveFileDialog.ShowDialog(); if (nResult == DialogResult.OK) { CodesController.getInstance().ExportCSV(this.mSaveFileDialog.FileName); } }
private void InitializeFields(Record aRecord) { this.mDayTxtbox.Text = aRecord.TransDate.Day.ToString(); this.mMthTxtbox.Text = aRecord.TransDate.Month.ToString(); this.mYearTxtbox.Text = (aRecord.TransDate.Year - 2000).ToString(); this.mVoucherTxtbox.Text = aRecord.VoucherNo; this.mGLCodeTxtbox.Text = aRecord.GLCode; this.mChequeTxtbox.Text = aRecord.ChequeNo; this.mItemCodeTxtbox.Text = aRecord.ItemCode; this.mDescTxtbox.Text = aRecord.Description; this.mAmtTxtbox.Text = aRecord.Amount.ToString("000.00"); this.mRCodeDescLabel.Text = CodesController.getInstance().GetDescription(aRecord.GLCode); }
private void PopulateTrialBalance(List <Record> aRecordList) { Dictionary <GLCode, decimal> tbPair = new Dictionary <GLCode, decimal>(); foreach (Record nRecord in aRecordList) { GLCode nCode = CodesController.getInstance().ContainCode(nRecord.GLCode); if (nCode == null) { continue; } try { tbPair[nCode] += nRecord.Amount; } catch (KeyNotFoundException) { tbPair.Add(nCode, nRecord.Amount); } } decimal nBalance = 0; decimal nCredit = 0; decimal nDebit = 0; foreach (KeyValuePair <GLCode, decimal> nPair in tbPair) { TrialBalanceItem nItem = new TrialBalanceItem(); nItem.Code = nPair.Key; nItem.Balance = nPair.Value; this.mTrialBalanceOLV.AddObject(nItem); if (nItem.Balance > 0) { nDebit += nItem.Balance; } else { nCredit += nItem.Balance; } nBalance += nItem.Balance; } this.mBalanceLabel.Text = "Balance : " + String.Format("{0:C}", nBalance); this.mCreditLabel.Text = "Credit : " + String.Format("{0:C}", nCredit); this.mDebitLabel.Text = "Debit : " + String.Format("{0:C}", nDebit); this.mTotalLabel.Text = "Total Records : " + tbPair.Count.ToString(); }
private void InitializeOLV() { this.CodeModel = new DataModel <GLCode>(); this.RecordModel = new DataModel <Record>(); this.mTransactionOLV.Initialize(); OLVObserver nTransactionObserver = new OLVObserver(this.mTransactionOLV); MainFormObserver nMainObserver = new MainFormObserver(this); this.RecordModel.Subscribe(nTransactionObserver); this.RecordModel.Subscribe(nMainObserver); TransactionsController.getInstance().Init(this.RecordModel); CodesController.getInstance().Init(this.CodeModel); }
private void Initialize() { this.mFilterListbox.SelectedIndex = 0; DateTime curDate = DateTime.Today; for (int i = curDate.Year - 5; i < curDate.Year + 5; i++) { this.mYearComboBox.Items.Add(i.ToString()); } this.mMonthComboBox.Text = this.mMonthComboBox.Items[curDate.Month - 1].ToString(); this.mYearComboBox.Text = curDate.Year.ToString(); this.mFromDatePicker.Value = curDate.AddMonths(-1); this.mToDatePicker.Value = curDate; this.mCodeOLV.AddObjects(CodesController.getInstance().GetList()); this.mCodeOLV.CheckAll(); }
private void AddCode() { if (String.IsNullOrEmpty(mCCodeTxtbox.Text) || String.IsNullOrEmpty(mCDescTxtbox.Text)) { MessageBox.Show("Fields cannot be emptied."); return; } GLCode.GLType nType = GLCode.GLType.IE; if (mCIncomeRbutton.Checked) { nType = GLCode.GLType.IE; } else if (mCBalRButton.Checked) { nType = GLCode.GLType.BAL; } GLCode nNewCode = new GLCode(mCCodeTxtbox.Text, mCDescTxtbox.Text, nType); CodesController.getInstance().AddCode(nNewCode); }
private void mGLCodeTxtbox_TextChanged(object sender, EventArgs e) { this.mRCodeDescLabel.Text = CodesController.getInstance().GetDescription(this.mGLCodeTxtbox.Text); }
private void deleteToolStripMenuItem_Click(object sender, EventArgs e) { CodesController.getInstance().DeleteCodes((ArrayList)this.mCodeOLV.SelectedObjects); }