protected override void AfterChange(DataColumn dc, DataRow dr) { SST.SSTDecisionRow sdr = (SST.SSTDecisionRow)dr; switch (dc.ColumnName) { case "OutcomeId": case "DecisionDate": if (sdr.DecisionType == 3 && !sdr.IsDecisionDateNull()) { SST.SSTCaseRow scr = myA.DB.SSTCase.FindBySSTCaseId(sdr.SSTCaseId); scr.Received365Date = sdr.DecisionDate.AddDays(365); scr.EndEdit(); } if (!sdr.IsOutcomeIdNull()) { CodesDB.OutcomeRow orr = myA.AtMng.CodeDB.Outcome.FindByOutcomeId(sdr.OutcomeId); sdr.IsFinal = orr.IsFinal; } break; } }
protected override void BeforeUpdate(DataRow dr) { SST.SSTDecisionRow sdr = (SST.SSTDecisionRow)dr; if (sdr.IsFinal) { SST.SSTCaseRow scr = sdr.SSTCaseRow; if (!sdr.IsDecisionDateNull()) { scr.DecisionDate = sdr.DecisionDate; } if (!sdr.IsDecisionSentDateNull()) { scr.DecisionSentDate = sdr.DecisionSentDate; } if (!sdr.IsOutcomeIdNull()) { scr.OutcomeId = sdr.OutcomeId; } scr.DecisionType = sdr.DecisionType; } BeforeChange("IsCombined", dr); }
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; } }