Пример #1
0
        /// <summary>
        /// 删除公告通知
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public JsonResult UpNotice(string id)
        {
            var isOk = false;

            isOk = new ComNoticeBll().DeleteNotice(id);
            var rtEntity = new StatusModel <DBNull>
            {
                rtData  = null,
                rtMsrg  = "成功",
                rtState = isOk ? 1 : -1
            };

            return(Json(rtEntity, JsonRequestBehavior.AllowGet));
        }
Пример #2
0
        /// <summary>
        /// 公告详情
        /// </summary>
        /// <param name="id">公告详情</param>
        /// <returns></returns>
        public ActionResult NoticeDetail(string id)
        {
            var entity = new ComNoticeEntity();

            if (!string.IsNullOrEmpty(id))
            {
                entity = new ComNoticeBll().Get(id);
                var files = new ComNoticeAttachBll().GetSearchResult(new ComNoticeAttachEntity()
                {
                    ResourceId = id
                });
                ViewData["Files"] = files;
            }
            return(View(entity));
        }
Пример #3
0
        /// <summary>
        /// 查询个人公告通知
        /// </summary>
        /// <param name="pageIndex"></param>
        /// <param name="pageSize"></param>
        /// <returns></returns>
        public string GridPageList(int pageIndex = 1, int pageSize = 20)
        {
            var user = CurrentUser.CrmUser;

            int totalRecords;

            //计时
            var stopwatch = new Stopwatch();

            stopwatch.Start();
            var data      = new ComNoticeBll().GetUserNotice(user.Id, pageIndex, pageSize, out totalRecords);
            var resultrow = new StringBuilder("");

            if (data != null && data.Rows.Count > 0)
            {
                foreach (DataRow row in data.Rows)
                {
                    resultrow.AppendFormat(@"<tr onDblClick=OpenDetails('{0}')><td style='width: 50px; text-align: center;'>
                                  <input type='checkbox' value='{0}'/></td>
                                  <td style='width: 20px;'></td>
                                  <td style='width: 180px;'>{1}</td>
                                  <td>{2}</td>
                                  <td style='width: 100px; text-align: center;'>{3}</td>
                                  <td style='width: 20px;'></td></tr>", row["Id"], row["realname"], row["Title"], Convert.ToDateTime(row["SendTime"]).ToString(AppConst.DateFormat));
                }
            }

            stopwatch.Stop();
            var totalPage = (totalRecords + pageSize - 1) / pageSize;   //计算页数
            var result    = new PageStringDatagrid
            {
                page     = pageIndex,
                rows     = resultrow.ToString(),
                total    = totalPage,
                records  = totalRecords,
                costtime = stopwatch.ElapsedMilliseconds.ToString()
            };

            return(JsonConvert.SerializeObject(result));
        }
Пример #4
0
        public JsonResult Edit(ComNoticeEntity entity)
        {
            var rtState = 0;

            try
            {
                if (ModelState.IsValid)
                {
                    var user = CurrentUser.CrmUser;
                    entity.RowStatus = 1;
                    if (string.IsNullOrEmpty(entity.Id))
                    {
                        entity.CreatorId = user.Id;
                        entity.CreateBy  = user.UserName;
                        entity.CreateOn  = DateTime.Now;
                    }
                    else
                    {
                        entity.UpdateId = user.Id;
                        entity.UpdateBy = user.UserName;
                        entity.UpdateOn = DateTime.Now;
                    }
                    rtState = new ComNoticeBll().SaveNotice(entity) ? 0 : 1;
                }
            }
            catch (Exception)
            {
                rtState = 1;
            }
            var rtEntity = new StatusModel <DBNull>
            {
                rtData  = null,
                rtMsrg  = "成功",
                rtState = rtState
            };

            return(Json(rtEntity, JsonRequestBehavior.AllowGet));
        }