예제 #1
0
        // GET: Policy/Create
        public ActionResult Create(int?ClientId, string returnUrl)
        {
            if (ClientId.HasValue == false)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }

            PolicyDetailModel vm = new PolicyDetailModel()
            {
                Companies     = ListProviderSvc.GetInsuranceProviders(),
                PolicyTypes   = ListProviderSvc.GetPolicyTypes(),
                Statuses      = ListProviderSvc.GetPolicyStatuses(),
                Agents        = ListProviderSvc.GetAgents(),
                InceptionDate = DateTime.Now,
                DateIssued    = DateTime.Now,
                ExpiryDate    = DateTime.Now,
                StatusName    = "New",
                ReturnUrl     = returnUrl,
                ClientId      = (int)ClientId
            };

            List <ClientSimple> clients = null;

            if (ClientId == 0)
            {
                clients = ListProviderSvc.GetClientSimpleList();
            }
            else
            {
                clients = new List <ClientSimple>();
                var clientEntity = Uow.Clients.GetById((int)ClientId);
                if (clientEntity == null)
                {
                    return(HttpNotFound());
                }
                ClientSimple client = new ClientSimple
                {
                    Id = clientEntity.Id,
                };
                if (clientEntity.IsOrganization)
                {
                    client.ClientName = clientEntity.OrganizationName;
                }
                else
                {
                    client.ClientName = clientEntity.LastName + ", " + clientEntity.FirstName;
                }

                clients.Add(client);
            }
            vm.Clients = clients;

            List <DefaultRebate> defaultRebates = null;

            defaultRebates    = ListProviderSvc.GetDefaultRebates();
            vm.DefaultRebates = defaultRebates;

            return(View(vm));
        }
예제 #2
0
        // GET: Report
        public ActionResult Index()
        {
            var vm = new ReportIndexModel
            {
                Years = ListProviderSvc.GetInvoicesPaidYears(),
                InsuranceProviders = ListProviderSvc.GetInsuranceProviders(),
                PolicyTypes        = ListProviderSvc.GetPolicyTypes()
            };

            return(View(vm));
        }
예제 #3
0
        // GET: Client/Details/5
        public ActionResult Details(int?id)
        {
            if (id.HasValue == false)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }

            var clientDetailModel = Uow.Clients.GetAll()
                                    .Where(c => c.Id == id)
                                    .ProjectTo <ClientDetailModel>()
                                    .FirstOrDefault();

            if (clientDetailModel == null)
            {
                return(HttpNotFound());
            }

            if (clientDetailModel.IsOrganization)
            {
                clientDetailModel.ClientName = clientDetailModel.OrganizationName;
            }

            var clientPoliciesList = Uow.Policies.GetAll()
                                     .Where(p => p.ClientId == id)
                                     .ProjectTo <ClientPoliciesListModel>()
                                     .ToList();

            clientDetailModel.ClientPoliciesList = clientPoliciesList;

            var clientClaimsList = Uow.Policies.GetAll()
                                   .Where(p => p.ClientId == id)
                                   .SelectMany(p => p.Claims)
                                   .ProjectTo <ClientClaimsListModel>()
                                   .ToList();

            clientDetailModel.ClientClaimsList = clientClaimsList;

            var clientOffersList = Uow.Offers.GetAll()
                                   .Where(p => p.ClientId == id)
                                   .ProjectTo <ClientOffersListModel>()
                                   .ToList();

            clientDetailModel.ClientOffersList = clientOffersList;

            var offerStatuses = ListProviderSvc.GetOfferStatuses();

            clientDetailModel.OfferStatuses = offerStatuses;

            return(View(clientDetailModel));
        }
예제 #4
0
        // GET: Soa
        public ActionResult Index(string error)
        {
            var unpaidStatusId = AttributeProviderSvc.GetInvoiceStatusIdFromName("unpaid");

            var list = Uow.Soas.GetAll()
                       .OrderBy(s => s.StatusId)
                       .ProjectTo <SoaModel>(new { invoiceStatus = unpaidStatusId })
                       .ToList();

            foreach (var item in list)
            {
                if (item.IsOrganization)
                {
                    item.ClientName = item.OrganizationName;
                }
            }

            List <ExistingClientsViewModel> clients;

            clients = Uow.Clients.GetAll()
                      .Where(c => c.Policies.Count() != 0)
                      .ProjectTo <ExistingClientsViewModel>().ToList();
            foreach (var item in clients)
            {
                if (item.IsOrganization)
                {
                    item.ClientName = item.OrganizationName;
                }
            }
            List <SoaStatus> statuses;

            statuses = Uow.SoaStatuses.GetAll().ToList();

            var vm = new SoaIndexModel
            {
                SoaList   = list,
                HasError  = string.IsNullOrEmpty(error) == false,
                Error     = error,
                Clients   = clients.OrderBy(c => c.ClientName).ToList(),
                Companies = ListProviderSvc.GetInsuranceProviders(),
                Statuses  = statuses
            };

            return(View(vm));
        }
예제 #5
0
        public ActionResult ShowReport(ReportIndexModel vm)
        {
            vm.InsuranceProviders = ListProviderSvc.GetInsuranceProviders();
            vm.PolicyTypes        = ListProviderSvc.GetPolicyTypes();
            vm.Months             = new string[] { "January", "February", "March", "April",
                                                   "May", "June", "July", "August", "September", "October", "November", "December" };

            if (vm.IsMonthlyProdType)
            {
                vm = MonthlyProdReport(vm);
            }
            else
            {
                vm = CompTypeYearReport(vm);
            }

            return(View(vm));
        }
예제 #6
0
        //private const string FileLocationFolderDbSave = "./Content/Files/";
        // GET: Form
        public ActionResult Index()
        {
            var formsList = Uow.Forms.GetAll()
                            .ProjectTo <FormModel>()
                            .ToList();
            var documentTypeList      = ListProviderSvc.GetDocumentTypes();
            var insuranceProviderList = ListProviderSvc.GetInsuranceProviders();
            var clientList            = ListProviderSvc.GetClientSimpleList();

            var formViewModel = new FormViewModel
            {
                NewForm            = new FormModel(),
                FormsList          = formsList,
                DocumentTypes      = documentTypeList,
                InsuranceProviders = insuranceProviderList,
                Clients            = clientList
            };

            return(View(formViewModel));
        }
예제 #7
0
        private PolicyDetailModel GetPolicyDetailModel(int?id)
        {
            var policyDetailModel = Uow.Policies.GetAll()
                                    .Where(c => c.Id == id)
                                    .ProjectTo <PolicyDetailModel>()
                                    .FirstOrDefault();

            if (policyDetailModel.IsOrganization)
            {
                policyDetailModel.ClientName = policyDetailModel.OrganizationName;
            }

            policyDetailModel.Companies   = ListProviderSvc.GetInsuranceProviders();
            policyDetailModel.PolicyTypes = ListProviderSvc.GetPolicyTypes();
            policyDetailModel.Statuses    = ListProviderSvc.GetPolicyStatuses();
            policyDetailModel.Agents      = ListProviderSvc.GetAgents();
            policyDetailModel.Clients     = ListProviderSvc.GetClientSimpleList();

            return(policyDetailModel);
        }
예제 #8
0
        public ActionResult CreateEdit(int?id, int?policyId, string returnUrl)
        {
            InvoiceItemViewModel vm;

            if (id != null) //Edit
            {
                vm = Uow.Invoices.GetAll()
                     .Where(i => i.Id == (int)id)
                     .Include(i => i.Particulars)
                     .ProjectTo <InvoiceItemViewModel>()
                     .FirstOrDefault();

                if (vm.DueDate.Year < 1980)
                {
                    vm.DueDate = DateTime.Now;
                }

                if (!(vm.StatusName.ToLower() == "pending" || vm.StatusName.ToLower() == "rejected"))
                {
                    //Invoice has been approved. Premium and Endorsement Number are fixed at this point.
                    var premiumFromParticular = vm.Particulars.Where(p => p.ParticularTypeName.ToLower() == "premium")
                                                .FirstOrDefault();
                    if (premiumFromParticular != null)
                    {
                        vm.Premium = premiumFromParticular.ParticularAmount;
                    }

                    //For Particular Readonly Values
                    vm.IsReadOnlyState = true;
                }
                else
                {
                    //Invoice not yet approved. Endorsement Number can still be modified.
                    var policy = Uow.Policies.GetAll()
                                 .Where(p => p.Id == vm.PolicyId)
                                 .Include(p => p.Endorsements)
                                 .FirstOrDefault();
                    if (policy != null && policy.Endorsements != null && policy.Endorsements.Count > 0)
                    {
                        var latestEndorsementNumber = policy.Endorsements
                                                      .OrderByDescending(e => e.EffectiveDate)
                                                      .FirstOrDefault()
                                                      .EndorsementNumber;
                        vm.EndorsementNumber = latestEndorsementNumber;
                    }

                    //For Particular Readonly Values
                    vm.IsReadOnlyState = false;
                }

                if (vm.StatusName.ToLower() == "unpaid")
                {
                    vm.PaidDate = DateTime.Now;
                }

                var policies = Uow.Policies.GetAll()
                               .Where(p => p.ClientId == vm.ClientId)
                               .ProjectTo <ClientPoliciesListModel>()
                               .ToList();

                vm.Policies = policies;

                vm.Clients      = ListProviderSvc.GetClientsWithPoliciesSimpleList();
                vm.IsFromPolicy = false;
            }
            else //Create
            {
                vm = new InvoiceItemViewModel
                {
                    StatusName   = "New",
                    IssueDate    = DateTime.Now,
                    DueDate      = DateTime.Now.AddMonths(1),
                    IsFromPolicy = false
                };

                if (policyId != null)
                {
                    vm.IsFromPolicy = true;
                    vm.Policies     = Uow.Policies.GetAll()
                                      .Where(p => p.Id == policyId)
                                      .ProjectTo <ClientPoliciesListModel>()
                                      .ToList();

                    vm.PolicyId          = vm.Policies[0].Id;
                    vm.CompanyName       = vm.Policies[0].CompanyName;
                    vm.EndorsementNumber = vm.Policies[0].LatestEndorsementNumber;
                    vm.Premium           = vm.Policies[0].Premium;
                    vm.Rebate            = vm.Policies[0].Rebate;

                    var item = Uow.Policies.GetAll()
                               .Where(p => p.Id == policyId)
                               .Select(p => p.Client)
                               .FirstOrDefault();

                    var client = new ClientSimple
                    {
                        Id            = item.Id,
                        Email         = item.Email,
                        AccountNumber = item.AccountNumber
                    };

                    if (item.IsOrganization)
                    {
                        client.ClientName = item.OrganizationName;
                    }
                    else
                    {
                        client.ClientName = item.LastName + ", " + item.FirstName;
                    }

                    vm.Clients = new List <ClientSimple>();
                    vm.Clients.Add(client);
                    vm.ClientId      = client.Id;
                    vm.ClientName    = client.ClientName;
                    vm.AccountNumber = client.AccountNumber;
                }
                else
                {
                    vm.Clients = ListProviderSvc.GetClientsWithPoliciesSimpleList();
                }
            }

            vm.ReturnUrl           = returnUrl;
            vm.ParticularTypesList = ListProviderSvc.GetParticularTypes();

            return(View(vm));
        }