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