///<summary>Removes the assigned user from the InsVerify of the InsPlan that is associated to the PatPlan passed in. ///Will only unassign if the user assigned to the patplan matches the user assigned to the insplan.</summary> private static void RemoveAssignedUser(PatPlan patPlanCur) { //No Remoting check; no call to db. //Get the insurance verified assigned to the PatPlan. InsVerify insVerifyForPatPlan = InsVerifies.GetOneByFKey(patPlanCur.PatPlanNum, VerifyTypes.PatientEnrollment); if (insVerifyForPatPlan != null && insVerifyForPatPlan.UserNum > 0) { //Get the insplan associated to the PatPlan. InsSub inssub = null; if (patPlanCur != null) { inssub = InsSubs.GetOne(patPlanCur.InsSubNum); } InsPlan insPlan = null; if (inssub != null) { insPlan = InsPlans.RefreshOne(inssub.PlanNum); } if (insPlan != null) { //Get the insVerify for the insplan associated to the patplan we are about to delete. InsVerify insVerifyForInsPlan = InsVerifies.GetOneByFKey(insPlan.PlanNum, VerifyTypes.InsuranceBenefit); //Only unassign the user for the insplan if it matches the user for the patplan being dropped if (insVerifyForInsPlan != null && insVerifyForInsPlan.UserNum == insVerifyForPatPlan.UserNum) { //Remove user and set DateLastVerified to MinValue. insVerifyForInsPlan.UserNum = 0; insVerifyForInsPlan.DateLastVerified = DateTime.MinValue; InsVerifies.Update(insVerifyForInsPlan); } } } }
///<summary>If the passed in InsVerify is null, do nothing. ///Otherwise, insert the passed in InsVerify into InsVerifyHist and blank out InsVerify's UserNum, Status, and Note.</summary> public static void InsertFromInsVerify(InsVerify insVerify) { if (insVerify == null) { return; } Insert(new InsVerifyHist(insVerify)); insVerify.UserNum = 0; insVerify.DefNum = 0; insVerify.Note = ""; insVerify.DateLastAssigned = DateTime.MinValue; if (PrefC.GetBool(PrefName.InsVerifyFutureDateBenefitYear) && insVerify.AppointmentDateTime > DateTime.MinValue) { insVerify.DateLastVerified = insVerify.AppointmentDateTime; } InsVerifies.Update(insVerify); }