private void Deposit_Load(object sender, EventArgs e) { base.KeyDown += new KeyEventHandler(this.Deposit_KeyDown); BankBll bankBll = new BankBll(); this.ddlBank.DataSource = bankBll.getBanks(); this.ddlBank.ValueMember = "AccCode"; this.ddlBank.DisplayMember = "Name"; WithdrawalForm._print = 0; WithdrawalForm._voucherID = 0; COA_TDataTable allAccounts = this._accounts.GetAllAccounts(); string[] array = allAccounts.Select <COA_TRow, string>(new Func <COA_TRow, string>((a) => a.GL_Name_VC)).ToArray <string>(); AutoCompleteStringCollection autoCompleteStringCollections1 = new AutoCompleteStringCollection(); for (int i = 0; i < array.Count <string>(); i++) { autoCompleteStringCollections1.Add(array[i]); } this.tbName.AutoCompleteSource = AutoCompleteSource.CustomSource; this.tbName.AutoCompleteMode = AutoCompleteMode.Suggest; this.tbName.AutoCompleteCustomSource = autoCompleteStringCollections1; int[] numArray = allAccounts.Select <COA_TRow, int>(new Func <COA_TRow, int>((a) => a.GL_ID)).ToArray <int>(); AutoCompleteStringCollection autoCompleteStringCollections2 = new AutoCompleteStringCollection(); for (i = 0; i < numArray.Count <int>(); i++) { autoCompleteStringCollections2.Add(numArray[i].ToString()); } this.tbCode.AutoCompleteSource = AutoCompleteSource.CustomSource; this.tbCode.AutoCompleteMode = AutoCompleteMode.Suggest; this.tbCode.AutoCompleteCustomSource = autoCompleteStringCollections2; base.WindowState = FormWindowState.Maximized; this.canPrint(false); this.tsCreat.Select(); if (this._directed != 0) { this.tsEdit_Click(sender, e); this.tbVNumber.Text = &this._vNum.ToString(); this.tbVNumber_Leave(sender, e); } }
private void tsAdd_Click(object sender, EventArgs e) { int num1; int? nullable1; int? nullable2; int num2; DateTime dateTime; if (!this.checkValidity()) { this.tbName.Focus(); } else { int num3 = Convert.ToInt32(this.tbCode.Text); decimal num4 = Convert.ToDecimal(this.tbAmount.Text); string text = this.tbNote.Text; if (!string.IsNullOrEmpty(this.tbCode.Text) && !string.IsNullOrEmpty(this.tbName.Text) && !string.IsNullOrEmpty(this.tbAmount.Text)) { BankBll bankBll = new BankBll(); new int?(Convert.ToInt32(this.tbCheck.Text)); new int?(num1 = Convert.ToInt32(this.ddlBank.SelectedValue)); } else { nullable1 = null; nullable2 = null; num1 = 21; } if (this.cbType.Checked) { MessageBox.Show("أحد الحسابات هو حساب رئيسي .. لايمكن اختياره"); } else { switch (WithdrawalForm._mode) { case Mode.New: { num2 = this._cash.getNewVoucher(); num2.insertVoucher(num3, num1, num4, 1.ToString(), nullable2, nullable1, 2, text, dateTime = DateTime.Now, dateTime.Date); MessageBox.Show("تم حفظ السند"); WithdrawalForm._mode = 1; WithdrawalForm._print = 1; WithdrawalForm._voucherID = num2; this.canPrint(true); MessageBox.Show(exception.Message); break; } } try { VoucherDataTable voucher = this._voucher.getVoucher(Convert.ToInt32(this.tbVNumber.Text)); this._voucher.updateVoucher(int.Parse(this.tbVNumber.Text), num3, voucher[0].DAcc, num1, voucher[0].CAcc, voucher[0].Amount_NU, num4, text, nullable1, nullable2); MessageBox.Show("تم التعديل"); WithdrawalForm._print = 1; WithdrawalForm._voucherID = int.Parse(this.tbVNumber.Text); this.canPrint(true); } catch (Exception exception) { MessageBox.Show(exception.Message); } goto L_0276; L_0276: break; MessageBox.Show("الرجاء اضافة المعلومات"); } } }
private void btnAdd_Click(object sender, EventArgs e) { int? nullable; BankBll bankBll; popupClient _popupClient; try { string text = this.tbName.Text; int num1 = int.Parse(this.tbCode.Text); int catgeory = Convert.ToInt32(this.ddlCategory.SelectedValue); decimal num2 = decimal.Parse(this.tbBalance.Text); new int?(0); if (this.rbType1.Checked) { nullable = new int?(Convert.ToInt32(this.ddlSub.SelectedValue)); catgeory = this.accounts.getCatgeory(num1); } if (!this.edit) { if (catgeory == 1) { int nextParentCode = this.accounts.getNextParentCode(35); this.accounts.InsertFixedAssetAccount(num1, text, catgeory, num2, nullable, nextParentCode); } else { if (int valueOrDefault = nullable.GetValueOrDefault().HasValue || valueOrDefault != 0) { switch (valueOrDefault) { case 0: { this.accounts.InsertAccount(num1, text, catgeory, true, num2, nullable); bankBll = new BankBll(); bankBll.insertBank(text, num1, ""); break; } case 1: { _popupClient = new popupClient(); _popupClient.edit = false; _popupClient.clientF = null; _popupClient.accForm = this.accountsForm; _popupClient.tbAccCode.set_Text(this.tbCode.Text); _popupClient.tbEName.set_Text(this.tbName.Text); _popupClient.tbBalance.set_Text(this.tbBalance.Text); _popupClient.tbBalance.set_Visible(true); _popupClient.lblBalance.set_Visible(true); _popupClient.set_Text("إضافة عميل"); _popupClient.Show(); break; } case 2: { break; } case 32: { this.accounts.InsertAccount(num1, text, catgeory, true, num2, nullable); break; } default: { this.accounts.InsertAccount(num1, text, catgeory, true, num2, nullable); goto L_0207; break; } } } } } else { if (catgeory == 1) { this.accounts.UpdateFixedAssetAccount(num1, text); } else { this.accounts.UpdateAccount(num1, text, catgeory, true, num2, nullable); } } AccountsViewDataTable accountsView = this.accounts.GetAccountsView(); accountsView.BalanceColumn.ColumnName = "الرصيد"; accountsView.Category_NameColumn.ColumnName = "نوع الحساب"; accountsView.GL_IDColumn.ColumnName = "رقم الحساب"; accountsView.GL_Name_VCColumn.ColumnName = "اسم الحساب"; accountsView.ParentColumn.ColumnName = "تابع لحساب"; accountsView.Status_BTColumn.ColumnName = "مفعل"; this.accountsForm.dgvAccounts.DataSource = accountsView; this.accountsForm.dgvAccounts.Columns["BS_Category_VC"].Visible = false; base.Close(); base.Dispose(); } catch (Exception exception) { MessageBox.Show(exception.Message); } }