finish_list.aspx.cs
资源名称:web.rar [点击查看]
上传用户:xrffrp
上传日期:2022-03-25
资源大小:22155k
文件大小:8k
源码类别:
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_approvel_tw_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)
- {
- PnlApprovel.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_TW_APPROVEL_FORM_FLOW where id=" + id, conn);
- form_id = Convert.ToInt32(cmd.ExecuteScalar().ToString());
- cmd = new SqlCommand("select a.form_id, e.emp_name, e.emp_no, p.name position, " +
- "d.name department, e1.emp_name delegate, t.name off_type, a.parenthesis, a.days, a.vacation_begin, " +
- "a.vacation_end, vp.name vacation_place, fp1.name flight_go_depart, fp2.name flight_go_arrive, " +
- "a.flight_go_time, a.flight_back_time, fp3.name flight_back_depart, fp4.name flight_back_arrive, " +
- "a.business_begin, a.business_end, a.reason, a.apply_date, b.name business_place " +
- "from OA_TW_APPROVEL_FORM a " +
- "inner join OA_EMPLOYEE e on a.emp_id=e.id " +
- "inner join OA_EMPLOYEE e1 on a.delegate_id=e1.id " +
- "inner join OA_DEPARTMENT d on e.department_id=d.id " +
- "inner join OA_EMPLOYEE_POSITION p on e.position=p.id " +
- "inner join OA_TW_OFF_TYPE t on a.off_type=t.id " +
- "inner join OA_VACATION_PLACE vp on a.vacation_place=vp.id " +
- "inner join OA_FLIGHT_PLACE fp1 on a.flight_go_depart=fp1.id " +
- "inner join OA_FLIGHT_PLACE fp2 on a.flight_go_arrive=fp2.id " +
- "inner join OA_FLIGHT_PLACE fp3 on a.flight_back_depart=fp3.id " +
- "inner join OA_FLIGHT_PLACE fp4 on a.flight_back_arrive=fp4.id " +
- "inner join OA_BUSINESS_PLACE b on a.business_place=b.id where a.id=" + form_id, conn);
- SqlDataReader dr = cmd.ExecuteReader();
- if (dr.Read())
- {
- TxtFormNo.Text = dr["form_id"].ToString();
- TxtEmpName.Text = dr["emp_name"].ToString();
- TxtEmpNo.Text = dr["emp_no"].ToString();
- TxtPosition.Text = dr["position"].ToString();
- TxtDepartment.Text = dr["department"].ToString();
- TxtDelegate.Text = dr["delegate"].ToString();
- TxtOffType.Text = dr["off_type"].ToString();
- TxtParenthesis.Text = dr["parenthesis"].ToString();
- TxtDays.Text = dr["days"].ToString();
- TxtVacationBegin.Text = dr["vacation_begin"].ToString();
- TxtVacationEnd.Text = dr["vacation_end"].ToString();
- TxtVacationPlace.Text = dr["vacation_place"].ToString();
- TxtFlightGoDepart.Text = dr["flight_go_depart"].ToString();
- TxtFlightGoArrive.Text = dr["flight_go_arrive"].ToString();
- TxtFlightGoTime.Text = dr["flight_go_time"].ToString();
- TxtFlightBackTime.Text = dr["flight_back_time"].ToString();
- TxtFlightBackDepart.Text = dr["flight_back_depart"].ToString();
- TxtFlightBackArrive.Text = dr["flight_back_arrive"].ToString();
- TxtBusinessBegin.Text = dr["business_begin"].ToString();
- TxtBusinessEnd.Text = dr["business_end"].ToString();
- TxtReason.Text = dr["reason"].ToString();
- TxtApplyDate.Text = dr["apply_date"].ToString();
- TxtBusinessPlace.Text = dr["business_place"].ToString();
- }
- dr.Close();
- cmd = new SqlCommand("select is_agree, comment, check_date from OA_TW_APPROVEL_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();
- int step = 0;
- string id = ApprovelList.DataKeys[e.Row.RowIndex].Value.ToString();
- int form_id = 0;
- SqlCommand cmd = new SqlCommand("select e.emp_name, t.name off_type, f.step,f.is_agree, f.form_id" +
- " from OA_TW_APPROVEL_FORM_FLOW f " +
- "inner join OA_TW_APPROVEL_FORM a on f.form_id=a.id inner join OA_EMPLOYEE e on a.emp_id=e.id " +
- "inner join OA_TW_OFF_TYPE t on a.off_type=t.id where f.id=" + id, conn);
- SqlDataReader dr = cmd.ExecuteReader();
- if (dr.Read())
- {
- Label label = (Label)e.Row.FindControl("LblSubject");
- label.Text = dr["emp_name"].ToString() + "的" + dr["off_type"].ToString() + "單";
- Label label1 = (Label)e.Row.FindControl("LblStatus");
- if (dr["is_agree"].ToString().Equals("Y"))
- {
- label1.Text = "同意";
- }
- else
- {
- label1.Text = "不同意";
- }
- 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_TW_APPROVEL_FORM_FLOW where form_id=" +
- form_id + " and step>" + step + " order by step", 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_TW_APPROVEL_FORM_FLOW set is_check='N', is_agree='N', " +
- "comment='', check_date='' where id=" + id, conn);
- cmd.ExecuteNonQuery();
- cmd = new SqlCommand("select form_id from OA_TW_APPROVEL_FORM_FLOW where id=" + id, conn);
- int form_id = Convert.ToInt32(cmd.ExecuteScalar());
- cmd = new SqlCommand("update OA_TW_APPROVEL_FORM set step=0 where id=" + form_id, conn);
- cmd.ExecuteNonQuery();
- conn.Close();
- ApprovelList.DataBind();
- PnlApprovel.Visible = false;
- PnlDeal.Visible = false;
- }
- }