Beispiel #1
0
        private void btnUpdate_Click(object sender, EventArgs e)
        {
            try
            {
                if (!GlobalFunctions.checkRights("tsm" + lType.Name, "Update"))
                {
                    return;
                }

                for (int i = 0; i < lCountCol; i++)
                {
                    lRecord[i] = dgvLists.CurrentRow.Cells[i].Value.ToString();
                }

                if (lRecord.Length > 0)
                {
                    if (lRecord[0].ToString() != "")
                    {
                        switch (lType.Name)
                        {
                        case "Customer":
                            CustomerDetailUI loCustomerDetail = new CustomerDetailUI(lRecord);
                            loCustomerDetail.ParentList = this;
                            loCustomerDetail.ShowDialog();
                            break;

                        case "Supplier":
                            SupplierDetailUI loSupplierDetail = new SupplierDetailUI(lRecord);
                            loSupplierDetail.ParentList = this;
                            loSupplierDetail.ShowDialog();
                            break;

                        case "InventoryGroup":
                            InventoryGroupDetailUI loInventoryGroupDetailUI = new InventoryGroupDetailUI(lRecord);
                            loInventoryGroupDetailUI.ParentList = this;
                            loInventoryGroupDetailUI.ShowDialog();
                            break;

                        case "Category":
                            CategoryDetailUI loCategoryDetailUI = new CategoryDetailUI(lRecord);
                            loCategoryDetailUI.ParentList = this;
                            loCategoryDetailUI.ShowDialog();
                            break;

                        case "Stock":
                            StockDetailUI loStockDetailUI = new StockDetailUI(lRecord);
                            loStockDetailUI.ParentList = this;
                            loStockDetailUI.ShowDialog();
                            break;

                        case "Unit":
                            UnitDetailUI loUnitDetailUI = new UnitDetailUI(lRecord);
                            loUnitDetailUI.ParentList = this;
                            loUnitDetailUI.ShowDialog();
                            break;

                        case "InventoryType":
                            InventoryTypeDetailUI loInventoryTypeDetailUI = new InventoryTypeDetailUI(lRecord);
                            loInventoryTypeDetailUI.ParentList = this;
                            loInventoryTypeDetailUI.ShowDialog();
                            break;

                        case "Location":
                            LocationDetailUI loLocationDetailUI = new LocationDetailUI(lRecord);
                            loLocationDetailUI.ParentList = this;
                            loLocationDetailUI.ShowDialog();
                            break;
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                ErrorMessageUI em = new ErrorMessageUI(ex.Message, this.Name, "btnUpdate_Click");
                em.ShowDialog();
                return;
            }
        }
Beispiel #2
0
        private void btnCreate_Click(object sender, EventArgs e)
        {
            try
            {
                if (!GlobalFunctions.checkRights("tsm" + lType.Name, "Create"))
                {
                    return;
                }
                if (dgvLists.Rows.Count == 0)
                {
                    refresh("ViewAll", "", "", false);
                }
                switch (lType.Name)
                {
                case "Customer":
                    CustomerDetailUI loCustomerDetail = new CustomerDetailUI();
                    loCustomerDetail.ParentList = this;
                    loCustomerDetail.ShowDialog();
                    break;

                case "Supplier":
                    SupplierDetailUI loSupplierDetail = new SupplierDetailUI();
                    loSupplierDetail.ParentList = this;
                    loSupplierDetail.ShowDialog();
                    break;

                case "InventoryGroup":
                    InventoryGroupDetailUI loInventoryGroupDetailUI = new InventoryGroupDetailUI();
                    loInventoryGroupDetailUI.ParentList = this;
                    loInventoryGroupDetailUI.ShowDialog();
                    break;

                case "Category":
                    CategoryDetailUI loCategoryDetailUI = new CategoryDetailUI();
                    loCategoryDetailUI.ParentList = this;
                    loCategoryDetailUI.ShowDialog();
                    break;

                case "Stock":
                    StockDetailUI loStockDetailUI = new StockDetailUI();
                    loStockDetailUI.ParentList = this;
                    loStockDetailUI.ShowDialog();
                    break;

                case "Unit":
                    UnitDetailUI loUnitDetailUI = new UnitDetailUI();
                    loUnitDetailUI.ParentList = this;
                    loUnitDetailUI.ShowDialog();
                    break;

                case "InventoryType":
                    InventoryTypeDetailUI loInventoryTypeDetailUI = new InventoryTypeDetailUI();
                    loInventoryTypeDetailUI.ParentList = this;
                    loInventoryTypeDetailUI.ShowDialog();
                    break;

                case "Location":
                    LocationDetailUI loLocationDetailUI = new LocationDetailUI();
                    loLocationDetailUI.ParentList = this;
                    loLocationDetailUI.ShowDialog();
                    break;
                }
            }
            catch (Exception ex)
            {
                ErrorMessageUI em = new ErrorMessageUI(ex.Message, this.Name, "btnCreate_Click");
                em.ShowDialog();
                return;
            }
        }