finish.aspx.cs
资源名称:web.rar [点击查看]
上传用户:xrffrp
上传日期:2022-03-25
资源大小:22155k
文件大小:6k
源码类别:
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_computer_finish : 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)
- {
- Panform.Visible = true;
- PnlDeal.Visible = true;
- this.SetData(Request.QueryString["f_id"]);
- }
- }
- protected void SetData(string id)
- {
- SqlConnection conn = dbConnection.getConnection();
- conn.Open();
- // int form_id = 0;
- // SqlCommand cmd = new SqlCommand("select form_id from oa_computer_form where id=" + id, conn);
- // form_id = Convert.ToInt32(cmd.ExecuteScalar().ToString());
- SqlCommand cmd = new SqlCommand("select * from oa_computer_form as a left join oa_computer_form_flow as b on a.form_id=b.form_id"+
- " where b.id=" + id, conn);
- SqlDataReader dr = cmd.ExecuteReader();
- if (dr.Read())
- {
- form_no.Text = dr["form_id"].ToString();
- emp_no.Text = dr["emp_no"].ToString();
- emp_name.Text = dr["emp_name"].ToString();
- emp_dept.Text = dr["emp_dept"].ToString();
- emp_position.Text = dr["emp_position"].ToString();
- date1.Text = dr["date1"].ToString();
- f_item.Text = dr["item1"].ToString();
- Enddate.Text = dr["enddate"].ToString();
- content.Text = dr["content"].ToString();
- }
- dr.Close();
- cmd = new SqlCommand("select is_agree, comment, check_date from oa_computer_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)
- {
- /* SqlConnection conn = dbConnection.getConnection();
- conn.Open();
- SqlCommand cmd = new SqlCommand("select form_id from oa_computer_form where id='" + ApprovelList.DataKeys[e.Row.RowIndex].Value.ToString() + "'", conn);
- string form_id;
- form_id = cmd.ExecuteScalar().ToString();
- conn.Close();*/
- e.Row.Attributes.Add("onmouseover", "this.style.cursor='pointer';");
- e.Row.Attributes.Add("onclick", "location.href='finish.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();
- int step = 0;
- string id = ApprovelList.DataKeys[e.Row.RowIndex].Value.ToString();
- // int form_id = 0;
- SqlCommand cmd = new SqlCommand("select * from oa_computer_form as a left join oa_computer_form_flow as b on a.form_id=b.form_id where"+
- " operator_id='"+Session["user_id"]+"' order by date1 desc", conn);
- SqlDataReader dr = cmd.ExecuteReader();
- if (dr.Read())
- {
- Label label = (Label)e.Row.FindControl("LblSubject");
- label.Text = dr["emp_name"].ToString() + "的電腦設備報修單";
- step = Convert.ToInt32(dr["step"].ToString());
- //form_id = Convert.ToInt32(dr["form_id"].ToString());
- }
- dr.Close();
- LinkButton lbRevoke = (LinkButton)e.Row.FindControl("LbRevoke");
- cmd = new SqlCommand("select is_check from oa_computer_form_flow where id=" +
- ApprovelList.DataKeys[e.Row.RowIndex].Value.ToString() + " and step in (select max(step) from oa_computer_form_flow where f_id in" +
- "(select f_id from oa_computer_form_flow where f_id=" + ApprovelList.DataKeys[e.Row.RowIndex].Value.ToString() + "))", conn);
- try
- {
- string is_check = cmd.ExecuteScalar().ToString();
- if (is_check.Equals("Y"))
- {
- lbRevoke.Enabled = false;
- lbRevoke.OnClientClick = "";
- }
- else
- {
- lbRevoke.CommandArgument = id;
- lbRevoke.Click += new EventHandler(lbRevoke_Click);
- }
- }
- catch
- {
- lbRevoke.CommandArgument =id;
- lbRevoke.Click += new EventHandler(lbRevoke_Click);
- }
- conn.Close();
- }
- }
- void lbRevoke_Click(object sender, EventArgs e)
- {
- string id = ((LinkButton)sender).CommandArgument;
- SqlConnection conn = dbConnection.getConnection();
- conn.Open();
- SqlCommand cmd = new SqlCommand("update OA_computer_FORM_FLOW set is_check='N', is_agree='N', " +
- "comment='', check_date='' where id=" + id, conn);
- cmd.ExecuteNonQuery();
- conn.Close();
- ApprovelList.DataBind();
- Panform.Visible = false;
- PnlDeal.Visible = false;
- }
- }