top.aspx.cs
上传用户:xrffrp
上传日期:2022-03-25
资源大小:22155k
文件大小:3k
源码类别:

OA系统

开发平台:

ASP/ASPX

  1. using System;
  2. using System.Text;
  3. using System.Data;
  4. using System.Configuration;
  5. using System.Collections;
  6. using System.Data.SqlClient;
  7. using System.Web;
  8. using System.Web.Security;
  9. using System.Web.UI;
  10. using System.Web.UI.WebControls;
  11. using System.Web.UI.WebControls.WebParts;
  12. using System.Web.UI.HtmlControls;
  13. public partial class web_top : System.Web.UI.Page
  14. {
  15.     protected void Page_Load(object sender, EventArgs e)
  16.     {
  17.         if (!IsPostBack)
  18.         {
  19.             string place = string.Empty;
  20.             if (Application["TITLE"] != null)
  21.             {
  22.                 LblTitle.Text = Application["TITLE"].ToString();
  23.                 BtnReLogin.Text = "登出";
  24.                 BtnReLogin.OnClientClick = "return confirm('確定要登出嗎?')";
  25.                 HlWhere.Text = "大家在哪裡";
  26.                 if (Session["user"] != null)
  27.                 {
  28.                     User user = (User)Session["user"];
  29.                     LblInfo.Text = "當前用戶: " + user.Emp_no + " " + user.Emp_name + user.Position;
  30.                     SqlConnection conn = dbConnection.getConnection();
  31.                     conn.Open();
  32.                     SqlCommand sqlcom = new SqlCommand("select place from oa_employee where id=" + user.Id, conn);
  33.                     SqlDataReader dr = sqlcom.ExecuteReader();
  34.                     if (dr.HasRows)
  35.                     {
  36.                         while (dr.Read())
  37.                         {
  38.                             place = dr["place"].ToString().Trim();
  39.                         }
  40.                     }
  41.                 }
  42.                 
  43.                 Response.Write("<meta http-equiv='refresh' content='600'/> ");
  44.             }
  45.             /*ArrayList myarray = new ArrayList();
  46.             Weather myweather = new Weather();
  47.             if (place.Equals(""))
  48.             {
  49.                 place = "上海";
  50.             }
  51.             myarray = myweather.GetWeather(place);
  52.             LinkButton1.Text = myarray[0].ToString();
  53.             Label1.Text = myarray[1].ToString();
  54.             string str = myarray[2].ToString() + "~" + myarray[3].ToString();
  55.             Label2.Text = str.Trim();*/
  56.         }
  57.     }
  58.     protected void BtnReLogin_Click(object sender, EventArgs e)
  59.     {
  60.         Session.RemoveAll();
  61.         Response.Write("<script language='javascript'>window.parent.location.href='login.aspx'</script>");
  62.     }
  63.     protected void Button1_Click(object sender, EventArgs e)
  64.     {
  65.         Response.Redirect("Default.aspx");
  66.     }
  67.     protected void LinkButton1_Click(object sender, EventArgs e)
  68.     {
  69.         Response.Write(" <script>window.open('select_weather.aspx','_blank','left=262 top=180 height=340 width=560 scrollbars=no, resizable = no, status = no, toolbar = no, menubar = no') </script>");
  70.     }
  71. }