private void bindHistoricalComments()
        {
            int leadID = Core.SessionHelper.getLeadId();

            Data.Entities.LeadPolicy policy = LeadPolicyManager.GetByID(this.policyID);

            if (policy != null && policy.PolicyType != null)
            {
                List <LeadComment> historicalComments = LeadCommentManager.getLeadCommentByLeadID(leadID, (int)policy.PolicyType);

                gvHistoricalComments.DataSource = historicalComments;
                gvHistoricalComments.DataBind();
            }
        }
Exemple #2
0
        protected void gvPolicyList_RowDataBound(object sender, GridViewRowEventArgs e)
        {
            Data.Entities.LeadPolicy policy = null;

            if (e.Row.RowType == DataControlRowType.DataRow)
            {
                if (e.Row.DataItem != null)
                {
                    policy = e.Row.DataItem as Data.Entities.LeadPolicy;

                    ucClaimList claimList = e.Row.FindControl("claimList") as ucClaimList;

                    claimList.bindData(policy.Id);

                    //GridView gvClaims = e.Row.FindControl("gvClaims") as GridView;

                    //gvClaims.DataSource = policy.Claims;

                    //gvClaims.DataBind();
                }
            }
        }
Exemple #3
0
        public void bindData(int claimID)
        {
            adsource.PageSize    = 10;
            adsource.AllowPaging = true;

            pos = Convert.ToInt32(ViewState["vs"]);

            Data.Entities.LeadPolicy policy = LeadPolicyManager.Get(this.policyID);

            if (policy != null)
            {
                ViewState["policyTypeID"] = policy.PolicyType.ToString();

                ViewState["vs"] = ViewState["pageIndex"] == null ? "0" : ViewState["pageIndex"].ToString();

                pos = Convert.ToInt32(ViewState["vs"]);

                Session["pageIndex"] = null;

                FillImage(this.leadID);
            }
        }
Exemple #4
0
        protected void gvPolicyList_RowCommand(object sender, GridViewCommandEventArgs e)
        {
            int id = 0;

            switch (e.CommandName)
            {
            case "DoEdit":
            case "DoView":
                Session["policyID"] = e.CommandArgument;

                Response.Redirect("~/Protected/LeadPolicyEdit.aspx");
                break;

            case "DoDelete":
                id = Convert.ToInt32(e.CommandArgument);
                try {
                    Data.Entities.LeadPolicy policy = LeadPolicyManager.Get(id);
                    if (policy != null)
                    {
                        policy.IsActive = false;

                        LeadPolicyManager.Save(policy);

                        // refresh policy list
                        gvPolicyList.DataBind();
                    }
                }
                catch (Exception ex) {
                    Core.EmailHelper.emailError(ex);
                }
                break;


            default:
                break;
            }
        }
        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);
        }
        public static string SaveClaimStatus(int claimStatus, string insurerClaimId, string insurerName, int claimAdjusterId, string adjusterComapnyName, string updatedby, string commentNote, string emailTo, int carrierID, int claimID, string recipientId, string claimAdjuster, string claimStatusName, string carrier, string idOf)
        {
            string json = "";
            Claim objclaim = null;
            AdjusterMaster objAdjusterMaster = null;
            Leads objLeads = null;
            CRM.Data.Entities.LeadPolicy objLeadPolicy = null;
            ClaimComment comment = null;
            Client objClient = null;
            int userID = SessionHelper.getUserId();
            int leadID = 0;
            int policyId = 0;
            try
            {
                using (TransactionScope scope = new TransactionScope())
                {
                    using (ClaimManager repository = new ClaimManager())
                    {
                        objclaim = new Claim();
                        objclaim.ClaimID = claimID;
                        objclaim.StatusID = claimStatus;
                        objclaim.InsurerClaimNumber = insurerClaimId;
                        //objclaim.CarrierID = carrierID;
                        objclaim.AdjusterID = claimAdjusterId;
                        objclaim.StatusUpdatedBy = updatedby;
                        objclaim.StatusCommentNote = commentNote;
                        //objclaim.StatusEmailTo = EmailTo;
                        repository.UpdateClaimStatus(objclaim);

                        // AdjusterMaster
                        objAdjusterMaster = new AdjusterMaster();
                        objAdjusterMaster.AdjusterId = claimAdjusterId;
                        //objAdjusterMaster.CompanyName = AdjusterComapnyName;
                        repository.UpdateAdjusterName(objAdjusterMaster);

                        //leads
                        leadID = repository.GetPolicyId(claimID);
                        objLeads = new Leads();
                        objLeads.LeadId = leadID;
                        objLeads.InsuredName = insurerName;
                        repository.UpdateInsurerName(objLeads);
                        //save carrier id in Lead policy
                        policyId = repository.GetLeadPolicyId(claimID);
                        objLeadPolicy = new Data.Entities.LeadPolicy();
                        objLeadPolicy.Id = policyId;
                        objLeadPolicy.CarrierID = carrierID;
                        repository.UpdateCarrierId(objLeadPolicy);
                        //claim comment for add notes
                        comment = new ClaimComment();
                        comment.ClaimID = claimID;
                        comment.IsActive = true;
                        comment.UserId = Core.SessionHelper.getUserId();
                        comment.CommentDate = DateTime.Now;
                        comment.ActivityType = "Status Changed";
                        comment.CommentText = commentNote.Trim();
                        ClaimCommentManager.Save(comment);

                        //client company name
                        //Client c = ClaimsManager.GetClientByUserId(SessionHelper.getUserId());
                        //c.BusinessName = AdjusterComapnyName;
                        //ClaimsManager.SaveClient(c);

                    }
                    scope.Complete();
                }
                string[] recipId = recipientId.Split(',');
                string recipientEmailId = string.Empty;

                string[] idofTable = idOf.Split(',');
                int index2 = 0;
                for (int index = 0; index < recipId.Length; index++)
                {
                    index2 = 0;
                    int.TryParse(recipId[index], out index2);
                    if (idofTable[index] == "c")
                    {

                        Contact objContact = ContactManager.Get(index2);
                        if (!string.IsNullOrEmpty(objContact.Email))
                        {
                            if (recipientEmailId == "")
                            {
                                recipientEmailId = objContact.Email;
                            }
                            else
                            {
                                recipientEmailId = recipientEmailId + "," + objContact.Email;
                            }
                        }
                    }
                    else
                    {

                        AdjusterMaster objAdjuster = AdjusterManager.GetAdjusterId(index2);

                        if (!string.IsNullOrEmpty(objAdjuster.email))
                        {
                            if (recipientEmailId == "")
                            {
                                recipientEmailId = objAdjuster.email;
                            }
                            else
                            {
                                recipientEmailId = recipientEmailId + "," + objAdjuster.email;
                            }
                        }

                    }
                }
                if (!string.IsNullOrEmpty(recipientEmailId))
                {
                    notifyUser(claimStatus, insurerClaimId, insurerName, claimAdjusterId, adjusterComapnyName, updatedby, commentNote, "", carrierID, claimID, recipientEmailId, claimAdjuster, claimStatusName, carrier, recipId, idofTable);
                }
                json = "Status save successfully";

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

            return json;
        }
        public static string SaveClaimExpense(string expenseType, string insurerClaimId, string insurerName, int claimAdjusterId, string adjusterComapnyName, string updatedby, string commentNote, string emailTo, int carrierID, int claimID, string recipientId, string claimAdjuster, string expenseTypeName, string carrier, string idOf, string expenseQty, string expenseAmount, string expenseDate, string reimbrance)
        {
            string json = "";
            Claim objclaim = null;
            AdjusterMaster objAdjusterMaster = null;
            Leads objLeads = null;
            ClaimComment comment = null;
            ClaimExpense claimExpense = null;
            CRM.Data.Entities.LeadPolicy objLeadPolicy = null;
            int userID = SessionHelper.getUserId();
            int leadID = 0;
            int policyId = 0;
            try
            {
                using (TransactionScope scope = new TransactionScope())
                {
                    using (ClaimManager repository = new ClaimManager())
                    {
                        objclaim = new Claim();
                        objclaim.ClaimID = claimID;

                        objclaim.InsurerClaimNumber = insurerClaimId;
                        //objclaim.CarrierID = carrierID;
                        objclaim.AdjusterID = claimAdjusterId;
                        // objclaim.StatusUpdatedBy = updatedby;
                        repository.UpdateClaimStatus(objclaim);

                        // AdjusterMaster
                        objAdjusterMaster = new AdjusterMaster();
                        objAdjusterMaster.AdjusterId = claimAdjusterId;
                        //objAdjusterMaster.CompanyName = AdjusterComapnyName;
                        repository.UpdateAdjusterName(objAdjusterMaster);

                        //leads
                        leadID = repository.GetPolicyId(claimID);
                        objLeads = new Leads();
                        objLeads.LeadId = leadID;
                        objLeads.InsuredName = insurerName;
                        repository.UpdateInsurerName(objLeads);
                        //save carrier id in Lead policy
                        policyId = repository.GetLeadPolicyId(claimID);
                        objLeadPolicy = new Data.Entities.LeadPolicy();
                        objLeadPolicy.Id = policyId;
                        objLeadPolicy.CarrierID = carrierID;
                        repository.UpdateCarrierId(objLeadPolicy);

                        //add expense
                        ClaimExpenseManager objClaimExpenseManager = new ClaimExpenseManager();
                        claimExpense = new ClaimExpense();
                        claimExpense.ClaimID = claimID;
                        if (!string.IsNullOrEmpty(expenseAmount))
                        {
                            claimExpense.ExpenseAmount = Convert.ToDecimal(expenseAmount);
                        }
                        if (!string.IsNullOrEmpty(expenseDate))
                        {
                            claimExpense.ExpenseDate = Convert.ToDateTime(expenseDate);
                        }
                        claimExpense.ExpenseDescription = commentNote.Trim();
                        claimExpense.ExpenseTypeID = Convert.ToInt32(expenseType);
                        if (reimbrance == "1")
                        {
                            claimExpense.IsReimbursable = true;
                        }
                        else
                        {
                            claimExpense.IsReimbursable = false;
                        }

                        claimExpense.UserID = userID;
                        claimExpense.AdjusterID = Convert.ToInt32(claimAdjusterId);
                        if (!string.IsNullOrEmpty(expenseQty))
                        {
                            claimExpense.ExpenseQty = Convert.ToDecimal(expenseQty);
                        }
                        objClaimExpenseManager.Save(claimExpense);

                        //claim comment for add notes
                        comment = new ClaimComment();
                        comment.ClaimID = claimID;
                        comment.IsActive = true;
                        comment.UserId = Core.SessionHelper.getUserId();
                        comment.CommentDate = DateTime.Now;
                        comment.ActivityType = "Add Expense";
                        comment.CommentText = string.Format("Expense: {0}, Description: {1}, Date: {2:MM/dd/yyyy}, Amount: {3:N2}, Adjuster: {4} Qty: {5:N2}",
                                                 expenseTypeName,
                                                 commentNote.Trim(),
                                                 Convert.ToDateTime(expenseDate),
                                                 expenseAmount,
                                                 claimAdjuster,
                                                 expenseQty
                                                 );
                        ClaimCommentManager.Save(comment);

                    }
                    scope.Complete();
                }
                string[] recipId = recipientId.Split(',');
                string recipientEmailId = string.Empty;

                string[] IdofTable = idOf.Split(',');
                int index2 = 0;
                for (int index = 0; index < recipId.Length; index++)
                {
                    index2 = 0;
                    int.TryParse(recipId[index], out index2);
                    if (IdofTable[index] == "c")
                    {

                        Contact objContact = ContactManager.Get(index2);
                        if (!string.IsNullOrEmpty(objContact.Email))
                        {
                            if (recipientEmailId == "")
                            {
                                recipientEmailId = objContact.Email;
                            }
                            else
                            {
                                recipientEmailId = recipientEmailId + "," + objContact.Email;
                            }
                        }
                    }
                    else
                    {

                        AdjusterMaster objAdjuster = AdjusterManager.GetAdjusterId(index2);

                        if (!string.IsNullOrEmpty(objAdjuster.email))
                        {
                            if (recipientEmailId == "")
                            {
                                recipientEmailId = objAdjuster.email;
                            }
                            else
                            {
                                recipientEmailId = recipientEmailId + "," + objAdjuster.email;
                            }
                        }

                    }
                }
                SendExpenseEmail(expenseType, insurerClaimId, insurerName, claimAdjusterId, adjusterComapnyName, updatedby, commentNote, "", carrierID, claimID, recipientEmailId, claimAdjuster, expenseTypeName, carrier, recipId, IdofTable, expenseQty, expenseAmount, expenseDate, reimbrance);
                json = "Expense add successfully";

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

            return json;
        }