public void DataBindToGridview() { ZWL.BLL.ERPRedHead MyModel = new ZWL.BLL.ERPRedHead(); GVData.DataSource = MyModel.GetList("FileName Like '%" + this.TextBox1.Text + "%' order by ID desc"); GVData.DataBind(); LabPageSum.Text = Convert.ToString(GVData.PageCount); LabCurrentPage.Text = Convert.ToString(((int)GVData.PageIndex + 1)); this.GoPage.Text = LabCurrentPage.Text.ToString(); }
public void DataBindToGridview() { GVData.PageSize = AspNetPager1.PageSize; GVData.PageIndex = AspNetPager1.CurrentPageIndex - 1; ZWL.BLL.ERPRedHead MyModel = new ZWL.BLL.ERPRedHead(); DataSet ds = MyModel.GetList("FileName Like '%" + this.TextBox1.Text + "%' order by ID desc"); GVData.DataSource = ds; GVData.DataBind(); AspNetPager1.RecordCount = ds.Tables[0].Rows.Count; }
protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { ZWL.Common.PublicMethod.CheckSession(); //绑定页面数据 ZWL.BLL.ERPRedHead MyModel = new ZWL.BLL.ERPRedHead(); MyModel.GetModel(int.Parse(Request.QueryString["ID"].ToString())); this.Label1.Text = MyModel.FilePath; this.TextBox1.Text = MyModel.FileName; } }
protected void ImageButton1_Click(object sender, ImageClickEventArgs e) { string FileNameStr = ZWL.Common.PublicMethod.UploadFileIntoDir(this.FileUpload1, DateTime.Now.Ticks.ToString() + System.IO.Path.GetExtension(FileUpload1.PostedFile.FileName)); if (FileNameStr.Trim().Length > 0) { ZWL.BLL.ERPRedHead MyModel = new ZWL.BLL.ERPRedHead(); MyModel.ID = int.Parse(Request.QueryString["ID"].ToString()); MyModel.FilePath = FileNameStr; MyModel.FileName = this.TextBox1.Text; MyModel.TimeStr = DateTime.Now; MyModel.UserName = ZWL.Common.PublicMethod.GetSessionValue("UserName"); MyModel.Update(); //写系统日志 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(); ZWL.Common.MessageBox.ShowAndRedirect(this, "红头文件修改成功!", "RedHeadFile.aspx"); } else if (FileUpload1.PostedFile.FileName.Trim().Length <= 0) { ZWL.BLL.ERPRedHead MyModel = new ZWL.BLL.ERPRedHead(); MyModel.ID = int.Parse(Request.QueryString["ID"].ToString()); MyModel.FilePath = this.Label1.Text; MyModel.FileName = this.TextBox1.Text; MyModel.TimeStr = DateTime.Now; MyModel.UserName = ZWL.Common.PublicMethod.GetSessionValue("UserName"); MyModel.Update(); //写系统日志 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(); ZWL.Common.MessageBox.ShowAndRedirect(this, "红头文件修改成功!", "RedHeadFile.aspx"); } }
protected void ImageButton1_Click(object sender, ImageClickEventArgs e) { string FileNameStr = ZWL.Common.PublicMethod.UploadFileIntoDir(this.FileUpload1, DateTime.Now.Ticks.ToString() + System.IO.Path.GetExtension(FileUpload1.PostedFile.FileName)); if (FileNameStr.Trim().Length > 0) { ZWL.BLL.ERPRedHead MyModel = new ZWL.BLL.ERPRedHead(); MyModel.ID = int.Parse(Request.QueryString["ID"].ToString()); MyModel.FilePath = FileNameStr; MyModel.FileName = this.TextBox1.Text; MyModel.TimeStr = DateTime.Now; MyModel.UserName = ZWL.Common.PublicMethod.GetSessionValue("UserName"); MyModel.Update(); //写系统日志 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(); ZWL.Common.MessageBox.ShowAndRedirect(this, "红头文件修改成功!", "RedHeadFile.aspx"); } else if (FileUpload1.PostedFile.FileName.Trim().Length <= 0) { ZWL.BLL.ERPRedHead MyModel = new ZWL.BLL.ERPRedHead(); MyModel.ID = int.Parse(Request.QueryString["ID"].ToString()); MyModel.FilePath =this.Label1.Text; MyModel.FileName = this.TextBox1.Text; MyModel.TimeStr = DateTime.Now; MyModel.UserName = ZWL.Common.PublicMethod.GetSessionValue("UserName"); MyModel.Update(); //写系统日志 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(); ZWL.Common.MessageBox.ShowAndRedirect(this, "红头文件修改成功!", "RedHeadFile.aspx"); } }