コード例 #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 "EarningType":
                            EarningTypeDetailUI loEarningTypeDetail = new EarningTypeDetailUI(lRecord);
                            loEarningTypeDetail.ParentList = this;
                            loEarningTypeDetail.ShowDialog();
                            break;

                        case "DeductionType":
                            DeductionTypeDetailUI loDeductionTypeDetail = new DeductionTypeDetailUI(lRecord);
                            loDeductionTypeDetail.ParentList = this;
                            loDeductionTypeDetail.ShowDialog();
                            break;

                        case "TaxType":
                            TaxTypeDetailUI loTaxTypeDetail = new TaxTypeDetailUI(lRecord);
                            loTaxTypeDetail.ParentList = this;
                            loTaxTypeDetail.ShowDialog();
                            break;

                        case "IncomeTaxTable":
                            IncomeTaxTableDetailUI loIncomeTaxTableDetail = new IncomeTaxTableDetailUI(lRecord);
                            loIncomeTaxTableDetail.ParentList = this;
                            loIncomeTaxTableDetail.ShowDialog();
                            break;
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                ErrorMessageUI em = new ErrorMessageUI(ex.Message, this.Name, "btnUpdate_Click");
                em.ShowDialog();
                return;
            }
        }
コード例 #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 "EarningType":
                    EarningTypeDetailUI loEarningTypeDetail = new EarningTypeDetailUI();
                    loEarningTypeDetail.ParentList = this;
                    loEarningTypeDetail.ShowDialog();
                    break;

                case "DeductionType":
                    DeductionTypeDetailUI loDeductionTypeDetail = new DeductionTypeDetailUI();
                    loDeductionTypeDetail.ParentList = this;
                    loDeductionTypeDetail.ShowDialog();
                    break;

                case "TaxType":
                    TaxTypeDetailUI loTaxTypeDetail = new TaxTypeDetailUI();
                    loTaxTypeDetail.ParentList = this;
                    loTaxTypeDetail.ShowDialog();
                    break;

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