Ejemplo n.º 1
0
        //atrod polisi, nomaina statusu uz nopirkts
        public void BuyInsurance(string policyId)
        {
            PolicyRepository policyRepository = new PolicyRepository();
            var policy = policyRepository.GetPolicyById(policyId);

            policy.Statuss = Statuss.Active;
            policyRepository.SavePolicy(policy);
        }
        /// <summary>
        /// Products
        /// Client data
        ///
        /// </summary>
        public decimal GetPrice(Client client, Product productId)
        {
            ProductRepository productRepository = new ProductRepository();
            var product = productRepository.GetProductById(productId.ProductId);


            //Izveidot Polices repozitoriju un izmantot metodi
            //Create a policy
            PolicyRepository policyRepository = new PolicyRepository();
            var policyNumber = policyRepository.CreateNewPolicy(product, client);

            //Return a policy price
            return(policyRepository.GetPolicyPriceByNumber(policyNumber));
        }
Ejemplo n.º 3
0
        //<Summary>
        //produktu
        //klienta dati, pec koienta pers.k. zinas masinu
        //
        //</Summary>
        public decimal GetPrice(Client client, int productId) //productid ka mainigais saja metode tikai, lidzigi ari client
        {
            //validate customer against product

            ProductRepository productRepository = new ProductRepository();
            var product = productRepository.GetProductById(productId);


            //Izveidot Polices repozitoriju un izmantot metodi
            //Create a policy
            PolicyRepository policyRepository = new PolicyRepository();
            var policyId = policyRepository.CreateNewPolicy(product, client);

            //Return a policy
            return(policyRepository.GetPolicyPriceById(policyId));
        }
        public Policy GetPolicyData(Client client, Product productId)
        {
            ProductRepository productRepository = new ProductRepository();
            var product = productRepository.GetProductById(productId.ProductId);


            //Izveidot Polices repozitoriju un izmantot metodi
            //Create a policy
            PolicyRepository policyRepository = new PolicyRepository();
            var policyNumber = policyRepository.CreateNewPolicy(product, client);

            //Return a policy number
            return
                (policyRepository.GetPolicyByNumber(policyNumber));
            // policyRepository.GetPolicyByNumber(policyNumber).State;
        }
        public Policy BuyInsurance(Client client, Product productId)
        {
            ProductRepository productRepository = new ProductRepository();
            var product = productRepository.GetProductById(productId.ProductId);

            //Izveidot Polices repozitoriju un izmantot metodi
            //Create a policy
            PolicyRepository policyRepository = new PolicyRepository();
            var policyNumber = policyRepository.CreateNewPolicy(product, client);


            // var obj = myList.FirstOrDefault(x => x.MyProperty == myValue);
            // if (obj != null) obj.OtherProperty = newValue;
            // http://stackoverflow.com/questions/7190016/how-to-update-an-object-in-a-list-in-c-sharp


            Policy policy = policyRepository.UpdatePolicyState(policyNumber);

            policyRepository.SavePolicy(policy);

            return(policy); // policyRepository.UpdatePolicyState(policyNumber);
        }