Exemple #1
0
        private void toolStripButton2_Click(object sender, EventArgs e)
        {
            int num1;

            try
            {
                int index  = this.dgvAccounts.SelectedRows[0].Index;
                int num2   = Convert.ToInt32(this.dgvAccounts.Rows[index].Cells[0].Value);
                int parent = this.accounts.getParent(num2);
                num1 = parent;
                popupClient _popupClient = new popupClient();
                _popupClient.edit               = true;
                _popupClient.clientF            = null;
                _popupClient.row                = index;
                _popupClient.tbAccCode.Text     = this.dgvAccounts.Rows[index].Cells[0].Value.ToString();
                _popupClient.tbEName.Text       = this.dgvAccounts.Rows[index].Cells[1].Value.ToString();
                _popupClient.tbBalance.Visible  = true;
                _popupClient.tbBalance.ReadOnly = true;
                _popupClient.lblBalance.Visible = true;
                _popupClient.lblBalance.Enabled = false;
                _popupClient.Text               = "تعديل معلومات عميل";
                _popupClient.Show();
                this.pop = new popupAddForm();
                this.pop.pnlType.Enabled = false;
                this.pop.accountsForm    = this;
                if (string.IsNullOrEmpty(this.dgvAccounts.Rows[index].Cells[6].Value.ToString()))
                {
                    this.pop.pnlSub.Visible            = false;
                    this.pop.ddlCategory.SelectedValue = this.dgvAccounts.Rows[index].Cells[3].Value.ToString();
                    this.pop.ddlCategory.Enabled       = false;
                    this.pop.rbType2.Checked           = true;
                    this.pop.rbType1.Checked           = false;
                }
                else
                {
                    this.pop.pnlSub.Visible       = true;
                    this.pop.pnlSub.Dock          = DockStyle.Top;
                    this.pop.ddlSub.SelectedValue = this.dgvAccounts.Rows[index].Cells[0].Value.ToString().Substring(0, 2);
                    this.pop.ddlSub.Enabled       = false;
                    this.pop.rbType2.Checked      = false;
                    this.pop.rbType1.Checked      = true;
                }
L_039f:
                this.pop.tbName.Text        = this.dgvAccounts.Rows[index].Cells[1].Value.ToString();
                this.pop.tbCode.Text        = this.dgvAccounts.Rows[index].Cells[0].Value.ToString();
                this.pop.tbCode.ReadOnly    = true;
                this.pop.tbBalance.Text     = this.dgvAccounts.Rows[index].Cells[5].Value.ToString();
                this.pop.tbBalance.ReadOnly = true;
                this.pop.btnAdd.Text        = "حفظ";
                this.pop.edit = true;
                this.pop.Show();
                goto L_039f;
            }
            catch (Exception exception)
            {
                MessageBox.Show(exception.Message);
            }
            if (num1 != 23)
            {
            }
            else
            {
            }
        }
Exemple #2
0
        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);
            }
        }