NoticeUpdate.aspx.cs
上传用户:tiancihang
上传日期:2014-03-12
资源大小:21387k
文件大小:4k
- using System;
- using System.Data;
- using System.Configuration;
- using System.Collections;
- using System.Web;
- using System.Web.Security;
- using System.Web.UI;
- using System.Web.UI.WebControls;
- using System.Web.UI.WebControls.WebParts;
- using System.Web.UI.HtmlControls;
- using com.etong.user;
- using com.etong.BusinessRule.Zwf;
- using com.etong.Inform;
- public partial class SysManage_Notice : System.Web.UI.Page
- {
- protected void Page_Load(object sender, EventArgs e)
- {
- Notice notice = new Notice();
- EtongZwf zwf = new EtongZwf();
- DataView dv = new DataView();
- CheckUserInfo checkuserinfo = (CheckUserInfo)Session["checkuserinfo"];
- int userid = checkuserinfo.UserID;
- dv = zwf.RoleGetAll();
- DDL_Role.DataSource = dv;
- DDL_Role.DataTextField = "RoleName";
- DDL_Role.DataValueField = "RoleID";
- DDL_Role.DataBind();
- DDL_Role.Items.Insert(0, new ListItem("---请选择---", "-1"));
- DDL_User.Items.Insert(0, new ListItem("---请选择---", "-1"));
- string noticeid = Request.QueryString["NoticeID"].Trim();
- if (!IsPostBack)
- {
- if (noticeid == "")
- return;
- dv = notice.NoticeSearch(userid, Convert.ToInt32(noticeid));
- this.TB_Content.Text = dv[0]["NoticeContent"].ToString().Trim();
- this.TB_CreateUserID.Text = dv[0]["EmpName"].ToString().Trim();
- this.TB_InvaidDate.Text = dv[0]["InvaidDate"].ToString().Trim();
- this.TB_NoticeDate.Text = dv[0]["NoticeDate"].ToString();
- this.TB_Title.Text = dv[0]["NoticeTitle"].ToString();
- string roleid = dv[0]["AssRoleID"].ToString();
- string assuserid = dv[0]["AssUserID"].ToString();
- if (dv[0]["AssRoleID"].ToString() != "-1")
- {
- DDL_Role.Items.FindByValue(roleid).Selected = true;
- //Page.ClientScript.RegisterStartupScript(this.GetType(), "", "<script>alert("+roleid+");</script>");
- //return;
- dv = notice.GetUser(Convert.ToInt32(roleid));
- DDL_User.DataSource = dv;
- DDL_User.DataTextField = "EmpName";
- DDL_User.DataValueField = "UserID";
- DDL_User.DataBind();
- if (assuserid != "-1")
- {
- DDL_User.Items.FindByValue(assuserid).Selected = true;
- }
- }
- }
- BT_Cancel.Attributes.Add("onclick", "javascript:if(confirm('确定要退出吗?')) {window.close();return;} else {return;}");
- }
- protected void BT_Confirm_Click(object sender, ImageClickEventArgs e)
- {
- string noticeid = Request.QueryString["NoticeID"].Trim();
- string title = TB_Title.Text.ToString();
- string content = this.TB_Content.Text.ToString();
- DateTime invaiddate = Convert.ToDateTime(this.TB_InvaidDate.Text);
- int roleid = Convert.ToInt32(DDL_Role.SelectedValue.ToString());
- int userid = Convert.ToInt32(DDL_User.SelectedValue.ToString());
- Notice notice = new Notice();
- bool returnvalue = false;
- returnvalue = notice.NoticeUpdate(Convert.ToInt32(noticeid), title, content, invaiddate, roleid, userid);
- if (returnvalue)
- ClientScript.RegisterStartupScript(this.GetType(),"","<script>alert('系统提示:修改记录成功!');</script>");
- else
- ClientScript.RegisterStartupScript(this.GetType(), "", "<script>alert('系统提示:修改记录不成功!');window.close();</script>");
- }
- protected void DDL_Role_SelectedIndexChanged(object sender, EventArgs e)
- {
- Notice notice = new Notice();
- int roleid = Convert.ToInt32(DDL_Role.SelectedValue.ToString());
- DataView dv = new DataView();
- dv = notice.GetUser(roleid);
- DDL_User.DataSource = dv;
- DDL_User.DataTextField = "EmpName";
- DDL_User.DataValueField = "UserID";
- DDL_User.DataBind();
- DDL_User.Items.Insert(0, new ListItem("---请选择---", "-1"));
- }
- }