my_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_my_list : System.Web.UI.Page
- {
- protected void Page_Load(object sender, EventArgs e)
- {
- if (!IsPostBack)
- {
- LoginDAO.CheckLogin(Session, Response, "../", 2);
- FairList.DataKeyNames = new string[] { "id" };
- if (Request.QueryString["f_id"] != null)
- {
- this.SetForm(Request.QueryString["f_id"]);
- PnlFair.Visible = true;
- FlowList.DataKeyNames = new string[] { "id" };
- }
- }
- }
- protected void FairList_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='my_list.aspx?f_id=" + FairList.DataKeys[e.Row.RowIndex].Value.ToString() + "'");
- }
- }
- protected void SetForm(string id)
- {
- SqlConnection conn = dbConnection.getConnection();
- conn.Open();
- SqlCommand 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=" + 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=" + 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();
- conn.Close();
- }
- protected void FlowList_RowCreated(object sender, GridViewRowEventArgs e)
- {
- if (e.Row.RowType == DataControlRowType.DataRow)
- {
- SqlConnection conn = dbConnection.getConnection();
- conn.Open();
- SqlCommand cmd = new SqlCommand("select apply_type, is_check, is_agree, comment from " +
- "OA_FAIR_FORM_FLOW where id=" + FlowList.DataKeys[e.Row.RowIndex].Value.ToString(), conn);
- SqlDataReader dr = cmd.ExecuteReader();
- if (dr.Read())
- {
- Label label = (Label)e.Row.FindControl("LblApplyType");
- if (dr["apply_type"].ToString().Equals("1"))
- {
- label.Text = "會簽";
- }
- else
- {
- label.Text = "審批";
- }
- label = (Label)e.Row.FindControl("LblIsCheck");
- if (dr["is_check"].ToString().Equals("N"))
- {
- label.Text = "未處理";
- }
- else
- {
- label.Text = "已處理";
- label = (Label)e.Row.FindControl("LblIsAgree");
- if (dr["is_agree"].ToString().Equals("Y"))
- {
- label.Text = "已同意";
- }
- else
- {
- label.Text = "不同意";
- }
- }
- label = (Label)e.Row.FindControl("LblComment");
- label.Text = dr["comment"].ToString();
- }
- dr.Close();
- conn.Close();
- }
- }
- }