company_1.aspx.cs
资源名称:web.rar [点击查看]
上传用户:xrffrp
上传日期:2022-03-25
资源大小:22155k
文件大小:9k
源码类别:
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_company_1 : System.Web.UI.Page
- {
- string emp_name = "";
- protected void Page_Load(object sender, EventArgs e)
- {
- }
- public void getname()
- {
- SqlConnection conn = dbConnection.getConnection();
- conn.Open();
- SqlCommand sqlcom = new SqlCommand("select emp_name from OA_EMPLOYEE where id='430'", conn);
- SqlDataReader dr = sqlcom.ExecuteReader();
- if (dr.HasRows)
- {
- while (dr.Read())
- {
- emp_name = dr["emp_name"].ToString();
- }
- }
- dr.Close();
- conn.Close();
- }
- public void bind1(string s)
- {
- string sqlstr = "";
- int id = 1;
- SqlConnection conn = dbConnection.getConnection();
- conn.Open();
- DataSet ds = new DataSet();
- DataTable dt = new DataTable();
- dt.Columns.Add(new DataColumn("id", typeof(int)));
- dt.Columns.Add(new DataColumn("form_id", typeof(string)));
- dt.Columns.Add(new DataColumn("department", typeof(string)));
- dt.Columns.Add(new DataColumn("apply_time", typeof(string)));
- SqlCommand sqlcom = new SqlCommand("select form_id from OA_COMPANY_CHECK where is_check='N' and company='" + s + "'", conn);
- SqlDataReader dr = sqlcom.ExecuteReader();
- if (dr.HasRows)
- {
- while (dr.Read())
- {
- DataRow row = dt.NewRow();
- row["id"] = id;
- id = id + 1;
- row["form_id"] = dr["form_id"].ToString();
- SqlConnection sqlcon = dbConnection.getConnection();
- sqlcon.Open();
- SqlCommand sqlcom1 = new SqlCommand("select f.name as name from OA_DEPARTMENT as f,OA_REPAIR_FORM_DETAIL as g where f.id=g.department_id and g.form_id='" + dr["form_id"].ToString() + "'", sqlcon);
- SqlDataReader dr1 = sqlcom1.ExecuteReader();
- if (dr1.HasRows)
- {
- while (dr1.Read())
- {
- row["department"] = dr1["name"].ToString();
- }
- }
- dr1.Close();
- SqlCommand sqlcom2 = new SqlCommand("select apply_time from OA_REPAIR_FORM where form_id='" + dr["form_id"].ToString() + "'", sqlcon);
- SqlDataReader dr2 = sqlcom2.ExecuteReader();
- if (dr2.HasRows)
- {
- while (dr2.Read())
- {
- row["apply_time"] = SetTime(dr2["apply_time"].ToString());
- }
- }
- dr2.Close();
- dt.Rows.Add(row);
- sqlcon.Close();
- }
- }
- ds.Tables.Add(dt);
- GridView1.DataSource = ds;
- GridView1.DataKeyNames = new string[] { "form_id" };
- GridView1.DataBind();
- dr.Close();
- conn.Close();
- }
- public void bind2(string s)
- {
- string sqlstr = "";
- int id = 1;
- SqlConnection conn = dbConnection.getConnection();
- conn.Open();
- DataSet ds = new DataSet();
- DataTable dt = new DataTable();
- dt.Columns.Add(new DataColumn("id", typeof(int)));
- dt.Columns.Add(new DataColumn("form_id", typeof(string)));
- dt.Columns.Add(new DataColumn("department", typeof(string)));
- dt.Columns.Add(new DataColumn("apply_time", typeof(string)));
- SqlCommand sqlcom = new SqlCommand("select form_id from OA_COMPANY_CHECK where is_check='Y' and company='" + s + "'", conn);
- SqlDataReader dr = sqlcom.ExecuteReader();
- if (dr.HasRows)
- {
- while (dr.Read())
- {
- DataRow row = dt.NewRow();
- row["id"] = id;
- id = id + 1;
- row["form_id"] = dr["form_id"].ToString();
- SqlConnection sqlcon = dbConnection.getConnection();
- sqlcon.Open();
- SqlCommand sqlcom1 = new SqlCommand("select f.name as name from OA_DEPARTMENT as f,OA_REPAIR_FORM_DETAIL as g where f.id=g.department_id and g.form_id='" + dr["form_id"].ToString() + "'", sqlcon);
- SqlDataReader dr1 = sqlcom1.ExecuteReader();
- if (dr1.HasRows)
- {
- while (dr1.Read())
- {
- row["department"] = dr1["name"].ToString();
- }
- }
- dr1.Close();
- SqlCommand sqlcom2 = new SqlCommand("select apply_time from OA_REPAIR_FORM where form_id='" + dr["form_id"].ToString() + "'", sqlcon);
- SqlDataReader dr2 = sqlcom2.ExecuteReader();
- if (dr2.HasRows)
- {
- while (dr2.Read())
- {
- row["apply_time"] = SetTime(dr2["apply_time"].ToString());
- }
- }
- dr2.Close();
- dt.Rows.Add(row);
- sqlcon.Close();
- }
- }
- ds.Tables.Add(dt);
- GridView2.DataSource = ds;
- GridView2.DataKeyNames = new string[] { "form_id" };
- GridView2.DataBind();
- dr.Close();
- conn.Close();
- }
- public void bind3(string s)
- {
- string sqlstr = "";
- int id = 1;
- SqlConnection conn = dbConnection.getConnection();
- conn.Open();
- DataSet ds = new DataSet();
- DataTable dt = new DataTable();
- dt.Columns.Add(new DataColumn("id", typeof(int)));
- dt.Columns.Add(new DataColumn("form_id", typeof(string)));
- dt.Columns.Add(new DataColumn("department", typeof(string)));
- dt.Columns.Add(new DataColumn("apply_time", typeof(string)));
- SqlCommand sqlcom = new SqlCommand("select form_id from OA_COMPANY_CHECK where and company='" + s + "'", conn);
- SqlDataReader dr = sqlcom.ExecuteReader();
- if (dr.HasRows)
- {
- while (dr.Read())
- {
- DataRow row = dt.NewRow();
- row["id"] = id;
- id = id + 1;
- row["form_id"] = dr["form_id"].ToString();
- SqlConnection sqlcon = dbConnection.getConnection();
- sqlcon.Open();
- SqlCommand sqlcom1 = new SqlCommand("select f.name as name from OA_DEPARTMENT as f,OA_REPAIR_FORM_DETAIL as g where f.id=g.department_id and g.form_id='" + dr["form_id"].ToString() + "'", sqlcon);
- SqlDataReader dr1 = sqlcom1.ExecuteReader();
- if (dr1.HasRows)
- {
- while (dr1.Read())
- {
- row["department"] = dr1["name"].ToString();
- }
- }
- dr1.Close();
- SqlCommand sqlcom2 = new SqlCommand("select apply_time from OA_REPAIR_FORM where form_id='" + dr["form_id"].ToString() + "'", sqlcon);
- SqlDataReader dr2 = sqlcom2.ExecuteReader();
- if (dr2.HasRows)
- {
- while (dr2.Read())
- {
- row["apply_time"] = SetTime(dr2["apply_time"].ToString());
- }
- }
- dr2.Close();
- dt.Rows.Add(row);
- sqlcon.Close();
- }
- }
- ds.Tables.Add(dt);
- GridView3.DataSource = ds;
- GridView3.DataKeyNames = new string[] { "form_id" };
- GridView3.DataBind();
- dr.Close();
- conn.Close();
- }
- public string SetTime(string s)
- {
- string year = "";
- string month = "";
- string day = "";
- string hour = "";
- string minite = "";
- string second = "";
- if (s.Length == 14)
- {
- year = s.Substring(0, 4).ToString();
- month = s.Substring(4, 2).ToString();
- day = s.Substring(6, 2).ToString();
- hour = s.Substring(8, 2).ToString();
- minite = s.Substring(10, 2).ToString();
- second = s.Substring(12, 2).ToString();
- return year + "-" + month + "-" + day + " " + hour + ":" + minite + ":" + second;
- }
- else
- {
- return s;
- }
- }
- protected void LinkButton1_Click(object sender, EventArgs e)
- {
- getname();
- bind1(emp_name);
- MultiView1.ActiveViewIndex = 0;
- }
- protected void LinkButton2_Click(object sender, EventArgs e)
- {
- getname();
- bind2(emp_name);
- MultiView1.ActiveViewIndex = 1;
- }
- protected void LinkButton3_Click(object sender, EventArgs e)
- {
- getname();
- bind3(emp_name);
- MultiView1.ActiveViewIndex = 2;
- }
- }