weather.aspx.cs
资源名称:web.rar [点击查看]
上传用户:xrffrp
上传日期:2022-03-25
资源大小:22155k
文件大小:5k
源码类别:
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 weather : System.Web.UI.Page
- {
- protected void Page_Load(object sender, EventArgs e)
- {
- if (!IsPostBack)
- {
- bind1();
- bind2();
- }
- }
- public void bind1()
- {
- string department_id = "";
- DateMgr mgr = new DateMgr();
- string today = mgr.getDate();
- DataSet ds = new DataSet();
- DataTable dt = new DataTable();
- dt.Columns.Add("id", typeof(Int32));
- dt.Columns.Add("subject", typeof(string));
- SqlConnection conn = dbConnection.getConnection();
- conn.Open();
- SqlCommand sqlcom1 = new SqlCommand("select department_id from oa_employee where id='"+Session["user_id"]+"'",conn);
- department_id = sqlcom1.ExecuteScalar().ToString();
- SqlCommand sqlcom = new SqlCommand("select id,subject,authority from OA_ANNOUNCEMENT where validate_date >='" + today + "' and is_del='N'", conn);
- SqlDataReader dr = sqlcom.ExecuteReader();
- if (dr.HasRows)
- {
- while (dr.Read())
- {
- SqlConnection conn1 = dbConnection.getConnection();
- conn1.Open();
- if (dr["authority"].ToString().Equals("1"))
- {
- DataRow row = dt.NewRow();
- row["id"] = Convert.ToInt32(dr["id"]);
- row["subject"] = dr["subject"].ToString();
- dt.Rows.Add(row);
- }
- else
- {
- SqlCommand sqlcom2 = new SqlCommand("select * from OA_ANNOUNCEMENT_DEPARTMENT where a_id='" + dr["id"] + "' and department_id='" + department_id + "'", conn1);
- SqlDataReader dr2 = sqlcom2.ExecuteReader();
- if (dr2.HasRows)
- {
- DataRow row = dt.NewRow();
- row["id"] = Convert.ToInt32(dr["id"]);
- row["subject"] = dr["subject"].ToString();
- dt.Rows.Add(row);
- }
- else
- {
- }
- }
- }
- }
- dr.Close();
- ds.Tables.Add(dt);
- GridView1.DataSource = ds;
- GridView1.DataBind();
- GridView1.DataKeyNames = new string[] { "id" };
- conn.Close();
- }
- /*public void bind2()
- {
- User user = (User)Session["user"];
- string department = user.Department.Name;
- SqlConnection conn = dbConnection.getConnection();
- conn.Open();
- DataSet ds_1 = new DataSet();
- DataTable dt_1 = new DataTable();
- dt_1.Columns.Add("form_id", typeof(string));
- dt_1.Columns.Add("subject", typeof(string));
- dt_1.Columns.Add("emp_id", typeof(string));
- SqlCommand sqlcom1 = new SqlCommand("select f.create_time as create_time,f.equipment as equipment,g.destine_time as destine_time from OA_REPAIR as f,OA_REPAIR_D as g where f.form_id=g.form_id and g.destine_time is not null and g.complete_time is null and f.department='" + department.Trim() + "' order by destine_time desc", conn);
- SqlDataReader dr1 = sqlcom1.ExecuteReader();
- if (dr1.HasRows)
- {
- while (dr1.Read())
- {
- DataRow row = dt_1.NewRow();
- row["form_id"] = dr1["create_time"].ToString()+"报修的";
- row["emp_id"] = dr1["equipment"].ToString();
- row["subject"] = dr1["create_time"].ToString() + "报修的" + dr1["equipment"].ToString() + "问题的预计维修时间∶" + dr1["destine_time"].ToString(); ;
- dt_1.Rows.Add(row);
- }
- }
- ds_1.Tables.Add(dt_1);
- GridView2.DataSource = ds_1;
- GridView2.DataBind();
- GridView2.DataKeyNames = new string[] { "form_id" };
- dr1.Close();
- conn.Close();
- }*/
- protected void GridView1_PageIndexChanging(object sender, GridViewPageEventArgs e)
- {
- GridView1.PageIndex = e.NewPageIndex;
- bind1();
- }
- /* protected void GridView2_PageIndexChanging(object sender, GridViewPageEventArgs e)
- {
- GridView2.PageIndex = e.NewPageIndex;
- bind2();
- }*/
- }