public AccountHistoryBE GetAccountHistory() { if (myAccountHistory == null) { myAccountHistory = new AccountHistoryBE(this); } return(myAccountHistory); }
protected override void BeforeUpdate(DataRow row) { CLAS.FileHistoryRow dr = (CLAS.FileHistoryRow)row; //this.BeforeChange(dr.Table.Columns["SubFileType"], dr); this.BeforeChange(dr.Table.Columns["BillingCode"], dr); this.BeforeChange(dr.Table.Columns["SentToOfficeDate"], dr); this.BeforeChange(dr.Table.Columns["OfficeId"], dr); if (!dr.IsReceivedFromOfficeDateNull()) { //update leadoffice to owner on efile bool demoteLead = false; if (myA.FM.CurrentFile.LeadOfficeId != myA.FM.CurrentFile.OwnerOfficeId) { demoteLead = true; } myA.FM.CurrentFile.LeadOfficeId = myA.FM.CurrentFile.OwnerOfficeId; //demote leadoffice to ag if (demoteLead) { this.myA.FM.GetFileOffice().AddOfficeToFile(dr.OfficeId, false, false, false); } //else // this.myA.FM.GetFileOffice().AddOfficeToFile(dr.OfficeId, true, true, false); //set LeadOfficeContact endDate //atriumDB.FileContactRow[] LeadOfficeContact = (atriumDB.FileContactRow[])myA.FM.DB.FileContact.Select("ContactType='FLO'", ""); //if (LeadOfficeContact.Length == 1) // LeadOfficeContact[0].EndDate = DateTime.Today; //update secfilerule table //OfficeManager om = myA.FM.AtMng.GetOffice(dr.OfficeId); //atriumDB.secFileRuleRow[] secRule = (atriumDB.secFileRuleRow[])myA.FM.DB.secFileRule.Select("GroupId=" + om.CurrentOffice.DefaultGroup, ""); //if (secRule.Length == 1) //{ // atriumDB.secFileRuleRow secRecord = secRule[0]; // secRecord.EndDate = atDates.StandardDate.NextQuarter.EndDate; //} //else // throw new AtriumException("(OFFICEID: " + dr.OfficeId + ") - NO SECFILERULE RECORD WAS FOUND, OR THIS OFFICE HAS MULTIPLE SECFILERULE RECORDS."); } if (dr.RowState == DataRowState.Added) { this.myA.FM.GetFileOffice().AddOfficeToFile(dr.OfficeId, false, true, false); //AddUpdateLeadOfficeContact(dr); //AddSecFileRuleOnAssignment(dr); //for each fileaccount assign to this office AccountHistoryBE ahBE = this.myA.GetAccountHistory(); foreach (CLAS.DebtRow far in this.myA.DB.Debt.Rows) { if (far.AssignToAgent) { if (!far.ActiveWithJustice) { far.ActiveWithJustice = true; // if user selected account to assign, set active to true } CLAS.AccountHistoryRow ahr = (CLAS.AccountHistoryRow)ahBE.Add(far); ahr.FileId = myA.FM.CurrentFileId; ahr.FileHistoryId = dr.HistoryId; ahr.OfficeId = dr.OfficeId; ahr.SentToOfficeDate = dr.SentToOfficeDate; } } } else { //for each fileaccount assigned to this office foreach (CLAS.AccountHistoryRow ahr in myA.DB.AccountHistory.Select("FileHistoryId=" + dr.HistoryId.ToString())) { if (ahr.IsReceivedFromOfficeDateNull() && ahr.DebtRow.ActiveWithJustice) { if (ahr.IsReceivedFromOfficeDateNull() && !dr.IsReceivedFromOfficeDateNull()) { ahr.ReceivedFromOfficeDate = dr.ReceivedFromOfficeDate; } if (ahr.IsReturnedByOfficeDateNull() && !dr.IsReturnedByOfficeDateNull()) { if (ahr.IsReceivedByOfficeDateNull()) { throw new AtriumException(Resources.AccountNotReceived); } ahr.ReturnedByOfficeDate = dr.ReturnedByOfficeDate; } if (ahr.IsReceivedByOfficeDateNull() && !dr.IsReceivedByOfficeDateNull()) { ahr.ReceivedByOfficeDate = dr.ReceivedByOfficeDate; } if (ahr.IsReturnCodeNull() && !dr.IsReturnCodeNull()) { ahr.ReturnCode = dr.ReturnCode; } } } } }