Beispiel #1
0
        public int getProgressId(int claimId)
        {
            int progress = 0;
            ClaimManager ClaimManagerobj = new ClaimManager();
            Claim claimObj = new Claim();
            claimObj = ClaimManagerobj.Get(claimId);

            if (claimObj.ProgressStatusID != null)
            {
                progress = Convert.ToInt32(claimObj.ProgressStatusID);

            }
            else
            {
                progress = 0;

            }

            return progress;
        }
Beispiel #2
0
        public DateTime progressClaimRecievedData(int claimId)
        {
            DateTime progressDate = new DateTime();
            ClaimManager ClaimManagerobj = new ClaimManager();
            Claim claimObj = new Claim();
            claimObj = ClaimManagerobj.Get(claimId);

            if (claimObj.ProgressStatusID != null)
            {

                progressDate = Convert.ToDateTime(claimObj.DateOpenedReported);

            }
            else
            {
                progressDate = DateTime.MinValue;
            }

            return progressDate;
        }
        protected void btnShowLossTemplate_Click(object sender, EventArgs e)
        {
            int policyId = 0;
            Claim objClaim = null;
            ClaimManager objClaimManager = new ClaimManager();
            int claimId = Convert.ToInt32(hf_ClaimIdForStatus.Value);
            using (TransactionScope scope = new TransactionScope())
            {

                objClaim = objClaimManager.Get(claimID);
                policyId = objClaim.PolicyID;

                // delete limit,claimlimit,policylimit data which enter as loss details
                LimitManager.DeleteLimit(claimId, policyId);

                //ClaimLimitManager.IsDeleted(claimId);
                // PolicyLimitManager.IsDeleted(policyId);

                //enter claim limit and policy limit
                //first get all limit
                List<Limit> objLimit = LimitManager.GetAllLimit(true);

                foreach (var limit in objLimit)
                {
                    ClaimLimit objClaimLimit = new ClaimLimit();
                    objClaimLimit.ClaimID = claimId;
                    objClaimLimit.LimitID = limit.LimitID;
                    ClaimLimitManager.Save(objClaimLimit);

                    PolicyLimit objPolicyLimit = new PolicyLimit();
                    objPolicyLimit.PolicyID = policyId;
                    objPolicyLimit.LimitID = limit.LimitID;
                    PolicyLimitManager.Save(objPolicyLimit);
                }

                Data.Entities.LeadPolicy objLeadPolicy = new Data.Entities.LeadPolicy();
                objLeadPolicy.Id = policyId;
                objLeadPolicy.ApplyAcrossAllCoverage = false;
                objLeadPolicy.ApplyDeductibleSet = false;
                LeadPolicyManager.Update(objLeadPolicy);
                scope.Complete();
            }

            //acrossAllCoverages.Enabled = true;
            //coverageSpecific.Enabled = true;
            txtDeductible.Enabled = true;

            propertyLimits.bindData(policyID);

               // casualtyLimits.bindData(claimId);
        }
Beispiel #4
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;
        }
        protected void btnSaveClaimService_Click(object sender, EventArgs e)
        {
            ClaimService claimService = null;
            ClaimComment diary = null;
            AdjusterMaster adjuster = null;
            Claim myClaim = null;
            CarrierInvoiceProfile CarrierInvoice = null;

            int userID = SessionHelper.getUserId();
            int claimID = SessionHelper.getClaimID();
            int id = 0;
            int myAdjusterID = 0;
            int profileID = 0;

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

            id = Convert.ToInt32(ViewState["ClaimServiceID"]);

            //Get current claim info to pass through to emails
            ClaimManager cm = new ClaimManager();
            myClaim =  cm.Get(claimID);

            //AdjusterManager

            try {
                using (TransactionScope scope = new TransactionScope())
                {
                    using (ClaimServiceManager repository = new ClaimServiceManager())
                    {
                        if (id == 0)
                        {
                            claimService = new ClaimService();
                            claimService.ClaimID = claimID;
                        }
                        else
                        {
                            claimService = repository.Get(id);
                        }

                        claimService.ServiceQty = this.txtServiceQty.Value == null ? 0 : Convert.ToDecimal(txtServiceQty.Value);
                        claimService.ServiceDate = txtServiceDate.Date;
                        claimService.ServiceDescription = txtServiceDescription.Text.Trim();
                        claimService.ServiceTypeID = Convert.ToInt32(this.ddlInvoiceServiceType.SelectedValue);
                        claimService.UserID = userID;
                        claimService.AdjusterID = Convert.ToInt32(hf_serviceAdjusterID.Value);
                        claimService.Activity = ddlActivity.SelectedItem.Text;
                        claimService.InternalComments = txtMyComments.Text.Trim();
                        claimService.IsBillable = cbIsBillable.Checked;
                        claimService.Billed = false;
                        //save to db
                        claimService = repository.Save(claimService);

                        //string EmailService = ddlInvoiceServiceType.SelectedItem.Text;
                        //string EmailActivity = ddlActivity.SelectedItem.Text;
                        //string EmailDescription = txtServiceDescription.Text;
                        //string EmailInternal = txtMyComments.Text;
                        //string EmailQuantity = txtServiceQty.Text;
                        //string EmailDate = txtServiceDate.Text;

                    }

                    // diary
                    diary = new ClaimComment();
                    diary.ClaimID = claimID;
                    diary.CommentDate = DateTime.Now;
                    diary.UserId = userID;
                    diary.ActivityType = ddlActivity.SelectedItem.Text;
                    diary.InternalComments = txtMyComments.Text.Trim();
                    diary.CommentText = string.Format("Service: {0}, Description: {1}, Date {2:MM/dd/yyyy}, Qty: {3:N2}, Adjuster: {4}",
                                                ddlInvoiceServiceType.SelectedItem.Text,
                                                claimService.ServiceDescription,
                                                claimService.ServiceDate,
                                                claimService.ServiceQty,
                                                txtServiceAdjuster.Text
                                                );
                    ClaimCommentManager.Save(diary);

                    myAdjusterID = Convert.ToInt32(claimService.AdjusterID); //Convert.ToInt32(myClaim.AdjusterID);

                    //EMAIL ADJUSTER OC 10/21/2014
                    if (myAdjusterID != 0 || myAdjusterID != null)
                    {
                        adjuster = AdjusterManager.GetAdjusterId(myAdjusterID);
                    }
                    if (cbEmailAdjuster.Checked == true)
                    {
                        try
                        {
                            notifyAdjuster(adjuster, claimService, myClaim);
                        }
                        catch (Exception ex)
                        {
                            lblMessage.Text = "Unable to send email to adjuster";
                            lblMessage.CssClass = "error";
                        }
                    }
                    //EMAIL CLIENT CONTACT OC 10/22/2014
                    if (cbEmailClient.Checked == true) //Dont need to check if invoice Pro ID is empty becuase to get to this point, one has to exist already
                    {
                        if (Session["ComingFromAllClaims"] != null) //if the user got here straight from the all claims screen
                        {
                            profileID = Convert.ToInt32(Session["CarrierInvoiceID"]);
                        }
                        else//coming from claim detail page
                        {
                            profileID = Convert.ToInt32(Session["InvoiceProfileID"]);
                        }
                        CarrierInvoice = CarrierInvoiceProfileManager.Get(profileID);
                        try
                        {
                            notifyClientContact(CarrierInvoice, claimService, myClaim, adjuster);
                        }
                        catch (Exception ex)
                        {
                            lblMessage.Text = "Unable to send email to client contact";
                            lblMessage.CssClass = "error";
                        }

                    }
                    //EMAIL TO WHOMEVER
                    if(txtEmailTo.Text != "")
                    {

                        try
                        {
                            notifySpecifiedUser(adjuster, claimService, myClaim);
                        }
                        catch (Exception ex)
                        {
                            lblMessage.Text = "Unable to send email to adjuster";
                            lblMessage.CssClass = "error";
                        }
                    }

                    scope.Complete();

                }

                lblMessage.Text = "Service was saved successfully.";
                lblMessage.CssClass = "ok";

                // keep edit form active
                lbtnNewClaimService_Click(null, null);

                // refresh grid
                gvClaimService.DataSource = loadClaimServices(claimID);
                gvClaimService.DataBind();

            }
            catch (Exception ex)
            {
                Core.EmailHelper.emailError(ex);

                lblMessage.Text = "Unable to save claim service.";
                lblMessage.CssClass = "error";
            }
            //send email to adjuster
        }
        protected void bindData()
        {
            int claimID = 0;
            int clientID = 0;
            int policyID = 0;
            Claim claim = null;

            Leads lead = null;

            // get id for current lead
            claimID = Core.SessionHelper.getClaimID();

            // get client id
            clientID = Core.SessionHelper.getClientId();

            // get current policy
            policyID = Core.SessionHelper.getPolicyID();

            using (ClaimManager repository = new ClaimManager()) {
                claim = repository.Get(claimID);
            }
            if (claim == null)
                return;

            // get lead/claim
            lead = claim.LeadPolicy.Leads;

            if (claim.LeadPolicy != null && claim.LeadPolicy.LeadPolicyType != null) {
                // get policy type
                lblPolicyType.Text = claim.LeadPolicy.LeadPolicyType.Description;
            }

            if (claim.LeadPolicy != null && claim.LeadPolicy != null) {
                // get policy number
                lblPolicyNumber.Text = claim.LeadPolicy.PolicyNumber;
            }

            // get insurer claim number
            lblInsurerClaimNumber.Text = claim.InsurerClaimNumber;

            // get policy information
            if (lead != null) {
                lblClient.Text = string.Format("<b>{0} {1}<br/>{2}<br/>{3}<br/>{4}, {5} {6}</b>",
                        lead.ClaimantFirstName ?? "",		//0
                        lead.ClaimantLastName ?? "",		//1
                        lead.LossAddress ?? "",			//2
                        lead.LossAddress2 ?? "",			//3
                        lead.CityName ?? "",			//4
                        lead.StateName ?? "",			//5
                        lead.Zip ?? ""					//6
                        );

            }

            bindTimeExpenseForInvoice(claimID);
        }
        protected void btnSaveExpense_Click(object sender, EventArgs e)
        {
            Claim claim = null;
            Claim myClaim = null;
            ClaimExpense claimExpense = null;
            AdjusterMaster adjuster = null;
            CarrierInvoiceProfile CarrierInvoice = null;

            int clientID = SessionHelper.getClientId();
            int userID = SessionHelper.getUserId();
            int claimID = SessionHelper.getClaimID();
            int myAdjusterID = 0;
            int profileID = 0;
            int expenseTypeID = 0;
            int id = 0;

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

            id = Convert.ToInt32(ViewState["ClaimExpenseID"]);

            ClaimManager cm = new ClaimManager();
            myClaim = cm.Get(claimID);

            try
            {
                expenseTypeID = Convert.ToInt32(ddlExpenseType.SelectedValue);

                using (TransactionScope scope = new TransactionScope())
                {
                    using (ClaimExpenseManager repository = new ClaimExpenseManager())
                    {
                        if (id == 0) {
                            claimExpense = new ClaimExpense();
                            claimExpense.ClaimID = claimID;
                        }
                        else {
                            claimExpense = repository.Get(id);
                        }

                        // populate fields
                        if(txtExpenseAmount.Visible == false)
                        {
                            var x = Session["multiplier"].ToString();

                            double expenseAmount = Convert.ToDouble(x) * Convert.ToDouble(txtExpenseQty.ValueDecimal); //newOC 10/7/14
                            claimExpense.ExpenseAmount = Convert.ToDecimal(expenseAmount);

                            decimal d = Convert.ToDecimal(expenseAmount);
                            //Session["EmailAmount"] = "$" + Math.Round(d, 2);
                            Session["EmailAmount"] = String.Format("{0:0.00}", expenseAmount);
                           // Session["EmailAmount"] = expenseAmount;
                        }
                        else
                        {
                            claimExpense.ExpenseAmount = txtExpenseAmount.ValueDecimal;
                        }
                        claimExpense.ExpenseDate = txtExpenseDate.Date;
                        claimExpense.ExpenseDescription = txtExpenseDescription.Text.Trim();
                        claimExpense.ExpenseTypeID = expenseTypeID;
                        claimExpense.IsReimbursable = cbxExpenseReimburse.Checked;
                        claimExpense.UserID = userID;
                        claimExpense.AdjusterID = Convert.ToInt32(hf_expenseAdjusterID.Value);
                        claimExpense.ExpenseQty = txtExpenseQty.ValueDecimal;
                        claimExpense.InternalComments = txtMyComments.Text.Trim();
                        claimExpense.Billed = false;
                       // claimExpense.IsBillable = cbIsBillable.Checked;
                        // save expense
                        claimExpense = repository.Save(claimExpense);
                    }

                    // update diary entry
                    ClaimComment diary = new ClaimComment();
                    diary.ClaimID = claimID;
                    diary.CommentDate = DateTime.Now;
                    diary.UserId = userID;
                    diary.CommentText = string.Format("Expense: {0}, Description: {1}, Date: {2:MM/dd/yyyy}, Amount: {3:N2}, Adjuster: {4} Qty: {5:N2}",
                                                ddlExpenseType.SelectedItem.Text,
                                                claimExpense.ExpenseDescription,
                                                claimExpense.ExpenseDate,
                                                claimExpense.ExpenseAmount,
                                                txtExpenseAdjuster.Text,
                                                claimExpense.ExpenseQty
                                                );
                    ClaimCommentManager.Save(diary);

                    // 2014-05-02 apply rule
                    using (SpecificExpenseTypePerCarrier ruleEngine = new SpecificExpenseTypePerCarrier())
                    {
                        claim = new Claim();
                        claim.ClaimID = claimID;
                        RuleException ruleException = ruleEngine.TestRule(clientID, claim, expenseTypeID);

                        if (ruleException != null) {
                            ruleException.UserID = Core.SessionHelper.getUserId();
                            ruleEngine.AddException(ruleException);
                            CheckSendMail(ruleException);
                        }
                    }
                    myAdjusterID = Convert.ToInt32(claimExpense.AdjusterID); //Convert.ToInt32(myClaim.AdjusterID);
                    //EMAIL ADJUSTER OC 10/22/2014
                    if (myAdjusterID != 0 || myAdjusterID != null)
                    {
                        adjuster = AdjusterManager.GetAdjusterId(myAdjusterID);
                    }
                    if (cbEmailAdjuster.Checked == true)
                    {
                        try
                        {
                            notifyAdjuster(adjuster, claimExpense, myClaim);

                        }
                        catch (Exception ex)
                        {
                            lblMessage.Text = "Unable to send email to adjuster";
                            lblMessage.CssClass = "error";
                        }
                    }
                    //EMAIL CLIENT CONTACT OC 10/22/2014
                    if (cbEmailClient.Checked == true) //Dont need to check if invoice Pro ID is empty becuase to get to this point, one has to exist already
                    {
                        if (Session["ComingFromAllClaims"] != null) //if the user got here straight from the all claims screen
                        {
                            profileID = Convert.ToInt32(Session["CarrierInvoiceID"]);
                        }
                        else//coming from claim detail page
                        {
                            profileID = Convert.ToInt32(Session["InvoiceProfileID"]);
                        }
                        CarrierInvoice = CarrierInvoiceProfileManager.Get(profileID);
                        try
                        {
                              notifyClientContact(CarrierInvoice, claimExpense, myClaim, adjuster);
                        }
                        catch (Exception ex)
                        {
                            lblMessage.Text = "Unable to send email to client contact";
                            lblMessage.CssClass = "error";
                        }

                    }
                    //EMAIL TO WHOMEVER OC 10/22/2014
                    if (txtEmailTo.Text != "")
                    {

                        try
                        {
                             notifySpecifiedUser(adjuster, claimExpense, myClaim);
                        }
                        catch (Exception ex)
                        {
                            lblMessage.Text = "Unable to send email to adjuster";
                            lblMessage.CssClass = "error";
                        }
                    }

                    // complete transaction
                    scope.Complete();
                }

                lblMessage.Text = "Expense saved successfully.";
                lblMessage.CssClass = "ok";

                // refresh grid
                gvExpense.DataSource = loadExpenses(claimID);
                gvExpense.DataBind();

                // keep edit form active
                lbtnNewExpense_Click(null, null);
                lblAmount.Text = "";
                lblAmount.Visible = false;
                txtExpenseAmount.Visible = true;
            }
            catch (Exception ex) {
                Core.EmailHelper.emailError(ex);

                lblMessage.Text = "Unable to save claim expense.";
                lblMessage.CssClass = "error";
            }
        }
        public static string getExceptionsForRule(int clientID, int ruleID)
        {
            string encryptedValue = null;
            string json = null;
            List<RuleExceptionView> ruleExceptions = null;

            using (RuleExceptionManager repository = new RuleExceptionManager())
            {
                ruleExceptions = repository.GetByRuleID(clientID, ruleID);
            }

            if (ruleExceptions != null && ruleExceptions.Count > 0)
            {
                foreach (RuleExceptionView view in ruleExceptions)
                {
                    if (view.UserID == null)
                        view.UserName = "******";

                    switch (view.ObjectTypeID)
                    {
                        case (int)Globals.ObjectType.Invoice:

                            Invoice invoice = InvoiceManager.GetByID((int)view.ObjectID);

                            if (invoice != null)
                            {
                                encryptedValue = Core.SecurityManager.EncryptQueryString(view.ObjectID.ToString());

                                // add link to invoice page
                                view.url = string.Format("<a class='link' href=\"javascript:PopupCenter('../Protected/LeadInvoice.aspx?q={0}');\">Invoice #{1}</a>", encryptedValue, invoice.InvoiceNumber);

                            }
                            break;

                        case (int)Globals.ObjectType.Claim:
                            using (ClaimManager repository = new ClaimManager())
                            {
                                Claim claim = repository.Get((int)view.ObjectID);

                                if (claim != null)
                                {
                                    encryptedValue = Core.SecurityManager.EncryptQueryString(view.ObjectID.ToString());

                                    // add link to claim page
                                    view.url = string.Format("<a class='link' href=\"javascript:PopupCenter('../Protected/ClaimEdit.aspx?id={0}');\">{1}</a>", encryptedValue, claim.LeadPolicy.Leads.insuredName);
                                    view.InsureClaim = claim.InsurerClaimNumber;
                                    Carrier CarrierObj = new Carrier();

                                    if (claim.CarrierID != null) {
                                        CarrierObj = CarrierManager.GetByID(Convert.ToInt32(claim.CarrierID));
                                        view.Carrier = CarrierObj.CarrierName;
                                    }

                                }
                            }
                            break;

                        default:
                            break;
                    }
                }

            }

            json = Newtonsoft.Json.JsonConvert.SerializeObject(ruleExceptions);

            return json;
        }
        public static string SaveNotes(int claimID, string serviceQty, string serviceDate, string descp, string invoiceServiceType, int invoiceServiceTypeId, string serviceAdjuster, string serviceAdjustId, int leadID, string emailTo)
        {
            string json = "";
            ClaimService claimService = null;
            ClaimComment diary = null;
            Leads objLeads = null;
            Claim objClaim = null;
            int userID = SessionHelper.getUserId();

            try
            {
                using (TransactionScope scope = new TransactionScope())
                {
                    using (ClaimServiceManager repository = new ClaimServiceManager())
                    {
                        claimService = new ClaimService();
                        claimService.ClaimID = claimID;

                        claimService.ServiceQty = serviceQty == null ? 0 : Convert.ToDecimal(serviceQty);
                        claimService.ServiceDate = Convert.ToDateTime(serviceDate);
                        claimService.ServiceDescription = descp.Trim();
                        claimService.ServiceTypeID = Convert.ToInt32(invoiceServiceTypeId);
                        claimService.UserID = userID;
                        claimService.AdjusterID = Convert.ToInt32(serviceAdjustId);

                        claimService = repository.Save(claimService);
                    }

                    // diary
                    diary = new ClaimComment();
                    diary.ClaimID = claimID;
                    diary.CommentDate = DateTime.Now;
                    diary.UserId = userID;
                    diary.ActivityType = "Service: " + invoiceServiceType;
                    diary.CommentText = string.Format("Description: {0}, Date {1:MM/dd/yyyy h:mm}, Qty: {2:N2}, Adjuster: {3}",
                                                claimService.ServiceDescription,
                                                claimService.ServiceDate,
                                                claimService.ServiceQty,
                                                serviceAdjuster
                                                );
                    ClaimCommentManager.Save(diary);

                    scope.Complete();
                    //  SendNoteEmail();
                }
                objLeads = LeadsManager.GetByLeadId(leadID);
                ClaimManager objClaimManager = new ClaimManager();
                objClaim = objClaimManager.Get(claimID);
                string insuerFileId = objClaim.InsurerClaimNumber;
                string insurerName = objLeads.InsuredName;
                string claimNumber = objClaim.AdjusterClaimNumber;
                string userName = SessionHelper.getUserName();
                SendNoteEmail(insuerFileId, insurerName, claimNumber, serviceAdjuster, descp.Trim(), userName, emailTo, serviceDate, serviceQty);

                json = "Service save successfully";

            }
            catch (Exception ex)
            {
                Core.EmailHelper.emailError(ex);
            }

            return json;
        }