protected override void BeforeUpdate(DataRow row) { base.BeforeUpdate(row); CLAS.DebtorRow dr = (CLAS.DebtorRow)row; this.BeforeChange(dr.Table.Columns["CeasedToBeStudentDate"], dr); this.BeforeChange(row.Table.Columns["SIN"], row); if (dr.IsNull(atriumBE.ContactFields.SIN)) { throw new RequiredException(Resources.DebtorSIN); } if (row.RowState != DataRowState.Added && (!row["SIN", DataRowVersion.Original].Equals(row["SIN", DataRowVersion.Current]) || !row["LastName", DataRowVersion.Original].Equals(row["LastName", DataRowVersion.Current]) || !row["FirstName", DataRowVersion.Original].Equals(row["FirstName", DataRowVersion.Current]))) { this.myA.FM.GetAKA(); atriumDB.AKARow drAka = this.myA.FM.DB.AKA.NewAKARow(); this.myA.FM.DB.AKA.AddAKARow(drAka); drAka.BeginEdit(); drAka.LastName = row["LastName", DataRowVersion.Original].ToString(); drAka.FirstName = row["FirstName", DataRowVersion.Original].ToString(); drAka.SIN = row["SIN", DataRowVersion.Original].ToString(); drAka.ContactId = (int)row["ContactId"]; drAka.EndEdit(); } if (this.myA.FM.CurrentFile.OpponentID == (int)row["ContactId"]) { this.myA.FM.CurrentFile.NameE = String.Format("{0}, {1}", row["LastName"], row["FirstName"]); this.myA.FM.CurrentFile.NameF = String.Format("{0}, {1}", row["LastName"], row["FirstName"]); } }
protected override void BeforeChange(DataColumn dc, DataRow ddr) { base.BeforeChange(dc, ddr); string ObjectName = this.myDebtorDT.TableName; CLAS.DebtorRow dr = (CLAS.DebtorRow)ddr; switch (dc.ColumnName) { case "AddressCurrentID": if (ddr.IsNull(dc)) { throw new AtriumException(Resources.DebtAddressRqd); } break; case "SexCode": if (ddr.IsNull(dc)) { throw new RequiredException(Resources.DebtorSexCode); } if (!dr.IsNull("SexCode") && !myA.CheckDomain(dr.SexCode, myA.FM.Codes("Sex"))) { throw new AtriumException(atriumBE.Properties.Resources.BadDomainValue, dc.ColumnName, dr.Table.TableName, "Gender Code"); } break; case "LanguageCode": if (ddr.IsNull(dc)) { throw new RequiredException(Resources.DebtorLanguageCode); } else if (!myA.CheckDomain(dr.LanguageCode, myA.FM.Codes("LanguageCode"))) { throw new AtriumException(atriumBE.Properties.Resources.BadDomainValue, dc.ColumnName, dr.Table.TableName, "Language Code"); } break; case "BirthDate": if (ddr.IsNull(dc)) { throw new RequiredException(Resources.DebtorBirthDate); } myA.IsValidDate(Resources.DebtorBirthDate, (System.DateTime)ddr[dc], false, DateTime.Today.AddYears(-100), DateTime.Today.AddYears(-15), Resources.Validation100yearsago, Resources.Validation15yearsago); break; case "CeasedToBeStudentDate": if (!dr.IsCeasedToBeStudentDateNull()) { myA.IsValidDate(Resources.DebtorCeasedToBeStudentDate, dr.CeasedToBeStudentDate, false, DebtorBE.CSLBegin, DateTime.Today, Resources.ValidationCSLBegin, Resources.ValidationToday); } break; default: break; } }