deal1.aspx.cs
资源名称:web.rar [点击查看]
上传用户:xrffrp
上传日期:2022-03-25
资源大小:22155k
文件大小:15k
源码类别:
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_deal1 : System.Web.UI.Page
- {
- protected void Page_Load(object sender, EventArgs e)
- {
- string userid="10";
- string str = Session["user_id"].ToString();
- if (!IsPostBack)
- {
- this.MultiView1.Visible = true;
- }
- if (!str.Equals(userid))
- {
- this.SetTable();
- MultiView1.ActiveViewIndex = 0;
- }
- else
- {
- this.SetTab();
- MultiView1.ActiveViewIndex = 1;
- }
- }
- public void SetTable()
- {
- MultiView1.ActiveViewIndex = 0;
- lb_no.Text = Request.QueryString["form_id"].ToString();
- string str = "";
- SqlConnection conn = dbConnection.getConnection();
- conn.Open();
- SqlCommand sqlcom3 = new SqlCommand("select emp_name from OA_EMPLOYEE where id='" + Request.QueryString["emp_id"] + "'", conn);
- lb_person.Text = sqlcom3.ExecuteScalar().ToString();
- 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.eq_type as eq_type,f.eq_detail as eq_detail,g.name as name,g.tel as tel,f.company as company,f.content as content 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();
- company.Text = dr["company"].ToString();
- comment.Text = dr["content"].ToString().Replace("/n", "<br>");
- }
- }
- 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()
- {
- MultiView1.ActiveViewIndex = 1;
- lbno.Text = Request.QueryString["form_id"].ToString();
- string str = "";
- SqlConnection conn = dbConnection.getConnection();
- conn.Open();
- SqlCommand sqlcom3 = new SqlCommand("select emp_name from OA_EMPLOYEE where id='" + Request.QueryString["emp_id"] + "'", conn);
- lbperson.Text = sqlcom3.ExecuteScalar().ToString();
- 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.eq_type as eq_type,f.eq_detail as eq_detail,g.name as name,g.tel as tel, f.content as content 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())
- {
- lbdepartment.Text = dr["name"].ToString();
- lbtel.Text = dr["tel"].ToString();
- lbtype.Text = dr["eq_type"].ToString();
- lbname.Text = dr["eq_detail"].ToString();
- connet.Text = dr["content"].ToString().Replace("/n", "<br>");
- }
- }
- 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();
- }
- 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 = "";
- string str = "";
- 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();
- }
- SqlCommand sqlcom = new SqlCommand("select emp_id from OA_REPAIR_FORM where form_id='" + Request.QueryString["form_id"].ToString() + "'", conn);
- SqlDataReader dr = sqlcom.ExecuteReader();
- if (dr.HasRows)
- {
- while (dr.Read())
- {
- str = dr["emp_id"].ToString();
- }
- }
- dr.Close();
- if (MultiView1.ActiveViewIndex==1)
- {
- if (dll.SelectedItem != null)
- {
- SqlCommand sqlpany = new SqlCommand("update OA_REPAIR_FORM_DETAIL set company='" + dll.SelectedItem.ToString() + "' where form_id='" + Request.QueryString["form_id"].ToString() + "'", conn);
- sqlpany.ExecuteNonQuery();
- int no = 1;
- SqlCommand sqlcheck = new SqlCommand("select max(id) from OA_COMPANY_CHECK", conn);
- try
- {
- no = Convert.ToInt32(sqlcheck.ExecuteScalar()) + 1;
- }
- catch
- {
- }
- SqlCommand sqlcompany = new SqlCommand("insert into OA_COMPANY_CHECK(id,company,form_id,comment,is_check,is_agree,check_time)values('" + no + "','" + dll.SelectedItem.ToString() + "','" + Request.QueryString["form_id"].ToString() + "','','N','','')", conn);
- sqlcompany.ExecuteNonQuery();
- }
- }
- else
- {
- }
- 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");
- }
- public void SetLable()
- {
- person.Text = "";
- tel.Text = "";
- phone.Text = "";
- SqlConnection conn = dbConnection.getConnection();
- conn.Open();
- if (dll.Items.Count > 0)
- {
- if (!(dll.SelectedItem.ToString().Equals("")))
- {
- SqlCommand sqlcom = new SqlCommand("select contact_person,mobile_tel,phone from oa_company where company='" + dll.SelectedItem.ToString() + "'", conn);
- SqlDataReader dr = sqlcom.ExecuteReader();
- if (dr.HasRows)
- {
- while (dr.Read())
- {
- person.Text = dr["contact_person"].ToString();
- tel.Text = dr["mobile_tel"].ToString();
- phone.Text = dr["phone"].ToString();
- }
- }
- dr.Close();
- }
- }
- conn.Close();
- }
- protected void dll_SelectedIndexChanged(object sender, EventArgs e)
- {
- SetLable();
- }
- protected void dltype_SelectedIndexChanged(object sender, EventArgs e)
- {
- person.Text = "";
- tel.Text = "";
- phone.Text = "";
- }
- }