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

OA系统

开发平台:

ASP/ASPX

  1. using System;
  2. using System.Data;
  3. using System.Configuration;
  4. using System.Collections;
  5. using System.Web;
  6. using System.Web.Security;
  7. using System.Web.UI;
  8. using System.Web.UI.WebControls;
  9. using System.Web.UI.WebControls.WebParts;
  10. using System.Web.UI.HtmlControls;
  11. using System.Data.SqlClient;
  12. public partial class web_fair_my_list : System.Web.UI.Page
  13. {
  14.     protected void Page_Load(object sender, EventArgs e)
  15.     {
  16.         if (!IsPostBack)
  17.         {
  18.             LoginDAO.CheckLogin(Session, Response, "../", 2);
  19.             FairList.DataKeyNames = new string[] { "id" };
  20.             if (Request.QueryString["f_id"] != null)
  21.             {
  22.                 this.SetForm(Request.QueryString["f_id"]);
  23.                 PnlFair.Visible = true;
  24.                 FlowList.DataKeyNames = new string[] { "id" };
  25.             }
  26.         }
  27.     }
  28.     protected void FairList_RowDataBound(object sender, GridViewRowEventArgs e)
  29.     {
  30.         if (e.Row.RowType == DataControlRowType.DataRow)
  31.         {
  32.             e.Row.Attributes.Add("onmouseover", "this.style.cursor='pointer';");
  33.             e.Row.Attributes.Add("onclick", "location.href='my_list.aspx?f_id=" + FairList.DataKeys[e.Row.RowIndex].Value.ToString() + "'");
  34.         }
  35.     }
  36.     protected void SetForm(string id)
  37.     {
  38.         SqlConnection conn = dbConnection.getConnection();
  39.         conn.Open();
  40.         SqlCommand cmd = new SqlCommand("select e.emp_name, e.emp_no, f.apply_date, f.amount, f.remark, " +
  41.             "f.form_no, f.subject, f.form_id, f.form_table from OA_FAIR f inner join OA_EMPLOYEE e on " +
  42.             "f.emp_id=e.id where f.id=" + id, conn);
  43.         SqlDataReader dr = cmd.ExecuteReader();
  44.         string form_id = "0";
  45.         string form_table = "";
  46.         if (dr.Read())
  47.         {
  48.             TxtEmpName.Text = dr["emp_name"].ToString();
  49.             TxtEmpNo.Text = dr["emp_no"].ToString();
  50.             TxtApplyDate.Text = dr["apply_date"].ToString();
  51.             TxtAmount.Text = dr["amount"].ToString();
  52.             TxtRemark.Text = dr["remark"].ToString();
  53.             TxtFormNo.Text = dr["form_no"].ToString();
  54.             TxtSubject.Text = dr["subject"].ToString();
  55.             if (!dr["form_id"].Equals("0"))
  56.             {
  57.                 TblFair.Rows[7].Visible = true;
  58.                 form_id = dr["form_id"].ToString();
  59.                 form_table = dr["form_table"].ToString();
  60.             }
  61.         }
  62.         dr.Close();
  63.         if (!form_id.Equals("0"))
  64.         {
  65.             cmd = new SqlCommand("select form_id from " + form_table + " where id=" + form_id, conn);
  66.             HlFormNo.Text = cmd.ExecuteScalar().ToString();
  67.             HlFormNo.NavigateUrl = "form_show.aspx?id=" + form_id + "&table=" + form_table;
  68.             HlFormNo.Target = "_blank";
  69.         }
  70.         cmd = new SqlCommand("select attachment, attachment_save_name, content_length from " +
  71.             "OA_FAIR_ATTACHMENT where fair_id=" + id, conn);
  72.         dr = cmd.ExecuteReader();
  73.         while (dr.Read())
  74.         {
  75.             TblFair.Rows[9].Visible = true;
  76.             HyperLink img = new HyperLink();
  77.             img.ToolTip = dr["attachment"].ToString();
  78.             img.ImageUrl = "../fair_picture/"+dr["attachment_save_name"].ToString();
  79.             img.Target = "_blank";
  80.             img.Width = Unit.Pixel(450);
  81.             img.NavigateUrl = img.ImageUrl;
  82.             PnlPicture.Controls.Add(img);
  83.         }
  84.         dr.Close();
  85.         conn.Close();
  86.     }
  87.     protected void FlowList_RowCreated(object sender, GridViewRowEventArgs e)
  88.     {
  89.         if (e.Row.RowType == DataControlRowType.DataRow)
  90.         {
  91.             SqlConnection conn = dbConnection.getConnection();
  92.             conn.Open();
  93.             SqlCommand cmd = new SqlCommand("select apply_type, is_check, is_agree, comment from " +
  94.                 "OA_FAIR_FORM_FLOW where id=" + FlowList.DataKeys[e.Row.RowIndex].Value.ToString(), conn);
  95.             SqlDataReader dr = cmd.ExecuteReader();
  96.             if (dr.Read())
  97.             {
  98.                 Label label = (Label)e.Row.FindControl("LblApplyType");
  99.                 if (dr["apply_type"].ToString().Equals("1"))
  100.                 {
  101.                     label.Text = "會簽";
  102.                 }
  103.                 else
  104.                 {
  105.                     label.Text = "審批";
  106.                 }
  107.                 label = (Label)e.Row.FindControl("LblIsCheck");
  108.                 if (dr["is_check"].ToString().Equals("N"))
  109.                 {
  110.                     label.Text = "未處理";
  111.                 }
  112.                 else
  113.                 {
  114.                     label.Text = "已處理";
  115.                     label = (Label)e.Row.FindControl("LblIsAgree");
  116.                     if (dr["is_agree"].ToString().Equals("Y"))
  117.                     {
  118.                         label.Text = "已同意";
  119.                     }
  120.                     else
  121.                     {
  122.                         label.Text = "不同意";
  123.                     }
  124.                 }
  125.                 label = (Label)e.Row.FindControl("LblComment");
  126.                 label.Text = dr["comment"].ToString();
  127.             }
  128.             dr.Close();
  129.             conn.Close();
  130.         }
  131.     }
  132. }