public static void CheckSendMail(RuleException ruleExp) { if (ruleExp != null) { string adjusterEmail = string.Empty; string supervisorEmail = string.Empty; bool sendAdjuster = false; bool sendSupervisor = false; string recipient = string.Empty; int claimId = 0; BusinessRuleManager objRuleManager = new BusinessRuleManager(); BusinessRule objRule = new BusinessRule(); CRM.Data.Entities.Claim objClaim = new CRM.Data.Entities.Claim(); CRM.Data.Entities.SecUser objSecUser = new Data.Entities.SecUser(); AdjusterMaster adjustermaster = new AdjusterMaster(); int businessRuleID = ruleExp.BusinessRuleID ?? 0; objRule = objRuleManager.GetBusinessRule(businessRuleID); if (objRule != null) { claimId = ruleExp.ObjectID ?? 0; objClaim = objRuleManager.GetClaim(claimId); adjustermaster = objRuleManager.GetAdjuster(objClaim.AdjusterID ?? 0); objSecUser = objRuleManager.GetSupervisor(objClaim.SupervisorID ?? 0); if (objSecUser != null) { adjusterEmail = adjustermaster.email; supervisorEmail = objSecUser.Email; sendAdjuster = objRule.EmailAdjuster; sendSupervisor = objRule.EmailSupervisor; if (sendAdjuster == true && sendSupervisor == true) { recipient = adjusterEmail + "," + supervisorEmail; notifyUser(objRule.Description, claimId, recipient); } else if (sendAdjuster == false && sendSupervisor == true) { recipient = supervisorEmail; notifyUser(objRule.Description, claimId, recipient); } else if (sendAdjuster == true && sendSupervisor == false) { recipient = adjusterEmail; notifyUser(objRule.Description, claimId, recipient); } } } } }
public static Claim Save(Claim objClaim) { if (objClaim.ClaimID == 0) { DbContextHelper.DbContext.Claim.Add(objClaim); } DbContextHelper.DbContext.SaveChanges(); return objClaim; }