finish_list.aspx.cs
资源名称:web.rar [点击查看]
上传用户:xrffrp
上传日期:2022-03-25
资源大小:22155k
文件大小:5k
源码类别:
OA系统
开发平台:
ASP/ASPX
- using System;
- using System.Data;
- using System.Configuration;
- using System.Collections;
- using System.Web;
- using System.Web.Security;
- using System.Web.UI;
- using System.Web.UI.WebControls;
- using System.Web.UI.WebControls.WebParts;
- using System.Web.UI.HtmlControls;
- using System.Data.SqlClient;
- public partial class web_fair_finish_list : System.Web.UI.Page
- {
- protected void Page_Load(object sender, EventArgs e)
- {
- if (!IsPostBack)
- {
- LoginDAO.CheckLogin(Session, Response, "../", 2);
- ApprovelList.DataKeyNames = new string[] { "id" };
- }
- if (Request.QueryString["f_id"] != null)
- {
- this.SetForm(Request.QueryString["f_id"]);
- PnlDeal.Visible = true;
- TblFair.Visible = true;
- }
- }
- protected void SetForm(string id)
- {
- string fair_id = "0";
- SqlConnection conn = dbConnection.getConnection();
- conn.Open();
- SqlCommand cmd = new SqlCommand("select form_id from OA_FAIR_FORM_FLOW where id=" + id, conn);
- fair_id = cmd.ExecuteScalar().ToString();
- cmd = new SqlCommand("select e.emp_name, e.emp_no, f.apply_date, f.amount, f.remark, f.form_no, " +
- "f.subject, f.form_id, f.form_table from OA_FAIR f " +
- " inner join OA_EMPLOYEE e" +
- " on f.emp_id=e.id " +
- "where f.id=" + fair_id, conn);
- SqlDataReader dr = cmd.ExecuteReader();
- string form_id = "0";
- string form_table = "";
- if (dr.Read())
- {
- TxtEmpName.Text = dr["emp_name"].ToString();
- TxtEmpNo.Text = dr["emp_no"].ToString();
- TxtApplyDate.Text = dr["apply_date"].ToString();
- TxtAmount.Text = dr["amount"].ToString();
- TxtRemark.Text = dr["remark"].ToString();
- TxtFormNo.Text = dr["form_no"].ToString();
- TxtSubject.Text = dr["subject"].ToString();
- if (!dr["form_id"].Equals("0"))
- {
- TblFair.Rows[7].Visible = true;
- form_id = dr["form_id"].ToString();
- form_table = dr["form_table"].ToString();
- }
- }
- dr.Close();
- if (!form_id.Equals("0"))
- {
- cmd = new SqlCommand("select form_id from " + form_table + " where id=" + form_id, conn);
- HlFormNo.Text = cmd.ExecuteScalar().ToString();
- HlFormNo.NavigateUrl = "form_show.aspx?id=" + form_id + "&table=" + form_table;
- HlFormNo.Target = "_blank";
- }
- cmd = new SqlCommand("select attachment, attachment_save_name, content_length from OA_FAIR_ATTACHMENT where fair_id=" + fair_id, conn);
- dr = cmd.ExecuteReader();
- while (dr.Read())
- {
- TblFair.Rows[9].Visible = true;
- HyperLink img = new HyperLink();
- img.ToolTip = dr["attachment"].ToString();
- img.ImageUrl = "../fair_picture/" + dr["attachment_save_name"].ToString();
- img.Target = "_blank";
- img.Width = Unit.Pixel(450);
- img.NavigateUrl = img.ImageUrl;
- PnlPicture.Controls.Add(img);
- }
- dr.Close();
- cmd = new SqlCommand("select is_agree, comment, check_date from OA_FAIR_FORM_FLOW where id=" + id, conn);
- dr = cmd.ExecuteReader();
- if (dr.Read())
- {
- RbAgree.SelectedValue = dr["is_agree"].ToString();
- TxtComment.Text = dr["comment"].ToString();
- TxtCheckDate.Text = dr["check_date"].ToString();
- }
- dr.Close();
- conn.Close();
- }
- protected void ApprovelList_RowDataBound(object sender, GridViewRowEventArgs e)
- {
- //行高亮
- if (e.Row.RowType == DataControlRowType.DataRow)
- {
- e.Row.Attributes.Add("onmouseover", "this.style.cursor='pointer';");
- e.Row.Attributes.Add("onclick", "location.href='finish_list.aspx?f_id=" + ApprovelList.DataKeys[e.Row.RowIndex].Value.ToString() + "'");
- }
- }
- protected void ApprovelList_RowCreated(object sender, GridViewRowEventArgs e)
- {
- if (e.Row.RowType == DataControlRowType.DataRow)
- {
- SqlConnection conn = dbConnection.getConnection();
- conn.Open();
- 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 " +
- " inner join OA_EMPLOYEE e on f.emp_id=e.id where b.id=" + ApprovelList.DataKeys[e.Row.RowIndex].Value.ToString(), conn);
- // int department_id = Convert.ToInt32(cmd.ExecuteScalar().ToString());
- SqlDataReader dr = cmd.ExecuteReader();
- while (dr.Read())
- {
- string department = "";
- DepartmentDAO departmentDAO = new DepartmentDAO();
- department = departmentDAO.queryById(Convert.ToInt32(dr["department_id"])).Full_name;
- Label lblDepartment = (Label)e.Row.FindControl("LblDepartment");
- lblDepartment.Text = department;
- Label lblStatus = (Label)e.Row.FindControl("LblStatus");
- if (dr["is_agree"].ToString().Equals("Y"))
- {
- lblStatus.Text = "同意";
- }
- else
- {
- lblStatus.Text = "不同意";
- }
- }
- dr.Close();
- }
- }
- }