public ActionResult Carloan1(string productcode,string producttype) { ViewBag.productcode = productcode; ViewBag.producttype = producttype; //第一步中的下拉选项预加载 ViewBag.CarProperty = BizCommon.GetAA10Items("sCarProperty", "cast(aaa102 as int)"); //车贷-房产 下拉选项 ViewBag.CarPurchasingPeriod = BizCommon.GetAA10Items("sCarPurchasingPeriod", "cast(aaa102 as int)"); //车贷-购车阶段 下拉选项 if (Session[BizCommon.g_SessionName_ApplyProject] != null) { //为了防止已填写数据丢失,此处将Session中的内容取出填入 ApplyingRecord p = (Session[BizCommon.g_SessionName_ApplyProject] as ApplyingRecord); CarLoanStep1 m = new CarLoanStep1(); m.CarCustomerMonthlySalary = p.CarCustomerMonthlySalary; m.CarProperty = p.CarProperty; m.CarPurchasingPeriod = p.CarPurchasingPeriod; return View(m); } else { return View(); } }
public ActionResult Carloan1(CarLoanStep1 c, FormCollection values) { if (ModelState.IsValid) { string productcode = values["productcode"].ToString(); string producttype = values["producttype"].ToString(); if (Session[BizCommon.g_SessionName_ApplyProject] != null) { //若session中已经存在申请对象,则将本步骤所取得的值赋到session中的对象上; (Session[BizCommon.g_SessionName_ApplyProject] as ApplyingRecord).CarCustomerMonthlySalary = c.CarCustomerMonthlySalary; (Session[BizCommon.g_SessionName_ApplyProject] as ApplyingRecord).CarProperty = c.CarProperty; (Session[BizCommon.g_SessionName_ApplyProject] as ApplyingRecord).CarPurchasingPeriod = c.CarPurchasingPeriod; (Session[BizCommon.g_SessionName_ApplyProject] as ApplyingRecord).ProductCode = productcode; (Session[BizCommon.g_SessionName_ApplyProject] as ApplyingRecord).ProductType = producttype; return View("Carloan2"); } else { //否则,新创建一个申请对象,并将本步骤取得值赋到新的对象上,然后将对象放到session中; ApplyingRecord p = new ApplyingRecord(); p.CarCustomerMonthlySalary = c.CarCustomerMonthlySalary; p.CarProperty = c.CarProperty; p.CarPurchasingPeriod = c.CarPurchasingPeriod; p.ProductCode = productcode; p.ProductType = producttype; //第一步创建project类放到session中 if (Session[BizCommon.g_SessionName_ApplyProject] != null) Session[BizCommon.g_SessionName_ApplyProject] = null; Session[BizCommon.g_SessionName_ApplyProject] = p; return View("Carloan2"); } } //万一发生异常时,将执行以下代码(即返回第一步页面) //第一步中的下拉选项预加载 ViewBag.CarProperty = BizCommon.GetAA10Items("sCarProperty", "cast(aaa102 as int)"); //车贷-房产 下拉选项 ViewBag.CarPurchasingPeriod = BizCommon.GetAA10Items("sCarPurchasingPeriod", "cast(aaa102 as int)"); //车贷-购车阶段 下拉选项 return View("Carloan1"); }