protected override void BeforeUpdate(DataRow ddr) { CLAS.AccountHistoryRow dr = (CLAS.AccountHistoryRow)ddr; if (this.myA.GetFileHistory().GetCurrentRow().Length != 0) { if (((CLAS.FileHistoryRow) this.myA.GetFileHistory().GetCurrentRow()[0]).IsReceivedByOfficeDateNull()) { if (!dr.IsReceivedByOfficeDateNull()) { throw new AtriumException(Resources.FileNotReceived); } } } if (dr.IsReceivedByOfficeDateNull()) { CLAS.DebtRow cddr = myA.DB.Debt.FindByDebtId(dr.FileAccountID); cddr.OfficeID = dr.OfficeId; } }
protected override void BeforeChange(DataColumn dc, DataRow ddr) { string ObjectName = this.myAccountHistoryDT.TableName; CLAS.AccountHistoryRow dr = (CLAS.AccountHistoryRow)ddr; switch (dc.ColumnName) { case "SentToOfficeDate": if (dr.IsSentToOfficeDateNull()) { throw new RequiredException(Resources.AccountHistorySentToOfficeDate); } // if(dr.DebtRow.IsReceivedByJusticeDateNull()) // this.myA.RaiseError((int)AtriumEnum.AppErrorCodes.RelatedDateRequired, myA.GetLabelLeft(ObjectName, dc.ColumnName), myA.GetLabelLeft("FileAccount", "ReceivedByJusticeDate")); myA.IsValidDate(Resources.AccountHistorySentToOfficeDate, dr.SentToOfficeDate, false, dr.DebtRow.ReceivedByJusticeDate, DateTime.Today.AddDays(7), Resources.DebtReceivedByJusticeDate, Resources.ValidationSevenDaysLater); break; case "ReceivedByOfficeDate": // if(dr.IsReceivedByOfficeDateNull()) // this.myA.RaiseError((int)AtriumEnum.AppErrorCodes.CannotBeBlank, myA.GetLabelLeft(ObjectName, dc.ColumnName)); if (dr.IsSentToOfficeDateNull()) { throw new RelatedException(Resources.AccountHistoryReceivedByOfficeDate, Resources.AccountHistorySentToOfficeDate); } if (!dr.IsReceivedByOfficeDateNull()) { myA.IsValidDate(Resources.AccountHistoryReceivedByOfficeDate, dr.ReceivedByOfficeDate, true, dr.SentToOfficeDate, DateTime.Today, Resources.AccountHistorySentToOfficeDate, Resources.ValidationToday); } break; case "ReturnedByOfficeDate": if (dr.IsReceivedByOfficeDateNull()) { throw new AtriumException(Resources.AccountNotReceived); //this.myA.RaiseError((int)AtriumEnum.AppErrorCodes.CannotBeBlank, myA.GetLabelLeft(ObjectName, dc.ColumnName)); } // if(dr.IsReceivedByOfficeDateNull()) // this.myA.RaiseError((int)AtriumEnum.AppErrorCodes.RelatedDateRequired,myA.GetLabelLeft(ObjectName, dc.ColumnName),myA.GetLabelLeft(ObjectName, "ReceivedByOfficeDate")); if (!dr.IsReturnedByOfficeDateNull()) { myA.IsValidDate(Resources.AccountHistoryReturnedByOfficeDate, dr.ReturnedByOfficeDate, true, dr.ReceivedByOfficeDate, DateTime.Today, Resources.AccountHistoryReceivedByOfficeDate, Resources.ValidationToday); } break; case "ReceivedFromOfficeDate": // if(dr.IsReceivedFromOfficeDateNull()) // this.myA.RaiseError((int)AtriumEnum.AppErrorCodes.CannotBeBlank, myA.GetLabelLeft(ObjectName, dc.ColumnName)); if (dr.IsReceivedByOfficeDateNull()) { throw new RelatedException(Resources.AccountHistoryReceivedFromOfficeDate, Resources.AccountHistoryReceivedByOfficeDate); } if (!dr.IsReceivedFromOfficeDateNull()) { myA.IsValidDate(Resources.AccountHistoryReceivedFromOfficeDate, dr.ReceivedFromOfficeDate, true, dr.ReturnedByOfficeDate, DateTime.Today, Resources.AccountHistoryReturnedByOfficeDate, Resources.ValidationToday); } break; case "OfficeId": if (dr.IsNull(dc)) { throw new RequiredException(Resources.OfficeID); } else if (!myA.CheckDomain(dr.OfficeId, myA.FM.Codes("officelist"))) { throw new AtriumException(atriumBE.Properties.Resources.BadDomainValue, dc.ColumnName, dc.Table.TableName, "Office List"); } break; case "StatusCode": if (!myA.CheckDomain(dr.StatusCode, myA.FM.Codes("status"))) { throw new AtriumException(atriumBE.Properties.Resources.BadDomainValue, dc.ColumnName, dc.Table.TableName, "Status Code"); } break; //case "SubFileType": // if (dr.IsNull(dc)) // myA.RaiseError((int)AtriumEnum.AppErrorCodes.CannotBeBlank, myA.GetLabelLeft(ObjectName, dc.ColumnName)); // else if (!myA.Codes("HistoryType").Rows.Contains(dr.SubFileType)) // myA.RaiseError((int)AtriumEnum.AppErrorCodes.FHInvalidFileType); // break; default: break; } }