📄 chakan.aspx.cs
字号:
using System;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Web;
using System.Web.SessionState;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;
using System.IO;
namespace djks
{
/// <summary>
/// chakan 的摘要说明。
/// </summary>
///
public class chakan : System.Web.UI.Page
{
protected System.Web.UI.WebControls.Panel pnl_player;
// protected string xb,csrq,mz,mz_text,zy,zy_text,whcd,whcd_text,blcjzl,blcjzl_text;
// protected static string xm,sfzh;
// protected string yzkzh,lxdh,lxdz,zdyxx;
// protected string bkyy,bkyy_text,;
protected static string havexp="0";
protected System.Web.UI.WebControls.Button btn_upload;
protected System.Web.UI.HtmlControls.HtmlInputFile photo;
protected System.Web.UI.WebControls.Image Image1;
protected System.Web.UI.HtmlControls.HtmlGenericControl SPAN1;
protected System.Web.UI.WebControls.Image Image2;
protected System.Web.UI.WebControls.Button Button2;
protected System.Web.UI.WebControls.Label lbl_bkyy;
protected System.Web.UI.WebControls.Label lbl_sfzh;
protected System.Web.UI.WebControls.Label lbl_xm;
protected System.Web.UI.WebControls.Label lbl_xb;
protected System.Web.UI.WebControls.Label lbl_csrq;
protected System.Web.UI.WebControls.Label lbl_mz;
protected System.Web.UI.WebControls.Label lbl_zy;
protected System.Web.UI.WebControls.Label lbl_whcd;
protected System.Web.UI.WebControls.Label lbl_blcj;
protected System.Web.UI.WebControls.Label lbl_yzkzh;
protected System.Web.UI.WebControls.Label lbl_lxdh;
protected System.Web.UI.WebControls.Label lbl_lxdz;
protected System.Web.UI.WebControls.Label lbl_zdyxx;
protected System.Web.UI.WebControls.Label lbl_bmh;
protected System.Web.UI.WebControls.Button btn_edit;
protected System.Web.UI.HtmlControls.HtmlForm Form1;
private void Page_Load(object sender, System.EventArgs e)
{
// 在此处放置用户代码以初始化页面
if(!this.IsPostBack)
{
if(Request.QueryString["sfzh"]!="")
{
this.lbl_sfzh.Text=Request.QueryString["sfzh"].ToString();
this.lbl_xm.Text=Request.QueryString["xm"].ToString();
this.init_databind(this.lbl_xm.Text,this.lbl_sfzh.Text);
// hxyy_js.jsAlert(Request.QueryString["sfzh"].ToString()+" "+Request.QueryString["xm"].ToString());
}
}
}
#region Web 窗体设计器生成的代码
override protected void OnInit(EventArgs e)
{
//
// CODEGEN: 该调用是 ASP.NET Web 窗体设计器所必需的。
//
InitializeComponent();
base.OnInit(e);
}
/// <summary>
/// 设计器支持所需的方法 - 不要使用代码编辑器修改
/// 此方法的内容。
/// </summary>
private void InitializeComponent()
{
this.Button2.Click += new System.EventHandler(this.btn_upload_Click);
this.btn_edit.Click += new System.EventHandler(this.btn_edit_Click);
this.Load += new System.EventHandler(this.Page_Load);
}
#endregion
private void init_databind(string xm,string sfzh)
{
Random rd=new Random();
DataTable dt=new DataTable();
string strSql="select * from bmk where XM='"+xm+"'and SFZH='"+sfzh+"'"; //查询语句
DataSet ds=new DataSet();
ds=database.CreateDateSet(strSql);
dt=ds.Tables[0];
string jbyy;
this.lbl_bmh.Text=dt.Rows[0]["BMH"].ToString();
string bmh=this.lbl_bmh.Text;
jbyy=this.lbl_bmh.Text.Substring(6,2);
this.lbl_bkyy.Text=select_string("select JBYY from JBYY where JBYYDM='"+jbyy+"'"); //数据绑定函数调用
string mz=dt.Rows[0]["MZ"].ToString(); //民族下拉列表数据绑定
this.lbl_mz.Text=select_string("select MZMC from MZ where MZ='"+mz+"'");
string zy=dt.Rows[0]["ZY"].ToString(); //职业下拉列表数据绑定
this.lbl_zy.Text=select_string("select ZYMC from ZY where ZY='"+zy+"'");
string whcd=dt.Rows[0]["WHCD"].ToString(); //文化程度下拉列表数据绑定
this.lbl_whcd.Text=select_string("select WHCDMC from WHCD where WHCD='"+whcd+"'");
string blcjzl=dt.Rows[0]["BLCJZL"].ToString(); //保留成绩绑定
this.lbl_blcj.Text=select_string("select BLCJMC from BLCJ where BLCJ='"+blcjzl+"'");
this.lbl_xb.Text=dt.Rows[0]["XB"].ToString();
// this.lbl_xm.Text=dt.Rows[0]["XM"].ToString();
// this.lbl_sfzh.Text=dt.Rows[0]["SFZH"].ToString();
this.lbl_csrq.Text=dt.Rows[0]["CSRQ"].ToString();
this.lbl_lxdh.Text=dt.Rows[0]["LXDH"].ToString();
this.lbl_lxdz.Text=dt.Rows[0]["LXDZ"].ToString();
this.lbl_yzkzh.Text=dt.Rows[0]["YZKZH"].ToString();
this.lbl_zdyxx.Text=dt.Rows[0]["ZDYXX"].ToString();
havexp=dt.Rows[0]["HAVEXP"].ToString();
if(havexp=="1")
{
this.Image2.Dispose();
this.Image2.ImageUrl="photo/"+bmh+".jpg?"+rd.Next(100).ToString();
}
else
{
this.Image2.ImageUrl="images/nopho.jpg";
}
}
private string select_string(string sql)
{
string str=database.CreateDateSet(sql).Tables[0].Rows[0][0].ToString();
return str;
}
private void Button1_Click(object sender, System.EventArgs e)
{
Response.Redirect("ksgg.aspx");
}
private void btn_edit_Click(object sender, System.EventArgs e)
{
Response.Redirect("xg.aspx?sfzh="+this.lbl_sfzh.Text+"&xm="+this.lbl_xm.Text);
}
private void btn_upload_Click(object sender, System.EventArgs e)
{
Random rd=new Random();
string photoname;
string bmh=this.lbl_bmh.Text;
try
{
if(this.photo.PostedFile.ContentLength.ToString()=="")
{
hxyy_js.jsAlert("上传的文件不存在");
}
else
{
if(File.Exists(Server.MapPath("photo/")+bmh+".jpg")) //判断是否存在与新报名号相同的照片,若存在则删除
{
File.Delete(Server.MapPath("photo/")+bmh+".jpg");
}
string ext=Path.GetExtension(photo.PostedFile.FileName);
if(ext==".jpg"||ext==".JPG")
{
photoname=this.lbl_bmh.Text+".jpg";
photo.PostedFile.SaveAs(System.Web.HttpContext.Current.Server.MapPath("photo/")+photoname);
// hxyy_js.jsAlert(photoname);
this.Image2.ImageUrl="photo/"+photoname+"?"+rd.Next(100).ToString();
if(havexp=="0")
{
string strSql="update bmk set HAVEXP=1 where SFZH='"+this.lbl_sfzh.Text+"' and XM='"+this.lbl_xm.Text+"'";
database.doSql(strSql);
havexp="1";
}
// this.Image1.ImageUrl=""
// init_databind(xm,sfzh);
}
else
{
hxyy_js.jsAlert("上传文件应为(.jpg)格式,请重新上传");
}
}
}
catch
{
hxyy_js.jsAlert("图片上传中出错。为保证你的信息无误,请到相关部门查证!");
}
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -