123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129 |
- using Bowin.Web.Controls.Mvc;
- using EMIS.CommonLogic.SystemServices;
- using EMIS.Entities;
- using EMIS.ViewModel;
- using EMIS.ViewModel.SystemView;
- using EMIS.Web.Controls;
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Web;
- using System.Web.Mvc;
- namespace EMIS.Web.Controllers.ProjectShareManage
- {
- [Authorization]
- public class ProjectInformationController : Controller
- {
- public IAnnouncementServices AnnouncementServices { get; set; }
- /// <summary>
- /// 项目资讯页面
- /// </summary>
- /// <returns></returns>
- public ActionResult List()
- {
- return View();
- }
- [HttpPost]
- public ActionResult List(QueryParamsModel pararms)
- {
- ConfiguretView configuretView = ConfiguretExtensions.GetConfiguretermsView(pararms);
- //避开全选值
- if (configuretView.Attribute == DropdownList.SELECT_ALL.ToString()) configuretView.Attribute = "";
- List<AnnouncementTypeView> typeList = AnnouncementServices.GetUsableAnnouncementTypeViewList().ToList();
- var type = typeList.Where(x => x.No == "05").FirstOrDefault();
- Guid? typeID = null;
- if (type != null)
- {
- typeID = type.AnnouncementTypeID;
- }
- return base.Json(AnnouncementServices.GetAnnouncementViewList(configuretView, (int)pararms.page, (int)pararms.rows, typeID));
- }
- [HttpGet]
- public ActionResult Edit(Guid? announcementID)
- {
- AnnouncementView announcementView = new AnnouncementView();
- if (announcementID != null && announcementID != Guid.Empty)
- {
- announcementView = AnnouncementServices.GetAnnouncementViewInfo(announcementID);
- }
- List<AnnouncementTypeView> typeList = AnnouncementServices.GetUsableAnnouncementTypeViewList().ToList();
- var type = typeList.Where(x => x.No == "05").FirstOrDefault();
- Guid? typeID = null;
- if (type != null)
- {
- typeID = type.AnnouncementTypeID;
- }
- announcementView.AnnouncementTypeID = typeID;
- return View(announcementView);
- }
- /// <summary>
- /// 保存
- /// </summary>
- /// <returns></returns>
- [HttpPost]
- public ActionResult Edit(AnnouncementView announcementView)
- {
- try
- {
- var roleList = DataGrid.GetTableData<RoleView>("dgRoleList");
- var userList = DataGrid.GetTableData<StudentUserView>("dgUserList");
- var roleIDList = roleList.Select(x => (Guid?)x.RoleID).ToList();
- var userIDList = userList.Select(x => (Guid?)x.UserID).ToList();
- var msg = "";
- Sys_Announcement Announcement = AnnouncementServices.Save(announcementView, roleIDList, userIDList);
- //if (announcementView.IsSendWXEdit)
- //{
- // var openIDList = WechatMPServices.GetOpenIDList(roleIDList, userIDList);
- // openIDList.Remove("null");
- // //暂时不考虑针对角色发送的消息
- // if (openIDList.Count() < userIDList.Count())
- // {
- // msg = "但有部分学生未在微信端登陆或未关注公众号,无法发送消息给他们!";
- // }
- // WechatHelper.SendAnnouncement(announcementView.Title, announcementView.textContent, openIDList, null, Announcement.CreateTime);
- //}
- return Json(new ReturnMessage()
- {
- IsSuccess = true,
- Message = "保存成功!" + msg
- });
- }
- catch (Exception ex)
- {
- return Json(new ReturnMessage()
- {
- IsSuccess = false,
- Message = "保存失败:" + ex.Message
- });
- }
- }
- /// <summary>
- /// 删除
- /// </summary>
- /// <param name="roleID"></param>
- /// <returns></returns>
- [HttpPost]
- public ActionResult Delete(string announcementIDs)
- {
- try
- {
- var announcementIDList = announcementIDs.Split(',').Select(x => (Guid?)new Guid(x)).ToList();
- AnnouncementServices.Delete(announcementIDList);
- return base.Json("删除成功!");
- }
- catch (Exception ex)
- {
- return base.Json("删除失败,原因:" + ex.Message + "。");
- }
- }
- }
- }
|