コード例 #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"));
        }
コード例 #2
0
        public void AddCustomerPolicy()
        {
            CheckoutInfo checkout = (CheckoutInfo)Session["checkoutInfo"];

            Vehicle_Info    vehicleInfo    = checkout.Vehicle;
            Customer_Policy customerPolicy = checkout.CustomerPolicy;

            VehicleinfoViewModel vehicle = new VehicleinfoViewModel()
            {
                address          = vehicleInfo.address,
                brandid          = vehicleInfo.brand_id,
                eginenumber      = vehicleInfo.engine_number,
                framenumber      = vehicleInfo.frame_number,
                modelid          = vehicleInfo.model_id,
                ownername        = vehicleInfo.owner_name,
                ratebycondition  = vehicleInfo.rate_by_condition,
                vehiclecondition = vehicleInfo.vehicle_condition,
                vehiclenumber    = vehicleInfo.vehicle_number,
                version          = vehicleInfo.version
            };

            VehicleinfoDAORequest request1 = new VehicleinfoDAORequest();

            request1.Add(vehicle);

            VehicleinfoViewModel vehicle2 = request1.GetByAllNumber(vehicle.framenumber, vehicle.eginenumber, vehicle.vehiclenumber);

            CustomerpolicyViewModel cPolicy = new CustomerpolicyViewModel()
            {
                active           = customerPolicy.active,
                createdate       = customerPolicy.create_date,
                customeraddprove = customerPolicy.customer_add_prove,
                customerid       = (int)customerPolicy.customer_id,
                policyenddate    = customerPolicy.policy_end_date,
                policyid         = (int)customerPolicy.policy_id,
                policystartdate  = customerPolicy.policy_start_date,
                TotalPayment     = customerPolicy.total_payment,
                vehicleid        = vehicle2.id
            };

            CustomerpolicyDAORequest request2 = new CustomerpolicyDAORequest();

            request2.Add(cPolicy);
        }
コード例 #3
0
        public int Add(CustomerpolicyViewModel newItem)
        {
            Customer_Policy customer = new Customer_Policy()
            {
                policy_start_date  = newItem.policystartdate,
                policy_end_date    = newItem.policyenddate,
                create_date        = newItem.createdate,
                customer_add_prove = newItem.customeraddprove,
                active             = newItem.active,
                customer_id        = newItem.customerid,
                vehicle_id         = newItem.vehicleid,
                policy_id          = newItem.policyid,
                total_payment      = newItem.TotalPayment
            };

            context.Customer_Policy.Add(customer);
            context.SaveChanges();
            return(1);
        }
コード例 #4
0
 public void Delete(Customer_Policy Stages)
 {
     FDIDB.Customer_Policy.Remove(Stages);
 }
コード例 #5
0
 public void Add(Customer_Policy Stage)
 {
     FDIDB.Customer_Policy.Add(Stage);
 }