finish_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_finish_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.             ApprovelList.DataKeyNames = new string[] { "id" };
  20.         }
  21.         if (Request.QueryString["f_id"] != null)
  22.         {
  23.             this.SetForm(Request.QueryString["f_id"]);
  24.             PnlDeal.Visible = true;
  25.             TblFair.Visible = true;
  26.         }
  27.     }
  28.     protected void SetForm(string id)
  29.     {
  30.         string fair_id = "0";
  31.         SqlConnection conn = dbConnection.getConnection();
  32.         conn.Open();
  33.         SqlCommand cmd = new SqlCommand("select form_id from OA_FAIR_FORM_FLOW where id=" + id, conn);
  34.         fair_id = cmd.ExecuteScalar().ToString();
  35.         cmd = new SqlCommand("select e.emp_name, e.emp_no, f.apply_date, f.amount, f.remark, f.form_no, " +
  36.             "f.subject, f.form_id, f.form_table from OA_FAIR f inner join OA_EMPLOYEE e on f.emp_id=e.id " +
  37.             "where f.id=" + fair_id, conn);
  38.         SqlDataReader dr = cmd.ExecuteReader();
  39.         string form_id = "0";
  40.         string form_table = "";
  41.         if (dr.Read())
  42.         {
  43.             TxtEmpName.Text = dr["emp_name"].ToString();
  44.             TxtEmpNo.Text = dr["emp_no"].ToString();
  45.             TxtApplyDate.Text = dr["apply_date"].ToString();
  46.             TxtAmount.Text = dr["amount"].ToString();
  47.             TxtRemark.Text = dr["remark"].ToString();
  48.             TxtFormNo.Text = dr["form_no"].ToString();
  49.             TxtSubject.Text = dr["subject"].ToString();
  50.             if (!dr["form_id"].Equals("0"))
  51.             {
  52.                 TblFair.Rows[7].Visible = true;
  53.                 form_id = dr["form_id"].ToString();
  54.                 form_table = dr["form_table"].ToString();
  55.             }
  56.         }
  57.         dr.Close();
  58.         if (!form_id.Equals("0"))
  59.         {
  60.             cmd = new SqlCommand("select form_id from " + form_table + " where id=" + form_id, conn);
  61.             HlFormNo.Text = cmd.ExecuteScalar().ToString();
  62.             HlFormNo.NavigateUrl = "form_show.aspx?id=" + form_id + "&table=" + form_table;
  63.             HlFormNo.Target = "_blank";
  64.         }
  65.         cmd = new SqlCommand("select attachment, attachment_save_name, content_length from OA_FAIR_ATTACHMENT where fair_id=" + fair_id, conn);
  66.         dr = cmd.ExecuteReader();
  67.         while (dr.Read())
  68.         {
  69.             TblFair.Rows[9].Visible = true;
  70.             HyperLink img = new HyperLink();
  71.             img.ToolTip = dr["attachment"].ToString();
  72.             img.ImageUrl = "../fair_picture/" + dr["attachment_save_name"].ToString();
  73.             img.Target = "_blank";
  74.             img.Width = Unit.Pixel(450);
  75.             img.NavigateUrl = img.ImageUrl;
  76.             PnlPicture.Controls.Add(img);
  77.         }
  78.         dr.Close();
  79.         cmd = new SqlCommand("select is_agree, comment, check_date from OA_FAIR_FORM_FLOW where id=" + id, conn);
  80.         dr = cmd.ExecuteReader();
  81.         if (dr.Read())
  82.         {
  83.             RbAgree.SelectedValue = dr["is_agree"].ToString();
  84.             TxtComment.Text = dr["comment"].ToString();
  85.             TxtCheckDate.Text = dr["check_date"].ToString();
  86.         }
  87.         dr.Close();
  88.         conn.Close();
  89.     }
  90.     protected void ApprovelList_RowDataBound(object sender, GridViewRowEventArgs e)
  91.     {
  92.         //行高亮
  93.         if (e.Row.RowType == DataControlRowType.DataRow)
  94.         {
  95.             e.Row.Attributes.Add("onmouseover", "this.style.cursor='pointer';");
  96.             e.Row.Attributes.Add("onclick", "location.href='finish_list.aspx?f_id=" + ApprovelList.DataKeys[e.Row.RowIndex].Value.ToString() + "'");
  97.         }
  98.     }
  99.     protected void ApprovelList_RowCreated(object sender, GridViewRowEventArgs e)
  100.     {
  101.         if (e.Row.RowType == DataControlRowType.DataRow)
  102.         {
  103.             SqlConnection conn = dbConnection.getConnection();
  104.             conn.Open();
  105.             SqlCommand cmd = new SqlCommand("select e.department_id from OA_FAIR_FORM_FLOW f inner join OA_FAIR a "+
  106.                 "on f.form_id=a.id inner join OA_EMPLOYEE e on a.emp_id=e.id where f.id=" + ApprovelList.DataKeys[e.Row.RowIndex].Value.ToString(), conn);
  107.             int department_id = Convert.ToInt32(cmd.ExecuteScalar().ToString());
  108.             string department = "";
  109.             DepartmentDAO departmentDAO = new DepartmentDAO();
  110.             department = departmentDAO.queryById(department_id).Full_name;
  111.             conn.Close();
  112.             Label lblDepartment = (Label)e.Row.FindControl("LblDepartment");
  113.             lblDepartment.Text = department;
  114.         }
  115.     }
  116. }