📄 work_cumulate.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;
public partial class Work_Cumulate : System.Web.UI.Page
{
public static SqlConnection MyConnection;
public static SqlCommand MyCommand;
protected void Page_Load(object sender, EventArgs e)
{
}
protected void btnSubmit_Click(object sender, ImageClickEventArgs e)
{
if (Session["Name"] == null)
{
JS.Alert("您还未登陆或登陆超时!");
Response.Redirect("Default.aspx");
}
int i=Convert.ToInt32(Request.QueryString["ID"].ToString());
DateTime time = DateTime.Now;
string status = "已经完成";
string document = "";
string gain = txtGain.Text;
if ("" != File1.PostedFile.FileName)
{
string path = File1.PostedFile.FileName;
string filetype = path.Substring(path.LastIndexOf(".") + 1);
string filename =Session["Name"]+ DateTime.Now.Year.ToString() + DateTime.Now.Month.ToString() + DateTime.Now.Day.ToString() + DateTime.Now.Hour.ToString() + DateTime.Now.Minute.ToString() + DateTime.Now.Second.ToString() + "." + filetype;
if (filetype == "rar")
{
try
{
File1.PostedFile.SaveAs(Server.MapPath("~/WorkDocument") + "\\" + filename);
document = filename;
}
catch (Exception e3)
{
JS.Alert("对不起,您不能上传过大的附件!");
}
}
else
{
JS.Alert("请上传格式为rar的附件!");
return;
}
}
if (UpdateWorkPlanInfo(i, time, status, document, gain))
{
Response.Redirect("SheduReport.aspx");
}
}
public static bool UpdateWorkPlanInfo(int i, DateTime time, string s1, string s2, string s3)
{
MyConnection = DB.createCon();
MyCommand = new SqlCommand("Update_WorkPlan_Info", MyConnection);
MyCommand.CommandType = CommandType.StoredProcedure;
SqlParameter ID = new SqlParameter("@ID", SqlDbType.Int);
ID.Value = i;
MyCommand.Parameters.Add(ID);
SqlParameter Finish_Time = new SqlParameter("@Finish_Time", SqlDbType.DateTime);
Finish_Time.Value = time;
MyCommand.Parameters.Add(Finish_Time);
SqlParameter Status = new SqlParameter("@Status", SqlDbType.VarChar);
Status.Value = s1;
MyCommand.Parameters.Add(Status);
SqlParameter Document = new SqlParameter("@Document", SqlDbType.VarChar);
Document.Value = s2;
MyCommand.Parameters.Add(Document);
SqlParameter Gain = new SqlParameter("@Gain", SqlDbType.VarChar);
Gain.Value = s3;
MyCommand.Parameters.Add(Gain);
MyConnection.Open();
int result;
result = MyCommand.ExecuteNonQuery();
MyConnection.Close();
if (result > 0)
{
return true;
}
else
{
return false;
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -