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