NoticeAdd.aspx.cs
上传用户:tiancihang
上传日期:2014-03-12
资源大小:21387k
文件大小:3k
- 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)
- {
- if (!IsPostBack)
- {
- Notice notice = new Notice();
- CheckUserInfo checkuserinfo = (CheckUserInfo)Session["checkuserinfo"];
- int userid = checkuserinfo.UserID;
- //int userid = 0;
- EtongZwf zwf = new EtongZwf();
- DataView dv = new DataView();
- 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"));
- if (checkuserinfo.EmpName != null)
- {
- TB_CreateUserID.Text = checkuserinfo.EmpName;
- }
- else
- TB_CreateUserID.Text = "系统管理员";
- TB_NoticeDate.Text = DateTime.Now.ToString();
- BT_Cancel.Attributes.Add("onclick", "javascript:if(confirm('确定要退出吗?')) {window.close();return;} else {return;}");
- }
- }
- protected void BT_Confirm_Click(object sender, ImageClickEventArgs e)
- {
- string noticetitle = this.TB_Title.Text;
- string content = this.TB_Content.Text;
- CheckUserInfo checkuserinfo = (CheckUserInfo)Session["checkuserinfo"];
- int userid = checkuserinfo.UserID;
- //int userid = 0;
- DateTime invaiddate =Convert.ToDateTime(this.TB_InvaidDate.Text);
- int roleid = Convert.ToInt32( DDL_Role.SelectedValue);
- int assuserid =Convert.ToInt32( DDL_User.SelectedValue);
- Notice notice = new Notice();
- bool returnvalue = false;
- returnvalue = notice.NoticeAdd(noticetitle, content, invaiddate, DateTime.Now,userid, roleid, assuserid);
- if (returnvalue)
- ClientScript.RegisterStartupScript(this.GetType(), "", "<script>alert('系统提示:添加记录成功!');</script>");
-
- else
- ClientScript.RegisterStartupScript(this.GetType(), "", "<script>alert('系统提示:添加记录不成功!');window.close();</script>");
- this.TB_Content.Text = "";
- this.TB_CreateUserID.Text= "";
- this.TB_InvaidDate.Text = "";
- this.TB_NoticeDate.Text = DateTime.Now.ToString();
- this.TB_Title.Text = "";
- }
- 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"));
- }
- }