Esempio n. 1
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"));
        }
Esempio n. 2
0
        public ActionResult GetModelList(int brandId)
        {
            ModelDAORequest request = new ModelDAORequest();

            return(PartialView("ModelList_PartialPage", request.GetByBrandId(brandId)));
        }