protected override void AfterChange(DataColumn dc, DataRow dr) { Advisory.OpinionRow or = (Advisory.OpinionRow)dr; switch (dc.ColumnName) { case "DueDate": //maintain bfdate myA.FM.GetActivityBF().MaintainBFDate(or.OpinionId, "Opinion", "OPINIONDUEDATE", or.DueDate); break; case "ReceivedDate": if (or.IsDueDateNull()) { or.DueDate = or.ReceivedDate.AddDays(35); myA.FM.GetActivityBF().MaintainBFDate(or.OpinionId, "Opinion", "OPINIONDUEDATE", or.DueDate); } break; //case "CompletedDate": // if (!or.IsCompletedDateNull() && !or.IsDocIdNull()) // { // //mark opinion read-only // docDB.DocumentRow odoc = myA.FM.GetDocMng().DB.Document.FindByDocId(or.DocId); // if (odoc == null) // odoc=myA.FM.GetDocMng().GetDocument().Load(or.DocId); // docDB.DocContentRow odcc = myA.FM.GetDocMng().DB.DocContent.FindByDocId(or.DocId); // if (odcc == null) // odcc = myA.FM.GetDocMng().GetDocContent().Load(or.DocId); // if(!odcc.ReadOnly) // odcc.ReadOnly = true; // } // break; default: break; } }
protected override void BeforeChange(DataColumn dc, DataRow ddr) { Advisory.OpinionRow dr = (Advisory.OpinionRow)ddr; string ObjectName = this.myOpinionDT.TableName; switch (dc.ColumnName) { case "AssignedToId": //JLL 2018-04-23 //commented out lawyer list rule for demo //if (!myA.CheckDomain(dr.AssignedToId,myA.FM.Codes("LawyerList"))) // throw new AtriumException(atriumBE.Properties.Resources.BadDomainValue, "Assigned To",dr.Table.TableName,"Lawyer List"); break; case "RequestDocId": if (dr.IsRequestContactIdNull()) { //myA.FM.GetDocMng().GetRecipient().LoadByDocId(dr.RequestDocId); docDB.RecipientRow[] rs = (docDB.RecipientRow[])myA.FM.GetDocMng().DB.Recipient.Select("Type='0' and DocId=" + dr.RequestDocId.ToString()); if (rs.Length == 1 && rs[0].Address != rs[0].Name) { atriumDB.FileContactRow fcr = myA.FM.GetDocMng().GetRecipient().AddRecipToFile(rs[0], false, "FCC"); if (!fcr.IsOfficeIdNull()) { dr.RequestOfficeId = fcr.OfficeId; } dr.RequestContactId = fcr.ContactId; } } break; case "ReceivedDate": if (dr.IsReceivedDateNull()) { throw new RequiredException(Resources.OpinionReceivedDate); } //if(dr.EFileRow.IsOpenedDateNull()) // this.myA.RaiseError(AtriumEnum.AppErrorCodes.RelatedDateRequired, myA.GetLabelLeft(ObjectName, dc.ColumnName), myA.GetLabelLeft("Efile", "ReceivedByJusticeDate")); myA.IsValidDate(Resources.OpinionReceivedDate, dr.ReceivedDate, false, DateTime.MinValue, DateTime.Today, Resources.ValidationTheBeginning, Resources.ValidationToday); break; case "RequestDate": if (dr.IsRequestDateNull()) { throw new RequiredException(Resources.OpinionRequestDate); } myA.IsValidDate(Resources.OpinionRequestDate, dr.RequestDate, false, DateTime.MinValue, DateTime.Today, Resources.ValidationTheBeginning, Resources.ValidationToday); break; case "AssignedDate": if (!dr.IsAssignedDateNull()) { if (dr.IsRequestDateNull()) { throw new RelatedException(Resources.OpinionAssignedDate, Resources.OpinionRequestDate); } myA.IsValidDate(Resources.OpinionAssignedDate, dr.AssignedDate, true, dr.RequestDate, DateTime.Today, Resources.OpinionRequestDate, Resources.ValidationToday); } break; case "DueDate": if (!dr.IsDueDateNull()) { if (dr.IsAssignedDateNull()) { throw new RelatedException(Resources.OpinionDueDate, Resources.OpinionAssignedDate); } myA.IsValidDate(Resources.OpinionDueDate, dr.DueDate, true, dr.AssignedDate, DateTime.Today.AddMonths(6), Resources.OpinionAssignedDate, Resources.ValidationSixMonthsFromNow); } break; case "CompletedDate": if (!dr.IsCompletedDateNull()) { if (dr.IsAssignedDateNull()) { throw new RelatedException(Resources.OpinionCompletedDate, Resources.OpinionAssignedDate); } myA.IsValidDate(Resources.OpinionCompletedDate, dr.CompletedDate, true, dr.AssignedDate, DateTime.Today, Resources.OpinionAssignedDate, Resources.ValidationToday); } break; case "Subject": //case "Number": if (dr.IsNull(dc)) { throw new RequiredException(Resources.ResourceManager.GetString(ObjectName + dc.ColumnName)); } break; case "OpinionTypeId": if (!myA.CheckDomain(dr.OpinionTypeId, myA.FM.Codes("OpinionType"))) { throw new AtriumException(atriumBE.Properties.Resources.BadDomainValue, dc.ColumnName, dr.Table.TableName, "Opinion Type"); } break; default: break; } }