protected void btnSubmit_OnClick(object sender, EventArgs e) { Mxm.Model.download mo = new Mxm.DAL.download().GetModel(_id); mo.name = txtName.Text.Trim(); mo.remark = txtContent.InnerHtml; mo.sort = 0; if (fileUp.HasFile) { string fName = DateTime.Now.Ticks.ToString() + fileUp.FileName; string path = Server.MapPath( ConfigurationManager.AppSettings["downPath"].ToString()) + fName; fileUp.SaveAs(path); mo.path = fName; } if (picUp.HasFile) { string fName = DateTime.Now.Ticks.ToString() + picUp.FileName; string path = Server.MapPath( ConfigurationManager.AppSettings["imgPath"].ToString()) + fName; picUp.SaveAs(path); mo.picture = fName; } (new Mxm.DAL.download()).Update(mo); Mxm.Common.MessageBox.Show(this, "修改成功"); }
private void ShowList() { Mxm.DAL.download mgr = new Mxm.DAL.download(); DataSet ds = mgr.GetList(mPageSize, mPageIndex, "", "down_id", 1); if (ds.Tables.Count > 0) { rptList.DataSource = ds.Tables[0]; rptList.DataBind(); } }
private void ShowInfo() { Mxm.Model.download mo = new Mxm.Model.download(); mo = new Mxm.DAL.download().GetModel(_id); if (mo != null) { txtName.Text = mo.name; txtContent.Value = mo.remark; lblFile.Text = mo.path; img1.Src = ConfigurationManager.AppSettings["imgPath"] + mo.picture; } }
protected void Page_Load(object sender, EventArgs e) { if (Request.QueryString["fileid"] != null) { string filePath = new Mxm.DAL.download().GetModel( int.Parse(Request.QueryString["fileid"].ToString())).path; filePath = Server.MapPath(ConfigurationManager.AppSettings["downPath"].ToString() + filePath); FileInfo fi = new FileInfo(filePath); Response.ClearHeaders(); Response.AppendHeader("Content-Disposition", "attachment;filename=" + string.Format("{0:n}{1}", System.Guid.NewGuid(), fi.Extension)); Response.AddHeader("Content-Length", fi.Length.ToString()); Response.AppendHeader("Last-Modified", fi.LastWriteTime.ToFileTime().ToString()); Response.AppendHeader("Location", Request.Url.AbsoluteUri); Response.ContentType = "application/unknown"; Response.WriteFile(filePath); } }
private void SetPager() { int count = new Mxm.DAL.download().GetCount(""); pager1.RecordCount = count; pager1.PageSize = mPageSize; }