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

OA系统

开发平台:

ASP/ASPX

  1. using System;
  2. using System.Data;
  3. using System.Data.SqlClient;
  4. using System.Configuration;
  5. using System.Collections;
  6. using System.Web;
  7. using System.Web.Security;
  8. using System.Web.UI;
  9. using System.Web.UI.WebControls;
  10. using System.Web.UI.WebControls.WebParts;
  11. using System.Web.UI.HtmlControls;
  12. public partial class web_new_repair_form_edit : System.Web.UI.Page
  13. {
  14.     int flag = 0;
  15.     protected void Page_Load(object sender, EventArgs e)
  16.     {
  17.         SqlConnection conn = dbConnection.getConnection();
  18.         conn.Open();
  19.         if (!IsPostBack)
  20.         {
  21.             dl_company.Items.Clear();
  22.             dl_company.Items.Add("所有厂商");
  23.             SqlCommand sqlcom1 = new SqlCommand("select company from OA_COMPANY order by id", conn);
  24.             SqlDataReader dr1 = sqlcom1.ExecuteReader();
  25.             if (dr1.HasRows)
  26.             {
  27.                 while (dr1.Read())
  28.                 {
  29.                     dl_company.Items.Add(dr1["company"].ToString());
  30.                 }
  31.             }
  32.             dr1.Close();
  33.             dl_type.Items.Clear();
  34.             dl_type.Items.Add("所有类型");
  35.             SqlCommand sqlcom3 = new SqlCommand("select type from OA_UNIT_TYPE order by id", conn);
  36.             SqlDataReader dr3 = sqlcom3.ExecuteReader();
  37.             if (dr3.HasRows)
  38.             {
  39.                 while (dr3.Read())
  40.                 {
  41.                     dl_type.Items.Add(dr3["type"].ToString());
  42.                 }
  43.             }
  44.             dr3.Close();
  45.             dl_name.Items.Clear();
  46.             dl_name.Items.Add("所有设备");
  47.             SqlCommand sqlcom = new SqlCommand("select eq_name from OA_UNIT_DETAIL order by id", conn);
  48.             SqlDataReader dr = sqlcom.ExecuteReader();
  49.             if (dr.HasRows)
  50.             {
  51.                 while (dr.Read())
  52.                 {
  53.                     dl_name.Items.Add(dr["eq_name"].ToString());
  54.                 }
  55.             }
  56.             dr.Close();
  57.             flag = 2;
  58.             GridView1.DataBind();
  59.             MultiView2.ActiveViewIndex = -1;
  60.             MultiView1.ActiveViewIndex = -1;
  61.             bind4();
  62.         }
  63.         conn.Close();
  64.     }
  65.     protected void Begindate_SelectionChanged(object sender, EventArgs e)
  66.     {
  67.         Begindate.Visible = false;
  68.         string year = Begindate.SelectedDate.Year.ToString();
  69.         string month = Begindate.SelectedDate.Month.ToString();
  70.         if (month.Length == 1)
  71.         {
  72.             month = "0" + month;
  73.         }
  74.         string day = Begindate.SelectedDate.Day.ToString();
  75.         if (day.Length == 1)
  76.         {
  77.             day = "0" + day;
  78.         }
  79.         b_time.Text = year + month + day + "000000";
  80.         b_time.Focus();
  81.     }
  82.     protected void Enddate_SelectionChanged(object sender, EventArgs e)
  83.     {
  84.         Enddate.Visible = false;
  85.         string year = Enddate.SelectedDate.Year.ToString();
  86.         string month = Enddate.SelectedDate.Month.ToString();
  87.         if (month.Length == 1)
  88.         {
  89.             month = "0" + month;
  90.         }
  91.         string day = Enddate.SelectedDate.Day.ToString();
  92.         if (day.Length == 1)
  93.         {
  94.             day = "0" + day;
  95.         }
  96.         e_time.Text = year + month + day + "000000";
  97.         e_time.Focus();
  98.     }
  99.     protected void ImageButton2_Click(object sender, ImageClickEventArgs e)
  100.     {
  101.         if (Enddate.Visible == true)
  102.         {
  103.             Enddate.Visible = false;
  104.             Enddate.Focus();
  105.         }
  106.         else
  107.         {
  108.             Enddate.Visible = true;
  109.             Enddate.Focus();
  110.         }
  111.     }
  112.     protected void ImageButton1_Click(object sender, ImageClickEventArgs e)
  113.     {
  114.         if (Begindate.Visible == true)
  115.         {
  116.             Begindate.Visible = false;
  117.             Begindate.Focus();
  118.         }
  119.         else
  120.         {
  121.             Begindate.Visible = true;
  122.             Begindate.Focus();
  123.         }
  124.     }
  125.     protected void dl_type_SelectedIndexChanged(object sender, EventArgs e)
  126.     {
  127.         SqlConnection conn = dbConnection.getConnection();
  128.         conn.Open();
  129.         if (dl_type.SelectedItem.ToString().Equals("所有类型"))
  130.         {
  131.             dl_name.Items.Clear();
  132.             dl_name.Items.Add("所有设备");
  133.             SqlCommand sqlcom1 = new SqlCommand("select eq_name from OA_UNIT_DETAIL order by id", conn);
  134.             SqlDataReader dr1 = sqlcom1.ExecuteReader();
  135.             if (dr1.HasRows)
  136.             {
  137.                 while (dr1.Read())
  138.                 {
  139.                     dl_name.Items.Add(dr1["eq_name"].ToString());
  140.                 }
  141.             }
  142.             dr1.Close();
  143.         }
  144.         else
  145.         {
  146.             dl_name.Items.Clear();
  147.             dl_name.Items.Add("所有设备");
  148.             SqlCommand sqlcom = new SqlCommand("select eq_name from OA_UNIT_DETAIL where eq_type='" + dl_type.SelectedItem.ToString() + "'", conn);
  149.             SqlDataReader dr = sqlcom.ExecuteReader();
  150.             if (dr.HasRows)
  151.             {
  152.                 while (dr.Read())
  153.                 {
  154.                     dl_name.Items.Add(dr["eq_name"].ToString());
  155.                 }
  156.             }
  157.             dr.Close();
  158.         }
  159.         conn.Close();
  160.     }
  161.     protected void dl_company_SelectedIndexChanged(object sender, EventArgs e)
  162.     {
  163.         SqlConnection conn = dbConnection.getConnection();
  164.         conn.Open();
  165.         dl_type.Items.Clear();
  166.         dl_type.Items.Add("所有类型");
  167.         if (dl_company.SelectedItem.ToString().Equals("所有厂商"))
  168.         {
  169.             SqlCommand sqlcom3 = new SqlCommand("select type from OA_UNIT_TYPE order by id", conn);
  170.             SqlDataReader dr3 = sqlcom3.ExecuteReader();
  171.             if (dr3.HasRows)
  172.             {
  173.                 while (dr3.Read())
  174.                 {
  175.                     dl_type.Items.Add(dr3["type"].ToString());
  176.                 }
  177.             }
  178.             dr3.Close();
  179.         }
  180.         else
  181.         {
  182.             SqlCommand sqlcom = new SqlCommand("select equipment from OA_company where company='" + dl_company.SelectedItem.ToString() + "'", conn);
  183.             SqlDataReader dr = sqlcom.ExecuteReader();
  184.             if (dr.HasRows)
  185.             {
  186.                 while (dr.Read())
  187.                 {
  188.                     dl_type.Items.Add(dr["equipment"].ToString());
  189.                 }
  190.             }
  191.             dr.Close();
  192.         }
  193.         conn.Close();
  194.     }
  195.     protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
  196.     {
  197.         int i;
  198.         //执行循环,保证每条数据都可以更新
  199.         for (i = -1; i < GridView1.Rows.Count; i++)
  200.         {
  201.             //首先判断是否是数据行
  202.             if (e.Row.RowType == DataControlRowType.DataRow)
  203.             {
  204.                 //当鼠标停留时更改背景色
  205.                 e.Row.Attributes.Add("onmouseover", "c=this.style.backgroundColor;this.style.backgroundColor='#00A9FF'");
  206.                 //当鼠标移开时还原背景色
  207.                 e.Row.Attributes.Add("onmouseout", "this.style.backgroundColor=c");
  208.                 e.Row.Attributes.Add("onclick", "javascript:varwin=window.open('select_edit.aspx?form_id=" + GridView1.DataKeys[e.Row.RowIndex].Value.ToString() + "',null,'width=800,height=600')");
  209.                 //e.Row.Attributes.Add("onclick", "location.href='select.aspx?form_id=" + GridView1.DataKeys[e.Row.RowIndex].Value.ToString() + "'");
  210.             }
  211.         }
  212.     }
  213.     protected void GridView1_PageIndexChanging(object sender, GridViewPageEventArgs e)
  214.     {
  215.         GridView1.PageIndex = e.NewPageIndex;
  216.         if (flag == 0)
  217.         {
  218.             bind2();
  219.         }
  220.         else if (flag == 1)
  221.         {
  222.             bind3();
  223.         }
  224.         else if (flag == 2)
  225.         {
  226.             bind4();
  227.         }
  228.         else if (flag == 3)
  229.         {
  230.             bind1();
  231.         }
  232.         else
  233.         {
  234.         }
  235.     }
  236.     public void bind1()
  237.     {
  238.         MultiView2.ActiveViewIndex = 0;
  239.         User user = (User)Session["user"];
  240.         string department = user.Department.Name;
  241.         ArrayList array = new ArrayList();
  242.         MultiView2.ActiveViewIndex = 0;
  243.         SqlConnection conn = dbConnection.getConnection();
  244.         conn.Open();
  245.         DataSet ds = new DataSet();
  246.         DataTable dt = new DataTable();
  247.         dt.Columns.Add("no", typeof(string));
  248.         dt.Columns.Add("form_id", typeof(string));
  249.         dt.Columns.Add("bxperson", typeof(string));
  250.         dt.Columns.Add("level", typeof(string));
  251.         dt.Columns.Add("department", typeof(string));
  252.         dt.Columns.Add("tel", typeof(string));
  253.         dt.Columns.Add("date", typeof(string));
  254.         dt.Columns.Add("lbperson", typeof(string));
  255.         dt.Columns.Add("type", typeof(string));
  256.         dt.Columns.Add("equipment", typeof(string));
  257.         dt.Columns.Add("comment", typeof(string));
  258.         dt.Columns.Add("company", typeof(string));
  259.         dt.Columns.Add("destine_time", typeof(string));
  260.         dt.Columns.Add("complete_time", typeof(string));
  261.         dt.Columns.Add("confirm", typeof(string));
  262.         dt.Columns.Add("remark", typeof(string));
  263.         string sqlstr = "select  f.area as area,f.level as level,f.bxperson as bxperson,f.form_id as form_id,f.department as department,f.lbperson as lbperson,f.type as type,f.equipment as equipment,f.comment as comment,f.create_time as create_time,g.company as company,g.destine_time as destine_time,g.complete_time as complete_time,g.confirm as confirm,g.remark as remark from oa_repair as f,oa_repair_d as g where g.form_id=f.form_id AND g.destine_time IS NOT NULL  and f.department='" + department.Trim() + "'";
  264.         if (!dl_company.SelectedItem.ToString().Equals("所有厂商"))
  265.         {
  266.             sqlstr = sqlstr + " and g.company='" + dl_company.SelectedItem.ToString() + "'";
  267.         }
  268.         if (!dl_type.SelectedItem.ToString().Equals("所有类型"))
  269.         {
  270.             sqlstr = sqlstr + " and f.type='" + dl_type.SelectedItem.ToString() + "'";
  271.         }
  272.         if (!dl_name.SelectedItem.ToString().Equals("所有设备"))
  273.         {
  274.             sqlstr = sqlstr + " and f.equipment='" + dl_name.SelectedItem.ToString() + "'";
  275.         }
  276.         if ((!b_time.Text.Equals("")) && (!e_time.Text.Equals("")))
  277.         {
  278.             sqlstr = sqlstr + " and f.form_id between '" + b_time.Text.ToString().Trim() + "' and '" + e_time.Text.ToString() + "'";
  279.         }
  280.         sqlstr = sqlstr + " order by form_id desc";
  281.         SqlCommand sqlcom = new SqlCommand(sqlstr, conn);
  282.         SqlDataReader dr = sqlcom.ExecuteReader();
  283.         if (dr.HasRows)
  284.         {
  285.             while (dr.Read())
  286.             {
  287.                 DataRow row = dt.NewRow();
  288.                 row["no"] = dr["area"].ToString().Trim();
  289.                 row["bxperson"] = dr["bxperson"].ToString().Trim();
  290.                 row["level"] = dr["level"].ToString().Trim();
  291.                 row["form_id"] = dr["form_id"].ToString();
  292.                 array.Add(dr["form_id"].ToString());
  293.                 row["department"] = dr["department"].ToString();
  294.                 SqlConnection conn1 = dbConnection.getConnection();
  295.                 conn1.Open();
  296.                 SqlCommand sqlcom2 = new SqlCommand("select tel from oa_department where name='" + dr["department"] + "'", conn1);
  297.                 SqlDataReader dr2 = sqlcom2.ExecuteReader();
  298.                 if (dr2.HasRows)
  299.                 {
  300.                     while (dr2.Read())
  301.                     {
  302.                         row["tel"] = dr2["tel"].ToString();
  303.                     }
  304.                 }
  305.                 dr2.Close();
  306.                 row["date"] = dr["create_time"].ToString();
  307.                 SqlCommand sqlcom1 = new SqlCommand("select emp_name from oa_employee where id='" + dr["lbperson"].ToString().Trim() + "'", conn1);
  308.                 SqlDataReader dr1 = sqlcom1.ExecuteReader();
  309.                 if (dr1.HasRows)
  310.                 {
  311.                     while (dr1.Read())
  312.                     {
  313.                         row["lbperson"] = dr1["emp_name"].ToString();
  314.                     }
  315.                 }
  316.                 dr1.Close();
  317.                 row["type"] = dr["type"].ToString();
  318.                 row["equipment"] = dr["equipment"].ToString();
  319.                 row["comment"] = dr["comment"].ToString();
  320.                 row["company"] = dr["company"].ToString();
  321.                 row["destine_time"] = dr["destine_time"].ToString();
  322.                 row["complete_time"] = dr["complete_time"].ToString();
  323.                 row["confirm"] = dr["confirm"].ToString();
  324.                 row["remark"] = dr["remark"].ToString();
  325.                 dt.Rows.Add(row);
  326.                 conn1.Close();
  327.             }
  328.         }
  329.         dr.Close();
  330.         conn.Close();
  331.         ds.Tables.Add(dt);
  332.         GridView1.DataSource = ds;
  333.         GridView1.DataKeyNames = new string[] { "form_id" };
  334.         GridView1.DataBind();
  335.         Session["s_1"] = array;
  336.     }
  337.     public void bind2()
  338.     {
  339.         MultiView2.ActiveViewIndex = 0;
  340.         User user = (User)Session["user"];
  341.         string department = user.Department.Name;
  342.         ArrayList array = new ArrayList();
  343.         MultiView2.ActiveViewIndex = 0;
  344.         SqlConnection conn = dbConnection.getConnection();
  345.         conn.Open();
  346.         DataSet ds = new DataSet();
  347.         DataTable dt = new DataTable();
  348.         dt.Columns.Add("no", typeof(string));
  349.         dt.Columns.Add("form_id", typeof(string));
  350.         dt.Columns.Add("bxperson", typeof(string));
  351.         dt.Columns.Add("level", typeof(string));
  352.         dt.Columns.Add("department", typeof(string));
  353.         dt.Columns.Add("tel", typeof(string));
  354.         dt.Columns.Add("date", typeof(string));
  355.         dt.Columns.Add("lbperson", typeof(string));
  356.         dt.Columns.Add("type", typeof(string));
  357.         dt.Columns.Add("equipment", typeof(string));
  358.         dt.Columns.Add("comment", typeof(string));
  359.         dt.Columns.Add("company", typeof(string));
  360.         dt.Columns.Add("destine_time", typeof(string));
  361.         dt.Columns.Add("complete_time", typeof(string));
  362.         dt.Columns.Add("confirm", typeof(string));
  363.         dt.Columns.Add("remark", typeof(string));
  364.         string sqlstr = "select  f.area as area,f.level as level,f.bxperson as bxperson,f.form_id as form_id,f.department as department,f.lbperson as lbperson,f.type as type,f.equipment as equipment,f.comment as comment,f.create_time as create_time,g.company as company,g.destine_time as destine_time,g.complete_time as complete_time,g.confirm as confirm,g.remark as remark from oa_repair as f,oa_repair_d as g where g.form_id=f.form_id AND g.destine_time IS NOT NULL  and f.department='" + department.Trim() + "' order by f.form_id desc";
  365.         SqlCommand sqlcom = new SqlCommand(sqlstr, conn);
  366.         SqlDataReader dr = sqlcom.ExecuteReader();
  367.         if (dr.HasRows)
  368.         {
  369.             while (dr.Read())
  370.             {
  371.                 DataRow row = dt.NewRow();
  372.                 row["no"] = dr["area"].ToString().Trim();
  373.                 row["bxperson"] = dr["bxperson"].ToString().Trim();
  374.                 row["level"] = dr["level"].ToString().Trim();
  375.                 row["form_id"] = dr["form_id"].ToString();
  376.                 array.Add(dr["form_id"].ToString());
  377.                 row["department"] = dr["department"].ToString();
  378.                 SqlConnection conn1 = dbConnection.getConnection();
  379.                 conn1.Open();
  380.                 SqlCommand sqlcom2 = new SqlCommand("select tel from oa_department where name='" + dr["department"] + "'", conn1);
  381.                 SqlDataReader dr2 = sqlcom2.ExecuteReader();
  382.                 if (dr2.HasRows)
  383.                 {
  384.                     while (dr2.Read())
  385.                     {
  386.                         row["tel"] = dr2["tel"].ToString();
  387.                     }
  388.                 }
  389.                 dr2.Close();
  390.                 row["date"] = dr["create_time"].ToString();
  391.                 SqlCommand sqlcom1 = new SqlCommand("select emp_name from oa_employee where id='" + dr["lbperson"].ToString().Trim() + "'", conn1);
  392.                 SqlDataReader dr1 = sqlcom1.ExecuteReader();
  393.                 if (dr1.HasRows)
  394.                 {
  395.                     while (dr1.Read())
  396.                     {
  397.                         row["lbperson"] = dr1["emp_name"].ToString();
  398.                     }
  399.                 }
  400.                 dr1.Close();
  401.                 row["type"] = dr["type"].ToString();
  402.                 row["equipment"] = dr["equipment"].ToString();
  403.                 row["comment"] = dr["comment"].ToString();
  404.                 row["company"] = dr["company"].ToString();
  405.                 row["destine_time"] = dr["destine_time"].ToString();
  406.                 row["complete_time"] = dr["complete_time"].ToString();
  407.                 row["confirm"] = dr["confirm"].ToString();
  408.                 row["remark"] = dr["remark"].ToString();
  409.                 dt.Rows.Add(row);
  410.                 conn1.Close();
  411.             }
  412.         }
  413.         dr.Close();
  414.         conn.Close();
  415.         ds.Tables.Add(dt);
  416.         GridView1.DataSource = ds;
  417.         GridView1.DataKeyNames = new string[] { "form_id" };
  418.         GridView1.DataBind();
  419.         Session["s_1"] = array;
  420.     }
  421.     public void bind3()
  422.     {
  423.         MultiView2.ActiveViewIndex = 0;
  424.         User user = (User)Session["user"];
  425.         string department = user.Department.Name;
  426.         ArrayList array = new ArrayList();
  427.         MultiView2.ActiveViewIndex = 0;
  428.         SqlConnection conn = dbConnection.getConnection();
  429.         conn.Open();
  430.         DataSet ds = new DataSet();
  431.         DataTable dt = new DataTable();
  432.         dt.Columns.Add("no", typeof(string));
  433.         dt.Columns.Add("form_id", typeof(string));
  434.         dt.Columns.Add("bxperson", typeof(string));
  435.         dt.Columns.Add("level", typeof(string));
  436.         dt.Columns.Add("department", typeof(string));
  437.         dt.Columns.Add("tel", typeof(string));
  438.         dt.Columns.Add("date", typeof(string));
  439.         dt.Columns.Add("lbperson", typeof(string));
  440.         dt.Columns.Add("type", typeof(string));
  441.         dt.Columns.Add("equipment", typeof(string));
  442.         dt.Columns.Add("comment", typeof(string));
  443.         dt.Columns.Add("company", typeof(string));
  444.         dt.Columns.Add("destine_time", typeof(string));
  445.         dt.Columns.Add("complete_time", typeof(string));
  446.         dt.Columns.Add("confirm", typeof(string));
  447.         dt.Columns.Add("remark", typeof(string));
  448.         string sqlstr = "select  f.area as area,f.level as level,f.bxperson as bxperson,f.form_id as form_id,f.department as department,f.lbperson as lbperson,f.type as type,f.equipment as equipment,f.comment as comment,f.create_time as create_time,g.company as company,g.destine_time as destine_time,g.complete_time as complete_time,g.confirm as confirm,g.remark as remark from oa_repair as f,oa_repair_d as g where g.form_id=f.form_id  AND g.complete_time IS not NULL AND g.destine_time IS NOT NULL  and f.department='" + department.Trim() + "'  order by f.form_id desc";
  449.         SqlCommand sqlcom = new SqlCommand(sqlstr, conn);
  450.         SqlDataReader dr = sqlcom.ExecuteReader();
  451.         if (dr.HasRows)
  452.         {
  453.             while (dr.Read())
  454.             {
  455.                 DataRow row = dt.NewRow();
  456.                 row["no"] = dr["area"].ToString().Trim();
  457.                 row["bxperson"] = dr["bxperson"].ToString().Trim();
  458.                 row["level"] = dr["level"].ToString().Trim();
  459.                 row["form_id"] = dr["form_id"].ToString();
  460.                 array.Add(dr["form_id"].ToString());
  461.                 row["department"] = dr["department"].ToString();
  462.                 SqlConnection conn1 = dbConnection.getConnection();
  463.                 conn1.Open();
  464.                 SqlCommand sqlcom2 = new SqlCommand("select tel from oa_department where name='" + dr["department"] + "'", conn1);
  465.                 SqlDataReader dr2 = sqlcom2.ExecuteReader();
  466.                 if (dr2.HasRows)
  467.                 {
  468.                     while (dr2.Read())
  469.                     {
  470.                         row["tel"] = dr2["tel"].ToString();
  471.                     }
  472.                 }
  473.                 dr2.Close();
  474.                 row["date"] = dr["create_time"].ToString();
  475.                 SqlCommand sqlcom1 = new SqlCommand("select emp_name from oa_employee where id='" + dr["lbperson"].ToString().Trim() + "'", conn1);
  476.                 SqlDataReader dr1 = sqlcom1.ExecuteReader();
  477.                 if (dr1.HasRows)
  478.                 {
  479.                     while (dr1.Read())
  480.                     {
  481.                         row["lbperson"] = dr1["emp_name"].ToString();
  482.                     }
  483.                 }
  484.                 dr1.Close();
  485.                 row["type"] = dr["type"].ToString();
  486.                 row["equipment"] = dr["equipment"].ToString();
  487.                 row["comment"] = dr["comment"].ToString();
  488.                 row["company"] = dr["company"].ToString();
  489.                 row["destine_time"] = dr["destine_time"].ToString();
  490.                 row["complete_time"] = dr["complete_time"].ToString();
  491.                 row["confirm"] = dr["confirm"].ToString();
  492.                 row["remark"] = dr["remark"].ToString();
  493.                 dt.Rows.Add(row);
  494.                 conn1.Close();
  495.             }
  496.         }
  497.         dr.Close();
  498.         conn.Close();
  499.         ds.Tables.Add(dt);
  500.         GridView1.DataSource = ds;
  501.         GridView1.DataKeyNames = new string[] { "form_id" };
  502.         GridView1.DataBind();
  503.         Session["s_1"] = array;
  504.     }
  505.     public void bind4()
  506.     {
  507.         MultiView2.ActiveViewIndex = 0;
  508.         User user = (User)Session["user"];
  509.         string department = user.Department.Name;
  510.         ArrayList array = new ArrayList();
  511.         MultiView2.ActiveViewIndex = 0;
  512.         SqlConnection conn = dbConnection.getConnection();
  513.         conn.Open();
  514.         DataSet ds = new DataSet();
  515.         DataTable dt = new DataTable();
  516.         dt.Columns.Add("no", typeof(string));
  517.         dt.Columns.Add("form_id", typeof(string));
  518.         dt.Columns.Add("bxperson", typeof(string));
  519.         dt.Columns.Add("level", typeof(string));
  520.         dt.Columns.Add("department", typeof(string));
  521.         dt.Columns.Add("tel", typeof(string));
  522.         dt.Columns.Add("date", typeof(string));
  523.         dt.Columns.Add("lbperson", typeof(string));
  524.         dt.Columns.Add("type", typeof(string));
  525.         dt.Columns.Add("equipment", typeof(string));
  526.         dt.Columns.Add("comment", typeof(string));
  527.         dt.Columns.Add("company", typeof(string));
  528.         dt.Columns.Add("destine_time", typeof(string));
  529.         dt.Columns.Add("complete_time", typeof(string));
  530.         dt.Columns.Add("confirm", typeof(string));
  531.         dt.Columns.Add("remark", typeof(string));
  532.         string sqlstr = "select  f.area as area,f.level as level,f.bxperson as bxperson,f.form_id as form_id,f.department as department,f.lbperson as lbperson,f.type as type,f.equipment as equipment,f.comment as comment,f.create_time as create_time,g.company as company,g.destine_time as destine_time,g.complete_time as complete_time,g.confirm as confirm,g.remark as remark from oa_repair as f,oa_repair_d as g where g.form_id=f.form_id AND g.complete_time IS NULL AND g.destine_time IS NOT NULL  and f.department='" + department.Trim() + "' order by f.form_id desc";
  533.         SqlCommand sqlcom = new SqlCommand(sqlstr, conn);
  534.         SqlDataReader dr = sqlcom.ExecuteReader();
  535.         if (dr.HasRows)
  536.         {
  537.             while (dr.Read())
  538.             {
  539.                 DataRow row = dt.NewRow();
  540.                 row["no"] = dr["area"].ToString().Trim();
  541.                 row["bxperson"] = dr["bxperson"].ToString().Trim();
  542.                 row["level"] = dr["level"].ToString().Trim();
  543.                 row["form_id"] = dr["form_id"].ToString();
  544.                 array.Add(dr["form_id"].ToString());
  545.                 row["department"] = dr["department"].ToString();
  546.                 SqlConnection conn1 = dbConnection.getConnection();
  547.                 conn1.Open();
  548.                 SqlCommand sqlcom2 = new SqlCommand("select tel from oa_department where name='" + dr["department"] + "'", conn1);
  549.                 SqlDataReader dr2 = sqlcom2.ExecuteReader();
  550.                 if (dr2.HasRows)
  551.                 {
  552.                     while (dr2.Read())
  553.                     {
  554.                         row["tel"] = dr2["tel"].ToString();
  555.                     }
  556.                 }
  557.                 dr2.Close();
  558.                 row["date"] = dr["create_time"].ToString();
  559.                 SqlCommand sqlcom1 = new SqlCommand("select emp_name from oa_employee where id='" + dr["lbperson"].ToString().Trim() + "'", conn1);
  560.                 SqlDataReader dr1 = sqlcom1.ExecuteReader();
  561.                 if (dr1.HasRows)
  562.                 {
  563.                     while (dr1.Read())
  564.                     {
  565.                         row["lbperson"] = dr1["emp_name"].ToString();
  566.                     }
  567.                 }
  568.                 dr1.Close();
  569.                 row["type"] = dr["type"].ToString();
  570.                 row["equipment"] = dr["equipment"].ToString();
  571.                 row["comment"] = dr["comment"].ToString();
  572.                 row["company"] = dr["company"].ToString();
  573.                 row["destine_time"] = dr["destine_time"].ToString();
  574.                 row["complete_time"] = dr["complete_time"].ToString();
  575.                 row["confirm"] = dr["confirm"].ToString();
  576.                 row["remark"] = dr["remark"].ToString();
  577.                 dt.Rows.Add(row);
  578.                 conn1.Close();
  579.             }
  580.         }
  581.         dr.Close();
  582.         conn.Close();
  583.         ds.Tables.Add(dt);
  584.         GridView1.DataSource = ds;
  585.         GridView1.DataKeyNames = new string[] { "form_id" };
  586.         GridView1.DataBind();
  587.         Session["s_1"] = array;
  588.     }
  589.     protected void Button1_Click(object sender, EventArgs e)
  590.     {
  591.         bind1();
  592.         MultiView1.ActiveViewIndex = -1;
  593.         MultiView1.ActiveViewIndex = -1;
  594.     }
  595.     protected void LinkButton1_Click(object sender, EventArgs e)
  596.     {
  597.         flag = 0;
  598.         GridView1.DataBind();
  599.         MultiView2.ActiveViewIndex = -1;
  600.         MultiView1.ActiveViewIndex = -1;
  601.         bind2();
  602.     }
  603.     protected void LinkButton2_Click(object sender, EventArgs e)
  604.     {
  605.         flag = 1;
  606.         GridView1.DataBind();
  607.         MultiView2.ActiveViewIndex = -1;
  608.         MultiView1.ActiveViewIndex = -1;
  609.         bind3();
  610.     }
  611.     protected void LinkButton3_Click(object sender, EventArgs e)
  612.     {
  613.         flag = 2;
  614.         GridView1.DataBind();
  615.         MultiView2.ActiveViewIndex = -1;
  616.         MultiView1.ActiveViewIndex = -1;
  617.         bind4();
  618.     }
  619.     protected void LinkButton4_Click(object sender, EventArgs e)
  620.     {
  621.         flag = 3;
  622.         MultiView1.ActiveViewIndex = 0;
  623.         MultiView2.ActiveViewIndex = -1;
  624.     }
  625. }