// // GET: /M/Activity/ public ActionResult Index(int page = 1) { ActivitysViewModel model = new ActivitysViewModel(); try { ActivityService service = new ActivityService(); QueryActivityCriteria queryActivityCriteria = new QueryActivityCriteria { PageSize = 10, StartRowIndex = page, QueryType = -1 }; model.ActivityList = service.QueryActivities(queryActivityCriteria); if (model.ActivityList != null) { model.TotalCount = queryActivityCriteria.ResultTotalCount; } model.PageSize = 10; model.PageStep = 5; model.PageIndex = page; model.ActivityTypes = (new ActivityTypeManager()).GetAllActivityTypes(); } catch (Exception e) { LogService.Log("Activitys List 出错了!", e.ToString()); } return View(model); }
public ActionResult Show(int id) { ShowActivityViewModel model = new ShowActivityViewModel(); try { ActivityService service = new ActivityService(); model.Activity = service.GetActivityById(id); QueryActivityCriteria queryActivityCriteria = new QueryActivityCriteria { PageSize = 6, StartRowIndex = 1, QueryType = -1 }; model.ActivityList = service.QueryActivities(queryActivityCriteria); queryActivityCriteria.PageSize = 8; queryActivityCriteria.QueryType = 4; queryActivityCriteria.StartRowIndex = 1; model.PreTypeActivityList = service.QueryActivities(queryActivityCriteria); model.ActivityTypes = (new ActivityTypeManager()).GetAllActivityTypes(); } catch (Exception e) { LogService.Log("Show Activity出错了!", e.ToString()); } return View(model); }
public ActionResult TongJi(int page = 1, string Keyword = "", string StartTime = "", string EndTime = "") { ActivitysViewModel model = new ActivitysViewModel(); try { ActivityService service = new ActivityService(); QueryActivityCriteria queryActivityCriteria = new QueryActivityCriteria { PageSize = 35, StartRowIndex = page, QueryType = 7, Keyword = Keyword, StartTime = string.IsNullOrWhiteSpace(StartTime) ? new DateTime(2014,1,1) : Convert.ToDateTime(StartTime), EndTime = string.IsNullOrWhiteSpace(EndTime) ? DateTime.Now : Convert.ToDateTime(EndTime) }; model.ActivityList = service.QueryActivities(queryActivityCriteria); if (model.ActivityList != null) { model.TotalCount = queryActivityCriteria.ResultTotalCount; } model.StartTime = queryActivityCriteria.StartTime.Value; model.EndTime = queryActivityCriteria.EndTime.Value; model.PageSize = queryActivityCriteria.PageSize; model.PageIndex = queryActivityCriteria.StartRowIndex; model.PageStep = 5; model.ActivityTypes = (new ActivityTypeManager()).GetAllActivityTypes(); } catch (Exception e) { LogService.Log("Activitys TongJi 出错了!", e.ToString()); } return View(model); }
public ActionResult Index(int page = 1, string Status="") { ActivitysViewModel model = new ActivitysViewModel(); try { ActivityService service = new ActivityService(); QueryActivityCriteria queryActivityCriteria = new QueryActivityCriteria { PageSize = 35, StartRowIndex = page, QueryType = 5, Status = string.IsNullOrEmpty(Status) ? "0,2,3,4":Status }; model.ActivityList = service.QueryActivities(queryActivityCriteria); if (model.ActivityList != null) { model.TotalCount = queryActivityCriteria.ResultTotalCount; } model.PageSize = queryActivityCriteria.PageSize; model.PageIndex = queryActivityCriteria.StartRowIndex; model.PageStep = 5; model.ActivityTypes = (new ActivityTypeManager()).GetAllActivityTypes(); } catch (Exception e) { LogService.Log("Activitys List 出错了!", e.ToString()); } ViewBag.Status = Status; return View(model); }
/// <summary> /// 查询 /// </summary> /// <param name="conn"></param> /// <param name="Criteria"></param> /// <returns></returns> public List<Activity> QueryActivities(QueryActivityCriteria Criteria) { List<Activity> activitys = null; var conn = DBHelper.GetSqlConnection(); try { conn.Open(); activitys = activityDao.QueryActivities(conn, Criteria); } catch (Exception e) { LogService.Log("QueryActivities失败--" + e.Message, e.ToString()); } finally { conn.Close(); } return activitys; }
/// <summary> /// 查询 /// </summary> /// <param name="conn"></param> /// <param name="Criteria"></param> /// <returns></returns> public List<Activity> QueryActivities(SqlConnection conn, QueryActivityCriteria Criteria) { List<Activity> activities = new List<Activity>(); SqlParameter[] sqlParameters = new SqlParameter[] { new SqlParameter("@ActivityType", Criteria.ActivityType), new SqlParameter("@EndTime", Criteria.EndTime), new SqlParameter("@PageSize", Criteria.PageSize), new SqlParameter("@QueryType", Criteria.QueryType), new SqlParameter("@StartRowIndex", Criteria.StartRowIndex), new SqlParameter("@StartTime", Criteria.StartTime), new SqlParameter("@cityid", Criteria.cityid), new SqlParameter("@UserId", Criteria.UserId), new SqlParameter("@Status", Criteria.Status), new SqlParameter("@LastUpdatedTime", Criteria.LastUpdatedTime), new SqlParameter("@keywors", Criteria.Keyword) }; DBHelper.CheckSqlSpParameter(sqlParameters); SqlDataReader reader = DBHelper.RunProcedure(conn, sp_QueryActivitys, sqlParameters); while (reader.Read()) { activities.Add(ConvertToActivityObject(reader)); } if (reader.NextResult()) { while (reader.Read()) { Criteria.ResultTotalCount = reader[Constants.column_totalCount].DBToInt32(); } } if (reader != null) { reader.Close(); } return activities; }