deal.aspx.cs
资源名称:web.rar [点击查看]
上传用户:xrffrp
上传日期:2022-03-25
资源大小:22155k
文件大小:8k
源码类别:
OA系统
开发平台:
ASP/ASPX
- using System;
- using System.Data;
- using System.Data.SqlClient;
- 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;
- public partial class web_data_repair_deal : System.Web.UI.Page
- {
- protected void Page_Load(object sender, EventArgs e)
- {
- if (!IsPostBack)
- {
- this.MultiView1.Visible = true;
- lb_no.Text = Request.QueryString["form_id"].ToString();
- lb_person.Text = Request.QueryString["emp_name"].ToString();
- }
- this.SetTable();
- }
- public void SetTable()
- {
- string str = "";
- SqlConnection conn = dbConnection.getConnection();
- conn.Open();
- SqlCommand sqlemp = new SqlCommand("select emp_id from OA_REPAIR_FORM where form_id='" + Request.QueryString["form_id"].ToString() + "'", conn);
- str = sqlemp.ExecuteScalar().ToString();
- SqlCommand sqlcom = new SqlCommand("select f.content as content,f.eq_type as eq_type,f.eq_detail as eq_detail,g.name as name,g.tel as tel from OA_REPAIR_FORM_DETAIL as f,OA_DEPARTMENT as g where g.id=f.department_id and f.form_id='" + Request.QueryString["form_id"].ToString() + "'", conn);
- SqlDataReader dr = sqlcom.ExecuteReader();
- if (dr.HasRows)
- {
- while (dr.Read())
- {
- lb_department.Text = dr["name"].ToString();
- lb_tel.Text = dr["tel"].ToString();
- lb_type.Text = dr["eq_type"].ToString();
- lb_equipment.Text = dr["eq_detail"].ToString();
- comment.Text = dr["content"].ToString();
- }
- }
- dr.Close();
- SqlCommand sqlcom1 = new SqlCommand("select * from OA_REPAIR_FLOW where form_id='" + Request.QueryString["form_id"].ToString() + "' order by step", conn);
- SqlDataReader dr1 = sqlcom1.ExecuteReader();
- if (dr1.HasRows)
- {
- while (dr1.Read())
- {
- TableRow tr = new TableRow();
- TableCell td = new TableCell();
- td.BorderWidth = Unit.Pixel(1);
- td.Text = dr1["step"].ToString();
- tr.Cells.Add(td);
- td = new TableCell();
- td.BorderWidth = Unit.Pixel(1);
- SqlConnection conn1 = dbConnection.getConnection();
- conn1.Open();
- SqlCommand sqlcom2 = new SqlCommand("select emp_name from OA_EMPLOYEE where id='" + dr1["operator_id"].ToString() + "'", conn1);
- SqlDataReader dr2 = sqlcom2.ExecuteReader();
- if (dr2.HasRows)
- {
- while (dr2.Read())
- {
- td.Text = dr2["emp_name"].ToString();
- }
- }
- tr.Cells.Add(td);
- dr2.Close();
- conn1.Close();
- td = new TableCell();
- td.BorderWidth = Unit.Pixel(1);
- td.Text = "審批";
- tr.Cells.Add(td);
- td = new TableCell();
- td.BorderWidth = Unit.Pixel(1);
- if (dr1["is_check"].ToString().Equals("N"))
- {
- td.Text = "未處理";
- }
- else
- {
- td.Text = "已處理";
- }
- tr.Cells.Add(td);
- td = new TableCell();
- td.BorderWidth = Unit.Pixel(1);
- if (dr1["is_check"].ToString().Equals("Y"))
- {
- if (dr1["is_agree"].ToString().Equals("Y"))
- {
- td.Text = "已通知";
- }
- else
- {
- td.Text = "未通知";
- }
- }
- else
- {
- td.Text = "<br>";
- }
- tr.Cells.Add(td);
- td = new TableCell();
- td.BorderWidth = Unit.Pixel(1);
- if (!dr1["comment"].ToString().Equals(""))
- {
- td.Text = dr1["comment"].ToString();
- }
- else
- {
- td.Text = "<br>";
- }
- tr.Cells.Add(td);
- td = new TableCell();
- td.BorderWidth = Unit.Pixel(1);
- if (!dr1["check_time"].ToString().Equals(""))
- {
- td.Text = dr1["check_time"].ToString();
- }
- else
- {
- td.Text = "<br>";
- }
- tr.Cells.Add(td);
- FlowTable.Rows.Add(tr);
- }
- }
- dr1.Close();
- conn.Close();
- }
- public void SetTab()
- {
- }
- protected void RbAgree_SelectedIndexChanged(object sender, EventArgs e)
- {
- if (TxtComment.Text.Equals("已通知") || TxtComment.Text.Equals("未通知"))
- {
- if (RbAgree.SelectedValue.Equals("Y"))
- {
- TxtComment.Text = "已通知";
- }
- else
- {
- TxtComment.Text = "未通知";
- }
- }
- }
- protected void ShowMessageBox(string strMessage)
- {
- Response.Write(string.Format("<script>alert('{0}')</script>", strMessage));
- }
- protected void BtnOk_Click(object sender, EventArgs e)
- {
- string total_result = "跑流程中";
- string time = "";
- SqlConnection conn = dbConnection.getConnection();
- conn.Open();
- DateMgr mgr = new DateMgr();
- SqlCommand cmd = new SqlCommand("update OA_REPAIR_FLOW set is_check='Y',is_agree='" + RbAgree.SelectedValue.ToString() + "',comment='" + TxtComment.Text.Replace("n", "<br>") + "',check_time='" + mgr.getTime().ToString() + "'where form_id='" + Request.QueryString["form_id"] + "'and operator_id='" + Session["user_id"] + "'", conn);
- cmd.ExecuteNonQuery();
- cmd = new SqlCommand("select max(step) from OA_REPAIR_FLOW where form_id='" + Request.QueryString["form_id"] + "'", conn);
- int max_step = 1;
- max_step = Convert.ToInt32(cmd.ExecuteScalar());
- cmd = new SqlCommand("select step from OA_REPAIR_FORM where form_id='" + Request.QueryString["form_id"] + "'", conn);
- int step = Convert.ToInt32(cmd.ExecuteScalar());
- if (step == max_step)
- {
- if (RbAgree.SelectedValue.Equals("N"))
- {
- total_result = "不同意";
- }
- else
- {
- total_result = "同意";
- }
- time = mgr.getDateTime();
- }
- else
- {
- if (RbAgree.SelectedValue.Equals("N"))
- {
- total_result = "不同意";
- }
- time = mgr.getDateTime();
- }
- if (step == max_step)
- {
- cmd = new SqlCommand("update OA_REPAIR_FORM set step=step+1,total_result='" + total_result + "',finish_time='" + time + "'where form_id='" + Request.QueryString["form_id"] + "'", conn);
- cmd.ExecuteNonQuery();
- }
- else
- {
- cmd = new SqlCommand("update OA_REPAIR_FORM set step=step+1,total_result='" + total_result + "',finish_time=''where form_id='" + Request.QueryString["form_id"] + "'", conn);
- cmd.ExecuteNonQuery();
- }
- conn.Close();
- Response.Redirect("deal_list.aspx");
- }
- }