protected override void AfterChange(DataColumn dc, DataRow ddr) { string ObjectName = this.myDisbursementDT.TableName; atriumDB.DisbursementRow dr = (atriumDB.DisbursementRow)ddr; switch (dc.ColumnName) { case DisbursementFields.DisbTaxable: case "TaxRateId": if (!dr.Final) { if (dr.IsDisbTaxableNull()) { dr.SetDisbTaxNull(); } else { if (!dr.IsTaxRateIdNull()) { appDB.TaxRateRow taxRateRow = myA.AtMng.DB.TaxRate.FindByTaxRateId(dr.TaxRateId); dr.DisbTax = dr.DisbTaxable * taxRateRow.TaxRate; } else { officeDB.OfficeRow drOffice = this.myA.AtMng.GetOffice(dr.OfficeId).CurrentOffice; dr.DisbTax = dr.DisbTaxable * (drOffice.IsTaxRateNull() ? 0 : drOffice.TaxRate); } dr.DisbTax = Math.Round(dr.DisbTax, 2, MidpointRounding.AwayFromZero); } dr.EndEdit(); } break; default: break; } }
protected override void AfterChange(DataColumn dc, DataRow ddr) { string ObjectName = this.myIRPDT.TableName; atriumDB.IRPRow dr = (atriumDB.IRPRow)ddr; officeDB.OfficeRow drOffice = this.myA.AtMng.GetOffice(dr.OfficeID).CurrentOffice; switch (dc.ColumnName) { case "FeesTaxed": if (dr.IsFeesTaxedNull()) { dr.SetFeesTaxedTaxNull(); } else { dr.FeesTaxedTax = decimal.Round(dr.FeesTaxed * (drOffice.IsTaxRateNull()? 0 : drOffice.TaxRate), 2, MidpointRounding.AwayFromZero); } dr.EndEdit(); break; case "DisbursementTaxed": if (dr.IsDisbursementTaxedNull()) { dr.SetDisbursementTaxedTaxNull(); } else { officeDB.OfficeRow officeRow = myA.AtMng.GetOffice().GetOffice(dr.OfficeID); if (!officeRow.IsOnLine) { dr.DisbursementTaxedTax = decimal.Round(dr.DisbursementTaxed * (drOffice.IsTaxRateNull() ? 0 : drOffice.TaxRate), 2, MidpointRounding.AwayFromZero); } } dr.EndEdit(); break; case "FeesClaimed": if (dr.IsFeesClaimedNull()) { dr.SetFeesClaimedTaxNull(); } else { dr.FeesClaimedTax = decimal.Round(dr.FeesClaimed * (drOffice.IsTaxRateNull() ? 0 : drOffice.TaxRate), 2, MidpointRounding.AwayFromZero); } dr.EndEdit(); break; case "DisbursementClaimed": if (dr.IsDisbursementClaimedNull()) { dr.SetDisbursementClaimedTaxNull(); } else { officeDB.OfficeRow officeRow = myA.AtMng.GetOffice().GetOffice(dr.OfficeID); if (!officeRow.IsOnLine) { dr.DisbursementClaimedTax = decimal.Round(dr.DisbursementClaimed * (drOffice.IsTaxRateNull() ? 0 : drOffice.TaxRate), 2, MidpointRounding.AwayFromZero); } } dr.EndEdit(); break; case "DateTaxed": if (dr.SRPRow.IsTaxationBeganNull()) { dr.SRPRow.TaxationBegan = DateTime.Today; //dr.SRPRow.AcceptChanges(); dr.EndEdit(); dr.SRPRow.EndEdit(); } break; case "OfficerID": if (!dr.IsOfficerIDNull() && dr.IsDateTaxedNull()) { dr.DateTaxed = DateTime.Today; dr.FeesTaxed = dr.IsFeesClaimedNull()? 0 : dr.FeesClaimed; dr.FeesTaxedTax = dr.IsFeesClaimedTaxNull() ? 0 : dr.FeesClaimedTax; dr.DisbursementTaxed = dr.IsDisbursementClaimedNull() ? 0 : dr.DisbursementClaimed; dr.DisbursementTaxedTax = dr.IsDisbursementClaimedTaxNull()? 0 : dr.DisbursementClaimedTax; dr.DisbursementTaxExemptTaxed = dr.IsDisbursementTaxExemptClaimedNull() ? 0 : dr.DisbursementTaxExemptClaimed; dr.EndEdit(); } break; case "SIN": try { //FileManager fm = myA.AtMng.GetFileBySIN(dr.SIN); //dr.FileID = fm.CurrentFile.FileId; //fm.Dispose(); //dr.EndEdit(); } catch (Exception x) { System.Diagnostics.Trace.WriteLine(x.Message); throw new AtriumException(atriumBE.Properties.Resources.SINNotFound); } break; default: break; } }