protected override void BeforeChange(DataColumn dc, DataRow row) { SST.SSTCaseRow dr = (SST.SSTCaseRow)row; switch (dc.ColumnName) { case "ReconsiderationID": if (!dr.IsReconsiderationIDNull()) { int dupCount = Convert.ToInt32(myA.AppMan.ExecuteScalar("[SSTCaseDuplicateReconId]", new object[] { dr.ReconsiderationID, dr.SSTCaseId })); if (dupCount > 0) { //throw new AtriumException(Properties.Resources.DuplicateReconID); myA.FM.RaiseWarning(WarningLevel.Display, Properties.Resources.DuplicateReconID, myA.AtMng.AppMan.AppName); } } break; case "AppealDate": if (ReceivedComplete(dr)) { if (dr.IsAppealDateNull()) { throw new RequiredException(dc.ColumnName); } else { myA.IsValidDate(dc.ColumnName, dr.AppealDate, false, dr.ReceivedDate, DateTime.Today, "Received Date", "Today"); } } else { if (!dr.IsAppealDateNull()) { if (!dr.IsOrigDecisionDateNull()) { myA.IsValidDate(dc.ColumnName, dr.AppealDate, false, dr.OrigDecisionDate, DateTime.Today, "Reconsideration date", atriumBE.Properties.Resources.ValidationToday); } else { myA.IsValidDate(dc.ColumnName, dr.AppealDate, false, DateTime.Today.AddYears(-15), DateTime.Today, atriumBE.Properties.Resources.Validation15yearsago, atriumBE.Properties.Resources.ValidationToday); } } } break; case "ReceivedDate": if (dr.IsReceivedDateNull()) { throw new RequiredException(dc.ColumnName); } else { if (ReceivedComplete(dr)) { if (!dr.IsOrigDecisionDateNull()) { myA.IsValidDate(dc.ColumnName, dr.ReceivedDate, false, dr.OrigDecisionDate, DateTime.Today, "Reconsideration date", atriumBE.Properties.Resources.ValidationToday); } else { myA.IsValidDate(dc.ColumnName, dr.ReceivedDate, false, DateTime.Today.AddYears(-15), DateTime.Today, atriumBE.Properties.Resources.Validation15yearsago, atriumBE.Properties.Resources.ValidationToday); } } else { if (dr.IsAppealDateNull()) { myA.IsValidDate(dc.ColumnName, dr.ReceivedDate, false, DateTime.Today.AddYears(-15), DateTime.Today, atriumBE.Properties.Resources.Validation15yearsago, atriumBE.Properties.Resources.ValidationToday); } else { myA.IsValidDate(dc.ColumnName, dr.ReceivedDate, false, DateTime.Today.AddYears(-15), dr.AppealDate, atriumBE.Properties.Resources.Validation15yearsago, "Appeal date"); } } } break; case "OrigDecisionDate": if (ReceivedComplete(dr)) { if (dr.IsOrigDecisionDateNull()) { throw new RequiredException(dc.ColumnName); } else { if (dr.IsReceivedDateNull()) { myA.IsValidDate(dc.ColumnName, dr.OrigDecisionDate, false, DateTime.Today.AddYears(-15), DateTime.Today, atriumBE.Properties.Resources.Validation15yearsago, atriumBE.Properties.Resources.ValidationToday); } else { myA.IsValidDate(dc.ColumnName, dr.OrigDecisionDate, false, DateTime.Today.AddYears(-15), dr.ReceivedDate, atriumBE.Properties.Resources.Validation15yearsago, "Received Date"); } } } else { if (!dr.IsOrigDecisionDateNull()) { if (dr.IsAppealDateNull()) { myA.IsValidDate(dc.ColumnName, dr.OrigDecisionDate, false, DateTime.Today.AddYears(-15), DateTime.Today, atriumBE.Properties.Resources.Validation15yearsago, atriumBE.Properties.Resources.ValidationToday); } else { myA.IsValidDate(dc.ColumnName, dr.OrigDecisionDate, false, DateTime.Today.AddYears(-15), dr.AppealDate, atriumBE.Properties.Resources.Validation15yearsago, "Appeal Date"); } } } break; //case "OrigDecisionRecDate": // if (dr.IsOrigDecisionRecDateNull()) // throw new RequiredException(dc.ColumnName); // else // { // myA.IsValidDate(dc.ColumnName, dr.OrigDecisionRecDate, false, DateTime.Today.AddYears(-15), DateTime.Today, atriumBE.Properties.Resources.Validation15yearsago, atriumBE.Properties.Resources.ValidationToday); // } // break; case "IsLate": if (dr.IsLate && !dr.IgnoreLate) { LateWarning(dr); } break; case "LateOverride": //if (!dr.LateOverride) //{ if (dr.IsLate && !dr.IgnoreLate) { LateWarning(dr); } //} //else //{ // myA.FM.EFile.ClearImportantMessage(); //} break; case "AppealLevelID": if (dr.IsAppealLevelIDNull()) { throw new RequiredException(dc.ColumnName); } else if (!myA.CheckDomain(dr.AppealLevelID, myA.FM.Codes("AppealLevel"))) { throw new AtriumException(atriumBE.Properties.Resources.BadDomainValue, dc.ColumnName, dc.Table.TableName, "Appeal level"); } break; case "ProgramId": if (dr.IsProgramIdNull()) { throw new RequiredException(dc.ColumnName); } else if (!myA.CheckDomain(dr.ProgramId, myA.FM.Codes("Program"))) { throw new AtriumException(atriumBE.Properties.Resources.BadDomainValue, dc.ColumnName, dc.Table.TableName, "Program"); } break; case "AccountId": //TFS#54670 CJW 2013-09-05 added column and rule //if (!dr.IsProgramIdNull() && (dr.ProgramId==8 || dr.ProgramId==9) && dr.IsAccountIdNull()) // throw new RequiredException(dc.ColumnName); break; case "DecisionDate": if (!dr.IsDecisionDateNull()) { myA.IsValidDate(dc.ColumnName, dr.DecisionDate, true, dr.ReceivedDate, DateTime.Today, atriumBE.Properties.Resources.SSTAppealDate, atriumBE.Properties.Resources.ValidationToday); } break; case "DecisionSentDate": if (!dr.IsDecisionSentDateNull()) { myA.IsValidDate(dc.ColumnName, dr.DecisionSentDate, true, dr.ReceivedDate, DateTime.Today, atriumBE.Properties.Resources.SSTAppealDate, atriumBE.Properties.Resources.ValidationToday); } break; case "WithdrawalDate": if (!dr.IsWithdrawalDateNull()) { myA.IsValidDate(dc.ColumnName, dr.WithdrawalDate, true, dr.ReceivedDate, DateTime.Today, atriumBE.Properties.Resources.SSTAppealDate, atriumBE.Properties.Resources.ValidationToday); } break; case "FileCompleteDate": if (ReceivedComplete(dr)) { if (dr.IsFileCompleteDateNull()) { throw new RequiredException(dc.ColumnName); } else { myA.IsValidDate(dc.ColumnName, dr.FileCompleteDate, false, dr.ReceivedDate, DateTime.Today, "Received Date", "Today"); } } else { if (!dr.IsFileCompleteDateNull()) { if (!dr.IsOrigDecisionDateNull()) { myA.IsValidDate(dc.ColumnName, dr.FileCompleteDate, false, dr.OrigDecisionDate, DateTime.Today, "Reconsideration date", atriumBE.Properties.Resources.ValidationToday); } else { myA.IsValidDate(dc.ColumnName, dr.FileCompleteDate, false, DateTime.Today.AddYears(-15), DateTime.Today, atriumBE.Properties.Resources.Validation15yearsago, atriumBE.Properties.Resources.ValidationToday); } } } break; case "LeaveToAppealDate": myA.IsValidDate(dc.ColumnName, dr.LeaveToAppealDate, true, dr.ReceivedDate, DateTime.Today, atriumBE.Properties.Resources.SSTAppealDate, atriumBE.Properties.Resources.ValidationToday); break; case "LeaveToAppealRecDate": myA.IsValidDate(dc.ColumnName, dr.LeaveToAppealRecDate, true, dr.ReceivedDate, DateTime.Today, atriumBE.Properties.Resources.SSTAppealDate, atriumBE.Properties.Resources.ValidationToday); break; } }
protected override void BeforeChange(DataColumn dc, DataRow dr) { SST.SSTDecisionRow sdr = (SST.SSTDecisionRow)dr; switch (dc.ColumnName) { case "IsCombined": if (sdr.IsCombined) { //must be "allowed" if (!sdr.IsOutcomeIdNull() && sdr.OutcomeId == 10 && sdr.DecisionType == 4) { throw new AtriumException(Properties.Resources.SSTDecisionIsCombined); } } break; case "DecisionDate": if (!sdr.IsDecisionDateNull()) { myA.IsValidDate(dc.ColumnName, sdr.DecisionDate, true, sdr.SSTCaseRow.ReceivedDate, DateTime.Today, atriumBE.Properties.Resources.SSTAppealDate, atriumBE.Properties.Resources.ValidationToday); } break; case "DecisionSentDate": if (!sdr.IsDecisionSentDateNull()) { myA.IsValidDate(dc.ColumnName, sdr.DecisionSentDate, true, sdr.SSTCaseRow.ReceivedDate, DateTime.Today, atriumBE.Properties.Resources.SSTAppealDate, atriumBE.Properties.Resources.ValidationToday); } break; case "DecisionType": if (!sdr.IsNull(dc)) { CodesDB.DecisionTypeRow dtr = myA.AtMng.CodeDB.DecisionType.FindByDecisionTypeId(sdr.DecisionType); if (dtr.OncePerFile) { //check to see if there is already a design of this type foreach (SST.SSTDecisionRow xsdr in mySSTDecisionDT) { if (xsdr.SSTDecisionId != sdr.SSTDecisionId && xsdr.DecisionType == sdr.DecisionType) { string msg = String.Format(atriumBE.Properties.Resources.SSTDecisionTypeDup, dtr["DecType" + myA.AppMan.Language].ToString()); myA.FM.RaiseWarning(WarningLevel.Interrupt, msg, myA.AtMng.AppMan.AppName); } } } } else { throw new RequiredException(dc.ColumnName); } break; case "OutcomeId": if (!sdr.IsOutcomeIdNull()) { CodesDB.OutcomeRow orr = myA.AtMng.CodeDB.Outcome.FindByOutcomeId(sdr.OutcomeId); if (orr.DecisionType != sdr.DecisionType) { throw new AtriumException("Not a valid outcome for this decision type"); } } break; } }