protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { ZWL.Common.PublicMethod.CheckSession(); ZWL.BLL.ERPGongGao MyModel = new ZWL.BLL.ERPGongGao(); MyModel.GetModel(int.Parse(Request.QueryString["ID"].ToString())); this.Label1.Text = MyModel.TitleStr; this.Label2.Text = ZWL.Common.PublicMethod.GetWenJian(MyModel.FuJian, "../UploadFile/"); this.Label4.Text = MyModel.ContentStr; this.Label5.Text = MyModel.TimeStr; this.Label3.Text = ZWL.DBUtility.DbHelperSQL.GetSHSL("select TrueName from ERPUser where UserName ='******'"); string UserNames = "'" + MyModel.UserBuMen.Replace(",", "','") + "'"; DataTable dt = ZWL.DBUtility.DbHelperSQL.GetDataTable("select TrueName from ERPUser where UserName in (" + UserNames + ")"); string TrueName = ""; foreach (DataRow R in dt.Rows) { TrueName += TrueName == "" ? R["TrueName"].ToString() : "," + R["TrueName"].ToString(); } this.Label6.Text = TrueName; this.Label7.Text = MyModel.Num.ToString(); this.Label8.Text = MyModel.NoticeType.ToString(); this.Label9.Text = MyModel.TypeStr.ToString(); ZWL.DBUtility.DbHelperSQL.ExecuteSQL("update ERPGongGao set num= num+1 where ID=" + Request.QueryString["ID"].ToString()); DataEntityDataContext context = new DataEntityDataContext(); ERPGongGaoYD model = context.ERPGongGaoYD.SingleOrDefault(p => p.FID == int.Parse(Request.QueryString["ID"].ToString()) && p.XM == ZWL.Common.PublicMethod.GetSessionValue("UserName")); if (model != null) { model.SFYY = "是"; model.YDSJ = DateTime.Now; context.SubmitChanges(); } //var T = context.ERPGongGaoYD.Where(p => p.FID == int.Parse(Request.QueryString["ID"].ToString())); DataTable Gdt = ZWL.DBUtility.DbHelperSQL.GetDataTable("SELECT G.[ID],G.[FID],G.[SSBM] ,G.[XM] ,G.[SFYY] ,G.[YDSJ],G.[BZ1],G.[BZ2],U.[TrueName] " + "FROM [ERPGongGaoYD] as G left join [ERPUser] as U on G.XM=U.UserName " + "where G.[FID]='" + Request.QueryString["ID"].ToString() + "'"); foreach (DataRow R in Gdt.Rows) { if (string.IsNullOrEmpty(R["TrueName"].ToString())) { R["TrueName"] = R["XM"]; } } this.GVData.DataSource = Gdt; GVData.DataBind(); ReturnInput.Value = Request.UrlReferrer.ToString() == null ? "../GongGao/GongGao.aspx" : Request.UrlReferrer.ToString(); } }
protected void btn_Sub_Click(object sender, EventArgs e) { ZWL.BLL.ERPGongGao Model = new ZWL.BLL.ERPGongGao(); Model.TitleStr = this.TextBox1.Text; Model.UserName = ZWL.Common.PublicMethod.GetSessionValue("UserName"); Model.UserBuMen = this.Send_Person.Value; Model.NoticeType = this.DropDownList1.SelectedValue; Model.ZT = this.ZT.SelectedValue; Model.FuJian = ZWL.Common.PublicMethod.GetSessionValue("WenJianList"); Model.TypeStr = this.TextBox3.Text; Model.ContentStr = this.TxtContent.Text; Model.Num = 0; int id = Model.Add(); DataEntityDataContext context = new DataEntityDataContext(); if (!string.IsNullOrEmpty(this.Send_Person.Value)) { string[] ss = this.Send_Person.Value.Split(','); for (int i = 0; i < ss.Length; i++) { ERPGongGaoYD model = new ERPGongGaoYD(); model.FID = id; model.SSBM = context.ERPUser.SingleOrDefault(p => p.UserName == ZWL.Common.PublicMethod.GetSessionValue("UserName")).Department; model.XM = ss[i]; model.SFYY = "否"; model.BZ1 = ""; model.BZ2 = ""; context.ERPGongGaoYD.InsertOnSubmit(model); context.SubmitChanges(); } } //写系统日志 ZWL.BLL.ERPRiZhi MyRiZhi = new ZWL.BLL.ERPRiZhi(); MyRiZhi.UserName = ZWL.Common.PublicMethod.GetSessionValue("UserName"); MyRiZhi.DoSomething = "用户添加通知公告信息(" + this.TextBox1.Text + ")"; MyRiZhi.IpStr = System.Web.HttpContext.Current.Request.UserHostAddress.ToString(); MyRiZhi.Add(); Response.Write("<script>alert('通知公告信息添加成功!');window.location.href='GongGao.aspx'</script>"); }
string UserName = ""; //用户名 #endregion Fields #region Methods protected void btn_Sub_Click(object sender, EventArgs e) { ZWL.BLL.ERPGongGao Model = new ZWL.BLL.ERPGongGao(); Model.TitleStr = this.TextBox1.Text; Model.UserName = ZWL.Common.PublicMethod.GetSessionValue("UserName"); Model.UserBuMen = this.Send_Person.Value; Model.NoticeType = this.DropDownList1.SelectedValue; Model.ZT = this.ZT.SelectedValue; Model.FuJian = ZWL.Common.PublicMethod.GetSessionValue("WenJianList"); Model.TypeStr = this.TextBox3.Text; Model.ContentStr = this.TxtContent.Text; Model.Num = 0; int id = Model.Add(); DataEntityDataContext context = new DataEntityDataContext(); if(!string.IsNullOrEmpty(this.Send_Person.Value)) { string[] ss =this.Send_Person.Value.Split(','); for(int i = 0; i < ss.Length; i++) { ERPGongGaoYD model = new ERPGongGaoYD(); model.FID = id; model.SSBM = context.ERPUser.SingleOrDefault(p => p.UserName == ZWL.Common.PublicMethod.GetSessionValue("UserName")).Department; model.XM = ss[i]; model.SFYY = "否"; model.BZ1 = ""; model.BZ2 = ""; context.ERPGongGaoYD.InsertOnSubmit(model); context.SubmitChanges(); } } //写系统日志 ZWL.BLL.ERPRiZhi MyRiZhi = new ZWL.BLL.ERPRiZhi(); MyRiZhi.UserName = ZWL.Common.PublicMethod.GetSessionValue("UserName"); MyRiZhi.DoSomething = "用户添加通知公告信息(" + this.TextBox1.Text + ")"; MyRiZhi.IpStr = System.Web.HttpContext.Current.Request.UserHostAddress.ToString(); MyRiZhi.Add(); Response.Write("<script>alert('通知公告信息添加成功!');window.location.href='GongGao.aspx'</script>"); }
partial void DeleteERPGongGaoYD(ERPGongGaoYD instance);
partial void UpdateERPGongGaoYD(ERPGongGaoYD instance);
partial void InsertERPGongGaoYD(ERPGongGaoYD instance);