Exemplo n.º 1
0
        public bool AddPolicy(PolicyModel policy)
        {
            var entity = new Policie()
            {
                PolicyNumber     = policy.PolicyNumber,
                CarId            = policy.CarId,
                EffectiveDate    = (DateTime)policy.EffectiveDate,
                EndDate          = (DateTime)policy?.EndDate,
                IsGroupInsurance = policy.IsGroupInsurance,
                IsActive         = true,
                AddUser          = LoginUserDetails.GetWindowsLoginUserName(),
                AddDate          = DateUtil.GetCurrentDate(),
                CoverageId       = policy.CoverageId,
                ProductId        = policy.ProductId
            };

            _policyRepository.Add(entity);

            var latestPolicy = _policyRepository.GetAll().OrderByDescending(p => p.Id).FirstOrDefault();

            if (latestPolicy != null)
            {
                var clientPolocieModel = new ClientPolicie()
                {
                    ClientId  = policy.ClientId,
                    PolicieId = latestPolicy.Id,
                    IsActive  = true,
                    AddUser   = LoginUserDetails.GetWindowsLoginUserName(),
                    AddDate   = DateUtil.GetCurrentDate()
                };
                _commonService.AddClientPolocie(clientPolocieModel);
            }

            return(true);
        }
Exemplo n.º 2
0
        public bool AddClientPolocie(int clientId, int polocieId)
        {
            var clientPolocieModel = new ClientPolicie()
            {
                ClientId  = clientId,
                PolicieId = polocieId,
                IsActive  = true,
                AddUser   = LoginUserDetails.GetWindowsLoginUserName(),
                AddDate   = DateUtil.GetCurrentDate()
            };

            return(_commonService.AddClientPolocie(clientPolocieModel));
        }
Exemplo n.º 3
0
        public ActionResult AssignClient(AssignClientToPolicy clientPolicy)
        {
            var clinetPolicy = new ClientPolicie()
            {
                ClientId  = clientPolicy.ClinetId,
                PolicieId = clientPolicy.PolicyId
            };

            _commonService.AddClientPolocie(clinetPolicy);

            _commisionService.UpdateExceptionCommisionsClient(clientPolicy.Id, clientPolicy.ClinetId, clientPolicy.PolicyId, clientPolicy.PolicyNo);
            return(Json(_commisionService.GetCarrierPoliciesById(1), JsonRequestBehavior.AllowGet));
        }