public ActionResult CaseDetails(Claim claim)
        {
            claim.SetCaseDetails(claim.Cases);

            if (claim.Cases.CustomerID > 0)
                return RedirectToAction("Edit", "Claim", new { cusid = claim.Cases.CustomerID });
            else
                return null;
        }
        public ActionResult CustomerDetails(int ID)
        {
            Claim claim = new Claim();
            try
            {
                claim.GetClaimDetails(ID);
            }
            catch (Exception ex)
            {
                throw ex;
            }

            return PartialView(claim);
        }
        public ActionResult CustomerDetails(Claim claim)
        {
            try
            {
                claim.SetClaimDetails(claim.Customers);
            }
            catch (Exception ex)
            {
                throw ex;
            }

            if (claim.Customers.Customers.CustomerID != 0)
                return RedirectToAction("Edit", "Claim", new { cusid = claim.Customers.Customers.CustomerID });
            else
                return null;
        }
        public ActionResult Search(int SearchLeadID)
        {
            int CustomerID = 0;
            Claim claim = new Claim();
            try
            {
                CustomerID = claim.SearchClaim(SearchLeadID);
                if (CustomerID > 0)
                {
                    Session["LeadID"] = SearchLeadID;
                    Session["CustomerID"] = CustomerID;
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }

            if (CustomerID != 0)
                return RedirectToAction("Edit", "Claim", new { cusid = CustomerID });
            else
                return null;
        }
        public ActionResult RenderDocument(int ID)
        {
            Claim claim = new Claim();
            try
            {
                claim.GetDocument(ID);
            }
            catch (Exception ex)
            {
                throw ex;
            }

            return PartialView(claim);
        }
        public ActionResult Index()
        {
            Claim claim = new Claim();
            try
            {
                claim.GetUserClaims(SDKHelper.GetUserSession<AquariumUserManagement.LoggedOnUserResult>("User").User.ClientPersonnelID);
            }
            catch (Exception ex)
            {
                throw ex;
            }

            return View(claim);
        }
        public ActionResult GetDetailFields(Claim Claim)
        {
            int SearchLeadID = Convert.ToInt32(Session["LeadID"]);
            int CustomerID = Convert.ToInt32(Session["CustomerID"]);

            try
            {
                for (int i = 0; i < Claim.DetailFieldPage.DetailFields.Count; i++)
                {
                    if (Claim.DetailFieldPage.DetailFields[i].FieldDefinition.QuestionTypeID == 5)
                        Claim.SetDiaryDetailFields(Claim.DetailFieldPage.DetailFields[i], SearchLeadID, Claim.DetailFieldPage.DetailFields[i].FieldValueDate.ToString());
                    else if (Claim.DetailFieldPage.DetailFields[i].FieldDefinition.QuestionTypeID == 4)
                        Claim.SetDiaryDetailFields(Claim.DetailFieldPage.DetailFields[i], SearchLeadID, Claim.DetailFieldPage.DetailFields[i].FieldValueint.ToString());
                    else
                        Claim.SetDiaryDetailFields(Claim.DetailFieldPage.DetailFields[i], SearchLeadID, Claim.DetailFieldPage.DetailFields[i].FieldValue);

                }
            }
            catch (Exception ex)
            {
                throw ex;
            }

            if (CustomerID > 0)
                return RedirectToAction("Edit", "Claim", new { cusid = CustomerID });
            else
                return null;
        }
 public ActionResult DiaryEvents(Claim Claim)
 {
     //TODO: Redirect to view EventsFields
     return View();
 }
        public ActionResult GetDetailFieldPages()
        {
            int SearchLeadID = Convert.ToInt32(Session["LeadID"]);

            Claim claim = new Claim();
            try
            {
                claim.GetDiaryDetailFieldPages(SearchLeadID);
            }
            catch (Exception ex)
            {
                throw ex;
            }

            return Json(claim.DiaryDetailFieldPageList.ToArray(), JsonRequestBehavior.AllowGet);
        }
        public ActionResult EventHistory(int ID)
        {
            Claim claim = new Claim();
            try
            {
                claim.GetEventHistory(ID);
            }
            catch (Exception ex)
            {
                throw ex;
            }

            return PartialView(claim);
        }
        public ActionResult Edit(int cusid)
        {
            Claim claim = new Claim();
            try
            {
                //claim.GetClaimDetails(ID);
            }
            catch (Exception ex)
            {
                throw ex;
            }

            return View(claim);
        }
        public ActionResult DownloadDocument(int ID)
        {
            Claim claim = new Claim();
            try
            {
                claim.GetDocument(ID);
            }
            catch (Exception ex)
            {
                throw ex;
            }

            string ext = ".txt";
            string ContentType = "text/plain";
            string FileName = (claim.LeadDocument.LeadDocument.LeadDocumentTitle == null) ? "UntitledDocument" : claim.LeadDocument.LeadDocument.LeadDocumentTitle;

            if (claim.LeadDocument.LeadDocument.DocumentBLOB.Length > 0)
            {
                if (claim.LeadDocument.LeadDocument.DocumentFormat == "NOTE")
                {
                    ContentType = "text/plain";
                    ext = ".txt";
                }
                else
                {
                    if (claim.LeadDocument.LeadDocument.FileName != null && claim.LeadDocument.LeadDocument.FileName.Substring(claim.LeadDocument.LeadDocument.FileName.IndexOf(".") + 1) == "pdf")
                    {
                        ContentType = "application/pdf";
                        ext = ".pdf";
                    }
                    else
                    {
                        ContentType = "application/rtf";
                        ext = ".rtf";
                    }
                }
                Response.AppendHeader("Content-Disposition", "attachment;filename=" + FileName + ext);
                return File(claim.LeadDocument.LeadDocument.DocumentBLOB, ContentType);
            }
            else
            {
                Response.AppendHeader("Content-Disposition", "attachment;filename=" + FileName + ext);
                return File(System.Text.Encoding.UTF8.GetBytes("No Data found!!!!"), ContentType);
            }
        }
        public ActionResult DiaryNotes(Claim Claim)
        {
            int SearchLeadID = Convert.ToInt32(Session["LeadID"]);
            int CustomerID = Convert.ToInt32(Session["CustomerID"]);

            Case cases = new Case();
            try
            {
                int CaseID = cases.GetCaseID(CustomerID);

                Claim.SetDiaryNotes(Claim.Notes, SearchLeadID, CaseID);
            }
            catch (Exception ex)
            {
                throw ex;
            }
            //TODO: Redirect to view EventsFields
            if (CustomerID != 0)
                return RedirectToAction("Edit", "Claim", new { cusid = CustomerID });
            else
                return null;
        }
        public ActionResult DiaryNotes()
        {
            Claim claim = new Claim();

            try
            {
                claim.GetDiaryNotesDefaults();
            }
            catch (Exception ex)
            {
                throw ex;
            }

            return PartialView(claim);
        }
        public ActionResult GetDetailFields(int PageID, string PageName)
        {
            int SearchLeadID = Convert.ToInt32(Session["LeadID"]);

            Claim claim = new Claim();
            try
            {
                claim.GetDiaryDetailFields(PageID, PageName, SearchLeadID);
            }
            catch (Exception ex)
            {
                throw ex;
            }

            return PartialView(claim);
        }
        public ActionResult Claims(int ID)
        {
            Claim claim = new Claim();
            try
            {
                claim.GetUserClaimsWithNoDiaryTask(ID);
            }
            catch (Exception ex)
            {
                throw ex;
            }

            return PartialView(claim);
        }
        public ActionResult DiaryEvents(int CustomerID)
        {
            int SearchLeadID = Convert.ToInt32(Session["LeadID"]);

            Claim claim = new Claim();
            try
            {
                claim.GetDiaryEvents(CustomerID, SearchLeadID);
            }
            catch (Exception ex)
            {
                throw ex;
            }

            return PartialView(claim);
        }