public ActionResult ParamSearchList(string ProjectName, string MediaType, string Type, int PageIndex, int PageSize) { if (Request.IsAjaxRequest()) { Loger.Current.Write("MyViewTaskProjectController.ParamSearchList() PageIndex=" + PageIndex + ",PageSize=" + PageSize); if (string.IsNullOrEmpty(Type)) { Type = "In"; } string relation = "0";//All string status = "1"; switch (Type) { case "In": relation = "0"; ViewBag.Relation = "0"; status = "1"; break; case "Upload": relation = "0"; ViewBag.Relation = "0"; status = "2"; break; case "AuditPass": relation = "1"; ViewBag.Relation = "1"; status = "3"; break; case "AuditNoPass": relation = "2"; ViewBag.Relation = "2"; status = "4"; break; case "Overdue": relation = "3"; ViewBag.Relation = "3"; status = "5"; break; } TaskProjectViewModel model = new TaskProjectViewModel(); int CusId = Model.User.GetCusIdByUserId(CurrentUserID); string SqlWhere = " tp.TPId IN (SELECT TPId FROM dbo.TaskProjectUserRelation WHERE (UserId=" + CurrentUserID + " or CusId=" + CusId + ") AND Relation = " + relation + ")"; if (status == "1" || status == "2") { SqlWhere += " AND tp.Status = " + status + ""; } if (!string.IsNullOrEmpty(ProjectName) && ProjectName != "请输入楼宇名称") { SqlWhere += " AND tp.BlockName LIKE '%" + ProjectName + "%'"; } if (MediaType == "WIFI") { SqlWhere += " AND tp.MediaType LIKE '%wifi%'"; } else if (MediaType == "GM") { SqlWhere += " AND tp.MediaType LIKE '%框架%'"; } DataTable dt = Model.User.GetTaskProjectList(CurrentUserID, CusId, SqlWhere, PageIndex, PageSize); if (dt.Rows.Count > 0) { List <TaskProjectListViewModel> taskViewModelList = new List <TaskProjectListViewModel>(); TaskProjectListViewModel taskViewModel = null; foreach (DataRow dr in dt.Rows) { taskViewModel = new TaskProjectListViewModel(); taskViewModel.TPId = ConvertHelper.GetInteger(dr["TPId"]); taskViewModel.StreetAddress = ConvertHelper.GetString(dr["StreetAddress"]); taskViewModel.AreaName = ConvertHelper.GetString(dr["AreaName"]); taskViewModel.RegionId = ConvertHelper.GetString(dr["RegionId"]); taskViewModel.AreaName = ConvertHelper.GetString(dr["AreaName"]); taskViewModel.BlockName = ConvertHelper.GetString(dr["BlockName"]); taskViewModel.PointName = ConvertHelper.GetString(dr["PointName"]); taskViewModel.MediaType = ConvertHelper.GetString(dr["MediaType"]); taskViewModel.AdProductName = ConvertHelper.GetString(dr["AdProductName"]); taskViewModel.BeginDate = ConvertHelper.GetShortDateString(dr["BeginDate"]); taskViewModel.EndDate = ConvertHelper.GetShortDateString(dr["EndDate"]); taskViewModel.PhotoRequire = ConvertHelper.GetString(dr["PhotoRequire"]); taskViewModel.Status = ConvertHelper.GetInteger(dr["Status"]); taskViewModel.Price = ConvertHelper.GetInteger(dr["Price"]); taskViewModel.AuditReason = ConvertHelper.GetString(dr["AuditReason"]); taskViewModel.ImgPath = ConvertHelper.GetString(dr["ImgPath"]); taskViewModelList.Add(taskViewModel); } model.TaskProjectList = taskViewModelList; return(PartialView("_List", model)); } else { return(Json("", JsonRequestBehavior.AllowGet)); } } else { return(Json("err", JsonRequestBehavior.AllowGet)); } }
public ActionResult ParamSearchList(string RegionId, string AreaName, string ProjectName, string Type, int PageIndex, int PageSize) { if (Request.IsAjaxRequest()) { Loger.Current.Write("ViewTaskProjectController.ParamSearchList() PageIndex=" + PageIndex + ",PageSize=" + PageSize); TaskProjectViewModel model = new TaskProjectViewModel(); string SqlWhere = " t.Status in (1,2) AND tp.Status=0"; if (!string.IsNullOrEmpty(RegionId)) { SqlWhere += " AND tp.RegionId = '" + RegionId + "'"; } if (!string.IsNullOrEmpty(AreaName)) { SqlWhere += " AND tp.AreaName = '" + AreaName + "'"; } if (!string.IsNullOrEmpty(ProjectName) && ProjectName != "请输入楼宇名称") { SqlWhere += " AND (tp.BlockName LIKE '%" + ProjectName + "%' OR t.TaskName LIKE '%" + ProjectName + "%')"; } if (Type == "WIFI") { SqlWhere += " AND tp.MediaType LIKE '%wifi%'"; } else if (Type == "GM") { SqlWhere += " AND tp.MediaType LIKE '%框架%'"; } DataTable dt = Model.User.GetTaskProjectList(SqlWhere, PageIndex, PageSize); if (dt.Rows.Count > 0) { List <TaskProjectListViewModel> taskViewModelList = new List <TaskProjectListViewModel>(); TaskProjectListViewModel taskViewModel = null; foreach (DataRow dr in dt.Rows) { taskViewModel = new TaskProjectListViewModel(); taskViewModel.TId = ConvertHelper.GetInteger(dr["TId"]); taskViewModel.TPId = ConvertHelper.GetInteger(dr["TPId"]); taskViewModel.StreetAddress = ConvertHelper.GetString(dr["StreetAddress"]); taskViewModel.AreaName = ConvertHelper.GetString(dr["AreaName"]); taskViewModel.RegionId = ConvertHelper.GetString(dr["RegionId"]); taskViewModel.AreaName = ConvertHelper.GetString(dr["AreaName"]); taskViewModel.BlockName = ConvertHelper.GetString(dr["BlockName"]); taskViewModel.PointName = ConvertHelper.GetString(dr["PointName"]); taskViewModel.MediaType = ConvertHelper.GetString(dr["MediaType"]); taskViewModel.AdProductName = ConvertHelper.GetString(dr["AdProductName"]); taskViewModel.BeginDate = ConvertHelper.GetShortDateString(dr["BeginDate"]); taskViewModel.EndDate = ConvertHelper.GetShortDateString(dr["EndDate"]); taskViewModel.PhotoRequire = ConvertHelper.GetString(dr["PhotoRequire"]); taskViewModel.Status = ConvertHelper.GetInteger(dr["Status"]); taskViewModel.Price = ConvertHelper.GetInteger(dr["Price"]); taskViewModel.TaskStatus = ConvertHelper.GetInteger(dr["TaskStatus"]); taskViewModelList.Add(taskViewModel); } model.TaskProjectList = taskViewModelList; return(PartialView("_List", model)); } else { return(Json("", JsonRequestBehavior.AllowGet)); } } else { return(Json("err", JsonRequestBehavior.AllowGet)); } }