コード例 #1
0
        private void btnCreate_Click(object sender, EventArgs e)
        {
            if (!GlobalFunctions.checkRights("tsm" + lType.Name, "Create"))
            {
                return;
            }
            if (dgvLists.Rows.Count == 0)
            {
                refresh("ViewAll", "", false);
            }
            switch (lType.Name)
            {
            case "Location":
                LocationDetailUI loLocationDetail = new LocationDetailUI();
                loLocationDetail.ParentList = this;
                loLocationDetail.ShowDialog();
                break;

            case "Brand":
                BrandDetailUI loBrandDetail = new BrandDetailUI();
                loBrandDetail.ParentList = this;
                loBrandDetail.ShowDialog();
                break;

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

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

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

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

            case "Customer":
                CustomerDetailUI loCustomerDetail = new CustomerDetailUI();
                loCustomerDetail.ParentList = this;
                loCustomerDetail.ShowDialog();
                break;

            case "SalesIncharge":
                SalesInchargeDetailUI loSalesInchargeDetail = new SalesInchargeDetailUI();
                loSalesInchargeDetail.ParentList = this;
                loSalesInchargeDetail.ShowDialog();
                break;

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

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

            case "User":
                UserDetailUI loUserDetail = new UserDetailUI();
                loUserDetail.ParentList = this;
                loUserDetail.ShowDialog();
                break;
            }
        }
コード例 #2
0
        private void btnUpdate_Click(object sender, EventArgs e)
        {
            if (!GlobalFunctions.checkRights("tsm" + lType.Name, "Update"))
            {
                return;
            }
            try
            {
                try
                {
                    for (int i = 0; i < lCountCol; i++)
                    {
                        lRecord[i] = dgvLists.CurrentRow.Cells[i].Value.ToString();
                    }
                }
                catch
                {
                    MessageBoxUI mb = new MessageBoxUI("Fields are not complete!", GlobalVariables.Icons.Warning, GlobalVariables.Buttons.OK);
                    mb.ShowDialog();
                    return;
                }
                if (lRecord.Length > 0)
                {
                    try
                    {
                        if (lRecord[0].ToString() != "")
                        {
                            switch (lType.Name)
                            {
                            case "Location":
                                LocationDetailUI loLocationDetail = new LocationDetailUI(lRecord);
                                loLocationDetail.ParentList = this;
                                loLocationDetail.ShowDialog();
                                break;

                            case "Brand":
                                BrandDetailUI loBrandDetail = new BrandDetailUI(lRecord);
                                loBrandDetail.ParentList = this;
                                loBrandDetail.ShowDialog();
                                break;

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

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

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

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

                            case "Customer":
                                CustomerDetailUI loCustomerDetail = new CustomerDetailUI(lRecord);
                                loCustomerDetail.ParentList = this;
                                loCustomerDetail.ShowDialog();
                                break;

                            case "SalesIncharge":
                                SalesInchargeDetailUI loSalesInchargeDetail = new SalesInchargeDetailUI(lRecord);
                                loSalesInchargeDetail.ParentList = this;
                                loSalesInchargeDetail.ShowDialog();
                                break;

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

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

                            case "User":
                                UserDetailUI loUserDetail = new UserDetailUI(lRecord);
                                loUserDetail.ParentList = this;
                                loUserDetail.ShowDialog();
                                break;
                            }
                        }
                    }
                    catch (Exception ex)
                    {
                        MessageBoxUI mb = new MessageBoxUI(ex, GlobalVariables.Icons.Error, GlobalVariables.Buttons.Close);
                        mb.ShowDialog();
                        return;
                    }
                }
            }
            catch { }
        }