private void BindGrid() { NoticeBLL noticeBLL = new NoticeBLL(); DateTime start = new DateTime(2000, 1, 1); DateTime end = new DateTime(2100, 12, 31); if (dateBeginTime.DateValue.ToString() != string.Empty) { start = DateTime.Parse(dateBeginTime.DateValue.ToString()); } if (dateEndTime.DateValue.ToString() != string.Empty) { end = DateTime.Parse(dateEndTime.DateValue.ToString()); } IList <RailExam.Model.Notice> notices = noticeBLL.GetNotices(txtTitle.Text, int.Parse(ddlImportanceName.SelectedValue), txtOrgName.Text, txtEmployeeName.Text, start, end, PrjPub.CurrentLoginUser.IsAdmin, PrjPub.CurrentLoginUser.EmployeeID); if (notices != null) { Grid1.DataSource = notices; Grid1.DataBind(); } }
/// <summary> /// 编辑 /// </summary> /// <param name="pagerParas"></param> /// <returns></returns> public JObject Edit(JObject pagerParas) { NoticeBLL noticeBll = new NoticeBLL(); noticeBll.Add(pagerParas); return(new JObject()); }
public ActionResult PostNotice(Notice model) { NoticeBLL bll = new NoticeBLL(); try { //表单验证 if (isNUll(model.title, model.contents, model.url)) { return(Content("<script> alert('参数不能为空'); location.href = '" + Url.Action("AddItem", "Items") + "'</script>")); //return invildRequest("参数不能为空"); } //主键 Guid guid = Guid.NewGuid(); model.objectId = guid.ToString(); //时间 model.createdAt = DateTime.Now; model.updatedAt = DateTime.Now; bool result = bll.Insert(model); if (result) { return(Content("<script> alert('发布成功'); location.href = '" + Url.Action("AddItem", "Items") + "'</script>")); //return create(model); } return(Content("<script> alert('发布失败'); location.href = '" + Url.Action("AddItem", "Items") + "'</script>")); //return notFound("注册失败"); } catch (Exception e) { return(Content("<script> alert('" + e.Message + "'); location.href = '" + Url.Action("AddItem", "Items") + "'</script>")); //return execept(e.Message); } }
public static List<Notice> GetNoticeList(Notice notice, int PageSize, int PageIndex) { NoticeBLL noticeBLL = new NoticeBLL(); //IES.JW.Model.Notice notice = new IES.JW.Model.Notice(); IES.JW.Model.User user = IES.Service.UserService.CurrentUser; notice.UserID = user.UserID; return noticeBLL.Notice_List(notice, PageIndex, PageSize); }
public static List <Notice> GetNoticeList(Notice notice, int PageSize, int PageIndex) { NoticeBLL noticeBLL = new NoticeBLL(); //IES.JW.Model.Notice notice = new IES.JW.Model.Notice(); IES.JW.Model.User user = IES.Service.UserService.CurrentUser; notice.UserID = user.UserID; return(noticeBLL.Notice_List(notice, PageIndex, PageSize)); }
public async Task <ActionResult <IEnumerable <NoticeDTO> > > Get(int noticeID, int cohortID, int staffID, DateTime validFrom) { // Check if the current user is a staff member (or Super Admin) bool isUserStaff = User.IsInRole("Staff") || User.IsInRole("SuperAdmin"); // Call GetNoticekBLL method with all the parameters object BLLResponse = new NoticeBLL(_context).GetNoticeBLL(noticeID: noticeID, cohortID: cohortID, staffID: staffID, validFrom: validFrom, isUserStaff: isUserStaff); // Get the base class for the response // Ref: https://docs.microsoft.com/en-us/dotnet/api/system.type.basetype?view=netcore-3.1 if (BLLResponse.GetType().BaseType == typeof(Exception)) { // Create log entries for Debug log ((APIException)BLLResponse).Exceptions.ForEach(ex => Logger.Msg <NoticesController>((Exception)ex, Serilog.Events.LogEventLevel.Debug)); // Return response from API return(BadRequest(new { errors = ((APIException)BLLResponse).Exceptions.Select(x => x.Message).ToArray() })); } else { try { NoticeDTO BLLResponseDTO = (NoticeDTO)BLLResponse; // Apply all the criteria with supplied or default values from BLL. Limit Student access to notices issued up to current date. IQueryable <Notice> dbRequest = _context.Notices .Where(x => x.ValidFrom >= BLLResponseDTO.ValidFrom && (isUserStaff || x.ValidFrom <= DateTime.Today)); if (BLLResponseDTO.CohortID != 0) { dbRequest = dbRequest.Where(x => x.CohortID == BLLResponseDTO.CohortID); } if (BLLResponseDTO.StaffID != 0 && isUserStaff) { dbRequest = dbRequest.Where(x => x.StaffID == BLLResponseDTO.StaffID); } List <Notice> dbResponse = await dbRequest.ToListAsync(); // Convert result to TaskDTO List <NoticeDTO> response = new List <NoticeDTO>(); dbResponse.ForEach(x => response.Add(new NoticeDTO(x))); Logger.Msg <NoticesController>($"[{User.FindFirstValue("email")}] [GET] ", Serilog.Events.LogEventLevel.Debug); return(Ok(response)); } catch (Exception ex) { // Local log entry. Database reconciliation issues are more serious so reported as Error Logger.Msg <TasksController>($"[GET] Database sync error {ex.Message}", Serilog.Events.LogEventLevel.Error); // Return response to client return(StatusCode(500, new { errors = "Database update failed. Contact the administrator to resolve this issue." })); } } }// End of Get
public JArray GetInfo() { JArray result = new JArray(); NoticeBLL noticeBll = new NoticeBLL(); var noticeInfos = JsonConvert.SerializeObject(noticeBll.GetAll()); result = JArray.Parse(noticeInfos); return(result); }
public async Task <ActionResult> ModifyNotice([FromBody] NoticeDTO notice) { if (NoticeExists(notice.NoticeID)) { // Call BLL Notice Modify method with all the parameters object BLLResponse = new NoticeBLL(_context).ModifyNoticeBLL(notice: notice, userClaims: User); if (BLLResponse.GetType().BaseType == typeof(Exception)) { // Create log entries for Debug log ((APIException)BLLResponse).Exceptions.ForEach(ex => Logger.Msg <NoticesController>((Exception)ex, Serilog.Events.LogEventLevel.Debug)); // Return response from API return(BadRequest(new { errors = ((APIException)BLLResponse).Exceptions.Select(x => x.Message).ToArray() })); } else { try { NoticeDTO modNotice = (NoticeDTO)BLLResponse; // Find the existing record based on ID Notice currentRecord = _context.Notices.Where(x => x.NoticeID == modNotice.NoticeID).First(); // Modify the record currentRecord.HTML = modNotice.HTML; currentRecord.Markdown = modNotice.Markdown; currentRecord.ValidFrom = modNotice.ValidFrom; currentRecord.StaffID = modNotice.StaffID; // Save changes await _context.SaveChangesAsync(); Logger.Msg <NoticesController>($"[{User.FindFirstValue("email")}] [MODIFY] NoticeID: {currentRecord.NoticeID} successful", Serilog.Events.LogEventLevel.Information); // Return modified record as a DTO NoticeDTO response = new NoticeDTO(currentRecord); return(Ok(response)); } catch (Exception ex) { // Local log entry. Database reconciliation issues are more serious so reported as Error Logger.Msg <TaskTypesController>($"[MODIFY] Database sync error {ex.Message}", Serilog.Events.LogEventLevel.Error); // Return response to client return(StatusCode(500, new { errors = "Database update failed. Contact the administrator to resolve this issue." })); } } } else { return(NotFound()); } } // End of ModifyNotice
/// <summary> /// /// </summary> /// <param name="fc"></param> /// <returns></returns> public ActionResult Index(FormCollection fc) { var from = fc.Get("from"); var to = fc.Get("to"); var name = fc.Get("name"); var dfrom = string.IsNullOrEmpty(from) ? null : (DateTime?)DateTime.Parse(from); var dto = string.IsNullOrEmpty(to) ? null : (DateTime?)DateTime.Parse(to); var user = OperatorProvider.Provider.Current(); var bll1 = new WorkmeetingBLL(); var cnt1 = bll1.GetIndex(user.DeptId, dfrom, dto, name); ViewData["item2"] = cnt1; var bll2 = new ActivityBLL(); var cnt2 = bll2.GetIndex(user.DeptId, dfrom, dto, name); ViewData["item3"] = cnt2; var bll3 = new ToolBorrowBLL(); var cnt3 = bll3.GetList(user.UserId, user.DeptId, dfrom, dto, name); ViewData["item4"] = cnt3.Count(); var bll4 = new DrugBLL(); int cnt4 = bll4.GetOutListCount(user.DeptId, dfrom, dto, name); ViewData["item5"] = cnt4; int total = 0; var bll5 = new LllegalBLL(); int cnt5 = bll5.GetList(user.DeptId, "", "", dfrom, dto, 1, 12, out total).Count(); ViewData["item6"] = total; int total1 = 0; var bll6 = new NoticeBLL(); int cnt6 = bll6.GetAllNotice(user.DeptId, dfrom, dto, name, 1, 12, out total1).Count(); ViewData["item7"] = total1; int total2 = 0; var bll7 = new EmergencyBLL(); int cnt7 = bll7.EmergencyReportGetPageList(user.DeptId, name, dfrom, dto, 1, 12, out total2).Count(); ViewData["item8"] = total2; ViewData["from"] = from; ViewData["to"] = to; ViewData["name"] = name; return(View()); }
public async Task <ActionResult> AddNotice(NoticeDTO notice) { // Call BLL Notice Add method with all the parameters object BLLResponse = new NoticeBLL(_context).AddNoticeBLL(notice: notice, userClaims: User); // Get the base class for the response // Ref: https://docs.microsoft.com/en-us/dotnet/api/system.type.basetype?view=netcore-3.1 if (BLLResponse.GetType().BaseType == typeof(Exception)) { // Create log entries for Debug log ((APIException)BLLResponse).Exceptions.ForEach(ex => Logger.Msg <NoticesController>((Exception)ex, Serilog.Events.LogEventLevel.Debug)); // Return response from API return(BadRequest(new { errors = ((APIException)BLLResponse).Exceptions.Select(x => x.Message).ToArray() })); } else { try { // Convert BLLResponse to NoticeDTO object NoticeDTO newNoticeDTO = (NoticeDTO)BLLResponse; // Create a new Notice object Notice newNotice = new Notice { HTML = newNoticeDTO.HTML, Markdown = newNoticeDTO.Markdown, CohortID = newNoticeDTO.CohortID, StaffID = newNoticeDTO.StaffID, ValidFrom = newNoticeDTO.ValidFrom }; // Create the record _context.Notices.Add(newNotice); await _context.SaveChangesAsync(); Logger.Msg <NoticesController>($"[{User.FindFirstValue("email")}] [ADD] Notice '{newNotice.NoticeID}' successful", Serilog.Events.LogEventLevel.Information); // Convert back to DTO and return to user NoticeDTO response = new NoticeDTO(newNotice); return(Ok(response)); } catch (Exception ex) { // Local log entry. Database reconciliation issues are more serious so reported as Error Logger.Msg <NoticesController>($"[ADD] Database sync error {ex.Message}", Serilog.Events.LogEventLevel.Error); // Return response to client return(StatusCode(500, new { errors = "Database update failed. Contact the administrator to resolve this issue." })); } } } // End of AddNotice
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { string strNoticeID = Request.QueryString["id"]; NoticeBLL noticeBLL = new NoticeBLL(); RailExam.Model.Notice notice = noticeBLL.GetNotice(int.Parse(strNoticeID)); ViewState["Title"] = notice.Title; ViewState["Author"] = notice.EmployeeName; ViewState["Content"] = notice.Content; ViewState["CreateTime"] = notice.CreateTime; } }
public JObject Delete(JObject json) { var ids = JsonConvert.DeserializeObject <List <int> >(json["ids"].ToString()); NoticeBLL noticeBll = new NoticeBLL(); var deleteSuccess = noticeBll.Delete(ids); JObject result = new JObject(); if (deleteSuccess == 1) { result["success"] = true; } else { result["errorMsg"] = "删除失败!"; } return(result); }
public string Add(JObject pagerParas) { var id = HttpContext.Current.Request.QueryString["id"]; //var form = HttpContext.Current.Request.Form; NoticeBLL noticeBll = new NoticeBLL(); if (id != null && Int32.Parse(id) > 0) { noticeBll.Updata(pagerParas, Int32.Parse(id)); } else { pagerParas.Remove("ID"); noticeBll.Add(pagerParas); } return("1"); }
//获取通知回复列表 public void GetCommentList(HttpContext context) { NoticeBLL noticeBLL = new NoticeBLL(); IES.JW.Model.NoticeResponse notice = new IES.JW.Model.NoticeResponse(); notice.NoticeID = Convert.ToInt32(context.Request.Params["NoticeID"]); int PageSize = Convert.ToInt32(context.Request.Params["PageSize"]); int PageIndex = Convert.ToInt32(context.Request.Params["PageIndex"]); //noticeBLL.Notice_List(notice, 1, 20); DataTable dt = IES.Common.ListToDateUtil.ListToDataTable<IES.JW.Model.NoticeResponse>(noticeBLL.NoticeResponse_List(notice, PageIndex, PageSize)); if (dt != null && dt.Rows.Count > 0) { context.Response.Write(Tools.JsonConvert.GetJSON(dt)); } else { context.Response.Write("empty"); } }
/// <summary> /// 获取图片路径列表 /// </summary> /// <returns></returns> public Stream GetSystemPicture() { try { NoticeBLL noticeBLL = new NoticeBLL(); string resul = noticeBLL.GetSystemPicture(); if (!string.IsNullOrEmpty(resul)) { return(new MemoryStream(Encoding.UTF8.GetBytes(resul))); } else { return(new MemoryStream(Encoding.UTF8.GetBytes("error"))); } } catch (Exception err) { Logger.Error("GetSystemPicture Error", err); return(new MemoryStream(Encoding.UTF8.GetBytes("error"))); } }
/// <summary> /// 更改通知状态为已经查看 /// </summary> /// <param name="noticeID">通知的ID</param> /// <param name="noticeType">通知的类型0个人,1公司,2系统</param> /// <returns></returns> public Stream UpdateNoticeLooked(string noticeID, string noticeType) { try { NoticeBLL noticeBLL = new NoticeBLL(); string resul = noticeBLL.UpdateNoticeLooked(noticeID, noticeType); if (!string.IsNullOrEmpty(resul)) { return(new MemoryStream(Encoding.UTF8.GetBytes(resul))); } else { return(new MemoryStream(Encoding.UTF8.GetBytes("error"))); } } catch (Exception err) { Logger.Error("UpdateNoticeLooked Error", err); return(new MemoryStream(Encoding.UTF8.GetBytes("error"))); } }
/// <summary> /// 获取未查看通知个数 /// </summary> /// <param name="session">session</param> /// <returns></returns> public Stream NoLookNoticeNumber(string session) { try { NoticeBLL noticeBLL = new NoticeBLL(); string resul = noticeBLL.NoLookNoticeNumber(session); if (!string.IsNullOrEmpty(resul)) { return(new MemoryStream(Encoding.UTF8.GetBytes(resul))); } else { return(new MemoryStream(Encoding.UTF8.GetBytes("error"))); } } catch (Exception err) { Logger.Error("NoLookNoticeNumber Error", err); return(new MemoryStream(Encoding.UTF8.GetBytes("error"))); } }
/// <summary> /// 通知忽略 /// </summary> /// <param name="noticeID">通知ID</param> /// <param name="noticeType">标志要请求的通知类型,0全部通知,1个人通知,2系统通知</param> /// <returns></returns> public Stream NoticeHuLue(string session, string noticeID, string noticeType) { try { NoticeBLL noticeBLL = new NoticeBLL(); string resul = noticeBLL.NoticeHuLue(session, noticeID, noticeType); if (!string.IsNullOrEmpty(resul)) { return(new MemoryStream(Encoding.UTF8.GetBytes(resul))); } else { return(new MemoryStream(Encoding.UTF8.GetBytes("error"))); } } catch (Exception err) { Logger.Error("NoticeHuLue Error", err); return(new MemoryStream(Encoding.UTF8.GetBytes("error"))); } }
//发送通知 public void AddNotice(HttpContext context) { IES.JW.Model.User user = IES.Service.UserService.CurrentUser; NoticeBLL noticeBLL = new NoticeBLL(); IES.JW.Model.Notice notice = new IES.JW.Model.Notice(); notice.Title = context.Request.Params["Title"].ToString(); notice.Conten = context.Request.Params["Conten"].ToString(); notice.IsTop = Convert.ToBoolean(context.Request.Params["IsTop"]); notice.IsForMail = Convert.ToBoolean(context.Request.Params["IsEmail"]); notice.IsForSMS = Convert.ToBoolean(context.Request.Params["IsMSM"]); notice.SysID = Convert.ToInt32(context.Request.Params["SysID"].ToString()); notice.ModuleID = Convert.ToInt32(context.Request.Params["ModuleID"].ToString()); notice.UserID = user.UserID; notice.EndDate = DateTime.Now.AddDays(30); notice.Source2 = context.Request.Params["Source2"].ToString(); notice.SourceIDs = context.Request.Params["SourceIDs"].ToString(); notice.Source = context.Request.Params["Source"].ToString(); notice.SourceIDs2 = context.Request.Params["SourceIDs2"].ToString(); notice.EntryDates = context.Request.Params["EntryDates"].ToString(); notice = noticeBLL.Notice_ADD(notice); if (notice.NoticeID > 0) { if (notice.IsCanSendMsg == 0) { context.Response.Write("False"); } else { context.Response.Write("True"); } } else { context.Response.Write("empty"); } }
public JObject GetList(JObject pagerParas) { NoticeBLL noticeBll = new NoticeBLL(); return(noticeBll.GetList(pagerParas)); }
public HomeController(NoticeBLL noticeBll) { _noticeBll = noticeBll; }
/// <summary> /// 获取系统通知信息 /// </summary> /// <param name="user"></param> /// <returns></returns> public static List <Notice> User_Notice_List(User user) { NoticeBLL noticebll = new NoticeBLL(); return(noticebll.Notice_Receive_List(user)); }
protected string NoticeSel(string sAbbre) { return(NoticeBLL.JsonNoticeSelFromCMS(sAbbre)); }
private void DeleteData(int nNoticeID) { NoticeBLL noticeBLL = new NoticeBLL(); noticeBLL.DeleteNotice(nNoticeID); }
//获取通知回复列表 public void NoticeResponse_ADD(HttpContext context) { IES.JW.Model.User user = IES.Service.UserService.CurrentUser; NoticeBLL noticeBLL = new NoticeBLL(); IES.JW.Model.NoticeResponse notice = new IES.JW.Model.NoticeResponse(); notice.ResponseID = -1; notice.NoticeID = Convert.ToInt32(context.Request.Params["NoticeID"]); notice.Conten = context.Request.Params["Conten"].ToString(); notice.UserID = user.UserID; IES.JW.Model.NoticeResponse addnotice = noticeBLL.NoticeResponse_ADD(notice); if (addnotice.ResponseID != -1) { context.Response.Write("true"); } else { context.Response.Write("empty"); } }
//获取通知列表 public void GetNoticeList(HttpContext context) { NoticeBLL noticeBLL = new NoticeBLL(); IES.JW.Model.Notice notice = new IES.JW.Model.Notice(); IES.JW.Model.User user = IES.Service.UserService.CurrentUser; notice.UserID = user.UserID; notice.SysID = 1; notice.ModuleID = Convert.ToInt32(context.Request.Params["ModuleID"]); int PageSize = Convert.ToInt32(context.Request.Params["PageSize"]); int PageIndex = Convert.ToInt32(context.Request.Params["PageIndex"]); //noticeBLL.Notice_List(notice, 1, 20); DataTable dt = IES.Common.ListToDateUtil.ListToDataTable<IES.JW.Model.Notice>(noticeBLL.Notice_List(notice, PageIndex, PageSize)); if (dt != null && dt.Rows.Count > 0) { context.Response.Write(Tools.JsonConvert.GetJSON(dt)); } else { context.Response.Write("empty"); } }