Beispiel #1
0
        //===============================================================================================

        public ActionResult CreateCustomerPolicy()
        {
            if (Session["id"] != null)
            {
                //Get Customer
                int id = (int)Session["id"];
                CustomerinfoDAORequest request  = new CustomerinfoDAORequest();
                CustomerinfoViewModel  customer = request.GetCustomerById(id);
                ViewData["Customers"] = customer;

                //Get Policy
                int policyID = (int)TempData["PolicyID"];
                PolicyDAORequest request1 = new PolicyDAORequest();
                PolicyViewModel  policy   = request1.GetPolicyById(policyID);
                ViewData["Policies"] = policy;
                ViewData["Brands"]   = GetBrandList();

                //Get Total Payment
                PolicyTypeDAORequest request2 = new PolicyTypeDAORequest();
                PolicytypeViewModel  type     = request2.GetTypeById(policy.policytypeid);
                ViewBag.Price = (decimal)(type.price * policy.policyduration);

                return(View());
            }
            return(View());
        }
Beispiel #2
0
        public ActionResult InsurancePlan()
        {
            PolicyDAORequest       request = new PolicyDAORequest();
            List <PolicyViewModel> model   = request.GetAll();

            return(View(model));
        }
Beispiel #3
0
        public ActionResult CreateNewCustomerPolicy()
        {
            int cusId = (int)Session["id"];
            CustomerinfoDAORequest customerRequest = new CustomerinfoDAORequest();
            Customer_Info          customerInfo    = customerRequest.searchCustomerById(cusId);

            int policyID = int.Parse(Request.Params["idPolicyHidden"]);
            PolicyDAORequest policyRequest = new PolicyDAORequest();
            Policy           policyInfo    = policyRequest.searchPolicyById(policyID);

            int             modelId = int.Parse(Request.Params["cbVehicleModel"]);
            ModelDAORequest dao     = new ModelDAORequest();
            Model           model1  = dao.searchModelByModel(modelId);
            ModelViewModel  model   = dao.GetModelById(modelId);

            int vehicleCondition = int.Parse(Request.Params["condition"]);

            Vehicle_Info newVehicle = new Vehicle_Info()
            {
                brand_id          = int.Parse(Request.Form["cbVehicleBrand"]),
                model_id          = int.Parse(Request.Form["cbVehicleModel"]),
                address           = Request.Form["address"].ToString(),
                owner_name        = Request.Form["ownerName"].ToString(),
                version           = Request.Params["version"],
                frame_number      = Request.Params["frameNumber"],
                engine_number     = Request.Params["engineNumber"],
                vehicle_number    = Request.Params["vehicleNumber"],
                vehicle_condition = vehicleCondition,
                rate_by_condition = (vehicleCondition * model.rate) / 100,
                Model             = model1
            };

            Customer_Policy newCustomerPolicy = new Customer_Policy()
            {
                customer_id        = cusId,
                policy_id          = policyID,
                Vehicle_Info       = newVehicle,
                vehicle_id         = newVehicle.id,
                policy_start_date  = DateTime.Parse(Request.Params["startDate"]),
                policy_end_date    = DateTime.Parse(Request.Params["endDate"]),
                create_date        = DateTime.Parse(Request.Params["createDate"]),
                customer_add_prove = "Proved",
                total_payment      = decimal.Parse(Request.Params["totalPayment"]),
                active             = true,
                Policy             = policyInfo,
                Customer_Info      = customerInfo
            };

            CheckoutInfo checkout = new CheckoutInfo()
            {
                CustomerPolicy = newCustomerPolicy,
                Vehicle        = newVehicle
            };

            Session["checkoutInfo"] = checkout;
            return(RedirectToAction("CheckOutPage"));
        }