📄 admin_showordeletepaper.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;
public partial class Admin_Admin_PaperDelete : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
int ArticleId = Convert.ToInt32(Session["ArticleId"].ToString());
PaperOp select_paper = new PaperOp();
DataTable dt = new DataTable();
dt = select_paper.select_paperinformation_dynamic(ArticleId);
if (dt.Rows.Count == 0)
{
Response.Redirect("~/ViewPage/LoginError.aspx");
}
else
{
foreach (DataRow dr in dt.Rows)
{
TableRow tr = new TableRow();
for (int j = 0; j < dt.Columns.Count - 1; j++)
{
switch (j)
{
case 0:
Writerlab.Text = dr[0].ToString();
break;
case 1:
Subjectlab.Text = dr[1].ToString();
break;
case 2:
Disciplinelab.Text = dr[2].ToString();
break;
case 3:
Abstracttb.Text = dr[3].ToString();
break;
case 4:
String temp = dr[4].ToString();
Keywordlab1.Text = temp;
break;
}
}
}
}
//PaperOp update_paperstatic = new PaperOp();
//update_paperstatic.update_articlestatic_experts(ArticleId);
}
protected void Downloadbtn_Click(object sender, EventArgs e)
{
int ArticleId = Convert.ToInt32(Session["ArticleId"].ToString());
GetArticleUrl getarticleurl = new GetArticleUrl();
string filepath = getarticleurl.getarticleurl(ArticleId);
System.IO.Stream iStream = null;
// Buffer to read 10K bytes in chunk:
byte[] buffer = new Byte[10000];
// Length of the file:
int length;
// Total bytes to read:
long dataToRead;
// Identify the file to download including its path.
// string filepath = "DownloadFileName";
// Identify the file name.
string filename = System.IO.Path.GetFileName(filepath);
try
{
// Open the file.
iStream = new System.IO.FileStream(filepath, System.IO.FileMode.Open,
System.IO.FileAccess.Read, System.IO.FileShare.Read);
// Total bytes to read:
dataToRead = iStream.Length;
Response.ContentType = "application/octet-stream";
Response.AddHeader("Content-Disposition", "attachment; filename=" + filename);
// Read the bytes.
while (dataToRead > 0)
{
// Verify that the client is connected.
if (Response.IsClientConnected)
{
// Read the data in buffer.
length = iStream.Read(buffer, 0, 10000);
// Write the data to the current output stream.
Response.OutputStream.Write(buffer, 0, length);
// Flush the data to the HTML output.
Response.Flush();
buffer = new Byte[10000];
dataToRead = dataToRead - length;
}
else
{
//prevent infinite loop if user disconnects
dataToRead = -1;
}
}
}
catch (Exception ex)
{
// Trap the error, if any.
Response.Write("Error : " + ex.Message);
}
finally
{
if (iStream != null)
{
//Close the file.
iStream.Close();
}
}
}
protected void Button1_Click(object sender, EventArgs e)
{
Server.Transfer("~/Admin/Admin_ReviewedPapert.aspx");
}
protected void Button2_Click(object sender, EventArgs e)
{
int ArticleId = Convert.ToInt32(Session["ArticleId"].ToString());
PaperOp deletepaper = new PaperOp();
deletepaper.delete_paper_admin(ArticleId);
UserLogin deleteenvoyer = new UserLogin();
GetUserId getuserid = new GetUserId();
int UserId = getuserid.GetUserId_envoyers(ArticleId);
GetArticleId getnum = new GetArticleId();
int num = getnum.GetArticleId_number_admin(UserId);
if (num > 1)
deleteenvoyer.delete_envoyer_articleid_admin(ArticleId);
else
{ ArticleId=0;
UserLogin updateenvoyer = new UserLogin();
updateenvoyer.update_envoyers_articleid(ArticleId, UserId);
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -