Ejemplo n.º 1
0
        protected override void AfterChange(DataColumn dc, DataRow ddr)
        {
            string ObjectName = this.myJudgmentAccountDT.TableName;

            CLAS.JudgmentAccountRow dr = (CLAS.JudgmentAccountRow)ddr;
            switch (dc.ColumnName)
            {
            case JudgmentAccountFields.CostAmount:
            case JudgmentAccountFields.PreJudgmentInterestAmount:
            case JudgmentAccountFields.PrincipalAmountBeforeJudgment:
                if (!dr.IsCostAmountNull() && !dr.IsPreJudgmentInterestAmountNull() && !dr.IsPrincipalAmountBeforeJudgmentNull())
                {
                    dr.JudgmentAmount = dr.CostAmount + dr.PreJudgmentInterestAmount + dr.PrincipalAmountBeforeJudgment;
                    dr.EndEdit();
                }
                break;

            case "Include":
                break;
            }
        }
Ejemplo n.º 2
0
        protected override void BeforeChange(DataColumn dc, DataRow ddr)
        {
            string ObjectName = this.myJudgmentAccountDT.TableName;

            CLAS.JudgmentAccountRow dr = (CLAS.JudgmentAccountRow)ddr;
            switch (dc.ColumnName)
            {
            case "CostDate":
                if (dr.IsCostDateNull())
                {
                    throw new RequiredException(Resources.JudgmentAccountCostDate);
                }
                if (dr.JudgmentRow.IsJudgmentDateNull())
                {
                    throw new RelatedException(Resources.JudgmentAccountCostDate, Resources.JudgmentJudgmentDate);
                }
                myA.IsValidDate(Resources.JudgmentAccountCostDate, dr.CostDate, true, dr.JudgmentRow.JudgmentDate, DateTime.Today, Resources.JudgmentJudgmentDate, Resources.ValidationToday);
                break;

            case "CostAmount":
                if (!dr.IsCostAmountNull() && (dr.CostAmount < 0))
                {
                    throw new AtriumException(Resources.MustBeGreaterThanZero, Resources.JudgmentAccountCostAmount);
                }
                if (!dr.IsCostAmountNull() && dr.CostAmount > 40000)
                {
                    RaiseWarning(WarningLevel.Interrupt, Properties.Resources.CostShouldNotBeGreaterThanX);
                }
                break;

            case "InterestIncluded":
                break;

            case "JudgmentAmount":
                if (dr.JudgmentAmount != dr.CostAmount + dr.PreJudgmentInterestAmount + dr.PrincipalAmountBeforeJudgment)
                {
                    throw new AtriumException(Resources.JudgmentAccountInvalidJudgAmt);
                }

                if (!dr.IsJudgmentAmountNull() && (dr.JudgmentAmount < 0))
                {
                    throw new AtriumException(Resources.MustBeGreaterThanZero, Resources.JudgmentAccountJudgmentAmount);
                }
                if (!dr.IsJudgmentAmountNull() && (dr.JudgmentAmount > 100000))
                {
                    RaiseWarning(WarningLevel.Interrupt, Properties.Resources.JudgmentAmountShouldNotBeGreaterThanX);
                }
                break;

            case "PostJudgmentInterestRate":
                if (dr.IsPostJudgmentInterestRateNull() || dr.PostJudgmentInterestRate > 60 || dr.PostJudgmentInterestRate < 0)
                {
                    throw new AtriumException(Resources.InvalidInterestRate, Resources.JudgmentAccountPostJudgmentInterestRate);
                }
                break;

            case "PreJudgmentInterestRate":
                if (dr.IsPreJudgmentInterestRateNull() || dr.PreJudgmentInterestRate > 60 || dr.PreJudgmentInterestRate < 0)
                {
                    throw new AtriumException(Resources.InvalidInterestRate, Resources.JudgmentAccountPreJudgmentInterestRate);
                }
                break;

            case "PostJudgmentRateType":
                if (!myA.CheckDomain(dr.PostJudgmentRateType, myA.FM.Codes("InterestRateType")))
                {
                    throw new AtriumException(atriumBE.Properties.Resources.BadDomainValue, dc.ColumnName, dr.Table.TableName, "Interest Rate Type");
                }
                break;

            case "PreJudgmentInterestAmount":
                if (!dr.IsPreJudgmentInterestAmountNull() && (dr.PreJudgmentInterestAmount > 100000))
                {
                    RaiseWarning(WarningLevel.Interrupt, Properties.Resources.AmountNotGreaterThan, "Pre-Judgment Interest Amount", 100000);
                }
                break;

            case "PreJudgmentRateType":
                if (!myA.CheckDomain(dr.PreJudgmentRateType, myA.FM.Codes("InterestRateType")))
                {
                    throw new AtriumException(atriumBE.Properties.Resources.BadDomainValue, dc.ColumnName, dr.Table.TableName, "Interest Rate Type");
                }
                break;

            case "PrincipalAmountBeforeJudgment":
                if (!dr.IsPrincipalAmountBeforeJudgmentNull() && (dr.PrincipalAmountBeforeJudgment > 100000))
                {
                    RaiseWarning(WarningLevel.Interrupt, Properties.Resources.AmountNotGreaterThan, "Principal Amount Before Judgment", 100000);
                }
                break;

            default:
                break;
            }
        }