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

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_data_repair_deal : System.Web.UI.Page
  13. {
  14.     protected void Page_Load(object sender, EventArgs e)
  15.     {
  16.         if (!IsPostBack)
  17.         {
  18.             this.MultiView1.Visible = true;
  19.             lb_no.Text = Request.QueryString["form_id"].ToString();
  20.             lb_person.Text = Request.QueryString["emp_name"].ToString();
  21.         }
  22.         this.SetTable();
  23.     }
  24.     public void SetTable()
  25.     {
  26.         string str = "";
  27.         SqlConnection conn = dbConnection.getConnection();
  28.         conn.Open();
  29.         SqlCommand sqlemp = new SqlCommand("select emp_id from OA_REPAIR_FORM where form_id='" + Request.QueryString["form_id"].ToString() + "'", conn);
  30.         str = sqlemp.ExecuteScalar().ToString();
  31.         SqlCommand sqlcom = new SqlCommand("select f.content as content,f.eq_type as eq_type,f.eq_detail as eq_detail,g.name as name,g.tel as tel from OA_REPAIR_FORM_DETAIL as f,OA_DEPARTMENT as g where g.id=f.department_id and f.form_id='" + Request.QueryString["form_id"].ToString() + "'", conn);
  32.         SqlDataReader dr = sqlcom.ExecuteReader();
  33.         if (dr.HasRows)
  34.         {
  35.             while (dr.Read())
  36.             {
  37.                 lb_department.Text = dr["name"].ToString();
  38.                 lb_tel.Text = dr["tel"].ToString();
  39.                 lb_type.Text = dr["eq_type"].ToString();
  40.                 lb_equipment.Text = dr["eq_detail"].ToString();
  41.                 comment.Text = dr["content"].ToString();
  42.             }
  43.         }
  44.         dr.Close();
  45.         SqlCommand sqlcom1 = new SqlCommand("select * from OA_REPAIR_FLOW where form_id='" + Request.QueryString["form_id"].ToString() + "' order by step", conn);
  46.         SqlDataReader dr1 = sqlcom1.ExecuteReader();
  47.         if (dr1.HasRows)
  48.         {
  49.             while (dr1.Read())
  50.             {
  51.                 TableRow tr = new TableRow();
  52.                 TableCell td = new TableCell();
  53.                 td.BorderWidth = Unit.Pixel(1);
  54.                 td.Text = dr1["step"].ToString();
  55.                 tr.Cells.Add(td);
  56.                 td = new TableCell();
  57.                 td.BorderWidth = Unit.Pixel(1);
  58.                 SqlConnection conn1 = dbConnection.getConnection();
  59.                 conn1.Open();
  60.                 SqlCommand sqlcom2 = new SqlCommand("select emp_name from OA_EMPLOYEE where id='" + dr1["operator_id"].ToString() + "'", conn1);
  61.                 SqlDataReader dr2 = sqlcom2.ExecuteReader();
  62.                 if (dr2.HasRows)
  63.                 {
  64.                     while (dr2.Read())
  65.                     {
  66.                         td.Text = dr2["emp_name"].ToString();
  67.                     }
  68.                 }
  69.                 tr.Cells.Add(td);
  70.                 dr2.Close();
  71.                 conn1.Close();
  72.                 td = new TableCell();
  73.                 td.BorderWidth = Unit.Pixel(1);
  74.                 td.Text = "審批";
  75.                 tr.Cells.Add(td);
  76.                 td = new TableCell();
  77.                 td.BorderWidth = Unit.Pixel(1);
  78.                 if (dr1["is_check"].ToString().Equals("N"))
  79.                 {
  80.                     td.Text = "未處理";
  81.                 }
  82.                 else
  83.                 {
  84.                     td.Text = "已處理";
  85.                 }
  86.                 tr.Cells.Add(td);
  87.                 td = new TableCell();
  88.                 td.BorderWidth = Unit.Pixel(1);
  89.                 if (dr1["is_check"].ToString().Equals("Y"))
  90.                 {
  91.                     if (dr1["is_agree"].ToString().Equals("Y"))
  92.                     {
  93.                         td.Text = "已通知";
  94.                     }
  95.                     else
  96.                     {
  97.                         td.Text = "未通知";
  98.                     }
  99.                 }
  100.                 else
  101.                 {
  102.                     td.Text = "<br>";
  103.                 }
  104.                 tr.Cells.Add(td);
  105.                 td = new TableCell();
  106.                 td.BorderWidth = Unit.Pixel(1);
  107.                 if (!dr1["comment"].ToString().Equals(""))
  108.                 {
  109.                     td.Text = dr1["comment"].ToString();
  110.                 }
  111.                 else
  112.                 {
  113.                     td.Text = "<br>";
  114.                 }
  115.                 tr.Cells.Add(td);
  116.                 td = new TableCell();
  117.                 td.BorderWidth = Unit.Pixel(1);
  118.                 if (!dr1["check_time"].ToString().Equals(""))
  119.                 {
  120.                     td.Text = dr1["check_time"].ToString();
  121.                 }
  122.                 else
  123.                 {
  124.                     td.Text = "<br>";
  125.                 }
  126.                 tr.Cells.Add(td);
  127.                 FlowTable.Rows.Add(tr);
  128.             }
  129.         }
  130.         dr1.Close();
  131.         conn.Close();
  132.     }
  133.     public void SetTab()
  134.     {
  135.     }
  136.     protected void RbAgree_SelectedIndexChanged(object sender, EventArgs e)
  137.     {
  138.         if (TxtComment.Text.Equals("已通知") || TxtComment.Text.Equals("未通知"))
  139.         {
  140.             if (RbAgree.SelectedValue.Equals("Y"))
  141.             {
  142.                 TxtComment.Text = "已通知";
  143.             }
  144.             else
  145.             {
  146.                 TxtComment.Text = "未通知";
  147.             }
  148.         }
  149.     }
  150.     protected void ShowMessageBox(string strMessage)
  151.     {
  152.         Response.Write(string.Format("<script>alert('{0}')</script>", strMessage));
  153.     }
  154.     protected void BtnOk_Click(object sender, EventArgs e)
  155.     {
  156.         string total_result = "跑流程中";
  157.         string time = "";
  158.         SqlConnection conn = dbConnection.getConnection();
  159.         conn.Open();
  160.         DateMgr mgr = new DateMgr();
  161.         SqlCommand cmd = new SqlCommand("update OA_REPAIR_FLOW set is_check='Y',is_agree='" + RbAgree.SelectedValue.ToString() + "',comment='" + TxtComment.Text.Replace("n", "<br>") + "',check_time='" + mgr.getTime().ToString() + "'where form_id='" + Request.QueryString["form_id"] + "'and operator_id='" + Session["user_id"] + "'", conn);
  162.         cmd.ExecuteNonQuery();
  163.         cmd = new SqlCommand("select max(step) from OA_REPAIR_FLOW where form_id='" + Request.QueryString["form_id"] + "'", conn);
  164.         int max_step = 1;
  165.         max_step = Convert.ToInt32(cmd.ExecuteScalar());
  166.         cmd = new SqlCommand("select step from OA_REPAIR_FORM where form_id='" + Request.QueryString["form_id"] + "'", conn);
  167.         int step = Convert.ToInt32(cmd.ExecuteScalar());
  168.         if (step == max_step)
  169.         {
  170.             if (RbAgree.SelectedValue.Equals("N"))
  171.             {
  172.                 total_result = "不同意";
  173.             }
  174.             else
  175.             {
  176.                 total_result = "同意";
  177.             }
  178.             time = mgr.getDateTime();
  179.         }
  180.         else
  181.         {
  182.             if (RbAgree.SelectedValue.Equals("N"))
  183.             {
  184.                 total_result = "不同意";
  185.             }
  186.             time = mgr.getDateTime();
  187.         }
  188.         if (step == max_step)
  189.         {
  190.             cmd = new SqlCommand("update OA_REPAIR_FORM set step=step+1,total_result='" + total_result + "',finish_time='" + time + "'where form_id='" + Request.QueryString["form_id"] + "'", conn);
  191.             cmd.ExecuteNonQuery();
  192.         }
  193.         else
  194.         {
  195.             cmd = new SqlCommand("update OA_REPAIR_FORM set step=step+1,total_result='" + total_result + "',finish_time=''where form_id='" + Request.QueryString["form_id"] + "'", conn);
  196.             cmd.ExecuteNonQuery();
  197.         }
  198.         conn.Close();
  199.         Response.Redirect("deal_list.aspx");
  200.     }
  201. }