/// <summary> /// 数据绑定 /// </summary> protected void databind() { int id = MLMGC.COMP.Requests.GetQueryInt("id", 0); if (id == 0) { MLMGC.COMP.Jscript.AlertAndRedirect(this, "信息不存在", "index.aspx"); return; } E_Announcement data = new E_Announcement(); data.AnnouncementID = id; data = new T_Announcement().GetModel(data); if (data != null) { ltAnnTitle.Text = data.AnnTitle; ltAddDate.Text = string.Format("{0:yyyy-MM-dd HH:mm:ss}", data.AddDate); ltContent.Text = data.AnnContent; } else { MLMGC.COMP.Jscript.AlertAndRedirect(this, "信息不存在", "index.aspx"); return; } }
/// <summary> /// 点击确定按钮处理事件 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void btnSubmit_Click(object sender, EventArgs e) { string title = txtAnnTitle.Text; string content = txtAnnContent.Content; if (string.IsNullOrEmpty(title) || string.IsNullOrEmpty(content)) { MLMGC.COMP.Jscript.ShowMsg("请认真填写以上内容", this); return; } int aid = MLMGC.COMP.Requests.GetQueryInt("aid", 0); E_Announcement data = new E_Announcement(); data.AnnouncementID = aid; data.AnnTitle = title; data.AnnContent = content; bool flag = new T_Announcement().Update(data); if (flag) { MLMGC.COMP.Jscript.AlertAndRedirect(this, "操作成功", "AnnList.aspx"); } else { MLMGC.COMP.Jscript.ShowMsg("操作失败", this); } }
/// <summary> /// 绑定数据 /// </summary> protected void databind() { //得到最新公告 E_Announcement data = new E_Announcement(); data.EnterpriseID = EnterpriceID; data.TeamID = TeamID; data.AnnouncementID = -1; data = new T_Announcement().GetModel(data); if (data != null) { lblTitle.Text = data.AnnTitle; lblAddDate.Text = data.AddDate.ToString("yyyy-MM-dd HH:mm"); lblContent.Text = data.AnnContent; } //获取公告列表 data = new E_Announcement(); data.EnterpriseID = EnterpriceID; data.TeamID = TeamID; //分页参数 data.Page = new MLMGC.DataEntity.E_Page(); data.Page.PageSize = pageSize; data.Page.PageIndex = pageIndex; rpList.DataSource = new T_Announcement().GetList(data); rpList.DataBind(); //设置分页样式 pageList1.PageSize = pageSize; pageList1.CurrentPageIndex = pageIndex; pageList1.RecordCount = data.Page.TotalCount; pageList1.CustomInfoHTML = string.Format("共有记录 <span class='red_font'>{0}</span> 条", pageList1.RecordCount); pageList1.TextAfterPageIndexBox = " 页/" + pageList1.PageCount + " "; }
/// <summary> /// 点击确定按钮处理事件 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void btnSubmit_Click(object sender, EventArgs e) { //获取界面数据 string annTitle = txtAnnTitle.Text; string annContent = txtAnnContent.Content; if (annTitle == "" && annContent == "") { MLMGC.COMP.Jscript.ShowMsg("请输入公告标题和内容", this); return; } else if (annTitle == "") { MLMGC.COMP.Jscript.ShowMsg("请输入公告标题和内容", this); return; } else if (annContent == "") { MLMGC.COMP.Jscript.ShowMsg("请输入公告标题和内容", this); return; } //首先根据EPUserTMRID获取TeamID E_User user = new E_User(); user.EnterpriseID = EnterpriceID; user.EPUserTMRID = EPUserTMRID; DataTable dt = new T_Team().GetTeamID(user); if (dt == null || dt.Rows.Count != 1) { return; } int teamID = Convert.ToInt32(dt.Rows[0]["TeamID"]); //添加公告 E_Announcement data = new E_Announcement(); data.EnterpriseID = EnterpriceID; data.TeamID = teamID; data.AnnTitle = annTitle; data.AnnContent = annContent; bool flag = new T_Announcement().Add(data); if (flag) { new MLMGC.BLL.Enterprise.T_Log().Add(new MLMGC.DataEntity.Enterprise.E_Log() { EnterpriseID = EnterpriceID, UserID = UserID, LogTitle = "添加公告", IP = MLMGC.COMP.Requests.GetRealIP() }); MLMGC.COMP.Jscript.AlertAndRedirect(this, "添加成功", "AnnouncementList.aspx"); } else { MLMGC.COMP.Jscript.ShowMsg("添加失败", this); } }
/// <summary> /// 数据绑定 /// </summary> public void databind() { int aid = MLMGC.COMP.Requests.GetQueryInt("aid", 0); E_Announcement data = new T_Announcement().GetModel(new E_Announcement() { AnnouncementID = aid }); if (data != null) { txtAnnTitle.Text = data.AnnTitle; txtAnnContent.Content = data.AnnContent; } }
/// <summary> /// 删除公告 /// </summary> public void Delete() { int aid = MLMGC.COMP.Requests.GetQueryInt("aid", 0); bool flag = new T_Announcement().Delete(new E_Announcement() { AnnouncementID = aid }); if (flag) { MLMGC.COMP.Jscript.AlertAndRedirect(this, "删除成功", "AnnList.aspx"); } else { MLMGC.COMP.Jscript.ShowMsg("删除失败", this); } }