insStu.enrolDate.ToShortDateString(); txtPhone.Text =insStu.phone; txtQQ.Text =insStu.qq; txtEmail.Text =insStu.email; txtMemo.Text = insStu.memo; lblLogNum.Text = insStu.logNum.ToString(); lblLastLog.Text = insStu.lastLog.ToString();
txtEnrolDate.Focus(); Page.DataBind();
Session[\
upPhoto.Attributes.Add(\\ } }
//确定更新
protected void btnUpdate_Click(object sender, EventArgs e) {
Entity_Classes insClass =
Session[\ //检查权限:只有班级管理员具有此权限 if (insClass == null) {
CommonFuncs.ShowMsgAndJump(this.Page, \请登录!\ return; }
Entity_Student insStu = Session[\Entity_Student;
if (insStu==null) {
CommonFuncs.ShowMsg(this.Page, \没有找到学生,请返刷新页面后回重新操作!\ return; }
string fileName = \图片文件名 string fileExt = \图片文件的扩展名 if (upPhoto.HasFile) {
fileName = upPhoto.FileName.ToLower(); if (fileName.IndexOf(\ {
CommonFuncs.ShowMsg(this.Page, \照片文件错误!请重新选择!\ return; }
fileExt =
System.IO.Path.GetExtension(fileName);
List
if (lstExt.IndexOf(fileExt) < 0)
{
CommonFuncs.ShowMsg(this.Page, \请选择 JGP 或 GIF 格式的文件!请重新选择!\ return; }
//重命名照片为:学号.扩展名 fileName = insStu.snum + fileExt; try {
upPhoto.SaveAs(Server.MapPath(\fileName); }
catch (Exception ex) {
BLL_Logs.WriteLog(ex.Message); CommonFuncs.ShowMsg(this.Page, \照片上传失败,详细原因请管理员检查事务日志。\ return; }
//限制上传照片的尺寸大小<150*200 System.Drawing.Image img =
System.Drawing.Image.FromFile(Server.MapPath(\tos\
if (img.Width > 150 || img.Height > 200) {
CommonFuncs.ShowMsg(this.Page, \照片的宽*高不得超过 150*200 像素!\ return; } }
DateTime dtBirthday = new DateTime(1900, 1, 1);
if (txtBirthday.Text.Trim() != \ { if
(!DateTime.TryParse(txtBirthday.Text.Trim(), out dtBirthday)) {
CommonFuncs.ShowMsg(this.Page, \出生日期格式不正确,请更正!\