protected override void BeforeUpdate(DataRow row) { atriumDB.DisbursementRow dr = (atriumDB.DisbursementRow)row; if (!CanEdit(dr)) { throw new AtriumException(atriumBE.Properties.Resources.CACannotEditAnotherOffice); } if (dr.IsDisbDateNull()) { this.BeforeChange(DisbursementFields.DisbDate, dr); } if (dr.IsNull(dr.Table.Columns[DisbursementFields.DisbType])) { this.BeforeChange(DisbursementFields.DisbType, dr); } if (dr.IsDisbTaxableNull() && dr.IsDisbTaxExemptNull()) { throw new RequiredException(DisbursementFields.DisbTaxable); } }
protected override void BeforeChange(DataColumn dc, DataRow ddr) { string ObjectName = this.myDisbursementDT.TableName; atriumDB.DisbursementRow dr = (atriumDB.DisbursementRow)ddr; switch (dc.ColumnName) { case DisbursementFields.DisbDate: if (dr.IsDisbDateNull() || myA.IsEmpty(dr.DisbDate.ToString())) { throw new RequiredException(Resources.DisbursementDisbDate); } this.myA.IsValidDate(Resources.DisbursementDisbDate, dr.DisbDate, false, DateTime.Today.AddMonths(-6), DateTime.Today, Resources.ValidationSixMonthsAgo, Resources.ValidationToday); break; case DisbursementFields.DisbType: if (dr.IsNull(dc) || dr.DisbType.Length == 0) { throw new RequiredException(Resources.DisbursementDisbType); } else if (!myA.CheckDomain(dr.DisbType, myA.Codes("DisbursementType"))) { throw new AtriumException(atriumBE.Properties.Resources.BadDomainValue, dc.ColumnName, dr.Table.TableName, "Dsibursement Type"); } break; case "TaxRateId": if (!dr.IsTaxRateIdNull() && !myA.CheckDomain(dr.TaxRateId, myA.Codes("TaxRate"))) { throw new AtriumException(atriumBE.Properties.Resources.BadDomainValue, dc.ColumnName, dc.Table.TableName, "Tax Rate"); } break; case "OfficeId": if (!myA.CheckDomain(dr.OfficeId, myA.Codes("OfficeList"))) { throw new AtriumException(atriumBE.Properties.Resources.IsNotValid, dc.ColumnName); } else if (!myA.CheckDomain(dr.OfficeId, myA.Codes("officelist"))) { throw new AtriumException(atriumBE.Properties.Resources.BadDomainValue, dc.ColumnName, dc.Table.TableName, "Office List"); } break; case DisbursementFields.IRPId: case DisbursementFields.DisbTaxExempt: case DisbursementFields.DisbTaxable: case DisbursementFields.DisbTax: case DisbursementFields.Posted: case DisbursementFields.Final: if (dr.Final) { throw new AtriumException(Resources.DisbNoEditAfterCommit); } break; case DisbursementFields.Taxed: if (!dr.Final && dr.Taxed) { throw new AtriumException(Resources.DisbNoTaxUnlessCommit); } break; default: break; } }