Exemple #1
0
 private void btnAdd_Click(object sender, EventArgs e)
 {
     this.mode              = Mode.Null;
     this._addSub           = new popupSupplier();
     this._addSub.supplierF = this;
     this._addSub.edit      = false;
     this._addSub.Show();
 }
Exemple #2
0
        private void dgvSuppliers_KeyDown(object sender, KeyEventArgs e)
        {
            Keys keyCode = e.KeyCode;

            if (keyCode == Keys.Return)
            {
                DataGridView dataGridView = (DataGridView)sender;
                int          index        = dataGridView.SelectedRows[0].Index;
                try
                {
                    if (this.mode == Mode.Edit)
                    {
                        this._addSub                    = new popupSupplier();
                        this._addSub.edit               = true;
                        this._addSub.supplierF          = this;
                        this._addSub.row                = index;
                        this._addSub.tbAccCode.Text     = dataGridView.get_Item(5, index).Value.ToString();
                        this._addSub.tbSName.Text       = dataGridView.get_Item(1, index).Value.ToString();
                        this._addSub.tbPName.Text       = dataGridView.get_Item(2, index).Value.ToString();
                        this._addSub.tbPhone.Text       = dataGridView.get_Item(4, index).Value.ToString();
                        this._addSub.tbAddress.Text     = dataGridView.get_Item(3, index).Value.ToString();
                        this._addSub.tbBalance.Visible  = false;
                        this._addSub.lblBalance.Visible = false;
                        this._addSub.Text               = "تعديل مورد";
                        this._addSub.Show();
                    }
                    else
                    {
                        if (this.mode != Mode.Delete || MessageBox.Show("متاكد من حذف المزود؟", "حذف", MessageBoxButtons.OKCancel) == 1)
                        {
                            int num = Convert.ToInt32(dataGridView.get_Item(5, index).Value);
                            this._supplier.deleteSupplier(num);
                            this.dgvSuppliers.DataSource = this._supplier.getSuppliers();
                            this.dgvSuppliers.Refresh();
                        }
                    }
                }
                catch (Exception exception)
                {
                    MessageBox.Show(string.Concat(" لايمكن حذف المزود ", exception.Message));
                }
                goto L_01fc;
            }
L_01fc:
        }