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

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_company_deal : System.Web.UI.Page
  13. {
  14.     protected void Page_Load(object sender, EventArgs e)
  15.     {
  16.         string str = "";
  17.         SqlConnection conn = dbConnection.getConnection();
  18.         conn.Open();
  19.         SqlCommand sqlcom = new SqlCommand("select is_check from OA_COMPANY_CHECK where form_id='" + Request.QueryString["form_id"] + "'", conn);
  20.         SqlDataReader dr = sqlcom.ExecuteReader();
  21.         if (dr.HasRows)
  22.         {
  23.             while (dr.Read())
  24.             {
  25.                 str = dr["is_check"].ToString();
  26.             }
  27.         }
  28.         if (str.Equals("N"))
  29.         {
  30.             MultiView2.ActiveViewIndex = 0;
  31.         }
  32.         else
  33.         {
  34.             MultiView2.ActiveViewIndex = -1;
  35.         }
  36.         SetTable();
  37.     }
  38.     public void SetTable()
  39.     {
  40.         SqlConnection conn = dbConnection.getConnection();
  41.         conn.Open();
  42.         SqlCommand sqlcom = new SqlCommand("select department_id,eq_type,eq_detail,content from OA_REPAIR_FORM_DETAIL where form_id='" + Request.QueryString["form_id"].ToString() + "'", conn);
  43.         SqlDataReader dr = sqlcom.ExecuteReader();
  44.         if (dr.HasRows)
  45.         {
  46.             while (dr.Read())
  47.             {
  48.                 lb_no.Text = Request.QueryString["form_id"].ToString();
  49.                 lb_equipmet.Text = dr["eq_detail"].ToString();
  50.                 lb_type.Text = dr["eq_type"].ToString();
  51.                 lbcomment.Text = dr["content"].ToString();
  52.                 SqlConnection sqlcon = dbConnection.getConnection();
  53.                 sqlcon.Open();
  54.                 SqlCommand sqlcom1 = new SqlCommand("select name,tel from OA_DEPARTMENT where id='" + dr["department_id"].ToString() + "'", sqlcon);
  55.                 SqlDataReader dr1 = sqlcom1.ExecuteReader();
  56.                 if (dr1.HasRows)
  57.                 {
  58.                     while (dr1.Read())
  59.                     {
  60.                         lb_deparetment.Text = dr1["name"].ToString();
  61.                         lb_tel.Text = dr1["tel"].ToString();
  62.                     }
  63.                 }
  64.                 dr1.Close();
  65.                 SqlCommand sqlcom2 = new SqlCommand("select f.emp_name as name from OA_EMPLOYEE as f,OA_REPAIR_FORM as g where f.id=g.emp_id and g.form_id='" + Request.QueryString["form_id"] + "'", sqlcon);
  66.                 SqlDataReader dr2 = sqlcom2.ExecuteReader();
  67.                 if (dr2.HasRows)
  68.                 {
  69.                     while (dr2.Read())
  70.                     {
  71.                         lb_person.Text = dr2["name"].ToString();
  72.                     }
  73.                 }
  74.             }
  75.         }
  76.     }
  77.     protected void RbAgree_SelectedIndexChanged(object sender, EventArgs e)
  78.     {
  79.         if (TxtComment.Text.Equals("已处理") || TxtComment.Text.Equals("未处理"))
  80.         {
  81.             if (RbAgree.SelectedValue.Equals("Y"))
  82.             {
  83.                 TxtComment.Text = "已处理";
  84.             }
  85.             else
  86.             {
  87.                 TxtComment.Text = "未处理";
  88.             }
  89.         }
  90.     }
  91.     protected void ShowMessageBox(string strMessage)
  92.     {
  93.         Response.Write(string.Format("<script>alert('{0}')</script>", strMessage));
  94.     }
  95.     protected void BtnOk_Click(object sender, EventArgs e)
  96.     {
  97.         string time = "";
  98.         SqlConnection conn = dbConnection.getConnection();
  99.         conn.Open();
  100.         DateMgr mgr = new DateMgr();
  101.         SqlCommand sqlcom = new SqlCommand("update OA_COMPANY_CHECK set is_check='Y',is_agree='" + RbAgree.SelectedValue.ToString() + "',check_time='" + mgr.getTime().ToString() + "',comment='" + TxtComment.Text.Replace("n", "<br>") + "' where form_id='" + Request.QueryString["form_id"].ToString() + "'", conn);
  102.         sqlcom.ExecuteNonQuery();
  103.         conn.Close();
  104.         Response.Redirect("company.aspx");
  105.     }
  106. }