public ActionResult AddParam() { string SnNum = WebUtil.GetQueryStringValue <string>("SnNum", string.Empty); List <ReportParamsEntity> listSource = Session[SessionKey.SESSION_REPORT_DETAIL] as List <ReportParamsEntity>; ReportParamsEntity entity = null; if (!listSource.IsNullOrEmpty()) { entity = listSource.FirstOrDefault(a => a.SnNum == SnNum); } if (entity == null) { entity = new ReportParamsEntity(); } ViewBag.ParamType = DropDownHelper.GetDataType(entity.ParamType); entity.ParamElement = entity.ParamElement.IsEmpty() ? ((int)EElementType.TextBox).ToString() : entity.ParamElement; ViewBag.ParamElement = EnumHelper.GetOptions <EElementType>(entity.ParamElement); ViewBag.Entity = entity; return(View()); }