select.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_new_repair_select : System.Web.UI.Page
- {
- protected void Page_Load(object sender, EventArgs e)
- {
- SqlConnection conn = dbConnection.getConnection();
- conn.Open();
- if (!IsPostBack)
- {
- ArrayList array = new ArrayList();
- array = (ArrayList)Session["s"];
- if (array.Count != 0)
- {
- for (int j = 0; j < array.Count; j++)
- {
- DropDownList1.Items.Add(Convert.ToString(j + 1));
- }
- }
- if (Request.QueryString["form_id"] != null)
- {
- bind(Request.QueryString["form_id"]);
- for (int i = 0; i < array.Count; i++)
- {
- if (array[i].ToString().Equals(Request.QueryString["form_id"].ToString()))
- {
- DropDownList1.SelectedIndex = i;
- }
- }
- }
- dll.Items.Clear();
- dll.Items.Add("所有厂商");
- SqlCommand sqlcom1 = new SqlCommand("select company from OA_COMPANY where equipment='" + type.Text.ToString() + "' order by id", conn);
- SqlDataReader dr1 = sqlcom1.ExecuteReader();
- if (dr1.HasRows)
- {
- while (dr1.Read())
- {
- dll.Items.Add(dr1["company"].ToString());
- }
- }
- dr1.Close();
- }
- }
- public void bind(string s)
- {
- string str = "";
- SqlConnection conn = dbConnection.getConnection();
- conn.Open();
- form_id.Text = s;
- SqlCommand sqlcom4 = new SqlCommand("select * from oa_repair where form_id='" + s + "'", conn);
- SqlDataReader dr4 = sqlcom4.ExecuteReader();
- if (dr4.HasRows)
- {
- while (dr4.Read())
- {
- area.Text = dr4["area"].ToString().Trim();
- level.Text = dr4["Level"].ToString().Trim();
- bxperson.Text = dr4["bxperson"].ToString().Trim();
- department.Text = dr4["department"].ToString();
- type.Text = dr4["type"].ToString();
- equipment.Text = dr4["equipment"].ToString();
- create_time.Text = dr4["create_time"].ToString();
- SqlConnection conn1 = dbConnection.getConnection();
- conn1.Open();
- SqlCommand sqlcom5 = new SqlCommand("select emp_name from oa_employee where id=" + Convert.ToInt32(dr4["lbperson"]), conn1);
- SqlDataReader dr5 = sqlcom5.ExecuteReader();
- if (dr5.HasRows)
- {
- while (dr5.Read())
- {
- lbperson.Text = dr5["emp_name"].ToString();
- }
- }
- dr5.Close();
- SqlCommand sqlcom6 = new SqlCommand("select tel from oa_department where name='" + dr4["department"].ToString() + "'", conn1);
- SqlDataReader dr6 = sqlcom6.ExecuteReader();
- if (dr6.HasRows)
- {
- while (dr6.Read())
- {
- tel.Text = dr6["tel"].ToString();
- }
- }
- dr6.Close();
- }
- }
- dr4.Close();
- SqlCommand sqlcom7 = new SqlCommand("select destine_time from OA_REPAIR_D where form_id='" + s + "'", conn);
- SqlDataReader dr7 = sqlcom7.ExecuteReader();
- if (dr7.HasRows)
- {
- while (dr7.Read())
- {
- if (!dr7["destine_time"].ToString().Equals(""))
- {
- ImageButton3.Enabled = false;
- destine_time.Text = dr7["destine_time"].ToString();
- destine_time.Enabled = false;
- }
- else
- {
- ImageButton3.Enabled = true;
- destine_time.Enabled = true;
- }
- }
- }
- dr7.Close();
- SqlCommand sqlcom9 = new SqlCommand("select complete_time from OA_REPAIR_D where form_id='" + s + "'", conn);
- SqlDataReader dr9 = sqlcom9.ExecuteReader();
- if (dr9.HasRows)
- {
- while (dr9.Read())
- {
- if (!dr9["complete_time"].ToString().Equals(""))
- {
- complete_time.Text = dr9["complete_time"].ToString();
- }
- }
- }
- dr9.Close();
- SqlCommand sqlcom10 = new SqlCommand("select [confirm] from OA_REPAIR_D where form_id='" + s + "'", conn);
- SqlDataReader dr10 = sqlcom10.ExecuteReader();
- if (dr10.HasRows)
- {
- while (dr10.Read())
- {
- if (!dr10["confirm"].ToString().Equals(""))
- {
- confirm.Text = dr10["confirm"].ToString();
- }
- }
- }
- dr10.Close();
- SqlCommand sqlcom11 = new SqlCommand("select remark from OA_REPAIR_D where form_id='" + s + "'", conn);
- SqlDataReader dr11 = sqlcom11.ExecuteReader();
- if (dr11.HasRows)
- {
- while (dr11.Read())
- {
- if (!dr11["remark"].ToString().Equals(""))
- {
- remark.Text = dr11["remark"].ToString();
- }
- }
- }
- dr11.Close();
- SqlCommand sqlcom8 = new SqlCommand("select company from OA_repair_d where form_id='" + s + "'", conn);
- str = sqlcom8.ExecuteScalar().ToString();
- for (int j = 0; j < dll.Items.Count; j++)
- {
- if (dll.Items[j].Text.ToString().Equals(str))
- {
- dll.SelectedIndex = j;
- break;
- }
- }
- conn.Close();
- }
- protected void Button1_Click(object sender, EventArgs e)
- {
- SqlConnection conn = dbConnection.getConnection();
- conn.Open();
- if (!dll.SelectedItem.ToString().Equals(""))
- {
- string sqlstr = "update oa_repair_d set company='" + dll.SelectedItem.ToString() + "'";
- if (!destine_time.Text.ToString().Equals(""))
- {
- sqlstr = sqlstr + ",destine_time='" + destine_time.Text.ToString()+"'";
- }
- sqlstr = sqlstr + "where form_id='" + form_id.Text.ToString() + "'";
- SqlCommand sqlcom = new SqlCommand(sqlstr,conn);
- sqlcom.ExecuteNonQuery();
- ShowMessageBox("操作成功");
- }
- else
- {
- ShowMessageBox("请选择维修厂商");
- }
- conn.Close();
- }
- protected void ImageButton3_Click(object sender, ImageClickEventArgs e)
- {
- if (Calendar1.Visible == true)
- {
- Calendar1.Visible = false;
- Calendar1.Focus();
- }
- else
- {
- Calendar1.Visible = true;
- Calendar1.Focus();
- }
- }
- protected void Calendar1_SelectionChanged(object sender, EventArgs e)
- {
- Calendar1.Visible = false;
- string year = Calendar1.SelectedDate.Year.ToString();
- string month = Calendar1.SelectedDate.Month.ToString();
- if (month.Length == 1)
- {
- month = "0" + month;
- }
- string day = Calendar1.SelectedDate.Day.ToString();
- if (day.Length == 1)
- {
- day = "0" + day;
- }
- destine_time.Text = year + month + day ;
- destine_time.Focus();
- }
- protected void ShowMessageBox(string strMessage)
- {
- Response.Write(string.Format("<script>alert('{0}')</script>", strMessage));
- }
- protected void DropDownList1_SelectedIndexChanged(object sender, EventArgs e)
- {
- form_id.Text = "";
- department.Text = "";
- lbperson.Text = "";
- create_time.Text = "";
- type.Text="";
- equipment.Text = "";
- tel.Text = "";
- confirm.Text = "";
- destine_time.Text = "";
- complete_time.Text = "";
- remark.Text = "";
- ArrayList array = new ArrayList();
- array = (ArrayList)Session["s"];
- int id = Convert.ToInt32(DropDownList1.SelectedItem.ToString());
- id = id - 1;
- bind(array[id].ToString());
- }
- }