Example #1
0
        /// <summary>
        /// 处理加精操作加积分
        /// </summary>
        /// <param name="blogThread">日志</param>
        /// <param name="eventArgs">事件</param>
        private void BlogThreadPointModuleForManagerOperation_After(BlogThread blogThread, CommonEventArgs eventArgs)
        {
            NoticeService noticeService = new NoticeService();
            string        pointItemKey  = string.Empty;

            if (eventArgs.EventOperationType == EventOperationType.Instance().SetEssential())
            {
                pointItemKey = PointItemKeys.Instance().EssentialContent();

                PointService pointService = new PointService();
                string       description  = string.Format(ResourceAccessor.GetString("PointRecord_Pattern_" + eventArgs.EventOperationType), "日志", blogThread.ResolvedSubject);
                pointService.GenerateByRole(blogThread.UserId, pointItemKey, description);
                if (blogThread.UserId > 0)
                {
                    Notice notice = Notice.New();
                    notice.UserId             = blogThread.UserId;
                    notice.ApplicationId      = BlogConfig.Instance().ApplicationId;
                    notice.TypeId             = NoticeTypeIds.Instance().Hint();
                    notice.LeadingActor       = blogThread.Author;
                    notice.LeadingActorUrl    = SiteUrls.FullUrl(SiteUrls.FullUrl(SiteUrls.Instance().SpaceHome(blogThread.UserId)));
                    notice.RelativeObjectName = HtmlUtility.TrimHtml(blogThread.Subject, 64);
                    notice.RelativeObjectUrl  = SiteUrls.FullUrl(SiteUrls.Instance().BlogDetail(blogThread.User.UserName, blogThread.ThreadId));
                    notice.TemplateName       = NoticeTemplateNames.Instance().ManagerSetEssential();
                    noticeService.Create(notice);
                }
            }
        }
Example #2
0
        /// <summary>
        /// 公告分页数据
        /// </summary>
        /// <param name="page"></param>
        /// <param name="size"></param>
        /// <returns></returns>
        public ActionResult GetPageData(int page = 1, int size = 10)
        {
            var list      = NoticeService.GetPagesNoTracking(page, size, out int total, n => true, n => n.ModifyDate, false).ToList();
            var pageCount = Math.Ceiling(total * 1.0 / size).ToInt32();

            return(PageResult(list, pageCount, total));
        }
Example #3
0
        public ActionResult Last()
        {
            var notice = NoticeService.Get(n => n.Status == Status.Display, n => n.ModifyDate, false);

            if (notice == null)
            {
                return(ResultData(null, false));
            }

            if (Request.Cookies.TryGetValue("last-notice", out var id) && notice.Id.ToString() == id)
            {
                return(ResultData(null, false));
            }

            notice.ViewCount += 1;
            NoticeService.SaveChanges();
            var dto = notice.Mapper <NoticeDto>();

            Response.Cookies.Append("last-notice", dto.Id.ToString(), new CookieOptions()
            {
                Expires  = DateTime.Now.AddYears(1),
                SameSite = SameSiteMode.Lax
            });
            return(ResultData(dto));
        }
Example #4
0
        public ActionResult Delete(int id)
        {
            var post = NoticeService.GetById(id);

            if (post is null)
            {
                return(ResultData(null, false, "公告已经被删除!"));
            }

            var srcs = post.Content.MatchImgSrcs().Where(s => s.StartsWith("/"));

            foreach (var path in srcs)
            {
                try
                {
                    System.IO.File.Delete(HostEnvironment.WebRootPath + path);
                }
                catch
                {
                }
            }

            bool b = NoticeService.DeleteByIdSaved(id);

            return(ResultData(null, b, b ? "删除成功" : "删除失败"));
        }
Example #5
0
        /// <summary>
        /// 首页
        /// </summary>
        /// <returns></returns>
        public ActionResult Index()
        {
            WebLanguage lang     = XFrontContext.Current.Language;
            string      viewName = string.Format("Index_{0}", lang.ToString());

            if (lang == WebLanguage.zh_cn)
            {
                //显示启用的以及未删除的
                ViewBag.ProductService = CategoryService.ListByParentId(4).Where(p => (p.IsEnabled == true && p.IsDeleted == false)).ToList();


                ViewBag.CompanyNews = ArticleService.ListWithoutPageV2("新闻中心/公司新闻", 7, lang);

                ViewBag.IndustryNews = ArticleService.ListWithoutPageV2("新闻中心/行业新闻", 7, lang);

                ViewBag.FocusImageList = ArticleService.ListWithoutPageV2("首页设置/焦点图片", 4, lang);

                ViewBag.Business = ArticleService.ListWithoutPageV2("企业业绩", 7, lang);

                ViewBag.NoticeList = NoticeService.List();
            }
            if (lang == WebLanguage.en)
            {
                ViewBag.ProductService = CategoryService.ListByParentId(110).Where(p => (p.IsEnabled == true && p.IsDeleted == false)).ToList();
            }
            return(View(viewName));
        }
Example #6
0
        public ActionResult GongGao_xq(int gonggaoId)
        {
            HomeViewModel homeViewModel = new HomeViewModel();

            homeViewModel.Notices = NoticeService.GetEntities(b => b.Id == gonggaoId);
            return(View(homeViewModel));
        }
Example #7
0
        public ActionResult GongGao()
        {
            HomeViewModel homeViewModel = new HomeViewModel();

            homeViewModel.Notices = NoticeService.GetEntities(/*3, 1, false,*/ n => true /*, n => n.ModiTime*/);
            return(View(homeViewModel));
        }
 /// <summary>
 /// 最新公告
 /// </summary>
 /// <param name="noteresult"></param>
 /// <returns></returns>
 public ActionResult NoticeResult(int noteresult)
 {
     // int noteresult  获取最新的几条
     //倒序获取3条公告
     viewModel.Notices = NoticeService.GetEntitiesByPage(3, 1, true, r => true, r => r.ModiTime);
     return(View(viewModel));
 }
Example #9
0
 public NoticeController(NoticeRepository noticeRepo, NoticeService noticeService, IMapper mapper, PaginatedMetaService paginatedMetaService, FileHelper fileHelper)
 {
     _noticeRepo           = noticeRepo;
     _noticeService        = noticeService;
     _mapper               = mapper;
     _paginatedMetaService = paginatedMetaService;
     _fileHelper           = fileHelper;
 }
Example #10
0
        public ActionResult Index(int page = 1, int size = 10)
        {
            var list = NoticeService.GetPages <DateTime, NoticeOutputDto>(page, size, out var total, n => n.Status == Status.Display, n => n.ModifyDate, false).ToList();

            ViewBag.Total    = total;
            ViewData["page"] = new Pagination(page, size);
            return(CurrentUser.IsAdmin ? View("Index_Admin", list) : View(list));
        }
Example #11
0
        public async Task <ActionResult> Write(Notice notice)
        {
            notice.Content = await ImagebedClient.ReplaceImgSrc(notice.Content.ClearImgAttributes());

            Notice e = NoticeService.AddEntitySaved(notice);

            return(e != null?ResultData(null, message : "发布成功") : ResultData(null, false, "发布失败"));
        }
        private void FrmNotice_Load(object sender, EventArgs e)
        {
            List <Notice> notices = new NoticeService().SelectNoticeAll();

            notices.ForEach(source =>
            {
                dgvNoticeList.Items.Add(source.NoticeNo + ":" + source.Noticetheme);
            });
        }
        public ActionResult Index()
        {
            PageVM <NoticeVM> data = new NoticeService().GetNoticeListPage(new NoticeQuery()
            {
                PageSize = 6
            });

            return(View(data));
        }
Example #14
0
        public async Task <ActionResult> ChangeState(int id)
        {
            var notice = await NoticeService.GetByIdAsync(id) ?? throw new NotFoundException("公告未找到");

            notice.NoticeStatus = notice.NoticeStatus == NoticeStatus.Normal ? NoticeStatus.Expired : NoticeStatus.Normal;
            var b = await NoticeService.SaveChangesAsync() > 0;

            return(ResultData(null, b, notice.NoticeStatus == NoticeStatus.Normal ? $"【{notice.Title}】已上架!" : $"【{notice.Title}】已下架!"));
        }
Example #15
0
        public ActionResult Index()
        {
            PageVM <NoticeVM> data = new NoticeService().GetNoticeListPage(new NoticeQuery()
            {
                PageSize = 8
            });

            ViewBag.UserData = this.UserData;
            return(View(data));
        }
        public JsonResult GetList()
        {
            var offset = RequestHelper.GetInt("offset");
            var limit  = RequestHelper.GetInt("limit");
            var key    = RequestHelper.GetValue("search");
            int total;
            var list = NoticeService.GetList(offset, limit, out total, key);

            return(Json(new { rows = list, total = total }, JsonRequestBehavior.AllowGet));
        }
Example #17
0
        public ActionResult Details(int id)
        {
            Notice notice = NoticeService.GetById(id);

            if (notice != null)
            {
                return(View(notice));
            }
            return(RedirectToAction("Index"));
        }
Example #18
0
 // GET: Home
 public ActionResult Index()
 {
     Session["Custid"]         = 1;
     homeviewmodel.Banners     = BannerService.GetEntities(b => true);
     homeviewmodel.NoticeNum   = NoticeService.GetCount(b => true);
     homeviewmodel.Notice      = NoticeService.GetEntitiesByPage(3, 1, false, n => true, n => n.ModiTime);
     homeviewmodel.NewProduct  = ProductService.GetEntitiesByPage(5, 1, false, n => n.Type == 1 && n.Grounding == true, n => n.ModiTime);
     homeviewmodel.ShoppingNum = ShoppingCartService.GetCount(s => s.CusId == (int)Session["Custid"]);
     return(View(homeviewmodel));
 }
Example #19
0
        private void btnUpLoad_Click(object sender, EventArgs e)
        {
            if (CheckInput(rtbNoticeContent.Html))
            {
                Notice notice = new Notice()
                {
                    NoticeNo      = new CounterHelper().GetNewId("NoticeId"),
                    Noticetheme   = txtNoticeTheme.Text.Trim(),
                    NoticeContent = rtbNoticeContent.Html,
                    NoticeTime    = dtpUpLoadDate.Value,
                    NoticeClub    = cboSelectClub.SelectedValue.ToString(),
                    datains_usr   = AdminInfo.Account,
                    datains_date  = DateTime.Now
                };

                switch (cbNoticeType.Text)
                {
                case "人事变动":
                    notice.NoticeTypeName = "PersonnelChanges";
                    break;

                case "普通公告":
                    notice.NoticeTypeName = "GeneralNotice";
                    break;
                }

                bool n = new NoticeService().InsertNotice(notice);
                MessageBox.Show("上传成功!");
                #region 获取添加操作日志所需的信息
                OperationLog o = new OperationLog();
                o.OperationTime    = DateTime.Parse(DateTime.Now.ToString("yyyy-MM-dd,HH:mm:ss"));
                o.Operationlog     = AdminInfo.Account + AdminInfo.Name + "于" + DateTime.Now + "进行了上传公告操作!编号为:" + notice.NoticeNo;
                o.OperationAccount = AdminInfo.Account + AdminInfo.Name;
                o.datains_usr      = AdminInfo.Account;
                o.datains_date     = DateTime.Now;
                #endregion
                new OperationlogService().InsertOperationLog(o);
            }
            else
            {
                UIMessageBox.ShowWarning("含有非法操作字符!");
                return;
            }
            foreach (Control Ctrol in this.Controls)
            {
                if (Ctrol is TextBox)
                {
                    Ctrol.Text = "";
                }
                if (Ctrol is KSharpEditor.KEditor)
                {
                    Ctrol.Text = "";
                }
            }
        }
        private void dgvNoticeList_ItemClick(object sender, EventArgs e)
        {
            //根据:来分割字符串并返回第一项数据即为公告编号
            var    str    = dgvNoticeList.SelectedItem.ToString().Split(":").First();
            Notice notice = new NoticeService().SelectNoticeByNoticeNo(str);

            if (notice != null)
            {
                rtbNoticeContent.Html = notice.NoticeContent;
            }
        }
 /// <summary>
 /// 首页显示
 /// </summary>
 /// <param name="proid"></param>
 /// <returns></returns>
 public ActionResult Index(int proid = 1)
 {
     homeViewModel.NoticeNum = NoticeService.GetCount(n => true);                                                    //公告个数
     homeViewModel.Banners   = BannerService.GetEntities(b => true);                                                 //banner
     homeViewModel.Notices   = NoticeService.GetEntitiesByPage(3, 1, false, m => true, m => m.ModiTime);             //公告
     homeViewModel.Products  = ProductService.GetEntitiesByPage(3, 1, false, p => p.Type == proid, p => p.Moditime); //商品
     homeViewModel.Proid     = proid;                                                                                //热销,推荐,限时
     //addCus(Session["userinfo"] as OAuthUserInfo);//授权登陆
     Session["usid"] = 2;
     return(View(homeViewModel));
 }
Example #22
0
        public ActionResult Index()
        {
            HomeViewModel homeViewModel = new HomeViewModel();

            homeViewModel.NoticeNum = NoticeService.GetCount(n => true);
            homeViewModel.Notices   = NoticeService.GetEntitiesByPage(3, 1, false, n => true, n => n.ModiTime);
            homeViewModel.Banners   = BannerService.GetEntities(b => true);
            homeViewModel.Products  = ProductService.GetEntitiesByPage(3, 1, false, p => p.Type == 1, p => p.ModiTime);

            return(View(homeViewModel));
        }
Example #23
0
        /// <summary>
        /// 老師更新點名簽到記錄
        /// </summary>
        /// <param name="learningId">學習圈Id</param>
        /// <param name="token">老師token</param>
        /// <param name="eventId">點名活動Guid</param>
        /// <param name="studId">被編輯點名狀態的學生MemberId</param>
        /// <param name="status">點名狀態 1出席,2缺席,3遲到,4早退,5請假</param>
        /// <returns></returns>
        public async Task SignIn_Modify(string circleKey, Guid token, string outerKey, int stuId, int status)
        {
            try
            {
                var auth = new ServerCheckItem()
                {
                    OuterKey = outerKey, CircleKey = circleKey, ModuleFun = SignInFunction.Admin
                };
                bool chekc = AuthCheck(token, ref auth);
                if (chekc)
                {
                    if (auth.ModuleAuth)
                    {
                        if (AttendanceState.Status.ContainsKey(status.ToString()))
                        {
                            // 更新點名紀錄
                            var log = signInLogService.UpdateLog(auth.MemberId, auth.EventId, stuId, status.ToString());

                            // 新增一筆通知
                            string stateName     = AttendanceState.GetStateName(status.ToString());
                            string text          = "您的狀態已更新:" + stateName;
                            var    noticeService = new NoticeService();
                            noticeService.AddNoticeSaveChange(circleKey, stuId, auth.EventId, text);
                            var signalrService = new SignalrService();
                            //發通知給學生
                            var connectIdAndNoticeData = signalrService.GetConnectIdAndData(circleKey.ToLower(), log.StuId, SignalrConnectIdType.One, SignalrDataType.Notice);

                            SignalrClientHelper.SendNotice(connectIdAndNoticeData);
                            //告訴同學點名狀態已改變
                            Clients.Group(circleKey.ToLower()).signIn_StatusChanged(outerKey, log);

                            // 發送推播
                            await PushOnChangedSignIn(circleKey.ToLower(), auth.EventId, log.StudId, stateName);
                        }
                        else
                        {
                            Clients.Caller.onError("SignIn_Modify", "狀態錯誤!");
                        }
                    }
                    else
                    {
                        Clients.Caller.onError("SignIn_Modify", "您沒有權限!");
                    }
                }
                else
                {
                    Clients.Caller.onError("SignIn_Modify", "身分驗證失敗,請重新登入!token:[" + token + "]");
                }
            }
            catch (Exception ex)
            {
                Clients.Caller.onError("SignIn_Modify", "老師點名發生意外: " + ex.Message);
            }
        }
 public FacebookMessagesService(INotices noticeProxy)
 {
     _noticeService          = new NoticeService();
     _friendManager          = new FriendManager();
     _accountManager         = new AccountManager();
     _accountSettingsManager = new AccountSettingsManager();
     _seleniumManager        = new SeleniumManager();
     _notice = noticeProxy;
     _facebookStatusManager = new FacebookStatusManager();
     _messageManager        = new MessageManager();
 }
Example #25
0
        public JsonResult GetPushMessages()
        {
            var messages = new NoticeService().GetLastNotices(5);

            var result = JsonConvert.SerializeObject(messages);

            return(new JsonResult
            {
                Data = result
            });
        }
Example #26
0
        /// <summary>
        /// 公告详情
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public ActionResult Get(int id)
        {
            Notice notice = NoticeService.GetById(id);

            if (HttpContext.Session.Get("notice" + id) is null)
            {
                notice.ViewCount++;
                NoticeService.UpdateEntitySaved(notice);
                HttpContext.Session.Set("notice" + id, id.GetBytes());
            }
            return(ResultData(notice.MapTo <NoticeOutputDto>()));
        }
Example #27
0
        public async Task <ActionResult> Edit(Notice notice)
        {
            Notice entity = NoticeService.GetById(notice.Id);

            entity.ModifyDate = DateTime.Now;
            entity.Title      = notice.Title;
            entity.Content    = await _imagebedClient.ReplaceImgSrc(notice.Content.ClearImgAttributes());

            bool b = NoticeService.UpdateEntitySaved(entity);

            return(ResultData(null, b, b ? "修改成功" : "修改失败"));
        }
Example #28
0
        /// <summary>
        /// 公告分页数据
        /// </summary>
        /// <param name="page"></param>
        /// <param name="size"></param>
        /// <returns></returns>
        public ActionResult GetPageData([Range(1, int.MaxValue, ErrorMessage = "页码必须大于0")] int page = 1, [Range(1, 50, ErrorMessage = "页大小必须在0到50之间")] int size = 15)
        {
            var list = NoticeService.GetPagesNoTracking(page, size, n => true, n => n.ModifyDate, false);

            foreach (var n in list.Data)
            {
                n.ModifyDate = n.ModifyDate.ToTimeZone(HttpContext.Session.Get <string>(SessionKey.TimeZone));
                n.PostDate   = n.PostDate.ToTimeZone(HttpContext.Session.Get <string>(SessionKey.TimeZone));
            }

            return(Ok(list));
        }
        public ActionResult Get(int id)
        {
            var notice = NoticeService.Get <NoticeDto>(n => n.Id == id);

            if (notice != null)
            {
                notice.ModifyDate = notice.ModifyDate.ToTimeZone(HttpContext.Session.Get <string>(SessionKey.TimeZone));
                notice.PostDate   = notice.PostDate.ToTimeZone(HttpContext.Session.Get <string>(SessionKey.TimeZone));
            }

            return(ResultData(notice));
        }
        public async Task <ActionResult> Edit(Notice notice)
        {
            var entity = await NoticeService.GetByIdAsync(notice.Id) ?? throw new NotFoundException("公告已经被删除!");

            entity.ModifyDate = DateTime.Now;
            entity.Title      = notice.Title;
            entity.Content    = await ImagebedClient.ReplaceImgSrc(notice.Content.ClearImgAttributes());

            bool b = await NoticeService.SaveChangesAsync() > 0;

            return(ResultData(null, b, b ? "修改成功" : "修改失败"));
        }
Example #31
0
        public JsonResult IsExistsFinishedGame()
        {
            bool result = false;
            var memberId = this.GetMemberId();
            var systemDatetimeService = new SystemDatetimeService();
            var noticeService = new NoticeService(this.com, systemDatetimeService);
            var fromDate = Utils.GetStartOfDay(systemDatetimeService.SystemDate.AddDays(-1));
            var toDate = Utils.GetEndOfDay(systemDatetimeService.SystemDate);

            result = noticeService.NoticeExpectedGameInfo(memberId, fromDate, toDate, memberId);

            return Json(result, JsonRequestBehavior.AllowGet);
        }