📄 receive_flow.aspx.cs
字号:
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 System.Data.SqlClient;
using System.IO;
public partial class Receive_Flow : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
btndel.Attributes.Add("onclick", "return confirm('确定要删除选择的公文信息吗?')");
if (Session["uname"].ToString() != null)
{
if (!IsPostBack)
{
bandFlow();
}
}
}
private void bandFlow()
{
file f = new file();
FlowView.DataSource = f.Select_Flow(Convert.ToInt32(Session["uname"]));
FlowView.DataBind();
}
protected void down_flow_Command(object sender, CommandEventArgs e)
{
string flow_filename = e.CommandArgument.ToString();
string filepath = Server.MapPath("Flow\\" + flow_filename);
if (File.Exists(filepath))
{
FileInfo files = new FileInfo(filepath);
Response.Clear();
Response.ContentType = "application/octet-stream";
Response.AddHeader("Content-Disposition", "attachment; filename=" + HttpUtility.UrlEncode(flow_filename, System.Text.Encoding.UTF8));
Response.AddHeader("Content-length", files.Length.ToString());
Response.Flush();
Response.WriteFile(filepath);
}
else
{
Response.Write("<script>alert('没有找到下载的源文件!')</script>");
}
}
protected void FlowView_PageIndexChanging(object sender, GridViewPageEventArgs e)
{
FlowView.PageIndex = e.NewPageIndex;
bandFlow();
}
protected void btndel_Click(object sender, EventArgs e)
{
for (int i = 0; i <= this.FlowView.Rows.Count - 1; i++)
{
CheckBox check = (CheckBox)this.FlowView.Rows[i].FindControl("checkdel");
if (check.Checked == true)
{
int Flow_id = Convert.ToInt32(FlowView.DataKeys[i].Value.ToString());
string filename = ((LinkButton)FlowView.Rows[i].FindControl("down_flow")).Text.ToString();
string FullPath = Server.MapPath("Flow") + "\\" + filename;
if (File.Exists(FullPath))
{
File.Delete(FullPath);
file f = new file();
f.Delete_Flow(Flow_id);
}
}
}
bandFlow();
Response.Write("<script>alert('删除成功!')</script>");
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -