/// <summary> /// 删除操作 /// </summary> /// <param name="id">数据ID</param> /// <returns></returns> private string DeleteData(string id) { BNotice bllBNotice = new BNotice(); //返回结果 string msg = string.Empty; string[] noticeids = { "" }; //判断是不是多条数据删除 if (id.Contains(",")) { noticeids = id.Split(','); } else { noticeids[0] = id; } //批量删除数据 if (bllBNotice.DeleteGovNotice(noticeids)) { msg = "true"; } else { msg = "false"; } return(msg); }
/// <summary> /// 页面初始化 /// </summary> /// <param name="id">操作ID</param> protected void PageInit(string id) { if (!string.IsNullOrEmpty(id)) { BNotice bllBNotice = new BNotice(); MGovNotice modelMGovNotice = bllBNotice.GetGovNoticeModel(id); if (modelMGovNotice != null) { //公告标题 this.lblTitle.Text = modelMGovNotice.Title; //公告内容 this.lblContent.Text = modelMGovNotice.Content; //公告发布人 this.lblAddUser.Text = modelMGovNotice.Operator; //公告发布时间 this.lblAddDate.Text = modelMGovNotice.IssueTime.ToLongDateString(); } else { Response.Clear(); Response.Write("没有该数据"); Response.End(); } } else { Response.Clear(); Response.Write("缺少参数"); Response.End(); } }
public Object GetNoticesBySchool(int schoolid, int pageid) { var notices = BNotice.GetNoticeBySchool(schoolid, pageid - 1); if (notices == null) { return(new { result = false, info = "Não foram encontrados anuncios." }); } return(new { result = true, data = notices }); }
public Object GetNews() { var notices = BNotice.GetNews(); if (notices == null) { return(new { result = false, info = "Não foram encontrados anuncios." }); } return(new { result = true, data = notices }); }
public Object PutNotice([FromBody] TblNotices editednotice) { Payload payload = BAccount.ConfirmToken(this.Request); if (payload == null || (!payload.rol.Contains(3) && !payload.rol.Contains(6))) { return(new { result = false, info = "Não autorizado." }); } if (BNotice.EditNotice(editednotice, payload.aud)) { return(new { result = true }); } return(new { result = false, info = "Não foi possível alterar dados do anuncio." }); }
public Object PostNotice([FromBody] TblNotices newnotice) { Payload payload = BAccount.ConfirmToken(this.Request); if (payload == null || (!payload.rol.Contains(3) && !payload.rol.Contains(6))) { return(new { result = false, info = "Não autorizado." }); } if (BNotice.CreateNotice(newnotice, payload.aud)) { return(new { result = true }); } return(new { result = false, info = "Não foi possível registar o anuncio." }); }
public Object DeleteNotice(int noticeid) { Payload payload = BAccount.ConfirmToken(this.Request); if (payload == null || (!payload.rol.Contains(3) && !payload.rol.Contains(6))) { return(new { result = false, info = "Não autorizado." }); } if (BNotice.DeleteNotice(noticeid, payload.aud)) { return(new { result = true }); } return(new { result = false, info = "Não foi possível eliminar anuncio." }); }
/// <summary> /// 页面初始化 /// </summary> /// <param name="id">操作ID</param> protected void PageInit(string id) { this.SelectSection1.ParentIframeID = Utils.GetQueryStringValue("iframeId"); //通知公告实体类 MGovNotice modelMGovNotice = new MGovNotice(); //通知公告业务 BNotice bllBNotice = new BNotice(); modelMGovNotice = bllBNotice.GetGovNoticeModel(id); if (modelMGovNotice != null) { this.txtTitle.Text = modelMGovNotice.Title; this.txtContent.Text = modelMGovNotice.Content; this.txtAddUser.Text = modelMGovNotice.Operator; this.txtAddDate.Text = modelMGovNotice.IssueTime.ToShortDateString(); } else { this.txtAddUser.Text = SiteUserInfo.Username; } }
/// <summary> /// 页面保存 /// </summary> protected void PageSave(string doType) { #region 表单取值 Response.Clear(); string msg = ""; bool result = false; string title = Utils.GetFormValue(txtTitle.UniqueID); string id = Utils.GetFormValue(hidNotiecID.UniqueID); string content = Utils.GetFormValue(txtContent.UniqueID); string sectionhideid = Utils.GetFormValue(this.SelectSection1.SelectIDClient); string pointdept = Utils.GetFormValue("PointDept"); string innersection = "公司内部"; #endregion #region 表单验证 if (string.IsNullOrEmpty(title)) { msg += "-请输入公告标题!+<br/>"; } if (string.IsNullOrEmpty(content)) { msg += "-请输入公告内容!<br/>"; } if (!string.IsNullOrEmpty(pointdept) && string.IsNullOrEmpty(sectionhideid)) { msg += "-请选择指定部门!<br/>"; } if (!string.IsNullOrEmpty(msg)) { Response.Write(UtilsCommons.AjaxReturnJson(result ? "1" : "0", msg)); Response.End(); return; } #endregion #region 实体赋值 EyouSoft.BLL.GovStructure.BNotice NoticeBLL = new BNotice(); MGovNotice noticeModel = new MGovNotice(); //消息类型 0:公告 1:学习交流 noticeModel.NoticeType = "1"; //公司编号 noticeModel.CompanyId = this.SiteUserInfo.CompanyId; //公告标题 noticeModel.Title = title; noticeModel.NoticeId = id; //公告内容 noticeModel.Content = content; //是否提醒 noticeModel.IsRemind = false; //是否发送短信 //noticeModel.IsMsg = ismsg == "sendMsg"; noticeModel.IsMsg = false; //短信内容 //noticeModel.MsgContent = msgcontent; //浏览量 //noticeModel.Views = 0; //部门编号 noticeModel.DepartId = this.SiteUserInfo.DeptId; //操作人编号 noticeModel.OperatorId = this.SiteUserInfo.UserId; //操作时间 noticeModel.IssueTime = DateTime.Now; //操作人 noticeModel.Operator = this.SiteUserInfo.Name;// Username; //发布对象实体 noticeModel.MGovNoticeReceiverList = GetList(sectionhideid, pointdept, "", "", innersection); noticeModel.ComAttachList = NewGetAttach(); #endregion #region 提交回应 if (doType == "update") { //如果公告编号不为空则为修改 result = NoticeBLL.UpdateGovNotice(noticeModel); msg = result ? "修改成功!" : "修改失败!"; } else { //公告编号为空则新增 result = NoticeBLL.AddGovNotice(noticeModel); msg = result ? "添加成功!" : "添加失败!"; } Response.Write(UtilsCommons.AjaxReturnJson(result ? "1" : "0", msg)); Response.End(); #endregion }
/// <summary> /// 保存按钮点击事件执行方法 /// </summary> protected void PageSave() { //通知公告实体类 MGovNotice modelMGovNotice = new MGovNotice(); //通知公告业务 BNotice bllBNotice = new BNotice(); //操作类型(添加 修改) string doType = "Add"; //获取实体 if (!string.IsNullOrEmpty(HidNoticeID.Value)) { modelMGovNotice = bllBNotice.GetGovNoticeModel(HidNoticeID.Value); doType = "Update"; } #region 通知公告实体属性赋值 #region 通知公告实体显性属性 //标题 string title = Utils.GetFormValue(txtTitle.UniqueID); //内容 string content = Utils.GetFormValue(txtContent.UniqueID); //发布人 string addUser = Utils.GetFormValue(txtAddUser.UniqueID); //发布时间 string addDate = Utils.GetFormValue(txtAddDate.UniqueID); modelMGovNotice.Title = title; modelMGovNotice.Content = content; modelMGovNotice.Operator = addUser; modelMGovNotice.IssueTime = Utils.GetDateTime(addDate); //附件实体 modelMGovNotice.ComAttachList = null; #region 接收人员实体 MGovNoticeReceiver modelMGovNoticeReceiver = null; List <MGovNoticeReceiver> MGovNoticeReceiverlist = new List <MGovNoticeReceiver>(); #region 公司内部(选择所有部门) if (cbxAll.Checked) { modelMGovNoticeReceiver = new MGovNoticeReceiver(); modelMGovNoticeReceiver.ItemType = ItemType.公司内部; modelMGovNoticeReceiver.NoticeId = modelMGovNotice.NoticeId; MGovNoticeReceiverlist.Add(modelMGovNoticeReceiver); //释放实体资源 modelMGovNoticeReceiver = null; } #endregion #region 指定部门 if (cbxSelect.Checked) { //指定部门ids值 string selectDepartlist = Utils.GetFormValue("SectionHideID"); if (!string.IsNullOrEmpty(selectDepartlist)) { if (selectDepartlist.Contains(",")) { //循环指定部门存入数据库 foreach (string strid in selectDepartlist.Split(',')) { MGovNoticeReceiver modelselectReceiver = new MGovNoticeReceiver(); modelselectReceiver.ItemId = strid; modelselectReceiver.ItemType = ItemType.指定部门; modelselectReceiver.NoticeId = modelMGovNotice.NoticeId; MGovNoticeReceiverlist.Add(modelselectReceiver); //释放实体资源 modelselectReceiver = null; } } else { modelMGovNoticeReceiver.ItemId = selectDepartlist; modelMGovNoticeReceiver.ItemType = ItemType.指定部门; modelMGovNoticeReceiver.NoticeId = modelMGovNotice.NoticeId; MGovNoticeReceiverlist.Add(modelMGovNoticeReceiver); //释放实体资源 modelMGovNoticeReceiver = null; } } } #endregion #region 行社 if (cbxPeer.Checked) { modelMGovNoticeReceiver = new MGovNoticeReceiver(); modelMGovNoticeReceiver.ItemType = ItemType.行社; modelMGovNoticeReceiver.NoticeId = modelMGovNotice.NoticeId; MGovNoticeReceiverlist.Add(modelMGovNoticeReceiver); //释放实体资源 modelMGovNoticeReceiver = null; } #endregion #region 组团社 if (cbxGrounp.Checked) { modelMGovNoticeReceiver = new MGovNoticeReceiver(); modelMGovNoticeReceiver.ItemType = ItemType.组团社; modelMGovNoticeReceiver.NoticeId = modelMGovNotice.NoticeId; MGovNoticeReceiverlist.Add(modelMGovNoticeReceiver); //释放实体资源 modelMGovNoticeReceiver = null; } #endregion #endregion modelMGovNotice.MGovNoticeReceiverList = MGovNoticeReceiverlist; #endregion #region 通知公告实体隐形属性 //操作人id modelMGovNotice.OperatorId = SiteUserInfo.UserId; //短信内容 modelMGovNotice.MsgContent = ""; //是否提醒 modelMGovNotice.IsRemind = false; //是否发送短信 modelMGovNotice.IsMsg = false; //公司编号 modelMGovNotice.CompanyId = SiteUserInfo.CompanyId; #endregion #endregion bool result = false; //新增公告 if (doType == "Add") { modelMGovNotice.NoticeId = Guid.NewGuid().ToString(); result = bllBNotice.AddGovNotice(modelMGovNotice); if (result) { EyouSoft.Common.Function.MessageBox.ResponseScript(this, "alert('新增成功!');;window.location='NoticeList.aspx?sl=1';"); } else { EyouSoft.Common.Function.MessageBox.ResponseScript(this, "alert('新增失败!');;window.location='NoticeList.aspx?sl=1';"); } } else//修改公告 { result = bllBNotice.UpdateGovNotice(modelMGovNotice); if (result) { EyouSoft.Common.Function.MessageBox.ResponseScript(this, "alert('修改成功!');;window.location='NoticeList.aspx?sl=1';"); } else { EyouSoft.Common.Function.MessageBox.ResponseScript(this, "alert('修改失败!');;window.location='NoticeList.aspx?sl=1';"); } } }