您目前尚未登陆,请选择【登陆】或【注册
首页->上传下载->明日企业下载管理系统源码>>BackAdmin/AdminSoftwareInfo/UpdateAdminSoftwareInfo.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; 12using System.IO; 13 14public partial class BackAdmin_AdminSoftwareInfo_UpdateAdminSoftwareInfo : System.Web.UI.Page 15{ 16 CAN can = new CAN(); 17 string b; 18 protected void Page_Load(object sender, EventArgs e) 19 { 20 //获取登录后台时所输入的用户名 21 //TextBox1.Text = Session["Name"].ToString(); 22 //首次执行页面,通过DropDownList1控件将tb_regimentation表的Name字段显示出来 23 if (Page.IsPostBack == false) 24 { 25 UpImage.Visible = true; 26 UpFile.Visible = true; 27 txtinterface.Visible = true; 28 txtFile.Visible = true; 29 SqlConnection mycon1 = new SqlConnection("server=(local);user id=sa;PWD=sa;DataBase=db_ComPany"); 30 mycon1.Open(); 31 SqlDataAdapter myada1 = new SqlDataAdapter("select * from SoftView where id=" + Request["id"], mycon1); 32 DataSet myds1 = new DataSet(); 33 myada1.Fill(myds1); 34 ddlregimentation.DataSource = myds1; 35 ddlregimentation.DataTextField = "Expr1"; 36 ddlregimentation.DataValueField = "id"; 37 ddlregimentation.DataBind(); 38 39 40 41 SqlConnection mycon2 = new SqlConnection("server=(local);user id=sa;PWD=sa;DataBase=db_ComPany"); 42 mycon2.Open(); 43 SqlDataAdapter myada2 = new SqlDataAdapter("select * from tb_SoftwareInfo where ID=" + Request["ID"], mycon2); 44 DataSet myds2 = new DataSet(); 45 myada2.Fill(myds2, "tb_SoftwareInfo"); 46 DataRowView rowview = myds2.Tables["tb_SoftwareInfo"].DefaultView[0]; 47 txtname.Text = Convert.ToString(rowview["Name"]);           48 txtsize.Text = Convert.ToString(rowview["softwareSize"]);          49 txtlang.Text = Convert.ToString(rowview["lang"]);           50 txtplatform.Text = Convert.ToString(rowview["platform"]);           51 txtedition.Text = Convert.ToString(rowview["edition"]);       52 txtDownLoad.Text = Convert.ToString(rowview["DownLoad"]);           53 ddlrecommend.Text = Convert.ToString(rowview["recommend"]);         54 txtrecommendation.Text = Convert.ToString(rowview["recommendation"]); 55 txtinterface.Text = Convert.ToString(rowview["interface"]); 56 txtFile.Text = Convert.ToString(rowview["UpFileServerLoad"]); 57 if (rowview["IfFecommend"].ToString() == "") 58 { 59 cklIfFecommend.Items[0].Selected = true; 60 } 61 else 62 { 63 cklIfFecommend.Items[0].Selected = false; 64 } 65 mycon2.Close(); 66 } 67 } 68 protected void btnupdate_Click(object sender, EventArgs e) 69 { 70 71 if (UpImage.PostedFile.FileName != "" && txtinterface.Text == "" ) 72 { 73 string P_Str_filePath = "", P_Str_fileExtName = "", P_Str_mFileName, P_Str_mPath; 74 if ("" != this.UpImage.PostedFile.FileName) 75 { 76 P_Str_filePath = UpImage.PostedFile.FileName; 77 P_Str_fileExtName = P_Str_filePath.Substring(P_Str_filePath.LastIndexOf(".") + 1); 78 79 P_Str_mPath = Server.MapPath("..\\..\\SoftImg\\"); 80 P_Str_mFileName = P_Str_filePath.Substring(P_Str_filePath.LastIndexOf("\\") + 1); 81 UpImage.PostedFile.SaveAs(P_Str_mPath + P_Str_mFileName); 82 txtinterface.Text = "SoftImg\\" + P_Str_mFileName; 83 UpImage.Visible = true; 84 txtinterface.Visible = true; 85 } 86 } 87 else if (UpImage.PostedFile.FileName != "" && txtinterface.Text != "") 88 { 89 FileInfo file = new FileInfo(Server.MapPath("../../" + txtinterface.Text.ToString())); 90 file.Delete(); 91 string P_Str_filePath = "", P_Str_fileExtName = "", P_Str_mFileName, P_Str_mPath; 92 if ("" != this.UpImage.PostedFile.FileName) 93 { 94 P_Str_filePath = UpImage.PostedFile.FileName; 95 P_Str_fileExtName = P_Str_filePath.Substring(P_Str_filePath.LastIndexOf(".") + 1); 96 P_Str_mPath = Server.MapPath("..\\..\\SoftImg\\"); 97 P_Str_mFileName = P_Str_filePath.Substring(P_Str_filePath.LastIndexOf("\\") + 1); 98 UpImage.PostedFile.SaveAs(P_Str_mPath + P_Str_mFileName); 99 txtinterface.Text = "SoftImg\\" + P_Str_mFileName; 100 UpImage.Visible = true; 101 txtinterface.Visible = true; 102 } 103 } 104 if (UpFile.PostedFile.FileName != "" && txtFile.Text == "") 105 { 106 string P_Str_filePath2 = "", P_Str_fileExtName2 = "", P_Str_mFileName2, P_Str_mPath2; 107 if (UpFile.PostedFile.FileName != "") 108 { 109 P_Str_filePath2 = UpFile.PostedFile.FileName; 110 P_Str_mFileName2 = P_Str_filePath2.Substring(P_Str_filePath2.LastIndexOf("\\") + 1); 111 P_Str_mPath2 = Server.MapPath("..\\..\\FileDown\\" + P_Str_mFileName2); 112 UpFile.PostedFile.SaveAs(P_Str_mPath2 + P_Str_mFileName2); 113 txtFile.Text = "FileDown\\" + P_Str_mFileName2; 114 UpFile.Visible = false; 115 txtFile.Visible = true; 116 } 117 } 118 else if (UpFile.PostedFile.FileName != "" && txtFile.Text != "") 119 { 120 FileInfo file = new FileInfo(Server.MapPath("../../" + txtFile.Text.ToString())); 121 file.Delete(); 122 string P_Str_filePath2 = "", P_Str_fileExtName2 = "", P_Str_mFileName2, P_Str_mPath2; 123 if (UpFile.PostedFile.FileName != "") 124 { 125 P_Str_filePath2 = UpFile.PostedFile.FileName; 126 P_Str_mFileName2 = P_Str_filePath2.Substring(P_Str_filePath2.LastIndexOf("\\") + 1); 127 P_Str_mPath2 = Server.MapPath("..\\..\\FileDown\\" + P_Str_mFileName2); 128 UpFile.PostedFile.SaveAs(P_Str_mPath2 + P_Str_mFileName2); 129 txtFile.Text = "FileDown\\" + P_Str_mFileName2; 130 UpFile.Visible = false; 131 txtFile.Visible = true; 132 } 133 } 134 if (cklIfFecommend.Items[0].Selected == true) 135 { 136 b = ""; 137 can.ExecSqlCom("update tb_SoftwareInfo set Name='" + txtname.Text + "',softwareSize='" + txtsize.Text + "',lang='" + txtlang.Text + "',platform='" + txtplatform.Text + "',edition='" + txtedition.Text + "',DownLoad='" + txtDownLoad.Text + "',recommend='" + ddlrecommend.Text + "',IfFecommend='" + b + "',recommendation='" + txtrecommendation.Text + "',interface='" + txtinterface.Text + "',UpFileServerLoad='" + txtFile.Text + "' where ID=" + Request["ID"]); 138 //Response.Write("update tb_SoftwareInfo set Name='" + txtname.Text + "',softwareSize='" + txtsize.Text + "',lang='" + txtlang.Text + "',platform='" + txtplatform.Text + "',edition='" + txtedition.Text + "',DownLoad='" + txtDownLoad.Text + "',recommend='" + ddlrecommend.Text + "',IfFecommend='" + b + "',recommendation='" + txtrecommendation.Text + "',interface='" + txtinterface.Text + "',UpFileServerLoad='" + txtFile.Text + "' where ID=" + Request["ID"]); 139 Response.Write("<script lanuage=javascript>alert('修改成功!');location='AdminSoftwareInfo.aspx'</script>"); 140 } 141 else 142 { 143 b = ""; 144 can.ExecSqlCom("update tb_SoftwareInfo set Name='" + txtname.Text + "',softwareSize='" + txtsize.Text + "',lang='" + txtlang.Text + "',platform='" + txtplatform.Text + "',edition='" + txtedition.Text + "',DownLoad='" + txtDownLoad.Text + "',recommend='" + 0 + "',IfFecommend='" + b + "',recommendation='" + txtrecommendation.Text + "',interface='" + txtinterface.Text + "',UpFileServerLoad='" + txtFile.Text + "' where ID=" + Request["ID"]); 145 //Response.Write("update tb_SoftwareInfo set Name='" + txtname.Text + "',softwareSize='" + txtsize.Text + "',lang='" + txtlang.Text + "',platform='" + txtplatform.Text + "',edition='" + txtedition.Text + "',DownLoad='" + txtDownLoad.Text + "',recommend='" + 0 + "',IfFecommend='" + b + "',recommendation='" + txtrecommendation.Text + "',interface='" + txtinterface.Text + "',UpFileServerLoad='" + txtFile.Text + "' where ID=" + Request["ID"]); 146 Response.Write("<script lanuage=javascript>alert('修改成功!');location='AdminSoftwareInfo.aspx'</script>"); 147 } 148 } 149 protected void Button1_Click(object sender, EventArgs e) 150 { 151 Page.Response.Redirect("AdminSoftwareInfo.aspx"); 152 } 153 protected void Button2_Click(object sender, EventArgs e) 154 { 155 cklIfFecommend.Items[0].Selected = false; 156 txtname.Text = ""; 157 txtsize.Text = ""; 158 txtlang.Text = ""; 159 txtlang.Text = ""; 160 txtedition.Text = ""; 161 txtDownLoad.Text = ""; 162 txtrecommendation.Text = ""; 163 txtplatform.Text = ""; 164 ddlrecommend.Text = "0"; 165 166 } 167} 168
还没有找到您心仪的内容?请用.net源码大搜捕
代码片断 打包下载该项目完整源码:明日企业下载管理系统源码
51Aspx.com 版权所有 CopyRight © 2000-2008. 京ICP备06046876号