lt_touxiang.aspx.cs
上传用户:lishan0805
上传日期:2019-12-08
资源大小:12048k
文件大小:2k
源码类别:

OA系统

开发平台:

C#

  1. using System;
  2. using System.Data;
  3. using System.Configuration;
  4. using System.Collections;
  5. using System.Web;
  6. using System.Web.Security;
  7. using System.Web.UI;
  8. using System.Web.UI.WebControls;
  9. using System.Web.UI.WebControls.WebParts;
  10. using System.Web.UI.HtmlControls;
  11. using COM.OA.BLL;
  12. using COM.OA.Entity;
  13. public partial class linminchao_bbs_lt_touxiang : System.Web.UI.Page
  14. {
  15.     protected void Page_Load(object sender, EventArgs e)
  16.     {
  17.         users loginuser = Session["loginuser"] as users;
  18.         if (loginuser == null)
  19.         {
  20.             this.Response.Write(string.Format(GetRedirect.ALLREDIRECT, "../../login.aspx"));
  21.         }
  22.     }
  23.     protected void submit_ServerClick(object sender, EventArgs e)
  24.     {
  25.         if (this.FileUpload1 == null)
  26.         {
  27.         }
  28.         else
  29.         {
  30.             users loginuser = Session["loginuser"] as users;
  31.             int startIndex = this.FileUpload1.FileName.LastIndexOf(@"") + 1;
  32.             string fileName = this.FileUpload1.FileName.Substring(startIndex);
  33.             string phyFileName = this.Server.MapPath(@".." + "touxiang") + @"" + fileName + ".gif";
  34.             this.FileUpload1.SaveAs(phyFileName);
  35.             string img = "touxiang/" + this.FileUpload1.FileName + ".gif";
  36.             employee u = employeeBLL.Select(loginuser.u_em_id);
  37.             u.em_photo = img;
  38.             int ii = employeeBLL.Update(u);
  39.             if(ii<0){
  40.                 this.Response.Write(string.Format(GetRedirect.WINALERT, "上传头像成功!!"));
  41.                 this.Response.Write(string.Format(GetRedirect.REDIRECT, "lt_touxiang.aspx"));
  42.             }
  43.         }
  44.     }
  45. }