public ActionResult Purchaseloan1(PurchaseLoanStep1 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).PerslEmployment = c.PerslEmployment; (Session[BizCommon.g_SessionName_ApplyProject] as ApplyingRecord).PerslSalaryType = c.PerslSalaryType; (Session[BizCommon.g_SessionName_ApplyProject] as ApplyingRecord).PerslWorkingAge = c.PerslWorkingAge; (Session[BizCommon.g_SessionName_ApplyProject] as ApplyingRecord).PerslYoBirth = c.PerslYoBirth; (Session[BizCommon.g_SessionName_ApplyProject] as ApplyingRecord).PerslSalary = c.PerslSalary; (Session[BizCommon.g_SessionName_ApplyProject] as ApplyingRecord).ProductCode = productcode; (Session[BizCommon.g_SessionName_ApplyProject] as ApplyingRecord).ProductType = producttype; return View("Purchaseloan2"); } else { //否则,新创建一个申请对象,并将本步骤取得值赋到新的对象上,然后将对象放到session中; ApplyingRecord p = new ApplyingRecord(); p.PerslEmployment = c.PerslEmployment; p.PerslSalaryType = c.PerslSalaryType; p.PerslWorkingAge = c.PerslWorkingAge; p.PerslYoBirth = c.PerslYoBirth; p.PerslSalary = c.PerslSalary; p.ProductCode = productcode; p.ProductType = producttype; p.PerslSalary = c.PerslSalary; //第一步创建project类放到session中 if (Session[BizCommon.g_SessionName_ApplyProject] != null) Session[BizCommon.g_SessionName_ApplyProject] = null; Session[BizCommon.g_SessionName_ApplyProject] = p; return View("Purchaseloan2"); } } //万一发生异常时,将执行以下代码(即返回第一步页面) //第一步中的下拉选项预加载 ViewBag.PerslEmployment = BizCommon.GetAA10Items("sPerslEmployment", "cast(aaa102 as int)"); ViewBag.PerslSalaryType = BizCommon.GetAA10Items("sPerslSalaryType", "cast(aaa102 as int)"); ViewBag.PerslWorkingAge = BizCommon.GetAA10Items("sPerslWorkingAge", "cast(aaa102 as int)"); ViewBag.PerslSalary = BizCommon.GetAA10Items("sPerslSalary", "cast(aaa102 as int)"); return View("Purchaseloan1"); }
public ActionResult Purchaseloan1(string productcode, string producttype) { ViewBag.productcode = productcode; ViewBag.producttype = producttype; //第一步中的下拉选项预加载 ViewBag.PerslEmployment = BizCommon.GetAA10Items("sPerslEmployment", "cast(aaa102 as int)"); ViewBag.PerslSalaryType = BizCommon.GetAA10Items("sPerslSalaryType", "cast(aaa102 as int)"); ViewBag.PerslWorkingAge = BizCommon.GetAA10Items("sPerslWorkingAge", "cast(aaa102 as int)"); ViewBag.PerslSalary = BizCommon.GetAA10Items("sHouseIncome", "cast(aaa102 as int)"); if (Session[BizCommon.g_SessionName_ApplyProject] != null) { //为了防止已填写数据丢失,此处将Session中的内容取出填入 ApplyingRecord p = (Session[BizCommon.g_SessionName_ApplyProject] as ApplyingRecord); PurchaseLoanStep1 m = new PurchaseLoanStep1(); m.PerslEmployment = p.PerslEmployment; //选项 m.PerslSalaryType = p.PerslSalaryType; //选项 m.PerslWorkingAge = p.PerslWorkingAge; //选项 m.PerslYoBirth = p.PerslYoBirth; //选项(但不从数据库中取) m.PerslSalary = p.PerslSalary; return View(m); } else { return View(); } }