Beispiel #1
0
        public ActionResult Index()
        {
            HomeModel model = new HomeModel();

            try
            {
                int tempCount = 0;
                model.Newses = singlePageService.GetSinglePages(EnumEntityType.News.ToString(), null, true, 5, 1, out tempCount);
                model.Demands = demandService.GetDemands(20, 1, out tempCount);
                model.Trades = tradeService.GetTradeList(5, 1, -1, out tempCount);

                //活动
                activityService = new ActivityService();
                model.ActivityList = activityService.QueryActivities(new QueryActivityCriteria
                {
                    PageSize = 10,
                    StartRowIndex = 1,
                    QueryType = -1
                });

            }
            catch (Exception e)
            {
                LogService.Log("首页", e.ToString());
            }

            if (model.Newses == null)
            {
                model.Newses = new List<SinglePage>();
            }

            return View(model);
        }
Beispiel #2
0
        //
        // 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);
        }
Beispiel #3
0
        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);
        }
Beispiel #4
0
 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);
 }
Beispiel #5
0
 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);
 }
Beispiel #6
0
        public ActionResult Index()
        {
            HomeModel model = new HomeModel();

            try
            {
                int tempCount = 0;
                model.Demands = demandService.GetDemands(10, 1, out tempCount);
                //model.Trades = tradeService.GetTradeList(5, 1, -1, out tempCount);

                //活动
                activityService = new ActivityService();
                model.ActivityList = activityService.QueryActivities(new QueryActivityCriteria
                {
                    PageSize = 10,
                    StartRowIndex = 1,
                    QueryType = -1
                });

                model.Right = new Right();
                CommonService commonService = new CommonService();
                model.Right = commonService.GetRight();

            }
            catch (Exception e)
            {
                LogService.Log("移动版首页", e.ToString());
            }

            if (model.Right == null)
            {
                model.Right = new Right();
            }

            return View(model);
        }
Beispiel #7
0
 public ActionResult ShareActivity(Activity activity)
 {
     ShareActivityViewModel model = new ShareActivityViewModel();
     model.ActivityTypes = (new ActivityTypeManager()).GetAllActivityTypes();
     if (!IsUserLogin)
     {
         model.ErrorMsg = "未登录或登录超时";
         model.ErrorCode = "401";
     }
     else
     {
         try
         {
             if (string.IsNullOrEmpty(activity.Title) ||
                 string.IsNullOrEmpty(activity.Description) ||
                 string.IsNullOrEmpty(activity.Adress))
             {
                 model.ErrorMsg = "标题或内容不能为空";
                 model.ErrorCode = "400";
             }
             else
             {
                 ActivityService service = new ActivityService();
                 activity.UserId = UserInfo.UserId;
                 activity.LocationId = Request.Form["LocationId[]"];
                 activity.State = 3;
                 activity.IsFromMobile = true;
                 //activity.Description = Witbird.SHTS.Web.Public.StaticUtility.FilterSensitivewords(activity.Description);
                 activity.ContentStyle = activity.Description;
                 activity.ContentText = activity.Description;
                 service.CreateOrUpdateActivity(activity);
                 model.ErrorMsg = "发布成功!";
                 model.ErrorCode = "200";
                 return RedirectToAction("Index", "Activity", new { Area = "Mobile" });
             }
         }
         catch (Exception e)
         {
             LogService.Log("ShareActivity 出错了!", e.ToString());
         }
     }
     model.Activity = activity;
     return View(model);
 }
Beispiel #8
0
        public ActionResult Show(int id)
        {
            ShowActivityViewModel model = new ShowActivityViewModel();
            try
            {
                ActivityService service = new ActivityService();
                model.Activity = service.GetActivityById(id);

                model.ActivityTypes = (new ActivityTypeManager()).GetAllActivityTypes();
            }
            catch (Exception e)
            {
                LogService.Log("Show Activity出错了!", e.ToString());
            }
            return View(model);
        }
Beispiel #9
0
        public ActionResult SiteSerach(FormCollection form)
        {
            PublicConfig serachConfig = null;
            try
            {
                DateTime LastUpdateTime;
                string result = string.Empty;
                const string http = "http://{0}/";
                string baseroot = string.Format(http, Request.Url.Authority);
                // Use related url instead of full url, becuase always link to PC site when view search result in wechat client.
                //string baseroot = "/";

                serachConfig = GetConfig();

                LastUpdateTime = serachConfig.LastUpdatedTime;
                IndexManager indexManager =
                    new IndexManager(Server.MapPath(IndexPath), Server.MapPath(DictPath));

                List<MetaSource> sourceList = new List<MetaSource>();
                MetaSource source = null;

                int newAddIndex = 0;

                #region 活动

                ActivityService activityService=new ActivityService();
                List<Activity> activities = activityService.QueryActivities(
                    new QueryActivityCriteria
                    {
                        QueryType = 6,
                        LastUpdatedTime = LastUpdateTime,
                        PageSize = int.MaxValue,
                        StartRowIndex = 1,

                    });
                if (activities != null && activities.Count > 0)
                {
                    foreach (Activity n in activities)
                    {
                        source = new MetaSource()
                        {
                            ResourceId = n.Id,
                            Title = n.Title,
                            Time = n.CreatedTime.Value.ToShortDateString(),
                            CreatedTime = n.CreatedTime.Value,
                            ResultType = SearchResultType.Activity,
                            ProvinceId = n.Province,
                            CityId = n.City,
                            AreaId = n.Area
                        };
                        source.Url = GenFullUrl(baseroot, n.Id, "activity");
                        source.Imgs = string.Empty;
                        if (n.ImgUrls != null && n.ImgUrls.Length > 0)
                        {
                            foreach (var img in n.ImgUrls)
                            {
                                source.Imgs = source.Imgs + split + img;
                            }
                            source.Imgs = source.Imgs.TrimStart(split.ToCharArray());
                        }
                        // 过滤内容
                        source.Content = ParseTags(n.ContentStyle);
                        source.CheckFields(baseroot);
                        sourceList.Add(source);
                        newAddIndex++;
                    }
                }

                #endregion

                #region 资源

                ResourceManager resourceManager = new ResourceManager();
                var resources = resourceManager.GetResourcesByTime(LastUpdateTime);
                if (resources != null && resources.Count > 0)
                {
                    foreach (Witbird.SHTS.DAL.New.Resource n in resources)
                    {
                        source = new MetaSource()
                        {
                            ResourceId = n.Id,
                            Title = n.Title,
                            Time = n.LastUpdatedTime.ToShortDateString(),
                            CreatedTime = n.LastUpdatedTime,
                            // 资源存储类型为场地1, 演员2,设备3,其他4
                            ResultType = (SearchResultType)(n.ResourceType - 1),
                            ProvinceId = n.ProvinceId,
                            CityId = n.CityId,
                            AreaId = n.AreaId
                        };
                        source.Url = GenFullUrl(baseroot, n.Id, "Resource");
                        source.Imgs = string.Empty;
                        if (n.ImgUrls != null && n.ImgUrls.Length > 0)
                        {
                            foreach (var img in n.ImgUrls)
                            {
                                source.Imgs = source.Imgs + split + img;
                            }
                            source.Imgs = source.Imgs.TrimStart(split.ToCharArray());
                        }
                        // 过滤内容
                        source.Content = ParseTags(n.Description);
                        source.CheckFields(baseroot);
                        sourceList.Add(source);
                    }
                }

                #endregion

                #region 需求

                DemandManager demandManager = new DemandManager();
                var demands = demandManager.QueryDemandsByTime(LastUpdateTime);
                if (demands != null && demands.Count > 0)
                {
                    foreach (Demand n in demands)
                    {
                        source = new MetaSource()
                        {
                            ResourceId = n.Id,
                            Title = n.Title,
                            Time = n.InsertTime.ToShortDateString(),
                            CreatedTime = n.InsertTime,
                            ResultType = SearchResultType.Demand,
                            ProvinceId = n.Province,
                            CityId = n.City,
                            AreaId = n.Area
                        };
                        source.Url = GenFullUrl(baseroot, n.Id, "Demand");
                        source.Imgs = string.Empty;
                        // 过滤内容
                        source.Content = ParseTags(n.Description);
                        source.CheckFields(baseroot);
                        sourceList.Add(source);
                    }
                }

                #endregion

                indexManager.AddIndexByData(sourceList);
                serachConfig.LastUpdatedTime=DateTime.Now;
                UpdateConfig(serachConfig);
            }
            catch (Exception e)
            {
                LogService.Log("Cretae Serach index", e.ToString());
            }
            return View(serachConfig);
        }
Beispiel #10
0
 public JsonResult UpdateStatus(int id,int sid)
 {
     AjaxResult result=new AjaxResult();
     try
     {
         ActivityService service = new ActivityService();
         service.UpdateActivityStatu(new Activity
         {
             Id=id,
             State = sid
         });
     }
     catch (Exception e)
     {
         LogService.Log("Update Status Activitys 出错了!", e.ToString());
         result.ExceptionInfo = "出错了";
         result.ErrorCode = 102;
     }
     return Json(result);
 }