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

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.        int i = 0;
  18.        int k = 0;
  19.        int num1=0;
  20.        int num2=0;
  21.        int num3=0;
  22.        int num4 = 0;
  23.        string[] myarray= new string[100000];
  24.        int[] myarray1 = new int[100000];
  25.         DateMgr mgr = new DateMgr();
  26.         string today = mgr.getDate();
  27.         SqlConnection sqlconn1 = dbConnection.getConnection();
  28.         System.Data.SqlClient.SqlCommand sqlcomm1 = new SqlCommand("select subject,type_id from dbo.OA_ANNOUNCEMENT where validate_date >='"+today+"'", sqlconn1);
  29.         sqlconn1.Open();
  30.         System.Data.SqlClient.SqlDataReader comm1 =sqlcomm1.ExecuteReader();
  31.         Response.Write("<marquee onmouseover=stop() onmouseout=start()  width=300px style='left: 400px; position: absolute; top: 75px' scrollDelay=200 >");
  32.         while (comm1.Read())
  33.         {
  34.             myarray[i]=comm1["subject"].ToString();
  35.             myarray1[i] = Convert.ToInt32(comm1["type_id"]);
  36.             i=i+1;
  37.         }
  38.         for (int j = 0; j < myarray.Length; j++)
  39.         {
  40.             if(myarray[j]!=null)
  41.                 Response.Write("<a href='announcement/announce_list.aspx?type_id="+myarray1[j]+"'target=_blank>" + myarray[j] + "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;");
  42.         }
  43.         Response.Write("</marquee>");
  44.         comm1.Close();
  45.         sqlconn1.Close();
  46.         if (!IsPostBack)
  47.         {
  48.             if (Application["TITLE"] != null)
  49.             {
  50.                 LblTitle.Text = Application["TITLE"].ToString();
  51.                 BtnReLogin.Text = "登出";
  52.                 BtnReLogin.OnClientClick = "return confirm('確定要登出嗎?')";
  53.                 HlWhere.Text = "大家在哪裡";
  54.                 if (Session["user"] != null)
  55.                 {
  56.                     User user = (User)Session["user"];
  57.                     LblInfo.Text = "當前用戶: " + user.Emp_no + " " + user.Emp_name + user.Position;
  58.                     SqlConnection sqlconn2 = dbConnection.getConnection();
  59.                     System.Data.SqlClient.SqlCommand sqlcomm2 = new SqlCommand("select distinct id from dbo.OA_TW_APPROVEL_FORM as f where f.state=1", sqlconn2);
  60.                     sqlconn2.Open();
  61.                     SqlDataReader comm2 = sqlcomm2.ExecuteReader();
  62.                     while (comm2.Read())
  63.                     {
  64.                         SqlConnection sqlconn3 = dbConnection.getConnection();
  65.                         System.Data.SqlClient.SqlCommand sqlcomm3 = new SqlCommand("select top 1 * from dbo.OA_TW_APPROVEL_FORM_FLOW as f where f.is_check='N'and f.form_id=" + comm2["id"] + "order by form_id", sqlconn3);
  66.                             sqlconn3.Open();
  67.                             SqlDataReader comm3 = sqlcomm3.ExecuteReader();
  68.                             while (comm3.Read())
  69.                             {
  70.                                 k = Convert.ToInt32(comm3["operator_id"]);
  71.                                 if (k == user.Id )
  72.                                 {
  73.                                     num1 = num1 + 1;
  74.                                 }
  75.                             }
  76.                             comm3.Close();
  77.                             sqlconn3.Close();
  78.                     }
  79.                     comm2.Close();
  80.                     sqlconn2.Close();
  81.                     SqlConnection sqlconn4 =  dbConnection.getConnection();
  82.                     System.Data.SqlClient.SqlCommand sqlcomm4 = new SqlCommand("select distinct id from dbo.OA_CH_BUSINESS_FORM as f where f.state=1", sqlconn4);
  83.                     sqlconn4.Open();
  84.                     SqlDataReader comm4 = sqlcomm4.ExecuteReader();
  85.                     while (comm4.Read())
  86.                     {
  87.                         SqlConnection sqlconn5 = dbConnection.getConnection();
  88.                             System.Data.SqlClient.SqlCommand sqlcomm5 = new SqlCommand("select top 1 * from dbo.OA_CH_APPROVEL_FORM_FLOW as f  where f.is_business='Y'and f.is_check='N'and f.form_id=" + comm4["id"]+ "order by f.form_id", sqlconn5);
  89.                             sqlconn5.Open();
  90.                             SqlDataReader comm5 = sqlcomm5.ExecuteReader();
  91.                             while (comm5.Read())
  92.                             {
  93.                                 k = Convert.ToInt32(comm5["operator_id"]);
  94.                                 if (k == user.Id)
  95.                                 {
  96.                                     num2 = num2 + 1;
  97.                                 }
  98.                             }
  99.                             comm5.Close();
  100.                             sqlconn5.Close();
  101.                     }
  102.                     comm4.Close();
  103.                     sqlconn4.Close();
  104.                     SqlConnection sqlconn6 = dbConnection.getConnection();
  105.                     System.Data.SqlClient.SqlCommand sqlcomm6 = new SqlCommand("select distinct id from dbo.OA_CH_OFF_FORM as f where f.state=1", sqlconn6);
  106.                     sqlconn6.Open();
  107.                     SqlDataReader comm6 = sqlcomm6.ExecuteReader();
  108.                     while (comm6.Read())
  109.                     {
  110.                         SqlConnection sqlconn7 = dbConnection.getConnection();
  111.                         System.Data.SqlClient.SqlCommand sqlcomm7 = new SqlCommand("select top 1 * from dbo.OA_CH_APPROVEL_FORM_FLOW as f  where f.is_business='N'and f.is_check='N'and f.form_id=" + comm6["id"] + "order by f.form_id", sqlconn7);
  112.                         sqlconn7.Open();
  113.                         SqlDataReader comm7 = sqlcomm7.ExecuteReader();
  114.                         while (comm7.Read())
  115.                         {
  116.                             k = Convert.ToInt32(comm7["operator_id"]);
  117.                             if (k == user.Id)
  118.                             {
  119.                                 num4 = num4 + 1;
  120.                             }
  121.                         }
  122.                         comm7.Close();
  123.                         sqlconn7.Close();
  124.                     }
  125.                     comm6.Close();
  126.                     sqlconn6.Close();
  127.                     num2 = num2 + num4;
  128.                     SqlConnection sqlconn8 = dbConnection.getConnection();
  129.                     System.Data.SqlClient.SqlCommand sqlcomm8 = new SqlCommand("select distinct form_id from dbo.OA_FAIR_FORM_FLOW", sqlconn8);
  130.                     sqlconn8.Open();
  131.                     SqlDataReader comm8 = sqlcomm8.ExecuteReader();
  132.                     while (comm8.Read())
  133.                     {
  134.                         SqlConnection sqlconn9 = dbConnection.getConnection();
  135.                         System.Data.SqlClient.SqlCommand sqlcomm9 = new SqlCommand("select top 1 * from dbo.OA_FAIR_FORM_FLOW as f where f.is_check='N'and f.form_id=" + comm8["form_id"] + "order by f.form_id", sqlconn9);
  136.                         sqlconn9.Open();
  137.                         SqlDataReader comm9 = sqlcomm9.ExecuteReader();
  138.                         while (comm9.Read())
  139.                         {
  140.                             k = Convert.ToInt32(comm9["operator_id"]);
  141.                             if (k == user.Id)
  142.                             {
  143.                                 num3 = num3 + 1;
  144.                             }
  145.                         }
  146.                         comm9.Close();
  147.                         sqlconn9.Close();
  148.                     }
  149.                     comm8.Close();
  150.                     sqlconn8.Close();
  151.                     Response.Write("<marquee onmouseover=stop() onmouseout=start() width=250px Height=70px style='left: 400px; position: absolute; top: 2px'  direction=up  BEHAVIOR=SCROLL SCROLLAMOUNT=10 scrollDelay=400 >");
  152.                     if (num1 != 0)
  153.                     {
  154.                         Response.Write("<a href='approvel/tw/deal_list.aspx'" + " target=_blank>" + "您有" + num1 + "个台幹申請單需要審核 </br></br>");
  155.                     }
  156.                     if (num2 != 0)
  157.                     {
  158.                         Response.Write("<a href='approvel/ch/deal_list.aspx'" + " target=_blank>" + "您有" + num2 + "个中幹申請單需要審核</br> </br>");
  159.                     }
  160.                     if (num3 != 0)
  161.                     {
  162.                         Response.Write("<a href='fair/deal_list.aspx'" + " target=_blank>" + "您有" + num3 + "个費用申請單需要審核</br> </br>");
  163.                     }
  164.                     Response.Write("</marquee>");
  165.                 }
  166.                 
  167.                 Response.Write("<meta http-equiv='refresh' content='600'/> ");
  168.             }
  169.         }
  170.         
  171.     }
  172.     protected void BtnReLogin_Click(object sender, EventArgs e)
  173.     {
  174.         Session.RemoveAll();
  175.         Response.Write("<script language='javascript'>window.parent.location.href='login.aspx'</script>");
  176.     }
  177.     protected void Button1_Click(object sender, EventArgs e)
  178.     {
  179.         Response.Redirect("Default.aspx");
  180.     }
  181. }