public ActionResult CustSearch(CustSearchViewModel model) { Result res = TerminalContext.CustSearch(model); if (!res.Succeed) { ViewBag.Result = res.Desc; } return(View(res.Data)); }
// GET: Customer public ActionResult Index(CustSearchViewModel CusSearch, string sortcolumn, int page = 1) { if (string.IsNullOrEmpty(CusSearch.sortcolumn)) { CusSearch.sortcolumn = "cusid"; } ViewBag.NameSortParm = CusSearch.sortcolumn == "name" ? "name_desc" : "name"; //名稱 ViewBag.SerialSortParm = CusSearch.sortcolumn == "serial" ? "serial_desc" : "serial"; //統一編號 ViewBag.TELSortParm = CusSearch.sortcolumn == "tel" ? "tel_desc" : "tel"; ViewBag.FAXSortParm = CusSearch.sortcolumn == "fax" ? "fax_desc" : "fax"; ViewBag.AddressSortParm = CusSearch.sortcolumn == "address" ? "address_desc" : "address"; ViewBag.EmailSortParm = CusSearch.sortcolumn == "email" ? "email_desc" : "email"; ViewBag.CusTypeSortParm = CusSearch.sortcolumn == "custype" ? "custype_desc" : "custype"; //ViewBag.celKeyword = CusSearch.Keyword; //ViewBag.celCusType = CusSearch.客戶分類; //ViewBag.celSort = CusSearch.sortcolumn; CusSearch.CusType = repoCustomer.GetCusType(); CusSearch.Customers = repoCustomer.Search(CusSearch.Keyword, CusSearch.客戶分類, CusSearch.sortcolumn); int pageSize = 3; CusSearch.Customers = CusSearch.Customers.ToPagedList(page, pageSize); return(View(CusSearch)); }
public ActionResult ExcelExport(CustSearchViewModel CusSearch, string sortcolumn, int page = 1) { var data = repoCustomer.Search(CusSearch.Keyword, CusSearch.客戶分類, sortcolumn); return(File(repoCustomer.GenerateDataTable(data), "application/vnd.ms-excel", "customers.xls")); }
public ActionResult CustSearch() { CustSearchViewModel model = new CustSearchViewModel(); return(View(model)); }