public ActionResult SearchPhoneBook(PhoneBookViewModel viewModel) { string sqlWhereString; string sqlAndString; if (viewModel.ColValue == "" || viewModel.ColValue.Length == 0) { sqlWhereString = " 1= 1"; } else { sqlWhereString = "zza04 LIKE '%" + viewModel.ColValue + "%' "; } if (viewModel.Zza06 == "" || viewModel.Zza06 == null) { sqlAndString = ""; } else { sqlAndString = " zza06 = '" + viewModel.Zza06 + "' "; } PhoneBookSQLConnector phoneBookSQLConnector = new PhoneBookSQLConnector(); PhoneBookViewModel phoneBookViewModel = new PhoneBookViewModel(); phoneBookViewModel.UserBasicDataList = phoneBookSQLConnector.GetUserBasicDataByCriteria(sqlWhereString, sqlAndString); phoneBookViewModel.SelectListItems = phoneBookSQLConnector.getOfficeItem(); TempData["phoneBookViewModel"] = phoneBookViewModel; return(Redirect("BackToPhoneBookSearch")); }
public ActionResult HR(PhoneBookViewModel viewModel) { if (!ModelState.IsValid) { return(View("PhoneBook/PhoneBookSearch")); } TempData["LastPostFormData"] = viewModel; string sqlWhereString; string sqlAndString; if (viewModel.ColValue == "" || viewModel.ColValue == null) { sqlWhereString = " zza06 LIKE '%" + viewModel.Zza06 + "910100' "; } else { sqlWhereString = "zza04 LIKE '%" + viewModel.ColValue + "%' "; } if (viewModel.Zza06 == "" || viewModel.Zza06 == null) { sqlAndString = ""; } else { sqlAndString = " zza06 = '" + viewModel.Zza06 + "' "; } PhoneBookSQLConnector phoneBookSQLConnector = new PhoneBookSQLConnector(); PhoneBookViewModel phoneBookViewModel = new PhoneBookViewModel(); phoneBookViewModel.UserBasicDataList = phoneBookSQLConnector.GetUserBasicDataByCriteria(sqlWhereString, sqlAndString); phoneBookViewModel.SelectListItems = phoneBookSQLConnector.getOfficeItem(); TempData["phoneBookViewModel"] = phoneBookViewModel; return(Redirect("BackToPhoneBookSearch")); }
public ActionResult SearchPhoneBookButton(string Zza06) { string sqlAndString; if (Zza06 == "" || Zza06 == null) { sqlAndString = ""; } else { sqlAndString = " zza06 = '" + Zza06 + "' "; } PhoneBookSQLConnector phoneBookSQLConnector = new PhoneBookSQLConnector(); PhoneBookViewModel phoneBookViewModel = new PhoneBookViewModel(); phoneBookViewModel.UserBasicDataList = phoneBookSQLConnector.GetUserBasicDataByCriteria(" 1=1 ", sqlAndString); phoneBookViewModel.SelectListItems = phoneBookSQLConnector.getOfficeItem(); TempData["phoneBookViewModel"] = phoneBookViewModel; return(Redirect("BackToPhoneBookSearch")); }