您目前尚未登陆,请选择【登陆】或【注册
首页->上传下载->明日企业下载管理系统源码>>BackAdmin/AdminSoftwareInfo/InsertAdminSoftwareInfo.aspx.cs>>源码在线查看
温馨提示:代码在线浏览功能只能做为源码浏览参考,如果想更进一步了解该代码请下载:明日企业下载管理系统源码
普通视图
		            
1using System; 2using System.Data; 3using System.Configuration; 4using System.Collections; 5using System.Web; 6using System.Web.Security; 7using System.Web.UI; 8using System.Web.UI.WebControls; 9using System.Web.UI.WebControls.WebParts; 10using System.Web.UI.HtmlControls; 11using System.Data.SqlClient; 12 13public partial class BackAdmin_AdminSoftwareInfo_InsertAdminSoftwareInfo : System.Web.UI.Page 14{ 15 CAN can = new CAN(); 16 string b ; 17 protected void Page_Load(object sender, EventArgs e) 18 { 19 20 if (Page.IsPostBack == false) 21 { 22 txtinterface.Visible = false; 23 txtFile.Visible = false; 24 SqlConnection con = new SqlConnection("server=(local);user id=sa;PWD=sa;DataBase=db_ComPany"); 25 con.Open(); 26 SqlDataAdapter adapter = new SqlDataAdapter("select * from tb_regimentation ORDER BY ID DESC", con); 27 DataSet ds = new DataSet(); 28 adapter.Fill(ds); 29 ddlregimentation.DataSource = ds; 30 ddlregimentation.DataTextField = "Name"; 31 ddlregimentation.DataValueField = "id"; 32 ddlregimentation.DataBind(); 33 // ------------如果需要插入所登录人的所属ID编号,则需要下面代码以检索登录的用户名 34 //SqlCommand mycom = new SqlCommand("select id from tb_Administrator where Name='" + Session["Name"].ToString() + "'", myconnection); 35 //Session["userid"] = Convert.ToInt32(mycom.ExecuteScalar()); 36 con.Close(); 37 } 38 } 39 protected void btninsert_Click(object sender, EventArgs e) 40 { 41 if (UpImage.PostedFile.FileName != ""&&UpFile.PostedFile.FileName!="") 42 { 43 string P_Str_filePath = "", P_Str_mFileName, P_Str_mPath; 44 if (UpImage.PostedFile.FileName!="") 45 { 46 P_Str_filePath = UpImage.PostedFile.FileName; 47 P_Str_mFileName = P_Str_filePath.Substring(P_Str_filePath.LastIndexOf("\\") + 1); 48 49 P_Str_mPath = Server.MapPath("..\\..\\SoftImg\\" + P_Str_mFileName); 50 UpImage.PostedFile.SaveAs(P_Str_mPath); 51 txtinterface.Text = "SoftImg/" + P_Str_mFileName; 52 UpImage.Visible = false; 53 txtinterface.Visible = true; 54 } 55 string P_Str_filePath2 = "", P_Str_mFileName2, P_Str_mPath2; 56 57 if (UpFile.PostedFile.FileName != "") 58 { 59 P_Str_filePath2 = UpFile.PostedFile.FileName; 60 P_Str_mFileName2 = P_Str_filePath2.Substring(P_Str_filePath2.LastIndexOf("\\") + 1); 61 62 P_Str_mPath2 = Server.MapPath("../../FileDown/" + P_Str_mFileName2); 63 UpFile.PostedFile.SaveAs(P_Str_mPath2); 64 txtFile.Text = "FileDown/" + P_Str_mFileName2; 65 UpFile.Visible = false; 66 txtFile.Visible = true; 67 } 68 } 69 else 70 { 71 if (UpImage.PostedFile.FileName != "" && UpFile.PostedFile.FileName == "") 72 73 { 74 string P_Str_filePath = "", P_Str_fileExtName = "", P_Str_mFileName, P_Str_mPath; 75 76 if (UpImage.PostedFile.FileName !="") 77 { 78 P_Str_filePath = UpImage.PostedFile.FileName; 79 P_Str_mFileName = P_Str_filePath.Substring(P_Str_filePath.LastIndexOf("\\") + 1); 80 81 P_Str_mPath = Server.MapPath("..\\..\\SoftImg\\" + P_Str_mFileName); 82 83 UpImage.PostedFile.SaveAs(P_Str_mPath); 84 txtinterface.Text = "SoftImg/" + P_Str_mFileName; 85 UpImage.Visible = false; 86 txtinterface.Visible = true; 87 } 88 } 89 else 90 { 91 string P_Str_filePath2 = "", P_Str_fileExtName2 = "", P_Str_mFileName2, P_Str_mPath2; 92 if(UpImage.PostedFile.FileName == "" && UpFile.PostedFile.FileName != "") 93 { 94 P_Str_filePath2 = UpFile.PostedFile.FileName; 95 P_Str_mFileName2 = P_Str_filePath2.Substring(P_Str_filePath2.LastIndexOf("\\") + 1); 96 97 P_Str_mPath2 = Server.MapPath("../../FileDown/" + P_Str_mFileName2); 98 99 UpFile.PostedFile.SaveAs(P_Str_mPath2); 100 txtFile.Text = "FileDown/" + P_Str_mFileName2; 101 UpFile.Visible = false; 102 txtFile.Visible = true; 103 } 104 } 105 } 106 107 108 //--------------------------------------------------------------------------------------------------------------- 109 if (cklIfFecommend.Items[0].Selected == true) 110 { 111 b = ""; 112 can.ExecSqlCom("insert into tb_SoftwareInfo(Name,regimentationID,softwareSize,lang,platform,edition,DownLoad,IfFecommend,recommendation,interface,recommend,UpFileServerLoad)values('" + txtname.Text + "','" + ddlregimentation.Text + "','" + txtsize.Text + "','" + txtlang.Text + "','" + txtplatform.Text + "','" + txtedition.Text + "','" + txtDownLoad.Text + "','" + b + "','" + txtrecommendation.Text + "','" + txtinterface.Text + "','" + ddlrecommend.Text + "','" + txtFile.Text+ "')"); 113 } 114 else 115 { 116 b = ""; 117 can.ExecSqlCom("insert into tb_SoftwareInfo(Name,regimentationID,softwareSize,lang,platform,edition,DownLoad,IfFecommend,recommendation,interface,UpFileServerLoad)values('" + txtname.Text + "','" + ddlregimentation.Text + "','" + txtsize.Text + "','" + txtlang.Text + "','" + txtplatform.Text + "','" + txtedition.Text + "','" + txtDownLoad.Text + "','" + b + "','" + txtrecommendation.Text + "','" + txtinterface.Text + "','" + txtFile.Text+ "')"); 118 } 119 //Response.Write("<script lanuage=javascript>alert('添加成功!');location='javascript:history.go(-1)'</script>"); 120 Response.Write("<script lanuage=javascript>alert('添加成功!');location='AdminSoftwareInfo.aspx'</script>"); 121 } 122 protected void Button1_Click(object sender, EventArgs e) 123 { 124 Page.Response.Redirect("AdminSoftwareInfo.aspx"); 125 } 126} 127
还没有找到您心仪的内容?请用.net源码大搜捕
代码片断 打包下载该项目完整源码:明日企业下载管理系统源码
51Aspx.com 版权所有 CopyRight © 2000-2008. 京ICP备06046876号