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);
                        }
                    }
                }
            }
        }
        protected void gvBsuinessRules_RowCommand(object sender, GridViewCommandEventArgs e)
        {
            BusinessRule businessRule = null;
            int businessRuleID = 0;

            lblMessage.Text = string.Empty;
            lblMessage.Visible = false;

            if (e.CommandName == "DoEdit")
            {
                businessRuleID = Convert.ToInt32(e.CommandArgument);
                using (BusinessRuleManager repository = new BusinessRuleManager())
                {
                    businessRule = repository.GetBusinessRule(businessRuleID);

                    if (businessRule != null)
                    {
                        editBusinessRule((int)businessRule.RuleID, businessRule.Rule.RuleName, businessRule);
                    }
                }
            }
            else if (e.CommandName == "DoDelete")
            {
                try
                {
                    businessRuleID = Convert.ToInt32(e.CommandArgument);

                    using (BusinessRuleManager repository = new BusinessRuleManager())
                    {
                        businessRule = repository.GetBusinessRule(businessRuleID);

                        businessRule.IsActive = false;

                        repository.Save(businessRule);

                        refreshBusinessRuleGrid();

                        lblMessage.Text = "Rule was deactivate successfully.";
                        lblMessage.CssClass = "ok";
                        lblMessage.Visible = true;
                        Login login = new Login();
                        login.formatException();
                        login.setRulexception();
                    }
                }
                catch (Exception ex)
                {
                    lblMessage.Text = "Rule was not deactivate.";
                    lblMessage.CssClass = "ok";
                    lblMessage.Visible = true;
                }
            }
        }
Beispiel #3
0
        public List<string> getEmailData(int claimId, int BusinessRuleID)
        {
            List<string> emailData = new List<string>();
            string adjusterEmail = "";

            int adjusterId = 0;
            int superVisorId = 0;
            string adjusterClaimNumber = "";
            string dateRecieved = "";
            int ruleId = 0;
            string businessDescription = "";
            string redFlagName = "";
            string insuredName = "";
            string adjusterName = "";
            ClaimManager ClaimManagerObj = new ClaimManager();
            Claim claimObj = new Claim();
            claimObj = ClaimManagerObj.Get(claimId);
            if (claimObj != null && claimObj.AdjusterID != null)
            {
                adjusterId = Convert.ToInt32(claimObj.AdjusterID);
            }

            if (claimObj != null && claimObj.InsurerClaimNumber != null)
            {
                adjusterClaimNumber = claimObj.InsurerClaimNumber;

            }

            if (claimObj != null && claimObj.DateOpenedReported != null)
            {
                dateRecieved = Convert.ToString(claimObj.DateOpenedReported);
            }

            AdjusterMaster adjusterMasterObj = new AdjusterMaster();

            if (claimObj != null) { adjusterMasterObj = claimObj.AdjusterMaster; }
            if (adjusterMasterObj != null && adjusterMasterObj.email != null)
            {
                adjusterEmail = Convert.ToString(adjusterMasterObj.email);
            }

            if (adjusterMasterObj != null && adjusterMasterObj.adjusterName != null)
            {
                adjusterName = Convert.ToString(adjusterMasterObj.adjusterName);
            }

            if (adjusterMasterObj != null && adjusterMasterObj.SupervisorID != null)
            {
                superVisorId = Convert.ToInt32(adjusterMasterObj.SupervisorID);
            }

            CRM.Data.Entities.SecUser secUserObj = new CRM.Data.Entities.SecUser();

            secUserObj = getSecUser(superVisorId);
            insuredName = claimObj.LeadPolicy.Leads.insuredName;

            BusinessRuleManager BusinessRuleManagerObj = new BusinessRuleManager();
            BusinessRule BusinessRuleObj = new BusinessRule();
            BusinessRuleObj = BusinessRuleManagerObj.GetBusinessRule(BusinessRuleID);
            if (BusinessRuleObj.RuleID != null)
            {
                ruleId = Convert.ToInt32(BusinessRuleObj.RuleID);
            };
            businessDescription = BusinessRuleObj.Description;

            CRM.Data.Entities.Rule ruleObj = new CRM.Data.Entities.Rule();
            ruleObj = BusinessRuleManagerObj.GetRule(ruleId);
            redFlagName = ruleObj.RuleName;
            string encryptedClaimNumber = Core.SecurityManager.EncryptQueryString(claimId.ToString());

            emailData.Add(adjusterEmail);
            emailData.Add(adjusterName);
            emailData.Add(secUserObj.Email);
            emailData.Add(secUserObj.UserName);
            emailData.Add(adjusterClaimNumber);
            emailData.Add(dateRecieved);
            emailData.Add(businessDescription);
            emailData.Add(redFlagName);
            emailData.Add(insuredName);
            emailData.Add(encryptedClaimNumber);
            return emailData;
        }
Beispiel #4
0
        public bool checkSupervisorSendMail(int businessRuleId)
        {
            BusinessRuleManager businessRuleManagerObj = new BusinessRuleManager();
            BusinessRule businessRuleObj = new BusinessRule();
            businessRuleObj = businessRuleManagerObj.GetBusinessRule(businessRuleId);
            if (businessRuleObj.EmailSupervisor && businessRuleObj.IsActive == true)
            {

                return true;
            }
            else
            {
                return false;
            }
        }
Beispiel #5
0
        public void adjusterSendMail(int BusinessRuleID, int clientId, int userId, int claimId)
        {
            BusinessRuleManager businessRuleManagerObj = new BusinessRuleManager();
            BusinessRule businessRuleObj = new BusinessRule();
            businessRuleObj = businessRuleManagerObj.GetBusinessRule(BusinessRuleID);

            List<string> emailData = new List<string>();
            emailData = getEmailData(claimId, BusinessRuleID);

            string adjusterEmail = emailData[0];
            string adjusterName = emailData[1];
            string superVisorEmail = emailData[2];
            string superVisorName = emailData[3];
            string adjusterClaimNumber = emailData[4];
            string dateRecieved = emailData[5];
            string businessDescription = emailData[6];
            string redFlagName = emailData[7];
            string insuredName = emailData[8];
            string encryptedClaimNumber = emailData[9];
            StringBuilder mailContent = mail_content(adjusterEmail, adjusterName, superVisorEmail, superVisorName, adjusterClaimNumber, dateRecieved, businessDescription, redFlagName, insuredName, encryptedClaimNumber);
            string subjectString = get_mail_content(adjusterEmail, adjusterName, superVisorEmail, superVisorName, adjusterClaimNumber, dateRecieved, businessDescription, redFlagName, insuredName, encryptedClaimNumber);

            if (adjusterEmail != "")
            {
                sendMail(adjusterEmail, adjusterName, mailContent, subjectString);
            }
        }
Beispiel #6
0
        protected void btnSave_Click(object sender, EventArgs e)
        {
            BusinessRule rule = null;
            int businessRuleID = 0;

            Page.Validate("rule");
            if (!Page.IsValid)
                return;

            businessRuleID = Convert.ToInt32(ViewState["businessRuleID"]);
            lblMessage.Text = "";
            lblMessage.Visible = false;

            try {
                using (BusinessRuleManager repository = new BusinessRuleManager()) {

                    if (businessRuleID == 0) {
                        rule = new BusinessRule();
                        rule.RuleID = (int)Globals.RuleType.AdjusterClaimReview;
                        rule.ClientID = SessionHelper.getClientId();
                    }
                    else {
                        rule = repository.GetBusinessRule(businessRuleID);
                    }

                    if (rule != null) {
                        rule.UpdateDate = DateTime.Now;

                        rule.IsActive = cbxActive.Checked;
                        rule.EmailAdjuster = cbxEmailAdjuster.Checked;
                        rule.EmailSupervisor = cbxEmailSupervisor.Checked;

                        rule.Description = txtDescription.Text;

                        rule.RuleXML = buildRule().ToString();

                        rule = repository.Save(rule);

                        ViewState["businessRuleID"] = rule.BusinessRuleID.ToString();

                        lblMessage.Text = "Rule saved successfully.";
                        lblMessage.CssClass = "ok";
                        lblMessage.Visible = true;
                    }
                }
            }
            catch (Exception ex) {
                Core.EmailHelper.emailError(ex);
                lblMessage.Text = "Rule not saved.";
                lblMessage.CssClass = "error";
                lblMessage.Visible = true;
            }
        }
Beispiel #7
0
        protected void btnSave_Click(object sender, EventArgs e)
        {
            BusinessRule rule = null;
            int businessRuleID = 0;

            Page.Validate("rule");
            if (!Page.IsValid)
                return;

            businessRuleID = Convert.ToInt32(ViewState["businessRuleID"]);
            lblMessage.Text = "";
            lblMessage.Visible = false;

            try
            {
                using (BusinessRuleManager repository = new BusinessRuleManager())
                {

                    if (businessRuleID == 0)
                    {
                        rule = new BusinessRule();
                        BusinessRules businessRulesObj = new BusinessRules();
                        rule.RuleID = Convert.ToInt32(Session["ruleId"]);
                        rule.ClientID = SessionHelper.getClientId();
                        rule.CarrierId = Convert.ToInt32(this.ddlCarrier.SelectedValue);
                    }
                    else
                    {
                        rule = repository.GetBusinessRule(businessRuleID);
                    }

                    if (rule != null)
                    {
                        rule.IsActive = cbxActive.Checked;
                        rule.EmailAdjuster = cbxEmailAdjuster.Checked;
                        rule.EmailSupervisor = cbxEmailSupervisor.Checked;
                        rule.CarrierId = Convert.ToInt32(this.ddlCarrier.SelectedValue);
                        rule.Description = txtDescription.Text;
                        ViewState["businessRuleID"] = rule.BusinessRuleID.ToString();
                        rule.RuleXML = buildRule().ToString();
                        rule = repository.Save(rule);
                        string str_query = @"update BusinessRule set
                                            CarrierId = @CarrierId

                                    where

                                        BusinessRuleID=@BusinessRuleID
                                ";

                        using (SqlConnection conn = new SqlConnection(connectionString))
                        using (SqlCommand cmd = new SqlCommand(str_query, conn))
                        {

                            cmd.Parameters.AddWithValue("@BusinessRuleID ", rule.BusinessRuleID);
                            cmd.Parameters.AddWithValue("@CarrierId", rule.CarrierId);

                            conn.Open();

                            cmd.ExecuteNonQuery();
                            conn.Close();
                            conn.Dispose();

                            conn.Close();
                        }

                        lblMessage.Text = "Rule saved successfully.";
                        // notifyUser(txtDescription.Text, SessionHelper.getClientId());
                        lblMessage.CssClass = "ok";
                        lblMessage.Visible = true;
                    }
                }

                Login login = new Login();
                login.setGlobalSession();
                login.formatException();
                login.setRulexception();
            }
            catch (Exception ex)
            {
                Core.EmailHelper.emailError(ex);
                lblMessage.Text = "Rule not saved.";
                lblMessage.CssClass = "error";
                lblMessage.Visible = true;
            }
        }