public ActionResult Homeloan1(HomeLoanStep1 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).HouseIncome = c.HouseIncome; (Session[BizCommon.g_SessionName_ApplyProject] as ApplyingRecord).HouseLocalorNot = c.HouseLocalorNot; (Session[BizCommon.g_SessionName_ApplyProject] as ApplyingRecord).HouseNew = c.HouseNew; (Session[BizCommon.g_SessionName_ApplyProject] as ApplyingRecord).HouseType = c.HouseType; (Session[BizCommon.g_SessionName_ApplyProject] as ApplyingRecord).ProductCode = productcode; (Session[BizCommon.g_SessionName_ApplyProject] as ApplyingRecord).ProductType = producttype; return View("Homeloan2"); } else { //否则,新创建一个申请对象,并将本步骤取得值赋到新的对象上,然后将对象放到session中; ApplyingRecord p = new ApplyingRecord(); p.HouseIncome = c.HouseIncome; p.HouseLocalorNot = c.HouseLocalorNot; p.HouseNew = c.HouseNew; p.HouseType = c.HouseType; 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("Homeloan2"); } } //万一发生异常时,将执行以下代码(即返回第一步页面) //第一步中的下拉选项预加载 ViewBag.HouseLocalorNot = BizCommon.GetAA10Items("sHouseLocalorNot", "cast(aaa102 as int)"); ViewBag.HouseNew = BizCommon.GetAA10Items("sHouseNew", "cast(aaa102 as int)"); ViewBag.HouseType = BizCommon.GetAA10Items("sHouseType", "cast(aaa102 as int)"); return View("Homeloan1"); }
public ActionResult Homeloan1(string productcode, string producttype) { ViewBag.productcode = productcode; ViewBag.producttype = producttype; //第一步中的下拉选项预加载 ViewBag.HouseLocalorNot = BizCommon.GetAA10Items("sHouseLocalorNot", "cast(aaa102 as int)"); ViewBag.HouseNew = BizCommon.GetAA10Items("sHouseNew", "cast(aaa102 as int)"); ViewBag.HouseType = BizCommon.GetAA10Items("sHouseType", "cast(aaa102 as int)"); if (Session[BizCommon.g_SessionName_ApplyProject] != null) { //为了防止已填写数据丢失,此处将Session中的内容取出填入 ApplyingRecord p = (Session[BizCommon.g_SessionName_ApplyProject] as ApplyingRecord); HomeLoanStep1 m = new HomeLoanStep1(); m.HouseIncome = p.HouseIncome; //输入 m.HouseLocalorNot = p.HouseLocalorNot; //选项 m.HouseNew = p.HouseNew; //选项 m.HouseType = p.HouseType; //选项 return View(m); } else { return View(); } }