Beispiel #1
0
        private void AddItem(string table)
        {
            if (table == "customer")
            {
                var cust = new frmRegisterCustomer();
                cust.ShowDialog();
                populateDataGridView();
            }
            else if (table == "secretary")
            {
                var sec = new frmRegisterSecretary();
                sec.ShowDialog();
            }
            else if (table == "ceo")
            {
                var ceo = new frmRegisterCeo();
                ceo.ShowDialog();
            }

            else if (table == "fishtype")
            {
                var type = new frmCreateFishCannoeType("Fish Type");
                type.ShowDialog();
            }
            else if (table == "cannoetype")
            {
                var type = new frmCreateFishCannoeType("Cannoe Type");
                type.ShowDialog();
            }
            else if (table == "deptors")
            {
                var pay = new frmMakeCustomerPayment();
                pay.ShowDialog();
            }
            else if (table == "order")
            {
                var selectedRows = adgvResult.SelectedRows[0].Cells;
                var customerId   = selectedRows[1].Value.ToString();
                var order        = new frmCustomerOrder(customerId);
                order.ShowDialog();
            }
        }
Beispiel #2
0
        private void UpdateItem(string table)
        {
            if (table == "customer")
            {
                if (adgvResult.CurrentRow.Index >= 0)
                {
                    var selectedRowCells = adgvResult.SelectedRows[0].Cells;
                    var C = new Customer();
                    CheckInputIsNull(adgvResult.ColumnCount);
                    C.Name     = selectedRowCells[1].Value.ToString();
                    C.Phone    = selectedRowCells[2].Value.ToString();
                    C.Resident = selectedRowCells[3].Value.ToString();
                    var cust = new frmRegisterCustomer(C);
                    cust.ShowDialog();
                    populateDataGridView();
                }
            }

            else if (table == "fishtype")
            {
                if (adgvResult.CurrentRow.Index >= 0)
                {
                    var selectedRowCells = adgvResult.SelectedRows[0].Cells;


                    CheckInputIsNull(adgvResult.ColumnCount);

                    var name = selectedRowCells[1].Value.ToString();
                    var type = new frmCreateFishCannoeType("fish", name);
                    type.ShowDialog();
                    populateDataGridView();
                }
            }
            else if (table == "cannoetype")
            {
                if (adgvResult.CurrentRow.Index >= 0)
                {
                    var selectedRowCells = adgvResult.SelectedRows[0].Cells;
                    CheckInputIsNull(adgvResult.ColumnCount);
                    var name = selectedRowCells[1].Value.ToString();
                    var type = new frmCreateFishCannoeType("cannoe", name);
                    type.ShowDialog();
                    populateDataGridView();
                }
            }
            else if (table == "deptors")
            {
                // No update for Deptor Yet !!
                if (adgvResult.CurrentRow.Index >= 0)
                {
                    CheckInputIsNull(adgvResult.ColumnCount);
                    var pay = new frmMakeCustomerPayment();
                    pay.ShowDialog();
                }
            }
            else if (table == "order")
            {
                // No Update for Order Yet !!
                if (adgvResult.CurrentRow.Index >= 0)
                {
                    CheckInputIsNull(adgvResult.ColumnCount);
                    var order = new frmCustomerOrder();
                    order.ShowDialog();
                }
            }
        }