lt_touxiang.aspx.cs

来自「OA自动化办公系统,就是OA自动化办公系统」· CS 代码 · 共 47 行

CS
47
字号
using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using COM.OA.BLL;
using COM.OA.Entity;

public partial class linminchao_bbs_lt_touxiang : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        users loginuser = Session["loginuser"] as users;
        if (loginuser == null)
        {
            this.Response.Write(string.Format(GetRedirect.ALLREDIRECT, "../../login.aspx"));
        }
    }
    protected void submit_ServerClick(object sender, EventArgs e)
    {
        if (this.FileUpload1 == null)
        {
        }
        else
        {
            users loginuser = Session["loginuser"] as users;
            int startIndex = this.FileUpload1.FileName.LastIndexOf(@"\") + 1;
            string fileName = this.FileUpload1.FileName.Substring(startIndex);
            string phyFileName = this.Server.MapPath(@"..\" + "touxiang") + @"\" + fileName + ".gif";
            this.FileUpload1.SaveAs(phyFileName);
            string img = "touxiang/" + this.FileUpload1.FileName + ".gif";
            employee u = employeeBLL.Select(loginuser.u_em_id);
            u.em_photo = img;
            int ii = employeeBLL.Update(u);
            if(ii<0){
                this.Response.Write(string.Format(GetRedirect.WINALERT, "上传头像成功!!"));
                this.Response.Write(string.Format(GetRedirect.REDIRECT, "lt_touxiang.aspx"));
            }
        }
    }
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?